varsnap 1.8.3 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  /*
2
- * Varsnap.js v1.8.3
2
+ * Varsnap.js v1.8.4
3
3
  */
4
- !function(t){!function(e){"object"==typeof t&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).varsnap=e()}(function(){function o(n,r){return function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];return n.apply(r,e)}}var t=Object.prototype.toString;function i(e){return Array.isArray(e)}function n(e){return void 0===e}function r(e){return"[object ArrayBuffer]"===t.call(e)}function B(e){return null!==e&&"object"==typeof e}function a(e){if("[object Object]"!==t.call(e))return!1;e=Object.getPrototypeOf(e);return null===e||e===Object.prototype}function s(e,t){if(null!=e)if(i(e="object"!=typeof e?[e]:e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var h={isArray:i,isArrayBuffer:r,isBuffer:function(e){return null!==e&&!n(e)&&null!==e.constructor&&!n(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===t.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&r(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:B,isPlainObject:a,isUndefined:n,isDate:function(e){return"[object Date]"===t.call(e)},isFile:function(e){return"[object File]"===t.call(e)},isBlob:function(e){return"[object Blob]"===t.call(e)},isStream:function(e){return B(e)&&(e=e.pipe,"[object Function]"===t.call(e))},isURLSearchParams:function(e){return"[object URLSearchParams]"===t.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:s,merge:function n(){var r={};function e(e,t){a(r[t])&&a(e)?r[t]=n(r[t],e):a(e)?r[t]=n({},e):i(e)?r[t]=e.slice():r[t]=e}for(var t=0,o=arguments.length;t<o;t++)s(arguments[t],e);return r},extend:function(n,e,r){return s(e,function(e,t){n[t]=r&&"function"==typeof e?o(e,r):e}),n},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}};function q(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var z=function(e,t,n){if(!t)return e;var r,n=n?n(t):h.isURLSearchParams(t)?t.toString():(r=[],h.forEach(t,function(e,t){null!=e&&(h.isArray(e)?t+="[]":e=[e],h.forEach(e,function(e){h.isDate(e)?e=e.toISOString():h.isObject(e)&&(e=JSON.stringify(e)),r.push(q(t)+"="+q(e))}))}),r.join("&"));return n&&(-1!==(t=e.indexOf("#"))&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+n),e},D={};function e(){this.handlers=[]}e.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},e.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},e.prototype.forEach=function(t){h.forEach(this.handlers,function(e){null!==e&&t(e)})};function V(n,r){h.forEach(n,function(e,t){t!==r&&t.toUpperCase()===r.toUpperCase()&&(n[r]=e,delete n[t])})}var u,J,c,D=e,F=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,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,status:this.response&&this.response.status?this.response.status:null}},e},I={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},g=function(e,t,n,r,o){e=new Error(e);return F(e,t,n,r,o)},H=h.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),h.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),h.isString(r)&&a.push("path="+r),h.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){e=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},M=["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"],$=h.isStandardBrowserEnv()?(J=/(msie|trident)/i.test(navigator.userAgent),c=document.createElement("a"),u=G(window.location.href),function(e){e=h.isString(e)?G(e):e;return e.protocol===u.protocol&&e.host===u.host}):function(){return!0},m={};function G(e){return J&&(c.setAttribute("href",e),e=c.href),c.setAttribute("href",e),{href:c.href,protocol:c.protocol?c.protocol.replace(/:$/,""):"",host:c.host,search:c.search?c.search.replace(/^\?/,""):"",hash:c.hash?c.hash.replace(/^#/,""):"",hostname:c.hostname,port:c.port,pathname:"/"===c.pathname.charAt(0)?c.pathname:"/"+c.pathname}}function f(e){this.message=e}f.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},f.prototype.__CANCEL__=!0;function X(d){return new Promise(function(i,a){var e,n=d.data,r=d.headers,s=d.responseType;function u(){d.cancelToken&&d.cancelToken.unsubscribe(e),d.signal&&d.signal.removeEventListener("abort",e)}h.isFormData(n)&&delete r["Content-Type"];var c=new XMLHttpRequest;d.auth&&(o=d.auth.username||"",t=d.auth.password?unescape(encodeURIComponent(d.auth.password)):"",r.Authorization="Basic "+btoa(o+":"+t));o=d.baseURL,t=d.url;var t,o,f,l=o&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?(o=o,(l=t)?o.replace(/\/+$/,"")+"/"+l.replace(/^\/+/,""):o):t;function p(){var e,t,n,r,o;c&&(t="getAllResponseHeaders"in c?(t=c.getAllResponseHeaders(),o={},t&&h.forEach(t.split("\n"),function(e){r=e.indexOf(":"),n=h.trim(e.substr(0,r)).toLowerCase(),r=h.trim(e.substr(r+1)),!n||o[n]&&0<=M.indexOf(n)||(o[n]="set-cookie"===n?(o[n]||[]).concat([r]):o[n]?o[n]+", "+r:r)}),o):null,t={data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:t,config:d,request:c},e=t.config.validateStatus,t.status&&e&&!e(t.status)?(e=g("Request failed with status code "+t.status,t.config,null,t.request,t),a(e)):i(t),u(),c=null)}c.open(d.method.toUpperCase(),z(l,d.params,d.paramsSerializer),!0),c.timeout=d.timeout,"onloadend"in c?c.onloadend=p:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(p)},c.onabort=function(){c&&(a(g("Request aborted",d,"ECONNABORTED",c)),c=null)},c.onerror=function(){a(g("Network Error",d,null,c)),c=null},c.ontimeout=function(){var e=d.timeout?"timeout of "+d.timeout+"ms exceeded":"timeout exceeded",t=d.transitional||I;d.timeoutErrorMessage&&(e=d.timeoutErrorMessage),a(g(e,d,t.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},h.isStandardBrowserEnv()&&(f=(d.withCredentials||$(l))&&d.xsrfCookieName?H.read(d.xsrfCookieName):void 0)&&(r[d.xsrfHeaderName]=f),"setRequestHeader"in c&&h.forEach(r,function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete r[t]:c.setRequestHeader(t,e)}),h.isUndefined(d.withCredentials)||(c.withCredentials=!!d.withCredentials),s&&"json"!==s&&(c.responseType=d.responseType),"function"==typeof d.onDownloadProgress&&c.addEventListener("progress",d.onDownloadProgress),"function"==typeof d.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",d.onUploadProgress),(d.cancelToken||d.signal)&&(e=function(e){c&&(a(!e||e.type?new m("canceled"):e),c.abort(),c=null)},d.cancelToken&&d.cancelToken.subscribe(e),d.signal&&(d.signal.aborted?e():d.signal.addEventListener("abort",e))),n=n||null,c.send(n)})}var l,p,d,m=f,y=l={};function v(){throw new Error("setTimeout has not been defined")}function b(){throw new Error("clearTimeout has not been defined")}function W(t){if(p===setTimeout)return setTimeout(t,0);if((p===v||!p)&&setTimeout)return(p=setTimeout)(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}try{p="function"==typeof setTimeout?setTimeout:v}catch(e){p=v}try{d="function"==typeof clearTimeout?clearTimeout:b}catch(e){d=b}var w,S=[],T=!1,k=-1;function K(){T&&w&&(T=!1,w.length?S=w.concat(S):k=-1,S.length&&Y())}function Y(){if(!T){var e=W(K);T=!0;for(var t=S.length;t;){for(w=S,S=[];++k<t;)w&&w[k].run();k=-1,t=S.length}w=null,T=!1,function(t){if(d===clearTimeout)return clearTimeout(t);if((d===b||!d)&&clearTimeout)return(d=clearTimeout)(t);try{d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}(e)}}function Q(e,t){this.fun=e,this.array=t}function E(){}y.nextTick=function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];S.push(new Q(e,t)),1!==S.length||T||W(Y)},Q.prototype.run=function(){this.fun.apply(null,this.array)},y.title="browser",y.browser=!0,y.env={},y.argv=[],y.version="",y.versions={},y.on=E,y.addListener=E,y.once=E,y.off=E,y.removeListener=E,y.removeAllListeners=E,y.emit=E,y.prependListener=E,y.prependOnceListener=E,y.listeners=function(e){return[]},y.binding=function(e){throw new Error("process.binding is not supported")},y.cwd=function(){return"/"},y.chdir=function(e){throw new Error("process.chdir is not supported")},y.umask=function(){return 0};var C={},j=(!function(o){!function(){"use strict";var t={"Content-Type":"application/x-www-form-urlencoded"};function n(e,t){!h.isUndefined(e)&&h.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var e,r={transitional:I,adapter:e="undefined"!=typeof XMLHttpRequest||void 0!==o&&"[object process]"===Object.prototype.toString.call(o)?X:e,transformRequest:[function(e,t){{if(V(t,"Accept"),V(t,"Content-Type"),h.isFormData(e)||h.isArrayBuffer(e)||h.isBuffer(e)||h.isStream(e)||h.isFile(e)||h.isBlob(e))return e;if(h.isArrayBufferView(e))return e.buffer;if(h.isURLSearchParams(e))return n(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();if(h.isObject(e)||t&&"application/json"===t["Content-Type"]){if(n(t,"application/json"),h.isString(t=e))try{return(0,JSON.parse)(t),h.trim(t)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(t)}return e}}],transformResponse:[function(e){var t=this.transitional||r.transitional,n=t&&t.silentJSONParsing,t=t&&t.forcedJSONParsing,n=!n&&"json"===this.responseType;if(n||t&&h.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw F(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return 200<=e&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};h.forEach(["delete","get","head"],function(e){r.headers[e]={}}),h.forEach(["post","put","patch"],function(e){r.headers[e]=h.merge(t)}),C=r}.call(this)}.call(this,l),function(t,n,e){var r=this||C;return h.forEach(e,function(e){t=e.call(r,t,n)}),t}),Z=function(e){return!(!e||!e.__CANCEL__)};function O(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new m("canceled")}function ee(t){return O(t),t.headers=t.headers||{},t.data=j.call(t,t.data,t.headers,t.transformRequest),t.headers=h.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),h.forEach(["delete","get","head","post","put","patch","common"],function(e){delete t.headers[e]}),(t.adapter||C.adapter)(t).then(function(e){return O(t),e.data=j.call(t,e.data,e.headers,t.transformResponse),e},function(e){return Z(e)||(O(t),e&&e.response&&(e.response.data=j.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)})}function _(t,n){n=n||{};var r={};function o(e,t){return h.isPlainObject(e)&&h.isPlainObject(t)?h.merge(e,t):h.isPlainObject(t)?h.merge({},t):h.isArray(t)?t.slice():t}function i(e){return h.isUndefined(n[e])?h.isUndefined(t[e])?void 0:o(void 0,t[e]):o(t[e],n[e])}function e(e){if(!h.isUndefined(n[e]))return o(void 0,n[e])}function a(e){return h.isUndefined(n[e])?h.isUndefined(t[e])?void 0:o(void 0,t[e]):o(void 0,n[e])}function s(e){return e in n?o(t[e],n[e]):e in t?o(void 0,t[e]):void 0}var u={url:e,method:e,data:e,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return h.forEach(Object.keys(t).concat(Object.keys(n)),function(e){var t=u[e]||i,n=t(e);h.isUndefined(n)&&t!==s||(r[e]=n)}),r}var te,y="0.26.1",x={},ne=(["object","boolean","number","function","string","symbol"].forEach(function(t,n){x[t]=function(e){return typeof e===t||"a"+(n<1?"n ":" ")+t}}),{}),P=(x.transitional=function(r,o,n){function i(e,t){return"[Axios v0.26.1] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(e,t,n){if(!1===r)throw new Error(i(t," has been removed"+(o?" in "+o:"")));return o&&!ne[t]&&(ne[t]=!0,console.warn(i(t," has been deprecated since v"+o+" and will be removed in the near future"))),!r||r(e,t,n)}},{}),A=(te={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;0<o--;){var i=r[o],a=t[i];if(a){var s=e[i],a=void 0===s||a(s,i,e);if(!0!==a)throw new TypeError("option "+i+" must be "+a)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:x}).validators;function N(e){this.defaults=e,this.interceptors={request:new D,response:new D}}function R(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");this.promise=new Promise(function(e){t=e});var t,r=this;this.promise.then(function(e){if(r._listeners){for(var t=r._listeners.length,n=0;n<t;n++)r._listeners[n](e);r._listeners=null}}),this.promise.then=function(e){var t,e=new Promise(function(e){r.subscribe(e),t=e}).then(e);return e.cancel=function(){r.unsubscribe(t)},e},e(function(e){r.reason||(r.reason=new m(e),t(r.reason))})}N.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=_(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=t.transitional,n=(void 0!==e&&te.assertOptions(e,{silentJSONParsing:A.transitional(A.boolean),forcedJSONParsing:A.transitional(A.boolean),clarifyTimeoutError:A.transitional(A.boolean)},!1),[]),r=!0;this.interceptors.request.forEach(function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(r=r&&e.synchronous,n.unshift(e.fulfilled,e.rejected))});var o,i=[];if(this.interceptors.response.forEach(function(e){i.push(e.fulfilled,e.rejected)}),!r){var a=[ee,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(i),o=Promise.resolve(t);a.length;)o=o.then(a.shift(),a.shift());return o}for(var s=t;n.length;){var u=n.shift(),c=n.shift();try{s=u(s)}catch(e){c(e);break}}try{o=ee(s)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},N.prototype.getUri=function(e){return e=_(this.defaults,e),z(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},h.forEach(["delete","get","head","options"],function(n){N.prototype[n]=function(e,t){return this.request(_(t||{},{method:n,url:e,data:(t||{}).data}))}}),h.forEach(["post","put","patch"],function(r){N.prototype[r]=function(e,t,n){return this.request(_(n||{},{method:r,url:e,data:t}))}}),P=N,R.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},R.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},R.prototype.unsubscribe=function(e){this._listeners&&-1!==(e=this._listeners.indexOf(e))&&this._listeners.splice(e,1)},R.source=function(){var t;return{token:new R(function(e){t=e}),cancel:t}};var re=R,U=function t(n){var e=new P(n),r=o(P.prototype.request,e);return h.extend(r,P.prototype,e),h.extend(r,e),r.create=function(e){return t(_(n,e))},r}(C),oe=(U.Axios=P,U.Cancel=m,U.CancelToken=re,U.isCancel=Z,U.VERSION=y,U.all=function(e){return Promise.all(e)},U.spread=function(t){return function(e){return t.apply(null,e)}},U.isAxiosError=function(e){return h.isObject(e)&&!0===e.isAxiosError},U.default=U),ie={},L={};return function(y){!function(){"use strict";function c(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=f(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw o}}}}function f(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){return(t="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 r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function e(e,t,n){t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1})}Object.defineProperty(L,"__esModule",{value:!0}),L.varsnap=L.clientName=L.version=void 0,L.version="1.8.3",L.clientName="javascript."+L.version;var n={varsnap:!0,env:"development",branch:"",producerToken:"",consumerToken:"",logger:console},a=[],s=[],p=(e(g,null,[{key:"getConfig",value:function(e,t){if(!e)return"";e=e[t];return e?e.toString().toLowerCase():""}},{key:"setConfig",value:function(e,t,n){return"varsnap"===t&&(e[t]=n="string"==typeof n?"true"===n:n),"env"!==t&&"producerToken"!==t&&"consumerToken"!==t&&"branch"!==t||(e[t]=n),"logger"===t&&(e[t]=n),e}},{key:"getSignature",value:function(e,t){var n="",n=""!==t&&void 0!==t?t:(n=(n=e.toString().split("{")[0]).replace(/^\s+|\s+$/g,"")).replace(/,\s+/g,",");return"javascript."+L.version+"."+n}},{key:"ajax",value:function(e,t){e={method:"POST",url:e,headers:{"Content-Type":"application/x-www-form-urlencoded"},data:new URLSearchParams(t).toString(),responseType:"json"};return g.isNode()&&e.headers&&(e.headers["User-Agent"]="varsnap.js"),(0,oe.default)(e).then(function(e){return e.data}).catch(function(e){return e})}},{key:"debug",value:function(e,t){e.logger&&e.logger.debug(t)}},{key:"log",value:function(e,t){e.logger&&e.logger.log(t)}},{key:"error",value:function(e,t){e.logger&&e.logger.error(t)}},{key:"resetProducers",value:function(){a=[]}},{key:"resetConsumers",value:function(){s=[]}},{key:"getProducers",value:function(){return a}},{key:"getConsumers",value:function(){return s}},{key:"limitString",value:function(e){e=String(e);return e.length<=30?e:e.substring(0,30-"...".length)+"..."}},{key:"isNode",value:function(){return"object"===(void 0===y?"undefined":t(y))&&"undefined"==typeof window}},{key:"getBranch",value:function(e){var t=g.getConfig(e,"branch");return t?new Promise(function(e){return e(t)}):g.isNode()?new Promise(function(n){(0,ie.exec)("git rev-parse --abbrev-ref HEAD",function(e,t){return n(t.trim())})}):new Promise(function(e){return e("")})}}]),g),d=(e(i,[{key:"isEnabled",value:function(){return!!this.config.varsnap&&"production"===p.getConfig(this.config,"env")&&!!p.getConfig(this.config,"producerToken")}},{key:"produce",value:function(t,e){var n=this;return this.isEnabled()?(p.debug(this.config,"Sending call to Varsnap"),Promise.resolve(e).then(function(e){e={producer_token:p.getConfig(n.config,"producerToken"),signature:n.signature,inputs:i.serialize(t),prod_outputs:i.serialize(e)};return p.ajax("https://www.varsnap.com/api/snap/produce/",e).then(function(){return!0}).catch(function(e){if(e.response){if(429===e.response.status)return p.error(n.config,"Cannot produce to Varsnap; Signature at rate limit"),!0;404===e.response.status?p.error(n.config,"Cannot produce to Varsnap; check your producer token"):p.error(n.config,e.response.statusText)}return!1})})):new Promise(function(e){return e(!1)})}}],[{key:"serialize",value:function(e){return JSON.stringify(e)}},{key:"serialize_formatted",value:function(e){return JSON.stringify(e,null,2)}}]),i),u=(e(h,[{key:"isEnabled",value:function(){return!!this.config.varsnap&&"development"===p.getConfig(this.config,"env")&&!!p.getConfig(this.config,"consumerToken")}},{key:"consume",value:function(s){var u=this;if(!this.isEnabled())return new Promise(function(e){return p.error(u.config,"Varsnap not enabled for testing"),e(!1)});var o={consumer_token:p.getConfig(this.config,"consumerToken"),signature:this.signature};return p.ajax("https://www.varsnap.com/api/snap/consume/",o).then(function(e){var t=e;if(!t||"ok"!==t.status)return[new Promise(function(e){return p.error(u.config,"Received error from Varsnap: "+t.status),e(!1)})];0===t.results.length&&p.log(u.config,"No snaps found for signature: "+o.signature);var n,a=[],r=c(t.results);try{for(r.s();!(n=r.n()).done;)!function(){var e,r=n.value,o=h.deserialize(r.inputs),i=h.deserialize(r.prod_outputs),t=void 0;try{t=u.targetFunc.apply(u,function(e){if(Array.isArray(e))return l(e)}(e=o)||function(){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}()||f(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}catch(e){t=e}t=Promise.resolve(t).then(function(t){var n=d.serialize(i)===d.serialize(t);return u.reportCentral(s,r,i,t,n).then(function(e){u.reportLog(r.id,o,i,t,n,e)}),n});a.push(t)}()}catch(e){r.e(e)}finally{r.f()}return u.reportTrialGroup(s),a}).then(function(e){return Promise.all(e).then(function(e){return e.every(function(e){return e})})}).catch(function(e){return p.error(u.config,"Cannot contact Varsnap: "+e),!1})}},{key:"reportCentral",value:function(e,t,n,r,o){var i=this,e={trial_group_id:e.trial_group_id,consumer_token:p.getConfig(this.config,"consumerToken"),snap_id:t.id,test_outputs:d.serialize(r),matches:o.toString(),snap_outputs_formatted:d.serialize_formatted(n),test_outputs_formatted:d.serialize_formatted(r)};return p.ajax("https://www.varsnap.com/api/trial/produce/",e).then(function(e){return!(!e||"ok"!==e.status)&&e.trial_url}).catch(function(e){return p.error(i.config,"Cannot upload test results to Varsnap: "+e),!1})}},{key:"reportLog",value:function(e,t,n,r,o,i){p.log(this.config,""),p.log(this.config,"Testing with Varsnap uuid: "+e),p.log(this.config,"Signature: "+this.signature),p.log(this.config,"Function input args: "+p.limitString(t)),p.log(this.config,"Production function outputs: "+p.limitString(n)),p.log(this.config,"Your function outputs: "+p.limitString(r)),p.log(this.config,"Matching outputs: "+o);e="Cannot upload trial";i&&(e=String(i)),p.log(this.config,"Trial URL: "+e)}},{key:"reportTrialGroup",value:function(e){p.log(this.config,"Trial Group: "+e.trial_group_url)}}],[{key:"deserialize",value:function(e){if(""!==e)return JSON.parse(e)}}]),h);function h(e,t,n){r(this,h),this.targetFunc=e,this.signature=t,this.config=n}function i(e,t,n){r(this,i),this.targetFunc=e,this.signature=t,this.config=n}function g(){r(this,g)}function m(o,e){function t(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];try{e=o.apply(void 0,n)}catch(e){throw i.produce(n,e),e}return i.produce(n,e),e}var e=p.getSignature(o,e=void 0===e?"":e),i=new d(o,e,m._config),n=new u(o,e,m._config);return t.producer=i,t.consumer=n,t.signature=e,a.push(i),s.push(n),t}(L.varsnap=m)._config=n,m.updateConfig=function(e){for(var t=m._config,n=0,r=Object.keys(m._config);n<r.length;n++){var o=r[n];Object.prototype.hasOwnProperty.call(e,o)&&(t=p.setConfig(t,o,e[o]))}m._config=t},m.reset=function(){p.resetConsumers(),p.resetProducers()},m.version=L.version,m.runTests=function(){var t,i=p.getConsumers();return 0===i.length?Promise.resolve(!0):(t=i[0].config,p.getBranch(t).then(function(e){return{branch:e,consumer_token:p.getConfig(t,"consumerToken"),client:L.clientName}}).then(function(e){return p.ajax("https://www.varsnap.com/api/trial_group/",e)}).then(function(e){return e}).catch(function(e){e=e&&e.response&&e.response.data&&e.response.data.error?e.response.data.error:e.toString();return p.error(t,"Cannot generate a new Trial Group: "+e),{status:"not ok",project_id:"",trial_group_id:"",trial_group_url:""}}).then(function(e){var t,n=[],r=c(i);try{for(r.s();!(t=r.n()).done;){var o=t.value.consume(e);n.push(o)}}catch(e){r.e(e)}finally{r.f()}return Promise.all(n)}).then(function(e){return e.every(function(e){return e})}))}}.call(this)}.call(this,l),L.varsnap})}("undefined"==typeof Varsnap?Varsnap={}:Varsnap);
4
+ !function(e){!function(t){"object"==typeof e&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).varsnap=t()}(function(){function L(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)}}I=function(t,R){!function(t){!function(){"use strict";function c(t){if(2147483647<t)throw new RangeError('The value "'+t+'" is invalid for option "size"');t=new Uint8Array(t);return t.__proto__=h.prototype,t}function h(t,e,r){if("number"!=typeof t)return n(t,e,r);if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return i(t)}function n(t,e,r){if("string"==typeof t){var n=t,o=e;if(h.isEncoding(o="string"==typeof o&&""!==o?o:"utf8"))return(n=(s=c(i=0|d(n,o))).write(n,o))!==i?s.slice(0,n):s;throw new TypeError("Unknown encoding: "+o)}if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(T(t,ArrayBuffer)||t&&T(t.buffer,ArrayBuffer)){var i=t,n=e,s=r;if(n<0||i.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(i.byteLength<n+(s||0))throw new RangeError('"length" is outside of buffer bounds');return(i=void 0===n&&void 0===s?new Uint8Array(i):void 0===s?new Uint8Array(i,n):new Uint8Array(i,n,s)).__proto__=h.prototype,i}if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');o=t.valueOf&&t.valueOf();if(null!=o&&o!==t)return h.from(o,e,r);var a,u,f=h.isBuffer(a=t)?(0!==(u=c(f=0|p(a.length))).length&&a.copy(u,0,0,f),u):void 0!==a.length?"number"!=typeof a.length||S(a.length)?c(0):l(a):"Buffer"===a.type&&Array.isArray(a.data)?l(a.data):void 0;if(f)return f;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return h.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function i(t){return o(t),c(t<0?0:0|p(t))}function l(t){for(var e=t.length<0?0:0|p(t.length),r=c(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t){if(2147483647<=t)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function d(t,e){if(h.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||T(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=2<arguments.length&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return b(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return E(t).length;default:if(o)return n?-1:b(t).length;e=(""+e).toLowerCase(),o=!0}}function r(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function s(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),(r=(r=S(r=+r)?o?0:t.length-1:r)<0?t.length+r:r)>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=h.from(e,n)),h.isBuffer(e))return 0===e.length?-1:a(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(t,e,r):a(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function a(t,e,r,n,o){var i=1,s=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s/=i=2,a/=2,r/=2}function u(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}if(o)for(var f=-1,c=r;c<s;c++)if(u(t,c)===u(e,-1===f?0:c-f)){if(c-(f=-1===f?c:f)+1===a)return f*i}else-1!==f&&(c-=c-f),f=-1;else for(c=r=s<r+a?s-a:r;0<=c;c--){for(var h=!0,l=0;l<a;l++)if(u(t,c+l)!==u(e,l)){h=!1;break}if(h)return c}return-1}function v(t,e,r,n){return A(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function _(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,a,u,f=t[o],c=null,h=239<f?4:223<f?3:191<f?2:1;if(o+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&127<(u=(31&f)<<6|63&i)&&(c=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&2047<(u=(15&f)<<12|(63&i)<<6|63&s)&&(u<55296||57343<u)&&(c=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&65535<(u=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&a)&&u<1114112&&(c=u)}null===c?(c=65533,h=1):65535<c&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}var l=n,p=l.length;if(p<=y)return String.fromCharCode.apply(String,l);for(var d="",g=0;g<p;)d+=String.fromCharCode.apply(String,l.slice(g,g+=y));return d}R.Buffer=h,R.INSPECT_MAX_BYTES=50,(h.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&h[Symbol.species]===h&&Object.defineProperty(h,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),h.poolSize=8192,h.from=n,h.prototype.__proto__=Uint8Array.prototype,h.__proto__=Uint8Array,h.alloc=function(t,e,r){return e=e,r=r,o(t=t),!(t<=0)&&void 0!==e?"string"==typeof r?c(t).fill(e,r):c(t).fill(e):c(t)},h.allocUnsafe=i,h.allocUnsafeSlow=i,h.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==h.prototype},h.compare=function(t,e){if(T(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),T(e,Uint8Array)&&(e=h.from(e,e.offset,e.byteLength)),!h.isBuffer(t)||!h.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},h.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return h.alloc(0);if(void 0===e)for(o=e=0;o<t.length;++o)e+=t[o].length;for(var r=h.allocUnsafe(e),n=0,o=0;o<t.length;++o){var i=t[o];if(T(i,Uint8Array)&&(i=h.from(i)),!h.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,n),n+=i.length}return r},h.byteLength=d,h.prototype._isBuffer=!0,h.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)r(this,e,e+1);return this},h.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)r(this,e,e+3),r(this,e+1,e+2);return this},h.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)r(this,e,e+7),r(this,e+1,e+6),r(this,e+2,e+5),r(this,e+3,e+4);return this},h.prototype.toLocaleString=h.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):function(t,e,r){var n,o=!1;if((e=void 0===e||e<0?0:e)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t=t||"utf8";;)switch(t){case"hex":var i,s=this,a=e,u=r,f=s.length;(!u||u<0||f<u)&&(u=f);for(var c="",h=a=!a||a<0?0:a;h<u;++h)c+=(i=s[h])<16?"0"+i.toString(16):i.toString(16);return c;case"utf8":case"utf-8":return _(this,e,r);case"ascii":var l=this,f=e,p=r,d="";p=Math.min(l.length,p);for(var g=f;g<p;++g)d+=String.fromCharCode(127&l[g]);return d;case"latin1":case"binary":var y=this,a=e,m=r,v="";m=Math.min(y.length,m);for(var w=a;w<m;++w)v+=String.fromCharCode(y[w]);return v;case"base64":return b=this,n=r,0===(E=e)&&n===b.length?Q.fromByteArray(b):Q.fromByteArray(b.slice(E,n));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":for(var b=e,E=r,A=this.slice(b,E),T="",S=0;S<A.length;S+=2)T+=String.fromCharCode(A[S]+256*A[S+1]);return T;default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}.apply(this,arguments)},h.prototype.equals=function(t){if(h.isBuffer(t))return this===t||0===h.compare(this,t);throw new TypeError("Argument must be a Buffer")},h.prototype.inspect=function(){var t="",e=R.INSPECT_MAX_BYTES,t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim();return this.length>e&&(t+=" ... "),"<Buffer "+t+">"},h.prototype.compare=function(t,e,r,n,o){if(T(t,Uint8Array)&&(t=h.from(t,t.offset,t.byteLength)),!h.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(e=void 0===e?0:e)<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=e)return 0;if(o<=n)return-1;if(r<=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(i,s),u=this.slice(n,o),f=t.slice(e,r),c=0;c<a;++c)if(u[c]!==f[c]){i=u[c],s=f[c];break}return i<s?-1:s<i?1:0},h.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},h.prototype.indexOf=function(t,e,r){return s(this,t,e,r,!0)},h.prototype.lastIndexOf=function(t,e,r){return s(this,t,e,r,!1)},h.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||o<r)&&(r=o),0<t.length&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var i,s,a,u,f,c=!1;;)switch(n){case"hex":var h=this,l=t,p=e,d=r,g=(p=Number(p)||0,h.length-p);(!d||(d=Number(d))>g)&&(d=g),(g=l.length)/2<d&&(d=g/2);for(var y=0;y<d;++y){var m=parseInt(l.substr(2*y,2),16);if(S(m))return y;h[p+y]=m}return y;case"utf8":case"utf-8":return g=e,f=r,A(b(t,(u=this).length-g),u,g,f);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return u=this,f=e,a=r,A(E(t),u,f,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=e,s=r,A(function(t,e){for(var r,n,o=[],i=0;i<t.length&&!((e-=2)<0);++i)n=(r=t.charCodeAt(i))>>8,o.push(r%256),o.push(n);return o}(t,(i=this).length-a),i,a,s);default:if(c)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),c=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var y=4096;function u(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(r<t+e)throw new RangeError("Trying to access beyond buffer length")}function f(t,e,r,n,o,i){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<e||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function g(t,e,r,n){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function m(t,e,r,n,o){return e=+e,r>>>=0,o||g(t,0,r,4),O.write(t,e,r,n,23,4),r+4}function w(t,e,r,n,o){return e=+e,r>>>=0,o||g(t,0,r,8),O.write(t,e,r,n,52,8),r+8}h.prototype.slice=function(t,e){var r=this.length,r=((t=~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),e<t&&(e=t),this.subarray(t,e));return r.__proto__=h.prototype,r},h.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||u(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},h.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||u(t,e,this.length);for(var n=this[t+--e],o=1;0<e&&(o*=256);)n+=this[t+--e]*o;return n},h.prototype.readUInt8=function(t,e){return t>>>=0,e||u(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return t>>>=0,e||u(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return t>>>=0,e||u(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return t>>>=0,e||u(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return t>>>=0,e||u(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||u(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},h.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||u(t,e,this.length);for(var n=e,o=1,i=this[t+--n];0<n&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},h.prototype.readInt8=function(t,e){return t>>>=0,e||u(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){t>>>=0,e||u(t,2,this.length);e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},h.prototype.readInt16BE=function(t,e){t>>>=0,e||u(t,2,this.length);e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},h.prototype.readInt32LE=function(t,e){return t>>>=0,e||u(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return t>>>=0,e||u(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return t>>>=0,e||u(t,4,this.length),O.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return t>>>=0,e||u(t,4,this.length),O.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return t>>>=0,e||u(t,8,this.length),O.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return t>>>=0,e||u(t,8,this.length),O.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||f(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},h.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||f(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;0<=--o&&(i*=256);)this[e+o]=t/i&255;return e+r},h.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,1,255,0),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},h.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeIntLE=function(t,e,r,n){t=+t,e>>>=0,n||f(this,t,e,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,i=1,s=0;for(this[e]=255&t;++o<r&&(i*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},h.prototype.writeIntBE=function(t,e,r,n){t=+t,e>>>=0,n||f(this,t,e,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,i=1,s=0;for(this[e+o]=255&t;0<=--o&&(i*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/i>>0)-s&255;return e+r},h.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,1,127,-128),this[e]=255&(t=t<0?255+t+1:t),e+1},h.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},h.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},h.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},h.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||f(this,t,e,4,2147483647,-2147483648),this[e]=(t=t<0?4294967295+t+1:t)>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},h.prototype.writeFloatLE=function(t,e,r){return m(this,t,e,!0,r)},h.prototype.writeFloatBE=function(t,e,r){return m(this,t,e,!1,r)},h.prototype.writeDoubleLE=function(t,e,r){return w(this,t,e,!0,r)},h.prototype.writeDoubleBE=function(t,e,r){return w(this,t,e,!1,r)},h.prototype.copy=function(t,e,r,n){if(!h.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r=r||0,n||0===n||(n=this.length),e>=t.length&&(e=t.length),(n=0<n&&n<r?r:n)===r)return 0;if(0===t.length||0===this.length)return 0;if((e=e||0)<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o=(n=t.length-e<n-r?t.length-e+r:n)-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,n);else if(this===t&&r<e&&e<n)for(var i=o-1;0<=i;--i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},h.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var o;1===t.length&&(o=t.charCodeAt(0),("utf8"===n&&o<128||"latin1"===n)&&(t=o))}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");var i;if(!(r<=e))if(e>>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(t=t||0))for(i=e;i<r;++i)this[i]=t;else{var s=h.isBuffer(t)?t:h.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};var e=/[^+/0-9A-Za-z-_]/g;function b(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if(55295<(r=t.charCodeAt(s))&&r<57344){if(!o){if(56319<r){-1<(e-=3)&&i.push(239,191,189);continue}if(s+1===n){-1<(e-=3)&&i.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(e-=3)&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(e-=3)&&i.push(239,191,189);if(o=null,r<128){if(--e<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function E(t){return Q.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(e,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function A(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function T(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function S(t){return t!=t}}.call(this)}.call(this,D({}).Buffer)};var I,e,r,D=function(t){return e||I(e={exports:{},parent:t},e.exports),e.exports},n=Object.prototype.toString,M=(r=Object.create(null),function(t){t=n.call(t);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())});function t(e){return e=e.toLowerCase(),function(t){return M(t)===e}}function i(t){return Array.isArray(t)}function o(t){return void 0===t}var F=t("ArrayBuffer");function z(t){return null!==t&&"object"==typeof t}function s(t){return"object"===M(t)&&(null===(t=Object.getPrototypeOf(t))||t===Object.prototype)}var a=t("Date"),u=t("File"),q=t("Blob"),V=t("FileList");function J(t){return"[object Function]"===n.call(t)}var f=t("URLSearchParams");function c(t,e){if(null!=t)if(i(t="object"!=typeof t?[t]:t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.call(null,t[o],o,t)}h="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array);var h,l={isArray:i,isArrayBuffer:F,isBuffer:function(t){return null!==t&&!o(t)&&null!==t.constructor&&!o(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){return t&&("function"==typeof FormData&&t instanceof FormData||"[object FormData]"===n.call(t)||J(t.toString)&&"[object FormData]"===t.toString())},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&F(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:z,isPlainObject:s,isUndefined:o,isDate:a,isFile:u,isBlob:q,isStream:function(t){return z(t)&&J(t.pipe)},isURLSearchParams:f,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:c,merge:function r(){var n={};function t(t,e){s(n[e])&&s(t)?n[e]=r(n[e],t):s(t)?n[e]=r({},t):i(t)?n[e]=t.slice():n[e]=t}for(var e=0,o=arguments.length;e<o;e++)c(arguments[e],t);return n},extend:function(r,t,n){return c(t,function(t,e){r[e]=n&&"function"==typeof t?L(t,n):t}),r},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},inherits:function(t,e,r,n){t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,r&&Object.assign(t.prototype,r)},toFlatObject:function(t,e,r){var n,o,i,s={};e=e||{};do{for(o=(n=Object.getOwnPropertyNames(t)).length;0<o--;)s[i=n[o]]||(e[i]=t[i],s[i]=!0)}while((t=Object.getPrototypeOf(t))&&(!r||r(t,e))&&t!==Object.prototype);return e},endsWith:function(t,e,r){t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;t=t.indexOf(e,r);return-1!==t&&t===r},toArray:function(t){if(!t)return null;var e=t.length;if(o(e))return null;for(var r=new Array(e);0<e--;)r[e]=t[e];return r},isTypedArray:function(t){return h&&t instanceof h},isFileList:V};function W(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var H=function(t,e,r){var n;return!e||(r=r?r(e):l.isURLSearchParams(e)?e.toString():(n=[],l.forEach(e,function(t,e){null!=t&&(l.isArray(t)?e+="[]":t=[t],l.forEach(t,function(t){l.isDate(t)?t=t.toISOString():l.isObject(t)&&(t=JSON.stringify(t)),n.push(W(e)+"="+W(t))}))}),n.join("&")))&&(-1!==(e=t.indexOf("#"))&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r),t},X={};function p(){this.handlers=[]}p.prototype.use=function(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},p.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},p.prototype.forEach=function(e){l.forEach(this.handlers,function(t){null!==t&&e(t)})};function Y(r,n){l.forEach(r,function(t,e){e!==n&&e.toUpperCase()===n.toUpperCase()&&(r[n]=t,delete r[e])})}var X=p,d={};function g(t,e,r,n,o){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}l.inherits(g,Error,{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,status:this.response&&this.response.status?this.response.status:null}}});var $=g.prototype,G={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(t){G[t]={value:t}}),Object.defineProperties(g,G),Object.defineProperty($,"isAxiosError",{value:!0}),g.from=function(t,e,r,n,o,i){var s=Object.create($);return l.toFlatObject(t,s,function(t){return t!==Error.prototype}),g.call(s,t.message,e,r,n,o),s.name=t.name,i&&Object.assign(s,i),s};for(var d=g,K={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Q={toByteArray:function(t){for(var e,r=function(t){var e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");t=t.indexOf("=");return[t=-1===t?e:t,t===e?0:4-t%4]}(t),n=r[0],r=r[1],o=new Z(3*(n+r)/4-r),i=0,s=0<r?n-4:n,a=0;a<s;a+=4)e=m[t.charCodeAt(a)]<<18|m[t.charCodeAt(a+1)]<<12|m[t.charCodeAt(a+2)]<<6|m[t.charCodeAt(a+3)],o[i++]=e>>16&255,o[i++]=e>>8&255,o[i++]=255&e;return 2===r&&(e=m[t.charCodeAt(a)]<<2|m[t.charCodeAt(a+1)]>>4,o[i++]=255&e),1===r&&(e=m[t.charCodeAt(a)]<<10|m[t.charCodeAt(a+1)]<<4|m[t.charCodeAt(a+2)]>>2,o[i++]=e>>8&255,o[i++]=255&e),o},fromByteArray:function(t){for(var e,r=t.length,n=r%3,o=[],i=0,s=r-n;i<s;i+=16383)o.push(function(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(255&t[i+2]),o.push(y[(n=n)>>18&63]+y[n>>12&63]+y[n>>6&63]+y[63&n]);return o.join("")}(t,i,s<i+16383?s:i+16383));return 1==n?(e=t[r-1],o.push(y[e>>2]+y[e<<4&63]+"==")):2==n&&(e=(t[r-2]<<8)+t[r-1],o.push(y[e>>10]+y[e>>4&63]+y[e<<2&63]+"=")),o.join("")}},y=[],m=[],Z="undefined"!=typeof Uint8Array?Uint8Array:Array,tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=0,et=tt.length;v<et;++v)y[v]=tt[v],m[tt.charCodeAt(v)]=v;m["-".charCodeAt(0)]=62,m["_".charCodeAt(0)]=63;var rt,nt,w,O={read:function(t,e,r,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,f=u>>1,c=-7,h=r?o-1:0,l=r?-1:1,o=t[e+h];for(h+=l,i=o&(1<<-c)-1,o>>=-c,c+=a;0<c;i=256*i+t[e+h],h+=l,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;0<c;s=256*s+t[e+h],h+=l,c-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:1/0*(o?-1:1);s+=Math.pow(2,n),i-=f}return(o?-1:1)*s*Math.pow(2,i-n)},write:function(t,e,r,n,o,i){var s,a,u=8*i-o-1,f=(1<<u)-1,c=f>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,p=n?1:-1,i=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(n=Math.pow(2,-s))<1&&(s--,n*=2),2<=(e+=1<=s+c?h/n:h*Math.pow(2,1-c))*n&&(s++,n/=2),f<=s+c?(a=0,s=f):1<=s+c?(a=(e*n-1)*Math.pow(2,o),s+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,o),s=0));8<=o;t[r+l]=255&a,l+=p,a/=256,o-=8);for(s=s<<o|a,u+=o;0<u;t[r+l]=255&s,l+=p,s/=256,u-=8);t[r+l-p]|=128*i}},ot={},it=(!function(r){!function(){"use strict";ot=function(t,i){i=i||new FormData;var e=[];function s(t){return null===t?"":l.isDate(t)?t.toISOString():l.isArrayBuffer(t)||l.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):r.from(t):t}return function n(t,o){if(l.isPlainObject(t)||l.isArray(t)){if(-1!==e.indexOf(t))throw Error("Circular reference detected in "+o);e.push(t),l.forEach(t,function(t,e){if(!l.isUndefined(t)){var r=o?o+"."+e:e;if(t&&!o&&"object"==typeof t)if(l.endsWith(e,"{}"))t=JSON.stringify(t);else if(l.endsWith(e,"[]")&&(e=l.toArray(t)))return void e.forEach(function(t){l.isUndefined(t)||i.append(r,s(t))});n(t,r)}}),e.pop()}else i.append(o,s(t))}(t),i}}.call(this)}.call(this,D({}).Buffer),l.isStandardBrowserEnv()?{write:function(t,e,r,n,o,i){var s=[];s.push(t+"="+encodeURIComponent(e)),l.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),l.isString(n)&&s.push("path="+n),l.isString(o)&&s.push("domain="+o),!0===i&&s.push("secure"),document.cookie=s.join("; ")},read:function(t){t=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}),st=function(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?(t=t,(r=e)?t.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):t):e;var r},at=["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"],ut=l.isStandardBrowserEnv()?(nt=/(msie|trident)/i.test(navigator.userAgent),w=document.createElement("a"),rt=ft(window.location.href),function(t){t=l.isString(t)?ft(t):t;return t.protocol===rt.protocol&&t.host===rt.host}):function(){return!0},b={};function ft(t){return nt&&(w.setAttribute("href",t),t=w.href),w.setAttribute("href",t),{href:w.href,protocol:w.protocol?w.protocol.replace(/:$/,""):"",host:w.host,search:w.search?w.search.replace(/^\?/,""):"",hash:w.hash?w.hash.replace(/^#/,""):"",hostname:w.hostname,port:w.port,pathname:"/"===w.pathname.charAt(0)?w.pathname:"/"+w.pathname}}function ct(t){d.call(this,null==t?"canceled":t,d.ERR_CANCELED),this.name="CanceledError"}l.inherits(ct,d,{__CANCEL__:!0});function ht(h){return new Promise(function(s,a){var t,r=h.data,n=h.headers,u=h.responseType;function f(){h.cancelToken&&h.cancelToken.unsubscribe(t),h.signal&&h.signal.removeEventListener("abort",t)}l.isFormData(r)&&l.isStandardBrowserEnv()&&delete n["Content-Type"];var c=new XMLHttpRequest,e=(h.auth&&(e=h.auth.username||"",i=h.auth.password?unescape(encodeURIComponent(h.auth.password)):"",n.Authorization="Basic "+btoa(e+":"+i)),st(h.baseURL,h.url));function o(){var t,e,r,n,o,i;c&&(r="getAllResponseHeaders"in c?(r=c.getAllResponseHeaders(),i={},r&&l.forEach(r.split("\n"),function(t){o=t.indexOf(":"),n=l.trim(t.substr(0,o)).toLowerCase(),o=l.trim(t.substr(o+1)),!n||i[n]&&0<=at.indexOf(n)||(i[n]="set-cookie"===n?(i[n]||[]).concat([o]):i[n]?i[n]+", "+o:o)}),i):null,t={data:u&&"text"!==u&&"json"!==u?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:r,config:h,request:c},e=t.config.validateStatus,t.status&&e&&!e(t.status)?(e=new d("Request failed with status code "+t.status,[d.ERR_BAD_REQUEST,d.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t),a(e)):s(t),f(),c=null)}c.open(h.method.toUpperCase(),H(e,h.params,h.paramsSerializer),!0),c.timeout=h.timeout,"onloadend"in c?c.onloadend=o:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(o)},c.onabort=function(){c&&(a(new d("Request aborted",d.ECONNABORTED,h,c)),c=null)},c.onerror=function(){a(new d("Network Error",d.ERR_NETWORK,h,c,c)),c=null},c.ontimeout=function(){var t=h.timeout?"timeout of "+h.timeout+"ms exceeded":"timeout exceeded",e=h.transitional||K;h.timeoutErrorMessage&&(t=h.timeoutErrorMessage),a(new d(t,e.clarifyTimeoutError?d.ETIMEDOUT:d.ECONNABORTED,h,c)),c=null},l.isStandardBrowserEnv()&&(i=(h.withCredentials||ut(e))&&h.xsrfCookieName?it.read(h.xsrfCookieName):void 0)&&(n[h.xsrfHeaderName]=i),"setRequestHeader"in c&&l.forEach(n,function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete n[e]:c.setRequestHeader(e,t)}),l.isUndefined(h.withCredentials)||(c.withCredentials=!!h.withCredentials),u&&"json"!==u&&(c.responseType=h.responseType),"function"==typeof h.onDownloadProgress&&c.addEventListener("progress",h.onDownloadProgress),"function"==typeof h.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",h.onUploadProgress),(h.cancelToken||h.signal)&&(t=function(t){c&&(a(!t||t.type?new b:t),c.abort(),c=null)},h.cancelToken&&h.cancelToken.subscribe(t),h.signal&&(h.signal.aborted?t():h.signal.addEventListener("abort",t)));var i,r=r||null,e=(i=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e))&&i[1]||"";e&&-1===["http","https","file"].indexOf(e)?a(new d("Unsupported protocol "+e+":",d.ERR_BAD_REQUEST,h)):c.send(r)})}var E,A,b=ct,u=a={};function lt(){throw new Error("setTimeout has not been defined")}function pt(){throw new Error("clearTimeout has not been defined")}function dt(e){if(E===setTimeout)return setTimeout(e,0);if((E===lt||!E)&&setTimeout)return(E=setTimeout)(e,0);try{return E(e,0)}catch(t){try{return E.call(null,e,0)}catch(t){return E.call(this,e,0)}}}try{E="function"==typeof setTimeout?setTimeout:lt}catch(t){E=lt}try{A="function"==typeof clearTimeout?clearTimeout:pt}catch(t){A=pt}var T,S=[],_=!1,R=-1;function gt(){_&&T&&(_=!1,T.length?S=T.concat(S):R=-1,S.length&&yt())}function yt(){if(!_){var t=dt(gt);_=!0;for(var e=S.length;e;){for(T=S,S=[];++R<e;)T&&T[R].run();R=-1,e=S.length}T=null,_=!1,function(e){if(A===clearTimeout)return clearTimeout(e);if((A===pt||!A)&&clearTimeout)return(A=clearTimeout)(e);try{A(e)}catch(t){try{return A.call(null,e)}catch(t){return A.call(this,e)}}}(t)}}function mt(t,e){this.fun=t,this.array=e}function C(){}u.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];S.push(new mt(t,e)),1!==S.length||_||dt(yt)},mt.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=C,u.addListener=C,u.once=C,u.off=C,u.removeListener=C,u.removeAllListeners=C,u.emit=C,u.prependListener=C,u.prependOnceListener=C,u.listeners=function(t){return[]},u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0};var B={},vt=(!function(r){!function(){"use strict";var e={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!l.isUndefined(t)&&l.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var t,n={transitional:K,adapter:t="undefined"!=typeof XMLHttpRequest||void 0!==r&&"[object process]"===Object.prototype.toString.call(r)?ht:t,transformRequest:[function(t,e){if(Y(e,"Accept"),Y(e,"Content-Type"),!(l.isFormData(t)||l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t))){if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var r,n=l.isObject(t),o=e&&e["Content-Type"];if((i=l.isFileList(t))||n&&"multipart/form-data"===o)return r=this.env&&this.env.FormData,ot(i?{"files[]":t}:t,r&&new r);if(n||"application/json"===o){s(e,"application/json");var i=t;if(l.isString(i))try{return(0,JSON.parse)(i),l.trim(i)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(i)}}return t}],transformResponse:[function(t){var e=this.transitional||n.transitional,r=e&&e.silentJSONParsing,e=e&&e.forcedJSONParsing,r=!r&&"json"===this.responseType;if(r||e&&l.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw d.from(t,d.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:null},validateStatus:function(t){return 200<=t&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};l.forEach(["delete","get","head"],function(t){n.headers[t]={}}),l.forEach(["post","put","patch"],function(t){n.headers[t]=l.merge(e)}),B=n}.call(this)}.call(this,a),function(e,r,t){var n=this||B;return l.forEach(t,function(t){e=t.call(n,e,r)}),e}),wt=function(t){return!(!t||!t.__CANCEL__)};function bt(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new b}function Et(e){return bt(e),e.headers=e.headers||{},e.data=vt.call(e,e.data,e.headers,e.transformRequest),e.headers=l.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),l.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||B.adapter)(e).then(function(t){return bt(e),t.data=vt.call(e,t.data,t.headers,e.transformResponse),t},function(t){return wt(t)||(bt(e),t&&t.response&&(t.response.data=vt.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}function U(e,r){r=r||{};var n={};function o(t,e){return l.isPlainObject(t)&&l.isPlainObject(e)?l.merge(t,e):l.isPlainObject(e)?l.merge({},e):l.isArray(e)?e.slice():e}function i(t){return l.isUndefined(r[t])?l.isUndefined(e[t])?void 0:o(void 0,e[t]):o(e[t],r[t])}function t(t){if(!l.isUndefined(r[t]))return o(void 0,r[t])}function s(t){return l.isUndefined(r[t])?l.isUndefined(e[t])?void 0:o(void 0,e[t]):o(void 0,r[t])}function a(t){return t in r?o(e[t],r[t]):t in e?o(void 0,e[t]):void 0}var u={url:t,method:t,data:t,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return l.forEach(Object.keys(e).concat(Object.keys(r)),function(t){var e=u[t]||i,r=e(t);l.isUndefined(r)&&e!==a||(n[t]=r)}),n}var At,Tt={},St=(["object","boolean","number","function","string","symbol"].forEach(function(e,r){Tt[e]=function(t){return typeof t===e||"a"+(r<1?"n ":" ")+e}}),{}),k=(Tt.transitional=function(n,o,r){function i(t,e){return"[Axios v0.27.2] Transitional option '"+t+"'"+e+(r?". "+r:"")}return function(t,e,r){if(!1===n)throw new d(i(e," has been removed"+(o?" in "+o:"")),d.ERR_DEPRECATED);return o&&!St[e]&&(St[e]=!0,console.warn(i(e," has been deprecated since v"+o+" and will be removed in the near future"))),!n||n(t,e,r)}},{}),x=(At={assertOptions:function(t,e,r){if("object"!=typeof t)throw new d("options must be an object",d.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(t),o=n.length;0<o--;){var i=n[o],s=e[i];if(s){var a=t[i],s=void 0===a||s(a,i,t);if(!0!==s)throw new d("option "+i+" must be "+s,d.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new d("Unknown option "+i,d.ERR_BAD_OPTION)}},validators:Tt}).validators;function j(t){this.defaults=t,this.interceptors={request:new X,response:new X}}function N(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");this.promise=new Promise(function(t){e=t});var e,n=this;this.promise.then(function(t){if(n._listeners){for(var e=n._listeners.length,r=0;r<e;r++)n._listeners[r](t);n._listeners=null}}),this.promise.then=function(t){var e,t=new Promise(function(t){n.subscribe(t),e=t}).then(t);return t.cancel=function(){n.unsubscribe(e)},t},t(function(t){n.reason||(n.reason=new b(t),e(n.reason))})}j.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=U(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional,r=(void 0!==t&&At.assertOptions(t,{silentJSONParsing:x.transitional(x.boolean),forcedJSONParsing:x.transitional(x.boolean),clarifyTimeoutError:x.transitional(x.boolean)},!1),[]),n=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))});var o,i=[];if(this.interceptors.response.forEach(function(t){i.push(t.fulfilled,t.rejected)}),n){for(var s=e;r.length;){var a=r.shift(),u=r.shift();try{s=a(s)}catch(t){u(t);break}}try{o=Et(s)}catch(t){return Promise.reject(t)}for(;i.length;)o=o.then(i.shift(),i.shift())}else{var f=[Et,void 0];for(Array.prototype.unshift.apply(f,r),f=f.concat(i),o=Promise.resolve(e);f.length;)o=o.then(f.shift(),f.shift())}return o},j.prototype.getUri=function(t){t=U(this.defaults,t);var e=st(t.baseURL,t.url);return H(e,t.params,t.paramsSerializer)},l.forEach(["delete","get","head","options"],function(r){j.prototype[r]=function(t,e){return this.request(U(e||{},{method:r,url:t,data:(e||{}).data}))}}),l.forEach(["post","put","patch"],function(o){function t(n){return function(t,e,r){return this.request(U(r||{},{method:o,headers:n?{"Content-Type":"multipart/form-data"}:{},url:t,data:e}))}}j.prototype[o]=t(),j.prototype[o+"Form"]=t(!0)}),k=j,N.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},N.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},N.prototype.unsubscribe=function(t){this._listeners&&-1!==(t=this._listeners.indexOf(t))&&this._listeners.splice(t,1)},N.source=function(){var e;return{token:new N(function(t){e=t}),cancel:e}};var q=N,f=function e(r){var t=new k(r),n=L(k.prototype.request,t);return l.extend(n,k.prototype,t),l.extend(n,t),n.create=function(t){return e(U(r,t))},n}(B),_t=(f.Axios=k,f.CanceledError=b,f.CancelToken=q,f.isCancel=wt,f.VERSION="0.27.2",f.toFormData=ot,f.AxiosError=d,f.Cancel=f.CanceledError,f.all=function(t){return Promise.all(t)},f.spread=function(e){return function(t){return e.apply(null,t)}},f.isAxiosError=function(t){return l.isObject(t)&&!0===t.isAxiosError},f.default=f),Rt={},P={};return function(m){!function(){"use strict";function f(t,e){var r,n,o,i,s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(s)return o=!(n=!0),{s:function(){s=s.call(t)},n:function(){var t=s.next();return n=t.done,t},e:function(t){o=!0,r=t},f:function(){try{n||null==s.return||s.return()}finally{if(o)throw r}}};if(Array.isArray(t)||(s=c(t))||e&&t&&"number"==typeof t.length)return s&&(t=s),i=0,{s:e=function(){},n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(t,e){var r;if(t)return"string"==typeof t?h(t,e):"Map"===(r="Object"===(r=Object.prototype.toString.call(t).slice(8,-1))&&t.constructor?t.constructor.name:r)||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,e):void 0}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function t(t,e,r){e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1})}Object.defineProperty(P,"__esModule",{value:!0}),P.varsnap=P.clientName=P.version=void 0,P.version="1.8.4",P.clientName="javascript."+P.version;var r={varsnap:!0,env:"development",branch:"",producerToken:"",consumerToken:"",logger:console},s=[],a=[],l=(t(g,null,[{key:"getConfig",value:function(t,e){return(t=t&&t[e])?t.toString().toLowerCase():""}},{key:"setConfig",value:function(t,e,r){return"varsnap"===e&&(t[e]=r="string"==typeof r?"true"===r:r),"env"!==e&&"producerToken"!==e&&"consumerToken"!==e&&"branch"!==e||(t[e]=r),"logger"===e&&(t[e]=r),t}},{key:"getSignature",value:function(t,e){var r="",r=""!==e&&void 0!==e?e:(r=(r=t.toString().split("{")[0]).replace(/^\s+|\s+$/g,"")).replace(/,\s+/g,",");return"javascript."+P.version+"."+r}},{key:"ajax",value:function(t,e){t={method:"POST",url:t,headers:{"Content-Type":"application/x-www-form-urlencoded"},data:new URLSearchParams(e).toString(),responseType:"json"};return g.isNode()&&t.headers&&(t.headers["User-Agent"]="varsnap.js"),(0,_t.default)(t).then(function(t){return t.data}).catch(function(t){return t})}},{key:"debug",value:function(t,e){t.logger&&t.logger.debug(e)}},{key:"log",value:function(t,e){t.logger&&t.logger.log(e)}},{key:"error",value:function(t,e){t.logger&&t.logger.error(e)}},{key:"resetProducers",value:function(){s=[]}},{key:"resetConsumers",value:function(){a=[]}},{key:"getProducers",value:function(){return s}},{key:"getConsumers",value:function(){return a}},{key:"limitString",value:function(t){t=String(t);return t.length<=30?t:t.substring(0,30-"...".length)+"..."}},{key:"isNode",value:function(){return"object"===(void 0===m?"undefined":e(m))&&"undefined"==typeof window}},{key:"getBranch",value:function(t){var e=g.getConfig(t,"branch");return e?new Promise(function(t){return t(e)}):g.isNode()?new Promise(function(r){(0,Rt.exec)("git rev-parse --abbrev-ref HEAD",function(t,e){return r(e.trim())})}):new Promise(function(t){return t("")})}}]),g),p=(t(i,[{key:"isEnabled",value:function(){return!!this.config.varsnap&&"production"===l.getConfig(this.config,"env")&&!!l.getConfig(this.config,"producerToken")}},{key:"produce",value:function(e,t){var r=this;return this.isEnabled()?(l.debug(this.config,"Sending call to Varsnap"),Promise.resolve(t).then(function(t){t={producer_token:l.getConfig(r.config,"producerToken"),signature:r.signature,inputs:i.serialize(e),prod_outputs:i.serialize(t)};return l.ajax("https://www.varsnap.com/api/snap/produce/",t).then(function(){return!0}).catch(function(t){if(t.response){if(429===t.response.status)return l.error(r.config,"Cannot produce to Varsnap; Signature at rate limit"),!0;404===t.response.status?l.error(r.config,"Cannot produce to Varsnap; check your producer token"):l.error(r.config,t.response.statusText)}return!1})})):new Promise(function(t){return t(!1)})}}],[{key:"serialize",value:function(t){return JSON.stringify(t)}},{key:"serialize_formatted",value:function(t){return JSON.stringify(t,null,2)}}]),i),u=(t(d,[{key:"isEnabled",value:function(){return!!this.config.varsnap&&"development"===l.getConfig(this.config,"env")&&!!l.getConfig(this.config,"consumerToken")}},{key:"consume",value:function(a){var o,u=this;return this.isEnabled()?(o={consumer_token:l.getConfig(this.config,"consumerToken"),signature:this.signature},l.ajax("https://www.varsnap.com/api/snap/consume/",o).then(function(t){var e=t;if(!e||"ok"!==e.status)return[new Promise(function(t){return l.error(u.config,"Received error from Varsnap: "+e.status),t(!1)})];0===e.results.length&&l.log(u.config,"No snaps found for signature: "+o.signature);var r,s=[],n=f(e.results);try{for(n.s();!(r=n.n()).done;)!function(){var t,n=r.value,o=d.deserialize(n.inputs),i=d.deserialize(n.prod_outputs),e=void 0;try{e=u.targetFunc.apply(u,function(t){if(Array.isArray(t))return h(t)}(t=o)||function(){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}()||c(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}catch(t){e=t}e=Promise.resolve(e).then(function(e){var r=p.serialize(i)===p.serialize(e);return u.reportCentral(a,n,i,e,r).then(function(t){u.reportLog(n.id,o,i,e,r,t)}),r});s.push(e)}()}catch(t){n.e(t)}finally{n.f()}return s}).then(function(t){return Promise.all(t).then(function(t){return t.every(function(t){return t})})}).catch(function(t){return l.error(u.config,"Cannot contact Varsnap: "+t),!1})):new Promise(function(t){return l.error(u.config,"Varsnap not enabled for testing"),t(!1)})}},{key:"reportCentral",value:function(t,e,r,n,o){var i=this,t={trial_group_id:t.trial_group_id,consumer_token:l.getConfig(this.config,"consumerToken"),snap_id:e.id,test_outputs:p.serialize(n),matches:o.toString(),snap_outputs_formatted:p.serialize_formatted(r),test_outputs_formatted:p.serialize_formatted(n)};return l.ajax("https://www.varsnap.com/api/trial/produce/",t).then(function(t){return!(!t||"ok"!==t.status)&&t.trial_url}).catch(function(t){return l.error(i.config,"Cannot upload test results to Varsnap: "+t),!1})}},{key:"reportLog",value:function(t,e,r,n,o,i){o||(l.log(this.config,""),l.log(this.config,"Testing with Varsnap uuid: "+t),l.log(this.config,"Signature: "+this.signature),l.log(this.config,"Function input args: "+l.limitString(e)),l.log(this.config,"Production function outputs: "+l.limitString(r)),l.log(this.config,"Your function outputs: "+l.limitString(n)),l.log(this.config,"Matching outputs: "+o),t="Cannot upload trial",i&&(t=String(i)),l.log(this.config,"Trial URL: "+t))}},{key:"reportTrialGroup",value:function(t){l.log(this.config,"Trial Group: "+t.trial_group_url)}}],[{key:"deserialize",value:function(t){if(""!==t)return JSON.parse(t)}}]),d);function d(t,e,r){n(this,d),this.targetFunc=t,this.signature=e,this.config=r}function i(t,e,r){n(this,i),this.targetFunc=t,this.signature=e,this.config=r}function g(){n(this,g)}function y(o,t){function e(){for(var t,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];try{t=o.apply(void 0,r)}catch(t){throw i.produce(r,t),t}return i.produce(r,t),t}var t=l.getSignature(o,t=void 0===t?"":t),i=new p(o,t,y._config),r=new u(o,t,y._config);return e.producer=i,e.consumer=r,e.signature=t,s.push(i),a.push(r),e}(P.varsnap=y)._config=r,y.updateConfig=function(t){for(var e=y._config,r=0,n=Object.keys(y._config);r<n.length;r++){var o=n[r];Object.prototype.hasOwnProperty.call(t,o)&&(e=l.setConfig(e,o,t[o]))}y._config=e},y.reset=function(){l.resetConsumers(),l.resetProducers()},y.version=P.version,y.runTests=function(){var e,i=l.getConsumers();return 0===i.length?Promise.resolve(!0):(e=i[0].config,l.getBranch(e).then(function(t){return{branch:t,consumer_token:l.getConfig(e,"consumerToken"),client:P.clientName}}).then(function(t){return l.ajax("https://www.varsnap.com/api/trial_group/",t)}).then(function(t){return t}).catch(function(t){t=t&&t.response&&t.response.data?t.response.data.error:t.toString();return l.error(e,"Cannot generate a new Trial Group: "+t),{status:"not ok",project_id:"",trial_group_id:"",trial_group_url:""}}).then(function(t){var e,r=[],n=f(i);try{for(n.s();!(e=n.n()).done;){var o=e.value.consume(t);r.push(o)}}catch(t){n.e(t)}finally{n.f()}return 0<i.length&&i[0].reportTrialGroup(t),Promise.all(r)}).then(function(t){return t.every(function(t){return t})}))}}.call(this)}.call(this,a),P.varsnap})}("undefined"==typeof Varsnap?Varsnap={}:Varsnap);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "varsnap",
3
- "version": "1.8.3",
3
+ "version": "1.8.4",
4
4
  "description": "Varsnap Client",
5
5
  "main": "dist/built/index.js",
6
6
  "types": "dist/built/index.d.ts",
@@ -52,20 +52,20 @@
52
52
  "browserify": "^17.0.0",
53
53
  "chai": "^4.2.0",
54
54
  "eslint": "^8.4.1",
55
- "mocha": "^9.1.3",
55
+ "mocha": "^10.0.0",
56
56
  "mochify": "^9.0.0",
57
57
  "nyc": "^15.1.0",
58
- "sinon": "^13.0.0",
58
+ "sinon": "^14.0.0",
59
59
  "source-map-support": "^0.5.19",
60
60
  "tinyify": "^3.0.0",
61
- "ts-mocha": "albertyw/ts-mocha",
61
+ "ts-mocha": "^10.0.0",
62
62
  "ts-node": "^10.1.0",
63
63
  "tsify": "^5.0.2",
64
64
  "typescript": "^4.1.3",
65
65
  "uglify-js": "^3.12.3"
66
66
  },
67
67
  "dependencies": {
68
- "axios": "^0.26.0"
68
+ "axios": "^0.27.0"
69
69
  },
70
70
  "files": [
71
71
  "dist/varsnap.*",
package/CHANGELOG.md DELETED
@@ -1,386 +0,0 @@
1
- CHANGELOG
2
- =========
3
-
4
- 1.8.3 (2022-03-27)
5
- ------------------
6
-
7
- - Resolve issue with importing by webpack/enhanced-resolve
8
- - Update dependencies
9
-
10
-
11
- 1.8.2 (2022-01-29)
12
- ------------------
13
-
14
- - Remove dependency on `remove-query-string`
15
- - Return branch from `setGitBranchEnv`
16
- - Update dependencies
17
-
18
-
19
- 1.8.1 (2022-01-15)
20
- ------------------
21
-
22
- - Fix varsnap import config
23
- - Update dependencies
24
-
25
-
26
- 1.8.0 (2022-01-14)
27
- ------------------
28
-
29
- - Add `gitbranchenv` to make getting git branch names easier
30
- - Add documentation of git branch usage
31
- - Cleanup
32
- - Update depencencies
33
-
34
-
35
- 1.7.0 (2022-01-03)
36
- ------------------
37
-
38
- - Send git branch when generating trial groups
39
- - Update dependencies
40
- - Refactors
41
-
42
-
43
- 1.6.10 (2022-01-01)
44
- -------------------
45
-
46
- - Update dependencies
47
- - Simplify testing
48
-
49
-
50
- 1.6.9 (2021-09-11)
51
- ------------------
52
-
53
- - Update dependencies
54
-
55
-
56
- 1.6.8 (2021-07-25)
57
- ------------------
58
-
59
- - Remove "v" prefix from versions
60
- - Optimize dependency installation during CI
61
- - Update dependencies
62
-
63
-
64
- 1.6.7 (2021-05-22)
65
- ------------------
66
-
67
- - Update dependencies
68
- - Send client name when generating trial group
69
-
70
-
71
- 1.6.6 (2021-04-10)
72
- ------------------
73
-
74
- - Refactors
75
- - Update dependencies
76
-
77
-
78
- 1.6.5 (2021-03-18)
79
- ------------------
80
-
81
- - Show trial group url in test output
82
- - Fix error handling on failed snap produce calls
83
- - Better handle http 429 errors
84
- - Update dependencies
85
- - Use DroneCI
86
-
87
-
88
- 1.6.4 (2020-12-28)
89
- ------------------
90
-
91
- - Remove whitespace when recording function arguments so varsnap.js doesn't conflict with minifiers
92
- - Add minification configs to readme
93
-
94
-
95
- 1.6.3 (2020-12-13)
96
- ------------------
97
-
98
- - Send requests to varsnap with a custom user agent only when not in browser
99
-
100
-
101
- 1.6.2 (2020-12-12)
102
- ------------------
103
-
104
- - Fix bug with runTests when there are no consumers
105
- - Fix readme typo
106
- - Update dependencies
107
-
108
-
109
- 1.6.1 (2020-12-08)
110
- ------------------
111
-
112
- - Support trial groups
113
- - Update dependencies
114
-
115
-
116
- 1.6.0 (2020-11-26)
117
- ------------------
118
-
119
- - Support adding a function name/signature as a second argument to varsnap
120
- - Cache signature on varsnap wrapped method
121
-
122
-
123
- 1.5.6 (2020-11-23)
124
- ------------------
125
-
126
- - Update varsnap consume to compare serialized data so non-primitive data types are comparable
127
- - Update dependencies
128
- - Clean up integration tests
129
-
130
-
131
- 1.5.5 (2020-11-15)
132
- ------------------
133
-
134
- - Log a warning when no snaps are available to test against
135
- - Update dependencies
136
-
137
-
138
- 1.5.4 (2020-07-19)
139
- ------------------
140
-
141
- - Send formatted Trial outputs to Varsnap server
142
- - Add tests
143
- - Dependency updates
144
-
145
-
146
- 1.5.3 (2020-06-03)
147
- ------------------
148
-
149
- - Remove async/await
150
- - Fix config types in readme
151
- - Add more tests
152
- - Fix coverage calculation
153
-
154
-
155
- 1.5.2 (2020-05-12)
156
- ------------------
157
-
158
- - Make `runTests()` function not async and instead return a Promise
159
- - Removed the `varsnap.full.js` distributable
160
- - Switch from deprecated request node package to axios
161
- - Further compressed the distributable files
162
- - Update dependencies
163
-
164
-
165
- 1.5.1 (2020-05-09)
166
- ------------------
167
-
168
- - Fix bug when calculating trial results
169
- - Clean up logging
170
- - Prune npm package files
171
- - Update dependencies
172
-
173
-
174
- 1.5.0 (2020-04-26)
175
- ------------------
176
-
177
- - Add ability to resolve and snap promises
178
- - Clean up packaging
179
- - Dependency updates
180
-
181
-
182
- 1.4.0 (2020-04-18)
183
- ------------------
184
-
185
- - Add `varsnap.updateConfig` function to replace writing config directly
186
- - Remove `varsnap.config`
187
- - Refactors
188
- - NPM update
189
-
190
-
191
- 1.3.3 (2020-04-15)
192
- ------------------
193
-
194
- - Refactor typescript
195
-
196
-
197
- 1.3.2 (2020-04-11)
198
- ------------------
199
-
200
- - Removed all lint warnings
201
- - Cleanup and refactors
202
-
203
-
204
- 1.3.1 (2020-04-03)
205
- ------------------
206
-
207
- - Fix package exports
208
- - Dependency updates
209
-
210
-
211
- 1.3.0 (2020-04-01)
212
- ------------------
213
-
214
- - Remove mocha as a production dependency.
215
- Users of mocha for testing will have to copy a more verbose testing function.
216
- See the README for details.
217
- - Dependency updates
218
-
219
-
220
- 1.2.0 (2020-03-31)
221
- ------------------
222
-
223
- - Updated entire codebase to typescript; you can now import type definitions
224
-
225
-
226
- 1.1.4 (2020-03-23)
227
- ------------------
228
-
229
- - Fix a bug where varsnap tests would report the success/failure of the last case only.
230
- It will now report a success only if all cases pass.
231
- - Update deps
232
-
233
-
234
- 1.1.3 (2020-03-07)
235
- ------------------
236
-
237
- - Update deps
238
- - Use JS strict mode
239
-
240
-
241
- 1.1.2 (2020-02-09)
242
- ------------------
243
-
244
- - Fix string formatting again
245
- - Update dependencies
246
-
247
-
248
- 1.1.1 (2020-02-01)
249
- ------------------
250
-
251
- - Fix bug with formatting non-string variables
252
- - Update dependencies
253
-
254
-
255
- 1.1.0 (2019-12-23)
256
- ------------------
257
-
258
- - Limit the length of debug strings in test outputs
259
- - Update dependencies
260
-
261
-
262
- 1.0.3 (2019-11-17)
263
- ------------------
264
-
265
- - Reduce logging in production
266
- - Update VarSnap to Varsnap
267
-
268
-
269
- 1.0.2 (2019-10-29)
270
- ------------------
271
-
272
- - Fix generated distributables
273
- - Update dependencies
274
-
275
-
276
- 1.0.1 (2019-10-27)
277
- ------------------
278
-
279
- - Support comparing exceptions
280
- - Fix serialization of test outputs
281
- - Better handle logging for unconfigured client
282
- - Fix sequencing of test log outputs
283
-
284
-
285
- 1.0.0 (2019-10-21)
286
- ------------------
287
-
288
- - Update README
289
- - Refactor and break out test functionality
290
-
291
-
292
- 0.4.5 (2019-10-17)
293
- ------------------
294
-
295
- - Show trial url after running tests
296
- - Add dist-all script with all core functions
297
- - Add version header to minified script
298
-
299
-
300
- 0.4.4 (2019-10-14)
301
- ------------------
302
-
303
- - Test against all returned snaps
304
- - Add a script to browserify all varsnap functions
305
- - Include version in snap for browser distributable
306
-
307
-
308
- 0.4.3 (2019-10-12)
309
- ------------------
310
-
311
- - Fix "enable" check on Consumers
312
- - Refactors
313
-
314
-
315
- 0.4.2 (2019-10-06)
316
- ------------------
317
-
318
- - Report trials to varsnap server
319
- - Refactors
320
-
321
-
322
- 0.4.1 (2019-09-09)
323
- ------------------
324
-
325
- - Update dependencies
326
- - Increase mocha timeout
327
-
328
-
329
- 0.4.0 (2019-08-18)
330
- ------------------
331
-
332
- - Updated dependencies and added mocha as a production dependency
333
- - Added a mocha-based TestCase
334
- - Removed running tests automatically in development env
335
- - Various bugfixes
336
- - Better node.js support
337
-
338
-
339
- 0.3.2 (2019-07-20)
340
- ------------------
341
-
342
- - Updated dependencies
343
- - Updated Snap Consume logic to work with batch endpoint
344
- - Update release instructions
345
-
346
-
347
- 0.3.1 (2019-07-09)
348
- ------------------
349
-
350
- - Add configurable logging in client
351
- - Make sure varsnap doesn't fail when not configured
352
-
353
-
354
- 0.3.0 (2019-07-07)
355
- ------------------
356
-
357
- - Change configuration from environment/global variable to a property of the varsnap function
358
-
359
-
360
- 0.2.0 (2019-07-07)
361
- ------------------
362
-
363
- - Generate a distributable for browsers
364
- - Switch browser config variable from `varsnap` to `varsnapConfig`
365
- - Switch from requests to xhr package
366
- - Fix bug when reading non-string variables
367
-
368
-
369
- 0.1.1 (2019-06-27)
370
- ------------------
371
-
372
- - Switch to using a deep equal comparison
373
-
374
-
375
- 0.1.0 (2019-06-25)
376
- ------------------
377
-
378
- - Initial working release including Varsnap Producer and Consumer
379
- - Updated readme
380
- - Added example script
381
-
382
-
383
- 0.0.1 (2019-06-20)
384
- ------------------
385
-
386
- - Init an empty package