!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Keymetrics=e()}}(function(){return function(){return function e(t,n,o){function i(r,s){if(!n[r]){if(!t[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(a)return a(r,!0);var p=new Error("Cannot find module '"+r+"'");throw p.code="MODULE_NOT_FOUND",p}var u=n[r]={exports:{}};t[r][0].call(u.exports,function(e){return i(t[r][1][e]||e)},u,u.exports,e,t,n,o)}return n[r].exports}for(var a="function"==typeof require&&require,r=0;r-1&&e%1==0&&e<=I}function N(e){return null!=e&&U(e.length)&&!function(e){if(!l(e))return!1;var t=z(e);return t==D||t==F||t==B||t==R}(e)}var M={};function q(){}function G(e){return function(){if(null!==e){var t=e;e=null,t.apply(this,arguments)}}}var H="function"==typeof Symbol&&Symbol.iterator,W=function(e){return H&&e[H]&&e[H]()};function V(e){return null!=e&&"object"==typeof e}var K="[object Arguments]";function $(e){return V(e)&&z(e)==K}var Q=Object.prototype,X=Q.hasOwnProperty,J=Q.propertyIsEnumerable,Y=$(function(){return arguments}())?$:function(e){return V(e)&&X.call(e,"callee")&&!J.call(e,"callee")},Z=Array.isArray;var ee="object"==typeof n&&n&&!n.nodeType&&n,te=ee&&"object"==typeof t&&t&&!t.nodeType&&t,ne=te&&te.exports===ee?T.Buffer:void 0,oe=(ne?ne.isBuffer:void 0)||function(){return!1},ie=9007199254740991,ae=/^(?:0|[1-9]\d*)$/;function re(e,t){var n=typeof e;return!!(t=null==t?ie:t)&&("number"==n||"symbol"!=n&&ae.test(e))&&e>-1&&e%1==0&&e2&&(o=a(arguments,1)),t){var p={};Me(i,function(e,t){p[t]=e}),p[e]=o,s=!0,l=Object.create(null),n(t,p)}else i[e]=o,Ie(l[e]||[],function(e){e()}),f()});r++;var p=g(t[t.length-1]);t.length>1?p(i,o):p(o)}(e,t)})}function f(){if(0===p.length&&0===r)return n(null,i);for(;p.length&&r=0&&n.push(o)}),n}Me(e,function(t,n){if(!Z(t))return d(n,[t]),void u.push(n);var o=t.slice(0,t.length-1),i=o.length;if(0===i)return d(n,t),void u.push(n);c[n]=i,Ie(o,function(a){if(!e[a])throw new Error("async.auto task `"+n+"` has a non-existent dependency `"+a+"` in "+o.join(", "));!function(e,t){var n=l[e];n||(n=l[e]=[]);n.push(t)}(a,function(){0===--i&&d(n,t)})})}),function(){var e,t=0;for(;u.length;)e=u.pop(),t++,Ie(m(e),function(e){0==--c[e]&&u.push(e)});if(t!==o)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),f()};function We(e,t){for(var n=-1,o=null==e?0:e.length,i=Array(o);++n=o?e:function(e,t,n){var o=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++o-1;);return n}(i,a),function(e,t){for(var n=e.length;n--&&Ge(t,e[n],0)>-1;);return n}(i,a)+1).join("")}var dt=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,ft=/,/,mt=/(=.+)?(\s*)$/,yt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function ht(e,t){var n={};Me(e,function(e,t){var o,i,a=b(e),r=!a&&1===e.length||a&&0===e.length;if(Z(e))o=e.slice(0,-1),e=e[e.length-1],n[t]=o.concat(o.length>0?s:e);else if(r)n[t]=e;else{if(o=i=(i=(i=(i=(i=e).toString().replace(yt,"")).match(dt)[2].replace(" ",""))?i.split(ft):[]).map(function(e){return ct(e.replace(mt,""))}),0===e.length&&!a&&0===o.length)throw new Error("autoInject task functions require explicit parameters.");a||o.pop(),n[t]=o.concat(s)}function s(t,n){var i=We(o,function(e){return t[e]});i.push(n),g(e).apply(null,i)}}),He(n,t)}function vt(){this.head=this.tail=null,this.length=0}function bt(e,t){e.length=1,e.head=e.tail=t}function gt(e,t,n){if(null==t)t=1;else if(0===t)throw new Error("Concurrency must not be zero");var o=g(e),i=0,a=[],r=!1;function s(e,t,n){if(null!=n&&"function"!=typeof n)throw new Error("task callback must be a function");if(u.started=!0,Z(e)||(e=[e]),0===e.length&&u.idle())return f(function(){u.drain()});for(var o=0,i=e.length;o0&&a.splice(s,1),r.callback.apply(r,arguments),null!=t&&u.error(t,r.data)}i<=u.concurrency-u.buffer&&u.unsaturated(),u.idle()&&u.drain(),u.process()}}var p=!1,u={_tasks:new vt,concurrency:t,payload:n,saturated:q,unsaturated:q,buffer:t/4,empty:q,drain:q,error:q,started:!1,paused:!1,push:function(e,t){s(e,!1,t)},kill:function(){u.drain=q,u._tasks.empty()},unshift:function(e,t){s(e,!0,t)},remove:function(e){u._tasks.remove(e)},process:function(){if(!p){for(p=!0;!u.paused&&i2&&(i=a(arguments,1)),o[t]=i,n(e)})},function(e){n(e,o)})}function vn(e,t){hn(Oe,e,t)}function bn(e,t,n){hn(Ae(t),e,n)}var gn=function(e,t){var n=g(e);return gt(function(e,t){n(e[0],t)},t,1)},kn=function(e,t){var n=gn(e,t);return n.push=function(e,t,o){if(null==o&&(o=q),"function"!=typeof o)throw new Error("task callback must be a function");if(n.started=!0,Z(e)||(e=[e]),0===e.length)return f(function(){n.drain()});t=t||0;for(var i=n._tasks.head;i&&t>=i.priority;)i=i.next;for(var a=0,r=e.length;ao?1:0}Pe(e,function(e,t){o(e,function(n,o){if(n)return t(n);t(null,{value:e,criteria:o})})},function(e,t){if(e)return n(e);n(null,We(t.sort(i),Jt("value")))})}function Rn(e,t,n){var o=g(e);return s(function(i,a){var r,s=!1;i.push(function(){s||(a.apply(null,arguments),clearTimeout(r))}),r=setTimeout(function(){var t=e.name||"anonymous",o=new Error('Callback function "'+t+'" timed out.');o.code="ETIMEDOUT",n&&(o.info=n),s=!0,a(o)},t),o.apply(null,i)})}var In=Math.ceil,Un=Math.max;function Nn(e,t,n,o){var i=g(n);De(function(e,t,n,o){for(var i=-1,a=Un(In((t-e)/(n||1)),0),r=Array(a);a--;)r[o?a:++i]=e,e+=n;return r}(0,e,1),t,i,o)}var Mn=Ee(Nn,1/0),qn=Ee(Nn,1);function Gn(e,t,n,o){arguments.length<=3&&(o=n,n=t,t=Z(e)?[]:{}),o=G(o||q);var i=g(n);Oe(e,function(e,n,o){i(t,e,n,o)},function(e){o(e,t)})}function Hn(e,t){var n,o=null;t=t||q,Wt(e,function(e,t){g(e)(function(e,i){n=arguments.length>2?a(arguments,1):i,o=e,t(!e)})},function(){t(o,n)})}function Wn(e){return function(){return(e.unmemoized||e).apply(null,arguments)}}function Vn(e,t,n){n=Te(n||q);var o=g(t);if(!e())return n(null);var i=function(t){if(t)return n(t);if(e())return o(i);var r=a(arguments,1);n.apply(null,[null].concat(r))};o(i)}function Kn(e,t,n){Vn(function(){return!e.apply(this,arguments)},t,n)}var $n=function(e,t){if(t=G(t||q),!Z(e))return t(new Error("First argument to waterfall must be an array of functions"));if(!e.length)return t();var n=0;function o(t){var o=g(e[n++]);t.push(Te(i)),o.apply(null,t)}function i(i){if(i||n===e.length)return t.apply(null,arguments);o(a(arguments,1))}o([])},Qn={apply:r,applyEach:ze,applyEachSeries:Re,asyncify:m,auto:He,autoInject:ht,cargo:kt,compose:At,concat:St,concatLimit:Et,concatSeries:xt,constant:Ot,detect:zt,detectLimit:Bt,detectSeries:Dt,dir:Rt,doDuring:It,doUntil:Nt,doWhilst:Ut,during:Mt,each:Gt,eachLimit:Ht,eachOf:Oe,eachOfLimit:je,eachOfSeries:wt,eachSeries:Wt,ensureAsync:Vt,every:$t,everyLimit:Qt,everySeries:Xt,filter:tn,filterLimit:nn,filterSeries:on,forever:an,groupBy:sn,groupByLimit:rn,groupBySeries:ln,log:pn,map:Pe,mapLimit:De,mapSeries:Fe,mapValues:cn,mapValuesLimit:un,mapValuesSeries:dn,memoize:mn,nextTick:yn,parallel:vn,parallelLimit:bn,priorityQueue:kn,queue:gn,race:wn,reduce:_t,reduceRight:_n,reflect:Tn,reflectAll:An,reject:En,rejectLimit:Sn,rejectSeries:xn,retry:Cn,retryable:Ln,seq:Tt,series:Pn,setImmediate:f,some:zn,someLimit:Bn,someSeries:Dn,sortBy:Fn,timeout:Rn,times:Mn,timesLimit:Nn,timesSeries:qn,transform:Gn,tryEach:Hn,unmemoize:Wn,until:Kn,waterfall:$n,whilst:Vn,all:$t,allLimit:Qt,allSeries:Xt,any:zn,anyLimit:Bn,anySeries:Dn,find:zt,findLimit:Bt,findSeries:Dt,forEach:Gt,forEachSeries:Wt,forEachLimit:Ht,forEachOf:Oe,forEachOfSeries:wt,forEachOfLimit:je,inject:_t,foldl:_t,foldr:_n,select:tn,selectLimit:nn,selectSeries:on,wrapSync:m};n.default=Qn,n.apply=r,n.applyEach=ze,n.applyEachSeries=Re,n.asyncify=m,n.auto=He,n.autoInject=ht,n.cargo=kt,n.compose=At,n.concat=St,n.concatLimit=Et,n.concatSeries=xt,n.constant=Ot,n.detect=zt,n.detectLimit=Bt,n.detectSeries=Dt,n.dir=Rt,n.doDuring=It,n.doUntil=Nt,n.doWhilst=Ut,n.during=Mt,n.each=Gt,n.eachLimit=Ht,n.eachOf=Oe,n.eachOfLimit=je,n.eachOfSeries=wt,n.eachSeries=Wt,n.ensureAsync=Vt,n.every=$t,n.everyLimit=Qt,n.everySeries=Xt,n.filter=tn,n.filterLimit=nn,n.filterSeries=on,n.forever=an,n.groupBy=sn,n.groupByLimit=rn,n.groupBySeries=ln,n.log=pn,n.map=Pe,n.mapLimit=De,n.mapSeries=Fe,n.mapValues=cn,n.mapValuesLimit=un,n.mapValuesSeries=dn,n.memoize=mn,n.nextTick=yn,n.parallel=vn,n.parallelLimit=bn,n.priorityQueue=kn,n.queue=gn,n.race=wn,n.reduce=_t,n.reduceRight=_n,n.reflect=Tn,n.reflectAll=An,n.reject=En,n.rejectLimit=Sn,n.rejectSeries=xn,n.retry=Cn,n.retryable=Ln,n.seq=Tt,n.series=Pn,n.setImmediate=f,n.some=zn,n.someLimit=Bn,n.someSeries=Dn,n.sortBy=Fn,n.timeout=Rn,n.times=Mn,n.timesLimit=Nn,n.timesSeries=qn,n.transform=Gn,n.tryEach=Hn,n.unmemoize=Wn,n.until=Kn,n.waterfall=$n,n.whilst=Vn,n.all=$t,n.allLimit=Qt,n.allSeries=Xt,n.any=zn,n.anyLimit=Bn,n.anySeries=Dn,n.find=zt,n.findLimit=Bt,n.findSeries=Dt,n.forEach=Gt,n.forEachSeries=Wt,n.forEachLimit=Ht,n.forEachOf=Oe,n.forEachOfSeries=wt,n.forEachOfLimit=je,n.inject=_t,n.foldl=_t,n.foldr=_n,n.select=tn,n.selectLimit=nn,n.selectSeries=on,n.wrapSync=m,Object.defineProperty(n,"__esModule",{value:!0})})}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("timers").setImmediate)},{_process:35,timers:36}],3:[function(e,t,n){t.exports=e("./lib/axios")},{"./lib/axios":5}],4:[function(e,t,n){"use strict";var o=e("./../utils"),i=e("./../core/settle"),a=e("./../helpers/cookies"),r=e("./../helpers/buildURL"),s=e("../core/buildFullPath"),l=e("./../helpers/parseHeaders"),p=e("./../helpers/isURLSameOrigin"),u=e("../core/createError");t.exports=function(e){return new Promise(function(t,n){var c=e.data,d=e.headers;o.isFormData(c)&&delete d["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";d.Authorization="Basic "+btoa(m+":"+y)}var h=s(e.baseURL,e.url);if(f.open(e.method.toUpperCase(),r(h,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var o="getAllResponseHeaders"in f?l(f.getAllResponseHeaders()):null,a={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:o,config:e,request:f};i(t,n,a),f=null}},f.onabort=function(){f&&(n(u("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){n(u("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(u(t,e,"ECONNABORTED",f)),f=null},o.isStandardBrowserEnv()){var v=(e.withCredentials||p(h))&&e.xsrfCookieName?a.read(e.xsrfCookieName):void 0;v&&(d[e.xsrfHeaderName]=v)}if("setRequestHeader"in f&&o.forEach(d,function(e,t){void 0===c&&"content-type"===t.toLowerCase()?delete d[t]:f.setRequestHeader(t,e)}),o.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){f&&(f.abort(),n(e),f=null)}),c||(c=null),f.send(c)})}},{"../core/buildFullPath":11,"../core/createError":12,"./../core/settle":16,"./../helpers/buildURL":20,"./../helpers/cookies":22,"./../helpers/isURLSameOrigin":25,"./../helpers/parseHeaders":27,"./../utils":29}],5:[function(e,t,n){"use strict";var o=e("./utils"),i=e("./helpers/bind"),a=e("./core/Axios"),r=e("./core/mergeConfig");function s(e){var t=new a(e),n=i(a.prototype.request,t);return o.extend(n,a.prototype,t),o.extend(n,t),n}var l=s(e("./defaults"));l.Axios=a,l.create=function(e){return s(r(l.defaults,e))},l.Cancel=e("./cancel/Cancel"),l.CancelToken=e("./cancel/CancelToken"),l.isCancel=e("./cancel/isCancel"),l.all=function(e){return Promise.all(e)},l.spread=e("./helpers/spread"),l.isAxiosError=e("./helpers/isAxiosError"),t.exports=l,t.exports.default=l},{"./cancel/Cancel":6,"./cancel/CancelToken":7,"./cancel/isCancel":8,"./core/Axios":9,"./core/mergeConfig":15,"./defaults":18,"./helpers/bind":19,"./helpers/isAxiosError":24,"./helpers/spread":28,"./utils":29}],6:[function(e,t,n){"use strict";function o(e){this.message=e}o.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},o.prototype.__CANCEL__=!0,t.exports=o},{}],7:[function(e,t,n){"use strict";var o=e("./Cancel");function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new o(e),t(n.reason))})}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i(function(t){e=t}),cancel:e}},t.exports=i},{"./Cancel":6}],8:[function(e,t,n){"use strict";t.exports=function(e){return!(!e||!e.__CANCEL__)}},{}],9:[function(e,t,n){"use strict";var o=e("./../utils"),i=e("../helpers/buildURL"),a=e("./InterceptorManager"),r=e("./dispatchRequest"),s=e("./mergeConfig");function l(e){this.defaults=e,this.interceptors={request:new a,response:new a}}l.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[r,void 0],n=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;)n=n.then(t.shift(),t.shift());return n},l.prototype.getUri=function(e){return e=s(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},o.forEach(["delete","get","head","options"],function(e){l.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}}),o.forEach(["post","put","patch"],function(e){l.prototype[e]=function(t,n,o){return this.request(s(o||{},{method:e,url:t,data:n}))}}),t.exports=l},{"../helpers/buildURL":20,"./../utils":29,"./InterceptorManager":10,"./dispatchRequest":13,"./mergeConfig":15}],10:[function(e,t,n){"use strict";var o=e("./../utils");function i(){this.handlers=[]}i.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){o.forEach(this.handlers,function(t){null!==t&&e(t)})},t.exports=i},{"./../utils":29}],11:[function(e,t,n){"use strict";var o=e("../helpers/isAbsoluteURL"),i=e("../helpers/combineURLs");t.exports=function(e,t){return e&&!o(t)?i(e,t):t}},{"../helpers/combineURLs":21,"../helpers/isAbsoluteURL":23}],12:[function(e,t,n){"use strict";var o=e("./enhanceError");t.exports=function(e,t,n,i,a){var r=new Error(e);return o(r,t,n,i,a)}},{"./enhanceError":14}],13:[function(e,t,n){"use strict";var o=e("./../utils"),i=e("./transformData"),a=e("../cancel/isCancel"),r=e("../defaults");function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}t.exports=function(e){return s(e),e.headers=e.headers||{},e.data=i(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||r.adapter)(e).then(function(t){return s(e),t.data=i(t.data,t.headers,e.transformResponse),t},function(t){return a(t)||(s(e),t&&t.response&&(t.response.data=i(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})}},{"../cancel/isCancel":8,"../defaults":18,"./../utils":29,"./transformData":17}],14:[function(e,t,n){"use strict";t.exports=function(e,t,n,o,i){return e.config=t,n&&(e.code=n),e.request=o,e.response=i,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}},{}],15:[function(e,t,n){"use strict";var o=e("../utils");t.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],a=["headers","auth","proxy","params"],r=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function l(e,t){return o.isPlainObject(e)&&o.isPlainObject(t)?o.merge(e,t):o.isPlainObject(t)?o.merge({},t):o.isArray(t)?t.slice():t}function p(i){o.isUndefined(t[i])?o.isUndefined(e[i])||(n[i]=l(void 0,e[i])):n[i]=l(e[i],t[i])}o.forEach(i,function(e){o.isUndefined(t[e])||(n[e]=l(void 0,t[e]))}),o.forEach(a,p),o.forEach(r,function(i){o.isUndefined(t[i])?o.isUndefined(e[i])||(n[i]=l(void 0,e[i])):n[i]=l(void 0,t[i])}),o.forEach(s,function(o){o in t?n[o]=l(e[o],t[o]):o in e&&(n[o]=l(void 0,e[o]))});var u=i.concat(a).concat(r).concat(s),c=Object.keys(e).concat(Object.keys(t)).filter(function(e){return-1===u.indexOf(e)});return o.forEach(c,p),n}},{"../utils":29}],16:[function(e,t,n){"use strict";var o=e("./createError");t.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(o("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},{"./createError":12}],17:[function(e,t,n){"use strict";var o=e("./../utils");t.exports=function(e,t,n){return o.forEach(n,function(n){e=n(e,t)}),e}},{"./../utils":29}],18:[function(e,t,n){(function(n){(function(){"use strict";var o=e("./utils"),i=e("./helpers/normalizeHeaderName"),a={"Content-Type":"application/x-www-form-urlencoded"};function r(e,t){!o.isUndefined(e)&&o.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var s,l={adapter:("undefined"!=typeof XMLHttpRequest?s=e("./adapters/xhr"):void 0!==n&&"[object process]"===Object.prototype.toString.call(n)&&(s=e("./adapters/http")),s),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),o.isFormData(e)||o.isArrayBuffer(e)||o.isBuffer(e)||o.isStream(e)||o.isFile(e)||o.isBlob(e)?e:o.isArrayBufferView(e)?e.buffer:o.isURLSearchParams(e)?(r(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):o.isObject(e)?(r(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,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},o.forEach(["delete","get","head"],function(e){l.headers[e]={}}),o.forEach(["post","put","patch"],function(e){l.headers[e]=o.merge(a)}),t.exports=l}).call(this)}).call(this,e("_process"))},{"./adapters/http":4,"./adapters/xhr":4,"./helpers/normalizeHeaderName":26,"./utils":29,_process:35}],19:[function(e,t,n){"use strict";t.exports=function(e,t){return function(){for(var n=new Array(arguments.length),o=0;o=0)return;r[t]="set-cookie"===t?(r[t]?r[t]:[]).concat([n]):r[t]?r[t]+", "+n:n}}),r):r}},{"./../utils":29}],28:[function(e,t,n){"use strict";t.exports=function(e){return function(t){return e.apply(null,t)}}},{}],29:[function(e,t,n){"use strict";var o=e("./helpers/bind"),i=Object.prototype.toString;function a(e){return"[object Array]"===i.call(e)}function r(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function p(e){return"[object Function]"===i.call(e)}function u(e,t){if(null!==e&&void 0!==e)if("object"!=typeof e&&(e=[e]),a(e))for(var n=0,o=e.length;n{"%%"!==e&&"%c"===e&&(i=++o)}),e.splice(i,0,n)},n.save=function(e){try{e?n.storage.setItem("debug",e):n.storage.removeItem("debug")}catch(e){}},n.load=function(){let e;try{e=n.storage.getItem("debug")}catch(e){}!e&&void 0!==o&&"env"in o&&(e=o.env.DEBUG);return e},n.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},n.storage=function(){try{return localStorage}catch(e){}}(),n.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),n.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],n.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(n);const{formatters:i}=t.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":32,_process:35}],32:[function(e,t,n){t.exports=function(t){function n(e){let t,i=null;function a(...e){if(!a.enabled)return;const o=a,i=Number(new Date),r=i-(t||i);o.diff=r,o.prev=t,o.curr=i,t=i,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if("%%"===t)return"%";s++;const a=n.formatters[i];if("function"==typeof a){const n=e[s];t=a.call(o,n),e.splice(s,1),s--}return t}),n.formatArgs.call(o,e),(o.log||n.log).apply(o,e)}return a.namespace=e,a.useColors=n.useColors(),a.color=n.selectColor(e),a.extend=o,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?n.enabled(e):i,set:e=>{i=e}}),"function"==typeof n.init&&n.init(a),a}function o(e,t){const o=n(this.namespace+(void 0===t?":":t)+e);return o.log=this.log,o}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){return e instanceof Error?e.stack||e.message:e},n.disable=function(){const e=[...n.names.map(i),...n.skips.map(i).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const o=("string"==typeof e?e:"").split(/[\s,]+/),i=o.length;for(t=0;t{n[e]=t[e]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n0;)if(a===e[r])return o;i(t)}}Object.assign(v.prototype,{subscribe:function(e,t,n){var o=this,i=this._target,a=this._emitter,r=this._listeners,s=function(){var o=y.apply(null,arguments),r={data:o,name:t,original:e};n?!1!==n.call(i,r)&&a.emit.apply(a,[r.name].concat(o)):a.emit.apply(a,[t].concat(o))};if(r[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,a._newListener&&a._removeListener&&!o._onNewListener?(this._onNewListener=function(n){n===t&&null===r[e]&&(r[e]=s,o._on.call(i,e,s))},a.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!a.hasListeners(n)&&r[e]&&(r[e]=null,o._off.call(i,e,s))},r[e]=null,a.on("removeListener",this._onRemoveListener)):(r[e]=s,o._on.call(i,e,s))},unsubscribe:function(e){var t,n,o,i=this,a=this._listeners,r=this._emitter,s=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function p(){i._onNewListener&&(r.off("newListener",i._onNewListener),r.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=A.call(r,i);r._observers.splice(e,1)}if(e){if(!(t=a[e]))return;s.call(l,e,t),delete a[e],--this._listenersCount||p()}else{for(o=(n=c(a)).length;o-- >0;)e=n[o],s.call(l,e,a[e]);this._listeners={},this._listenersCount=0,p()}}});var w=k(["function"]),_=k(["object","function"]);function T(e,t,n){var o,i,a,r=0,s=new e(function(l,p,u){function c(){i&&(i=null),r&&(clearTimeout(r),r=0)}n=b(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}});var d=function(e){c(),l(e)},f=function(e){c(),p(e)};(o=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u)?t(d,f,u):(i=[function(e){f(e||Error("canceled"))}],t(d,f,function(e){if(a)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)}),a=!0),n.timeout>0&&(r=setTimeout(function(){var e=Error("timeout");r=0,s.cancel(e),p(e)},n.timeout))});return o||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n0;)"_listeners"!==(f=b[s])&&(g=j(e,t,n[f],o+1,i))&&(k?k.push.apply(k,g):k=g);return k}if("**"===w){for((v=o+1===i||o+2===i&&"*"===_)&&n._listeners&&(k=j(e,t,n,i,i)),s=(b=c(n)).length;s-- >0;)"_listeners"!==(f=b[s])&&("*"===f||"**"===f?(n[f]._listeners&&!v&&(g=j(e,t,n[f],i,i))&&(k?k.push.apply(k,g):k=g),g=j(e,t,n[f],o,i)):g=j(e,t,n[f],f===_?o+2:o,i),g&&(k?k.push.apply(k,g):k=g));return k}if(n[w]&&(k=j(e,t,n[w],o+1,i)),(m=n["*"])&&j(e,t,m,o+1,i),y=n["**"])if(o0;)"_listeners"!==(f=b[s])&&(f===_?j(e,t,y[f],o+2,i):f===w?j(e,t,y[f],o+1,i):((h={})[f]=y[f],j(e,t,{"**":h},o+1,i)));else y._listeners?j(e,t,y,i,i):y["*"]&&y["*"]._listeners&&j(e,t,y["*"],i,i);return k}function E(e){for(var t,n,o,i=c(e),a=i.length;a-- >0;)(t=e[n=i[a]])&&(o=!0,"_listeners"===n||E(t)||delete e[n]);return o}function S(e,t,n){this.emitter=e,this.event=t,this.listener=n}function x(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,e)}S.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},x.EventEmitter2=x,x.prototype.listenTo=function(e,t,n){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var i,a=n.reducers,r=A.call(o,e);i=-1===r?new v(o,e,n):o._observers[r];for(var s,l=c(t),p=l.length,u="function"==typeof a,d=0;d0;)o=n[i],e&&o._target!==e||(o.unsubscribe(t),a=!0);return a},x.prototype.delimiter=".",x.prototype.setMaxListeners=function(e){e!==i&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},x.prototype.getMaxListeners=function(){return this._maxListeners},x.prototype.event="",x.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},x.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},x.prototype._once=function(e,t,n,o){return this._many(e,1,t,n,o)},x.prototype.many=function(e,t,n,o){return this._many(e,t,n,!1,o)},x.prototype.prependMany=function(e,t,n,o){return this._many(e,t,n,!0,o)},x.prototype._many=function(e,t,n,o,i){var a=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function r(){return 0==--t&&a.off(e,r),n.apply(this,arguments)}return r._origin=n,this._on(e,r,o,i)},x.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||d.call(this);var e,t,n,o,i,a,r=arguments[0],s=this.wildcard;if("newListener"===r&&!this._newListener&&!this._events.newListener)return!1;if(s&&(e=r,"newListener"!==r&&"removeListener"!==r&&"object"==typeof r)){if(n=r.length,l)for(o=0;o3)for(t=new Array(u-1),i=1;i3)for(n=new Array(c-1),a=1;a1)for(n=0;n+10&&p._listeners.length>this._maxListeners&&(p._listeners.warned=!0,m.call(this,p._listeners.length,l))):p._listeners=t,!0;return!0}.call(this,t,n),l):(this._events[t]?("function"==typeof this._events[t]&&(this._events[t]=[this._events[t]]),o?this._events[t].unshift(n):this._events[t].push(n),!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,m.call(this,this._events[t].length,t))):this._events[t]=n,l)},x.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,o=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();if(!(o=j.call(this,null,i,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],o.push({_listeners:n})}for(var a=0;a0){for(n=0,o=(t=this._all).length;n0;)"function"==typeof(n=s[t[a]])?o.push(n):o.push.apply(o,n);return o}if(this.wildcard){if(!(r=this.listenerTree))return[];var l=[],p="string"==typeof e?e.split(this.delimiter):e.slice();return j.call(this,l,p,r,0),l}return s&&(n=s[e])?"function"==typeof n?[n]:n:[]},x.prototype.eventNames=function(e){var t=this._events;return this.wildcard?function e(t,n,o,i){for(var a,r,s,l,p=c(t),u=p.length,d=t._listeners;u-- >0;)a=t[r=p[u]],s="_listeners"===r?o:o?o.concat(r):[r],l=i||"symbol"==typeof r,d&&n.push(l?s:s.join(this.delimiter)),"object"==typeof a&&e.call(this,a,n,s,l);return n}.call(this,this.listenerTree,[],null,e):t?c(t):[]},x.prototype.listenerCount=function(e){return this.listeners(e).length},x.prototype.hasListeners=function(e){if(this.wildcard){var t=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return j.call(this,t,n,this.listenerTree,0),t.length>0}var o=this._events,a=this._all;return!!(a&&a.length||o&&(e===i?c(o).length:o[e]))},x.prototype.listenersAny=function(){return this._all?this._all:[]},x.prototype.waitFor=function(e,t){var n=this,o=typeof t;return"number"===o?t={timeout:t}:"function"===o&&(t={filter:t}),T((t=b(t,{timeout:0,filter:i,handleError:!1,Promise:Promise,overload:!1},{filter:w,Promise:g})).Promise,function(o,i,a){function r(){var a=t.filter;if(!a||a.apply(n,arguments))if(n.off(e,r),t.handleError){var s=arguments[0];s?i(s):o(y.apply(null,arguments).slice(1))}else o(y.apply(null,arguments))}a(function(){n.off(e,r)}),n._on(e,r,!1)},{timeout:t.timeout,overload:t.overload})};var O=x.prototype;Object.defineProperties(x,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return T((n=b(n,{Promise:Promise,timeout:0,overload:!1},{Promise:g})).Promise,function(n,o,i){var a;if("function"==typeof e.addEventListener)return a=function(){n(y.apply(null,arguments))},i(function(){e.removeEventListener(t,a)}),void e.addEventListener(t,a,{once:!0});var r,s=function(){r&&e.removeListener("error",r),n(y.apply(null,arguments))};"error"!==t&&(r=function(n){e.removeListener(t,s),o(n)},e.once("error",r)),i(function(){r&&e.removeListener("error",r),e.removeListener(t,s)}),e.once(t,s)},{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),"object"==typeof n?t.exports=x:new Function("","return this")().EventEmitter2=x}()}).call(this)}).call(this,e("_process"),e("timers").setImmediate)},{_process:35,timers:36}],34:[function(e,t,n){var o=1e3,i=60*o,a=60*i,r=24*a,s=7*r,l=365.25*r;function p(e,t,n,o){var i=t>=1.5*n;return Math.round(e/n)+" "+o+(i?"s":"")}t.exports=function(e,t){t=t||{};var n=typeof e;if("string"===n&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"weeks":case"week":case"w":return n*s;case"days":case"day":case"d":return n*r;case"hours":case"hour":case"hrs":case"hr":case"h":return n*a;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}(e);if("number"===n&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=r)return p(e,t,r,"day");if(t>=a)return p(e,t,a,"hour");if(t>=i)return p(e,t,i,"minute");if(t>=o)return p(e,t,o,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=r)return Math.round(e/r)+"d";if(t>=a)return Math.round(e/a)+"h";if(t>=i)return Math.round(e/i)+"m";if(t>=o)return Math.round(e/o)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],35:[function(e,t,n){var o,i,a=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(o===setTimeout)return setTimeout(e,0);if((o===r||!o)&&setTimeout)return o=setTimeout,setTimeout(e,0);try{return o(e,0)}catch(t){try{return o.call(null,e,0)}catch(t){return o.call(this,e,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:r}catch(e){o=r}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var p,u=[],c=!1,d=-1;function f(){c&&p&&(c=!1,p.length?u=p.concat(u):d=-1,u.length&&m())}function m(){if(!c){var e=l(f);c=!0;for(var t=u.length;t;){for(p=u,u=[];++d1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n.setImmediate="function"==typeof t?t:function(e){var t=l++,o=!(arguments.length<2)&&r.call(arguments,1);return s[t]=!0,i(function(){s[t]&&(o?e.apply(null,o):e.call(null),n.clearImmediate(t))}),t},n.clearImmediate="function"==typeof o?o:function(e){delete s[e]}}).call(this)}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":35,timers:36}],37:[function(e,t,n){t.exports={name:"@pm2/js-api",version:"0.6.7",description:"PM2.io API Client for Javascript",main:"index.js",unpkg:"dist/keymetrics.es5.min.js",engines:{node:">=4.0"},scripts:{test:"mocha test/*",build:"mkdir -p dist; browserify -s Keymetrics -r ./ > ./dist/keymetrics.es5.js",dist:"mkdir -p dist; browserify -s Keymetrics -r ./ | uglifyjs -c warnings=false -m > ./dist/keymetrics.es5.min.js",doc:"jsdoc -r ./src --readme ./README.md -d doc -t ./node_modules/minami",clean:"rm dist/*",prepare:"npm run build && npm run dist"},repository:{type:"git",url:"git+https://github.com/keymetrics/km.js.git"},keywords:["keymetrics","api","dashboard","monitoring","wrapper"],author:"Keymetrics Team",license:"Apache-2",bugs:{url:"https://github.com/keymetrics/km.js/issues"},homepage:"https://github.com/keymetrics/km.js#readme",dependencies:{async:"^2.6.3",axios:"^0.21.0",debug:"~4.3.1",eventemitter2:"^6.3.1",ws:"^7.0.0"},devDependencies:{"@babel/core":"^7.0.0","@babel/preset-env":"^7.0.0",babelify:"10.0.0",browserify:"^17.0.0",jsdoc:"^3.4.2",minami:"^1.1.1",mocha:"^7.0.0",should:"*","uglify-es":"~3.3.9"},browserify:{debug:!0,transform:[["babelify",{presets:[["@babel/preset-env",{debug:!1,forceAllTransforms:!0}]],sourceMaps:!0}]]},browser:{"./src/auth_strategies/embed_strategy.js":!1,ws:!1}}},{}],38:[function(e,t,n){t.exports={actions:[{route:{name:"/api/bucket/:id/actions/trigger",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"server_name",type:"string",description:"the name of the server",optional:!1,defaultvalue:null},{name:"process_id",type:"number",description:"the id of the process",optional:!0,defaultvalue:null},{name:"app_name",type:"number",description:"the name of the process",optional:!0,defaultvalue:null},{name:"action_name",type:"string",description:"the name of the action to trigger",optional:!1,defaultvalue:null},{name:"opts",type:"object",description:"any specific options to be passed to the function",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully run the action",optional:!1}],response:[{name:"success",type:"boolean",description:"succesully sended the action to PM2",optional:!1,defaultvalue:null}],name:"triggerAction",longname:"Actions.triggerAction",scope:"route"},{route:{name:"/api/bucket/:id/actions/triggerPM2",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"server_name",type:"string",description:"the name of the server",optional:!1,defaultvalue:null},{name:"method_name",type:"string",description:"the name of the pm2 method to trigger",optional:!1,defaultvalue:null},{name:"app_name",type:"string",description:"the name of the application",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"failed action",optional:!1},{type:"200",description:"succesfully run the action",optional:!1}],response:[{name:"success",type:"boolean",description:"succesully sended the action to PM2",optional:!1,defaultvalue:null}],name:"triggerPM2Action",longname:"Actions.triggerPM2Action",scope:"route"},{route:{name:"/api/bucket/:id/actions/triggerScopedAction",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"server_name",type:"string",description:"the name of the server",optional:!1,defaultvalue:null},{name:"action_name",type:"string",description:"the name of the pm2 method to trigger",optional:!1,defaultvalue:null},{name:"app_name",type:"string",description:"the name of the application",optional:!1,defaultvalue:null},{name:"pm_id",type:"number",description:"the id of the process",optional:!1,defaultvalue:null},{name:"opts",type:"object",description:"custom parameters to give to the action",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully run the action",optional:!1}],response:[{name:".",type:"object",description:"the action sended to the process",optional:!1,defaultvalue:null}],name:"triggerScopedAction",longname:"Actions.triggerScopedAction",scope:"route"}],bucket:{alert:{analyzer:[{route:{name:"/api/bucket/:id/alerts/analyzer",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"size",type:"integer",description:"line limit, default to 20",optional:!0,defaultvalue:null},{name:"from",type:"integer",description:"offset limit",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"list all alerts",optional:!1}],name:"list",longname:"Bucket.alert.analyzer.list",scope:"route",async:!0},{route:{name:"/api/bucket/:id/alerts/analyzer/:alert",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":alert",type:"string",description:"alert id",optional:!1}],body:[{name:"useful",type:"boolean",description:"",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"content modified",optional:!1}],name:"editState",longname:"Bucket.alert.analyzer.editState",scope:"route"},{route:{name:"/api/bucket/:id/alerts/analyzer/:analyzer/config",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":analyzer",type:"string",description:"analyzer name",optional:!1}],body:[{name:"blacklist",type:"object",description:"",optional:!1,defaultvalue:null},{name:"blacklist.apps",type:"array",description:"",optional:!0,defaultvalue:null},{name:"blacklist.servers",type:"array",description:"",optional:!0,defaultvalue:null},{name:"blacklist.metrics",type:"array",description:"",optional:!0,defaultvalue:null},{name:"threshold",type:"number",description:"",optional:!1,defaultvalue:null},{name:"window",type:"number",description:"",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"content modified",optional:!1}],name:"updateConfig",longname:"Bucket.alert.analyzer.updateConfig",scope:"route"}],default:[{route:{name:"/api/bucket/:id/alerts",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"name",type:"string",description:"Alert name",optional:!1,defaultvalue:null},{name:"enabled",type:"boolean",description:"Alert's state",optional:!0,defaultvalue:null},{name:"type",type:"string",description:"Should be `metric`, `event` or `webcheck`",optional:!1,defaultvalue:null},{name:"initiator",type:"string",description:"Should be metric name or event name",optional:!1,defaultvalue:null},{name:"options",type:"object",description:"",optional:!1,defaultvalue:null},{name:"options.operator",type:"string",description:"Should be `>`, `<`, `=`, `>=` or `<=`",optional:!0,defaultvalue:null},{name:"options.threshold",type:"number",description:"Value to reach to send an alert",optional:!0,defaultvalue:null},{name:"options.act",type:"string",description:"Should be `always`, `opposite`, `first` or `diff`",optional:!0,defaultvalue:null},{name:"options.timerange",type:"number",description:"Timerange to check, in seconds",optional:!0,defaultvalue:null},{name:"scope",type:"object",description:"",optional:!1,defaultvalue:null},{name:"scope.apps",type:"object",description:"Array of strings with apps name (can be empty)",optional:!0,defaultvalue:null},{name:"scope.servers",type:"object",description:"Array of strings with servers name (can be empty)",optional:!0,defaultvalue:null},{name:"scope.initiators",type:"object",description:"Array of strings with initiators name (need to be set if no apps or servers)",optional:!0,defaultvalue:null},{name:"scope.sources",type:"object",description:"Array of strings with sources name (can be empty)",optional:!0,defaultvalue:null},{name:"actions",type:"object",description:"List of actions to trigger",optional:!1,defaultvalue:null},{name:"actions[].type",type:"string",description:"Type of action",optional:!0,defaultvalue:null},{name:"actions[].params",type:"object",description:"Params for action",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"200",description:"successfuly created alert",optional:!1}],name:"create",longname:"Bucket.alert.create",scope:"route"},{route:{name:"/api/bucket/:id/alerts/:alert",type:"DELETE"},params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":alert",type:"string",description:"alert id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"204",description:"successfuly deleted alert",optional:!1}],name:"delete",longname:"Bucket.alert.delete",scope:"route",authentication:!1},{route:{name:"/api/bucket/:id/alerts/",type:"GET"},params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"list all alerts",optional:!1}],name:"list",longname:"Bucket.alert.list",scope:"route",authentication:!1},{route:{name:"/api/bucket/:id/alerts/:alert",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":alert",type:"string",description:"alert id",optional:!1}],body:[{name:"name",type:"string",description:"Alert name",optional:!0,defaultvalue:null},{name:"enabled",type:"boolean",description:"Alert's state",optional:!0,defaultvalue:null},{name:"type",type:"string",description:"Should be `metric`, `event` or `webcheck`",optional:!0,defaultvalue:null},{name:"initiator",type:"string",description:"Should be metric name or event name",optional:!0,defaultvalue:null},{name:"options",type:"object",description:"",optional:!0,defaultvalue:null},{name:"options.operator",type:"string",description:"Should be `>`, `<`, `=`, `<=` or `>=`",optional:!0,defaultvalue:null},{name:"options.threshold",type:"number",description:"Value to reach to send an alert",optional:!0,defaultvalue:null},{name:"options.act",type:"string",description:"Should be `always`, `opposite`, `first` or `diff`",optional:!0,defaultvalue:null},{name:"options.timerange",type:"number",description:"Timerange to check, in seconds",optional:!0,defaultvalue:null},{name:"scope",type:"object",description:"",optional:!0,defaultvalue:null},{name:"scope.apps",type:"array",description:"Array of strings with apps name (can be empty)",optional:!0,defaultvalue:null},{name:"scope.servers",type:"array",description:"Array of strings with servers name (can be empty)",optional:!0,defaultvalue:null},{name:"scope.initiators",type:"object",description:"Array of strings with initiators name (need to be set if no apps or servers)",optional:!0,defaultvalue:null},{name:"scope.sources",type:"object",description:"Array of strings with sources name (can be empty)",optional:!0,defaultvalue:null},{name:"actions",type:"array",description:"List of actions to trigger",optional:!0,defaultvalue:null},{name:"actions[].type",type:"string",description:"Type of action",optional:!0,defaultvalue:null},{name:"actions[].params",type:"object",description:"Params for action",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"404",description:"alert not found",optional:!1},{type:"200",description:"successfuly created alert",optional:!1}],name:"updateAlert",longname:"Bucket.alert.updateAlert",scope:"route"},{route:{name:"/api/bucket/:id/alerts/:alert",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":alert",type:"string",description:"alert id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"alert not found",optional:!1},{type:"200",description:"successfuly returned alert",optional:!1}],name:"get",longname:"Bucket.alert.get",scope:"route",async:!0},{route:{name:"/api/bucket/:id/alerts/:alert/sample",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":alert",type:"string",description:"alert id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"alert not found",optional:!1},{type:"202",description:"successfuly sended alert actions",optional:!1}],name:"triggerSample",longname:"Bucket.alert.triggerSample",scope:"route"},{route:{name:"/api/bucket/:id/alerts/update",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"triggers",type:"object",description:"",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing triggers parameter",optional:!1},{type:"200",description:"succesfully update triggers",optional:!1}],response:[{name:"triggers",type:"object",description:"new triggers object",optional:!1,defaultvalue:null}],name:"update",longname:"Bucket.alert.update",scope:"route"},{route:{name:"/api/bucket/:id/alerts/updateSlack",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"slack",type:"object",description:"",optional:!1,defaultvalue:null},{name:"slack.active",type:"boolean",description:"",optional:!0,defaultvalue:null},{name:"slack.url",type:"boolean",description:"needed if active is set to true",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing triggers parameter",optional:!1},{type:"200",description:"succesfully update triggers",optional:!1}],response:[{name:"bucket",type:"object",description:"",optional:!1,defaultvalue:null}],name:"updateSlack",longname:"Bucket.alert.updateSlack",scope:"route"},{route:{name:"/api/bucket/:id/alerts/updateWebhooks",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"webhooks",type:"object",description:"",optional:!1,defaultvalue:null},{name:"webhooks.active",type:"boolean",description:"",optional:!0,defaultvalue:null},{name:"webhooks.url",type:"boolean",description:"needed if active is set to true",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing triggers parameter",optional:!1},{type:"200",description:"succesfully update triggers",optional:!1}],response:[{name:"bucket",type:"object",description:"",optional:!1,defaultvalue:null}],name:"updateWebhooks",longname:"Bucket.alert.updateWebhooks",scope:"route"}]},application:[{route:{name:"/api/bucket/:id/applications",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"successfuly retrieved applications",optional:!1}],name:"list",longname:"Bucket.application.list",scope:"route",async:!0},{route:{name:"/api/bucket/:id/applications/:application",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":application",type:"string",description:"application id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"application not found",optional:!1},{type:"200",description:"successfuly retrieved application",optional:!1}],name:"get",longname:"Bucket.application.get",scope:"route",async:!0},{route:{name:"/api/bucket/:id/applications",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"name",type:"string",description:"",optional:!1,defaultvalue:null},{name:"domains",type:"object",description:"Array of string with domains",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"200",description:"successfuly created application",optional:!1}],name:"create",longname:"Bucket.application.create",scope:"route",async:!0},{route:{name:"/api/bucket/:id/applications/:application",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":application",type:"string",description:"application id",optional:!1}],body:[{name:"name",type:"string",description:"",optional:!0,defaultvalue:null},{name:"domains",type:"object",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"200",description:"successfuly updated application",optional:!1}],name:"update",longname:"Bucket.application.update",scope:"route",async:!0},{route:{name:"/api/bucket/:id/applications/:application",type:"DELETE"},params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":application",type:"string",description:"application id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"204",description:"successfuly deleted application",optional:!1}],name:"delete",longname:"Bucket.application.delete",scope:"route",async:!0,authentication:!1},{route:{name:"/api/bucket/:id/applications/:application/preview",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":application",type:"string",description:"application id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"preview not found",optional:!1},{type:"200",description:"successfuly retrieved application screenshot",optional:!1}],name:"getPreview",longname:"Bucket.application.getPreview",scope:"route",async:!0},{route:{name:"/api/bucket/:id/applications/:application/report",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":application",type:"string",description:"application id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"report not found",optional:!1},{type:"200",description:"successfuly retrieved application report",optional:!1}],name:"getReports",longname:"Bucket.application.getReports",scope:"route",async:!0}],billing:[{route:{name:"/api/bucket/:id/payment/subscribe",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"plan",type:"string",description:"name of the plan to upgrade to",optional:!1,defaultvalue:null},{name:"stripe_token",type:"string",description:"a card token created by stripe",optional:!0,defaultvalue:null},{name:"coupon_id",type:"string",description:"the id of the stripe coupon",optional:!0,defaultvalue:null}],code:[{type:"400",description:"missing/invalid parameters",optional:!1},{type:"403",description:"need a credit card OR not allowed to subscribe to the plan",optional:!1},{type:"500",description:"stripe/database error",optional:!1},{type:"200",description:"succesfully upgraded",optional:!1}],response:[{name:"bucket",type:"object",description:"the bucket object",optional:!1,defaultvalue:null},{name:"subscription",type:"object",description:"the subscription object attached to the subscription",optional:!1,defaultvalue:null}],name:"subscribe",longname:"Bucket.billing.subscribe",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/subscribe/:paymentIntent",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":paymentIntent",type:"string",description:"paymentIntent id",optional:!1}],body:[{name:"plan",type:"string",description:"name of the plan to upgrade to",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing/invalid parameters",optional:!1},{type:"500",description:"stripe/database error",optional:!1},{type:"200",description:"succesfully upgraded",optional:!1}],response:[{name:"bucket",type:"object",description:"the bucket object",optional:!1,defaultvalue:null}],name:"paymentIntentSucceed",longname:"Bucket.billing.paymentIntentSucceed",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/trial",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"plan",type:"string",description:"Plan to trial",optional:!1,defaultvalue:null}],code:[{type:"400",description:"can't claim trial",optional:!1},{type:"200",description:"trial launched",optional:!1}],response:[{name:"duration",type:"string",description:"the duration of the trial",optional:!1,defaultvalue:null},{name:"plan",type:"string",description:"the plan of the trial",optional:!1,defaultvalue:null}],name:"startTrial",longname:"Bucket.billing.startTrial",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/invoices",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"400",description:"Missing/invalid parameters",optional:!1},{type:"404",description:"This bucket hasn't invoices",optional:!1},{type:"200",description:"succesfully returns invoices",optional:!1}],response:[{name:".",type:"array",description:"array of invoices",optional:!1,defaultvalue:null}],name:"getInvoices",longname:"Bucket.billing.getInvoices",scope:"route"},{route:{name:"/api/bucket/:id/payment/receipts",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"400",description:"Missing/invalid parameters",optional:!1},{type:"404",description:"This bucket hasn't receipts",optional:!1},{type:"200",description:"succesfully returns receipts",optional:!1}],response:[{name:".",type:"array",description:"array of receipts",optional:!1,defaultvalue:null}],name:"getReceipts",longname:"Bucket.billing.getReceipts",scope:"route"},{route:{name:"/api/bucket/:id/payment/subscription",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"404",description:"the bucket doesnt have any subscription",optional:!1},{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved the subscription",optional:!1}],response:[{name:".",type:"object",description:"subscription object",optional:!1,defaultvalue:null}],name:"getSubcription",longname:"Bucket.billing.getSubcription",scope:"route"},{route:{name:"/api/bucket/:id/payment/subscription/state",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"404",description:"the bucket doesnt have any subscription",optional:!1},{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved the subscription",optional:!1}],response:[{name:"status",type:"string",description:"stripe state of the subscription",optional:!1,defaultvalue:null},{name:"plan",type:"string",description:"stripe plan name of the subscription",optional:!1,defaultvalue:null},{name:"canceled_at",type:"string",description:"if he sub has been cancelled, add the date",optional:!1,defaultvalue:null}],name:"getSubcriptionState",longname:"Bucket.billing.getSubcriptionState",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/cards",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"token",type:"string",description:"card token generated by stripe",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing parameters",optional:!1},{type:"500",description:"stripe error",optional:!1},{type:"200",description:"succesfully added the card",optional:!1}],response:[{name:"data",type:"object",description:"stripe credit card Object",optional:!1,defaultvalue:null}],name:"attachCreditCard",longname:"Bucket.billing.attachCreditCard",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/cards",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"stripe error",optional:!1},{type:"404",description:"the user doesn't have any default card",optional:!1},{type:"200",description:"succesfully retieved the charges",optional:!1}],response:[{name:"data",type:"array",description:"list of stripe cards object",optional:!1,defaultvalue:null}],name:"fetchCreditCards",longname:"Bucket.billing.fetchCreditCards",scope:"route"},{route:{name:"/api/bucket/:id/payment/card/:card_id",type:"GET"},authentication:!0,params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":card_id",type:"string",description:"the stripe id of the card",optional:!1}],header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"400",description:"missing parameters card_id",optional:!1},{type:"404",description:"the user doesn't have any default card",optional:!1},{type:"200",description:"succesfully retieved the card",optional:!1}],response:[{name:"data",type:"array",description:"stripe card object",optional:!1,defaultvalue:null}],name:"fetchCreditCard",longname:"Bucket.billing.fetchCreditCard",scope:"route"},{route:{name:"/api/bucket/:id/payment/card",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"stripe error",optional:!1},{type:"404",description:"the user doesn't have any default card",optional:!1},{type:"200",description:"succesfully retieved the card",optional:!1}],response:[{name:"data",type:"array",description:"stripe card object",optional:!1,defaultvalue:null}],name:"fetchDefaultCreditCard",longname:"Bucket.billing.fetchDefaultCreditCard",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/card",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"id",type:"string",description:"stripe card id",optional:!1,defaultvalue:null},{name:"address_line1",type:"string",description:"",optional:!0,defaultvalue:null},{name:"address_country",type:"string",description:"",optional:!0,defaultvalue:null},{name:"address_zip",type:"string",description:"",optional:!0,defaultvalue:null},{name:"address_city",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"400",description:"missing parameters, you need to specify a card",optional:!1},{type:"200",description:"succesfully updated the card",optional:!1}],response:[{name:"data",type:"array",description:"stripe card object",optional:!1,defaultvalue:null}],name:"updateCreditCard",longname:"Bucket.billing.updateCreditCard",scope:"route"},{route:{name:"/api/bucket/:id/payment/card/:card_id",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":card_id",type:"string",description:"the stripe id of the card",optional:!1}],code:[{type:"500",description:"stripe error",optional:!1},{type:"400",description:"missing parameters card_id",optional:!1},{type:"200",description:"succesfully retieved the card",optional:!1},{type:"403",description:"the user must have one card active when having a subscription",optional:!1}],response:[{name:".",type:"object",description:"stripe card object",optional:!1,defaultvalue:null}],name:"deleteCreditCard",longname:"Bucket.billing.deleteCreditCard",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/card/:card_id/default",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":card_id",type:"string",description:"the stripe id of the card",optional:!1}],code:[{type:"500",description:"stripe error",optional:!1},{type:"400",description:"missing parameters card_id",optional:!1},{type:"200",description:"succesfully set the card as default",optional:!1}],response:[{name:"data",type:"object",description:"stripe card object",optional:!1,defaultvalue:null}],name:"setDefaultCard",longname:"Bucket.billing.setDefaultCard",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"stripe error",optional:!1},{type:"400",description:"missing parameters card_id",optional:!1},{type:"200",description:"succesfully retrieved the metadata",optional:!1}],response:[{name:".",type:"object",description:"stripe metadata object",optional:!1,defaultvalue:null}],name:"fetchMetadata",longname:"Bucket.billing.fetchMetadata",scope:"route"},{route:{name:"/api/bucket/:id/payment",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"metadata",type:"object",description:"the metadata you can update",optional:!1,defaultvalue:null},{name:"metadata.vat_number",type:"string",description:"",optional:!0,defaultvalue:null},{name:"metadata.company_name",type:"string",description:"",optional:!0,defaultvalue:null},{name:"metadata.receipt_email",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"400",description:"missing parameters, you need to specify a card",optional:!1},{type:"200",description:"succesfully updated the card",optional:!1}],response:[{name:"data",type:"array",description:"stripe customer metadata object",optional:!1,defaultvalue:null}],name:"updateMetadata",longname:"Bucket.billing.updateMetadata",scope:"route",async:!0},{route:{name:"/api/bucket/:id/payment/banks",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"iban",type:"string",description:"the iban used to recognize the account",optional:!0,defaultvalue:null},{name:"type",type:"string",description:"the type of the bank account (currently only sepa is available)",optional:!1,defaultvalue:null},{name:"name",type:"string",description:"name of the bank account owner",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing parameters",optional:!1},{type:"500",description:"stripe error",optional:!1},{type:"200",description:"succesfully added the account",optional:!1}],response:[{name:"data",type:"object",description:"stripe credit card Object",optional:!1,defaultvalue:null}],name:"attachBankAccount",longname:"Bucket.billing.attachBankAccount",scope:"route"},{route:{name:"/api/bucket/:id/payment/banks",type:"GET"},authentication:!0,params:[{name:":id",type:"string",description:"bucket id",optional:!1}],header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"404",description:"the user doesn't have any default account",optional:!1},{type:"200",description:"succesfully retieved the card",optional:!1}],response:[{name:"data",type:"object",description:"stripe source object",optional:!1,defaultvalue:null}],name:"fetchBankAccount",longname:"Bucket.billing.fetchBankAccount",scope:"route"},{route:{name:"/api/bucket/:id/payment/banks",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"stripe error",optional:!1},{type:"200",description:"succesfully retieved the card",optional:!1},{type:"404",description:"the user doesn't have any default account",optional:!1}],response:[{name:".",type:"object",description:"stripe source object",optional:!1,defaultvalue:null}],name:"deleteBankAccount",longname:"Bucket.billing.deleteBankAccount",scope:"route"}],dashboardschema:[{route:{name:"/api/bucket/:id/dashboardSchema/",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"name",type:"string",description:"the name of the dashboard",optional:!1,defaultvalue:null},{name:"data",type:"object",description:"the list of component that compose the dashboard",optional:!1,defaultvalue:null},{name:"mode",type:"string",description:"the dashboard mode",optional:!1,defaultvalue:null},{name:"image",type:"object",description:"background image for the dashboard",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully created dashboard",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"dashboard",description:"complete dashboard object from database",optional:!1,defaultvalue:null}],name:"create",longname:"Bucket.dashboardschema.create",scope:"route"},{route:{name:"/api/bucket/:id/dashboardSchema/",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of servers status",optional:!1,defaultvalue:null}],name:"retrieveAll",longname:"Bucket.dashboardschema.retrieveAll",scope:"route"},{route:{name:"/api/bucket/:id/dashboardSchema/:dashid/visualization",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashid",type:"string",description:"dashboard id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"404",description:"dashboard not found",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of dashboards",optional:!1,defaultvalue:null}],name:"visualization",longname:"Bucket.dashboardschema.visualization",scope:"route"},{route:{name:"/api/bucket/:id/dashboardSchema/:dashid",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashid",type:"string",description:"dashboard id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"404",description:"dashboard not found",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of dashboards",optional:!1,defaultvalue:null}],name:"retrieve",longname:"Bucket.dashboardschema.retrieve",scope:"route"},{route:{name:"/api/bucket/:id/dashboardSchema/:dashid",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashid",type:"string",description:"dashboard id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully deleted dashboard",optional:!1},{type:"400",description:"Invalid params",optional:!1},{type:"404",description:"dashboard not found",optional:!1}],response:[{name:".",type:"array",description:"array of dashboards",optional:!1,defaultvalue:null}],name:"remove",longname:"Bucket.dashboardschema.remove",scope:"route"},{route:{name:"/api/bucket/:id/dashboardSchema/:dashId",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashId",type:"string",description:"dashboard id",optional:!1}],body:[{name:"name",type:"string",description:"the name of the dashboard",optional:!1,defaultvalue:null},{name:"data",type:"object",description:"the data to populate the dashboard",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"404",description:"dashboard not found",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of servers status",optional:!1,defaultvalue:null}],name:"update",longname:"Bucket.dashboardschema.update",scope:"route"}],server:[{route:{name:"/api/bucket/:id/data/deleteServer",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"server_name",type:"string",description:"the name of server",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"406",description:"require an action before delete",optional:!1},{type:"400",description:"missing or invalid parameters",optional:!1},{type:"200",description:"successfully deleted",optional:!1}],response:[{name:"success",type:"boolean",description:"can be true or false",optional:!1,defaultvalue:null},{name:"msg",type:"string",description:"response",optional:!1,defaultvalue:null}],name:"deleteServer",longname:"Bucket.server.deleteServer",scope:"route"}],webcheck:[{route:{name:"/api/bucket/:id/webchecks/metrics",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"successfuly retrieved webchecks metrics",optional:!1}],name:"listMetrics",longname:"Bucket.webcheck.listMetrics",scope:"route"},{route:{name:"/api/bucket/:id/webchecks/regions",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"successfuly retrieved webchecks regions",optional:!1}],name:"listRegions",longname:"Bucket.webcheck.listRegions",scope:"route"},{route:{name:"/api/bucket/:id/webchecks/:webcheck/metrics",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":webcheck",type:"string",description:"webcheck id",optional:!1}],body:[{name:"start",type:"string",description:"",optional:!0,defaultvalue:null},{name:"metrics",type:"array",description:"",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"successfuly retrieved webchecks regions",optional:!1}],name:"getMetrics",longname:"Bucket.webcheck.getMetrics",scope:"route",async:!0},{route:{name:"/api/bucket/:id/webchecks",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],query:[{name:"application",type:"string",description:"Application's id to filter",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"successfuly retrieved webchecks",optional:!1}],name:"list",longname:"Bucket.webcheck.list",scope:"route"},{route:{name:"/api/bucket/:id/webchecks/:webcheck",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":webcheck",type:"string",description:"webcheck id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"webcheck not found",optional:!1},{type:"200",description:"successfuly retrieved webcheck",optional:!1}],name:"get",longname:"Bucket.webcheck.get",scope:"route"},{route:{name:"/api/bucket/:id/webchecks",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"name",type:"string",description:"Webcheck name",optional:!1,defaultvalue:null},{name:"enabled",type:"boolean",description:"Webcheck's state",optional:!0,defaultvalue:null},{name:"target",type:"object",description:"",optional:!1,defaultvalue:null},{name:"target.type",type:"string",description:"Should be `http`, `https` or `tcp`",optional:!0,defaultvalue:null},{name:"target.port",type:"number",description:"Target's port",optional:!0,defaultvalue:null},{name:"target.address",type:"string",description:"Target's IP/domain",optional:!0,defaultvalue:null},{name:"target.path",type:"string",description:"HTTP Path (only for http/https)",optional:!0,defaultvalue:null},{name:"target.is_frontend",type:"boolean",description:"Enable or disable frontend metrics (via puppeteer)",optional:!0,defaultvalue:null},{name:"body",type:"string",description:"Body need to match this regex to succeed webcheck (only for http/https)",optional:!0,defaultvalue:null},{name:"interval",type:"number",description:"Webcheck's interval check (ms)",optional:!1,defaultvalue:null},{name:"timeout",type:"number",description:"Webcheck's timeout (ms)",optional:!1,defaultvalue:null},{name:"source",type:"object",description:"",optional:!1,defaultvalue:null},{name:"source.region",type:"string",description:"Webcheck's worker region",optional:!0,defaultvalue:null},{name:"retry",type:"object",description:"",optional:!1,defaultvalue:null},{name:"retry.max",type:"number",description:"Max webcheck's retry before mark as failed",optional:!0,defaultvalue:null},{name:"retry.interval",type:"number",description:"Webcheck's retry interval (ms)",optional:!0,defaultvalue:null},{name:"alerts",type:"object",description:"List of alerts (cf. Alert type)",optional:!1,defaultvalue:null},{name:"application",type:"string",description:"Application's id",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"200",description:"successfuly created webcheck",optional:!1}],name:"create",longname:"Bucket.webcheck.create",scope:"route"},{route:{name:"/api/bucket/:id/webchecks/:webcheck",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":webcheck",type:"string",description:"webcheck id",optional:!1}],body:[{name:"name",type:"string",description:"Webcheck name",optional:!0,defaultvalue:null},{name:"enabled",type:"boolean",description:"Webcheck's state",optional:!0,defaultvalue:null},{name:"target",type:"object",description:"",optional:!0,defaultvalue:null},{name:"target.type",type:"string",description:"Should be `http`, `https` or `tcp`",optional:!0,defaultvalue:null},{name:"target.port",type:"number",description:"Target's port",optional:!0,defaultvalue:null},{name:"target.address",type:"string",description:"Target's IP/domain",optional:!0,defaultvalue:null},{name:"target.path",type:"string",description:"HTTP Path (only for http/https)",optional:!0,defaultvalue:null},{name:"target.is_frontend",type:"boolean",description:"Enable or disable frontend metrics (via puppeteer)",optional:!0,defaultvalue:null},{name:"body",type:"string",description:"Body need to match this regex to succeed webcheck (only for http/https)",optional:!0,defaultvalue:null},{name:"interval",type:"number",description:"Webcheck's interval check (ms)",optional:!0,defaultvalue:null},{name:"timeout",type:"number",description:"Webcheck's timeout (ms)",optional:!0,defaultvalue:null},{name:"source",type:"object",description:"",optional:!0,defaultvalue:null},{name:"source.region",type:"string",description:"Webcheck's worker region",optional:!0,defaultvalue:null},{name:"retry",type:"object",description:"",optional:!0,defaultvalue:null},{name:"retry.max",type:"number",description:"Max webcheck's retry before mark as failed",optional:!0,defaultvalue:null},{name:"retry.interval",type:"number",description:"Webcheck's retry interval (ms)",optional:!0,defaultvalue:null},{name:"alerts",type:"object",description:"List of alerts (cf. Alert type)",optional:!0,defaultvalue:null},{name:"application",type:"string",description:"Application's id",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"200",description:"successfuly updated webcheck",optional:!1}],name:"update",longname:"Bucket.webcheck.update",scope:"route"},{route:{name:"/api/bucket/:id/webchecks/:webcheck",type:"DELETE"},params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":webcheck",type:"string",description:"webcheck id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"204",description:"successfuly deleted webcheck",optional:!1}],name:"delete",longname:"Bucket.webcheck.delete",scope:"route",authentication:!1}],default:[{route:{name:"/api/bucket/:id/feedback",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"feedback",type:"string",description:"the feedback text",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing feedback field",optional:!1},{type:"200",description:"succesfully registered the feedback",optional:!1}],response:[{name:"feedback",type:"string",description:"the feedback that hasn't been registered",optional:!1,defaultvalue:null}],name:"sendFeedback",longname:"Bucket.sendFeedback",scope:"route"},{name:"retrieveUsers",route:{name:"/api/bucket/:id/users_authorized",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved bucket's members",optional:!1}],response:[{name:".",type:"array",description:"a array of user containing their email, username and roles",optional:!1,defaultvalue:null}],longname:"Bucket.retrieveUsers",scope:"route"},{name:"currentRole",route:{name:"/api/bucket/:id/current_role",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"200",description:"succesfully retrieved the use role",optional:!1}],response:[{name:"role",type:"string",description:"the user role",optional:!1,defaultvalue:null}],longname:"Bucket.currentRole",scope:"route"},{route:{name:"/api/bucket/:id/manage_notif",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"email",type:"string",description:"the user email",optional:!1,defaultvalue:null},{name:"state",type:"string",description:"the notification state you want to set for that user\n (either 'email' or 'nonde)",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"user not found",optional:!1}],response:[{name:".",type:"array",description:"array of state for each user",optional:!1,defaultvalue:null}],name:"setNotificationState",longname:"Bucket.setNotificationState",scope:"route"},{name:"inviteUser",route:{name:"/api/bucket/:id/add_user",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"email",type:"string",description:"the email of the user",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing/invalid parameters",optional:!1},{type:"403",description:"you cant invit more users because you hit the bucket limit",optional:!1},{type:"200",description:"succesfully invited the user (either directly or by email)",optional:!1}],response:[{name:"invitations",type:"array",description:"the list of invitations actually active",optional:!1,defaultvalue:null}],longname:"Bucket.inviteUser",scope:"route"},{route:{name:"/api/bucket/:id/invitation",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],query:[{name:"email",type:"string",description:"the email of the invitation you want to delete",optional:!0,defaultvalue:null}],code:[{type:"400",description:"invalid/missing parameters",optional:!1},{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully deleted the invitation",optional:!1}],response:[{name:"invitations",type:"array",description:"the list of invitations actually active",optional:!1,defaultvalue:null}],name:"removeInvitation",longname:"Bucket.removeInvitation",scope:"route"},{route:{name:"/api/bucket/:id/remove_user",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"email",type:"string",description:"the email of the user you want to remove",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing/invalid parameters",optional:!1},{type:"404",description:"user not found",optional:!1},{type:"403",description:"impossible to remove the owner from the bucket",optional:!1},{type:"500",description:"database error",optional:!1}],response:[{name:".",type:"array",description:"a array of user containing their email, username and roles",optional:!1,defaultvalue:null}],name:"removeUser",longname:"Bucket.removeUser",scope:"route"},{route:{name:"/api/bucket/:id/promote_user",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"email",type:"string",description:"the email of the user you want to change the role",optional:!1,defaultvalue:null},{name:"role",type:"string",description:"the role you want to set",optional:!1,defaultvalue:null}],code:[{type:"400",description:"invalid/missing parameters",optional:!1},{type:"404",description:"user not found",optional:!1},{type:"403",description:"impossible to set the role of the owner",optional:!1}],response:[{name:".",type:"array",description:"a array of user containing their email, username and roles",optional:!1,defaultvalue:null}],name:"setUserRole",longname:"Bucket.setUserRole",scope:"route"},{name:"retrieveAll",route:{name:"/api/bucket/",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully fetched bucket",optional:!1}],response:[{name:".",type:"array",description:"array of buckets",optional:!1,defaultvalue:null}],longname:"Bucket.retrieveAll",scope:"route"},{name:"create",route:{name:"/api/bucket/create_classic",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"name",type:"string",description:"the name of the bucket",optional:!1,defaultvalue:null},{name:"comment",type:"string",description:"any comments that will be written under the bucket name",optional:!0,defaultvalue:null},{name:"app_url",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"400",description:"missing parameters",optional:!1},{type:"403",description:"you cant create any more bucket",optional:!1},{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully created a bucket",optional:!1}],response:[{name:"bucket",type:"object",description:"the created bucket",optional:!1,defaultvalue:null}],longname:"Bucket.create",scope:"route"},{deprecated:!0,route:{name:"/api/bucket/:id/start_trial",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"400",description:"can't claim trial",optional:!1},{type:"200",description:"trial launched",optional:!1}],response:[{name:"duration",type:"string",description:"the duration of the trial",optional:!1,defaultvalue:null},{name:"plan",type:"string",description:"the plan of the trial",optional:!1,defaultvalue:null}],name:"claimTrial",longname:"Bucket.claimTrial",scope:"route"},{deprecated:!0,name:"upgrade",route:{name:"/api/bucket/:id/upgrade",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"plan",type:"string",description:"name of the plan to upgrade to",optional:!1,defaultvalue:null},{name:"stripe_token",type:"string",description:"a card token created by stripe",optional:!0,defaultvalue:null},{name:"coupon_id",type:"string",description:"the id of the stripe coupon",optional:!0,defaultvalue:null}],code:[{type:"400",description:"missing/invalid parameters",optional:!1},{type:"403",description:"need a credit card OR not allowed to subscribe to the plan",optional:!1},{type:"500",description:"stripe/database error",optional:!1},{type:"200",description:"succesfully upgraded",optional:!1}],response:[{name:"bucket",type:"object",description:"the bucket object",optional:!1,defaultvalue:null},{name:"subscription",type:"object",description:"the subscription object attached to the subscription",optional:!1,defaultvalue:null}],longname:"Bucket.upgrade",scope:"route"},{name:"retrieve",route:{name:"/api/bucket/:id",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"200",description:"succesfully retrieved the bucket",optional:!1}],response:[{name:".",type:"object",description:"bucket object",optional:!1,defaultvalue:null}],longname:"Bucket.retrieve",scope:"route"},{route:{name:"/api/bucket/:id",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"name",type:"string",description:"",optional:!0,defaultvalue:null},{name:"comment",type:"string",description:"",optional:!0,defaultvalue:null},{name:"app_url",type:"string",description:"",optional:!0,defaultvalue:null},{name:"configuration",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters",optional:!1}],response:[{name:".",type:"object",description:"bucket object",optional:!1,defaultvalue:null}],name:"update",longname:"Bucket.update",scope:"route",async:!0},{name:"retrieveServers",route:{name:"/api/bucket/:id/meta_servers",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved the server's metadata",optional:!1}],response:[{name:".",type:"array",description:"servers metadata",optional:!1,defaultvalue:null}],longname:"Bucket.retrieveServers",scope:"route"},{route:{name:"/api/bucket/:id",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully deleted the bucket",optional:!1}],response:[{name:".",type:"object",description:"the deleted bucket",optional:!1,defaultvalue:null}],name:"destroy",longname:"Bucket.destroy",scope:"route"},{route:{name:"/api/bucket/:id/transfer_ownership",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"new_owner",type:"string",description:"the wanted owner's email",optional:!1,defaultvalue:null}],code:[{type:"400",description:"Missing/invalid parameters",optional:!1},{type:"404",description:"user not found",optional:!1},{type:"403",description:"the new owner need to have a active credit card",optional:!1},{type:"200",description:"succesfully transfered the bucket, old owner is now admin",optional:!1}],response:[{name:".",type:"object",description:"bucket object",optional:!1,defaultvalue:null}],name:"transferOwnership",longname:"Bucket.transferOwnership",scope:"route"},{route:{name:"/api/bucket/:id/user_options",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"options",type:"object",description:"user options",optional:!1,defaultvalue:null}],code:[{type:"200",description:"succesfully update user options",optional:!1},{type:"400",description:"missing parameters",optional:!1}],response:[{name:"bucket",type:"object",description:"",optional:!1,defaultvalue:null}],name:"updateUserOptions",longname:"Bucket.updateUserOptions",scope:"route"}]},dashboard:[{route:{name:"/api/bucket/:id/dashboard/",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of servers status",optional:!1,defaultvalue:null}],name:"retrieveAll",longname:"Dashboard.retrieveAll",scope:"route"},{route:{name:"/api/bucket/:id/dashboard/:dashid",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashid",type:"string",description:"dashboard id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"404",description:"dashboard not found",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of dashboards",optional:!1,defaultvalue:null}],name:"retrieve",longname:"Dashboard.retrieve",scope:"route"},{route:{name:"/api/bucket/:id/dashboard/:dashid",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashid",type:"string",description:"dashboard id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully deleted dashboard",optional:!1},{type:"400",description:"Invalid params",optional:!1},{type:"404",description:"dashboard not found",optional:!1}],response:[{name:".",type:"array",description:"array of dashboards",optional:!1,defaultvalue:null}],name:"remove",longname:"Dashboard.remove",scope:"route"},{route:{name:"/api/bucket/:id/dashboard/:dashId",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":dashId",type:"string",description:"dashboard id",optional:!1}],body:[{name:"name",type:"string",description:"the name of the dashboard",optional:!1,defaultvalue:null},{name:"children",type:"object",description:"the list of component that compose the dashboard",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"404",description:"dashboard not found",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of servers status",optional:!1,defaultvalue:null}],name:"update",longname:"Dashboard.update",scope:"route"},{route:{name:"/api/bucket/:id/dashboard/",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"name",type:"string",description:"the name of the dashboard",optional:!1,defaultvalue:null},{name:"children",type:"object",description:"the list of component that compose the dashboard",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully created dashboard",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"dashboard",description:"complete dashboard object from database",optional:!1,defaultvalue:null}],name:"create",longname:"Dashboard.create",scope:"route"}],data:{dependencies:[{route:{name:"/api/bucket/:id/data/dependencies/",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"the application name",optional:!1,defaultvalue:null},{name:"server_name",type:"string",description:"filter by server name",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"missing parameters",optional:!1}],response:[{name:".",type:"array",description:"recorded dependencies",optional:!1,defaultvalue:null}],examples:["km.data.dependencies.retrieve(bucket._id, {\n app_name: 'my_api'\n })"],name:"retrieve",longname:"Data.dependencies.retrieve",scope:"route"}],events:[{route:{name:"/api/bucket/:id/data/events",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"event_name",type:"string",description:"the event name to retrieve",optional:!1,defaultvalue:null},{name:"start",type:"date",description:"from which date to retrieve events",optional:!0,defaultvalue:null},{name:"end",type:"date",description:"to which date to retrieve events",optional:!0,defaultvalue:null},{name:"app_name",type:"string",description:"filter events by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter events by server source",optional:!0,defaultvalue:null},{name:"limit",type:"number",description:"limit the number of events to retrieve",optional:!0,defaultvalue:100},{name:"offset",type:"number",description:"offset research by X",optional:!0,defaultvalue:0}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of events",optional:!1,defaultvalue:null}],name:"retrieve",longname:"Data.events.retrieve",scope:"route"},{route:{name:"/api/bucket/:id/data/eventsKeysByApp",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object representing events emitted for each application name",optional:!1,defaultvalue:null}],name:"retrieveMetadatas",longname:"Data.events.retrieveMetadatas",scope:"route"},{route:{name:"/api/bucket/:id/data/events/stats",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"event_name",type:"string",description:"the event name to retrieve",optional:!1,defaultvalue:null},{name:"app_name",type:"string",description:"filter events by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter events by server source",optional:!0,defaultvalue:null},{name:"days",type:"number",description:"limit the number of days of data",optional:!0,defaultvalue:2},{name:"interval",type:"string",description:"interval of time between two point",optional:!0,defaultvalue:"minute"}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of point (each point is one dimensional array, X are at 0 and Y at 1)",optional:!1,defaultvalue:null}],name:"retrieveHistogram",longname:"Data.events.retrieveHistogram",scope:"route"},{route:{name:"/api/bucket/:id/data/events/delete_all",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully deleted data",optional:!1}],response:[{name:".",type:"array",description:"array of object representing events emitted for each application name",optional:!1,defaultvalue:null}],name:"deleteAll",longname:"Data.events.deleteAll",scope:"route"}],exceptions:[{route:{name:"/api/bucket/:id/data/exceptions",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"server_name",type:"string",description:"filter exceptions by server source",optional:!0,defaultvalue:null},{name:"app_name",type:"string",description:"filter exceptions by app source",optional:!0,defaultvalue:null},{name:"before",type:"string",description:"filter out exceptions older than X (in minutes)",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of exceptions",optional:!1,defaultvalue:null}],name:"retrieve",longname:"Data.exceptions.retrieve",scope:"route"},{route:{name:"/api/bucket/:id/data/exceptions/summary",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object containing exceptions for each application for each server",optional:!1,defaultvalue:null}],name:"retrieveSummary",longname:"Data.exceptions.retrieveSummary",scope:"route"},{route:{name:"/api/bucket/:id/data/exceptions/delete_all",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],name:"deleteAll",longname:"Data.exceptions.deleteAll",scope:"route"},{route:{name:"/api/bucket/:id/data/exceptions/delete",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"identifier",type:"string",description:"exception identifier",optional:!0,defaultvalue:null},{name:"app_name",type:"string",description:"the application on which exception happened",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"the server on which exception happened",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"missing/invalid parameters",optional:!1}],response:[{name:".",type:"array",description:"array of deleted exceptions",optional:!1,defaultvalue:null}],name:"delete",longname:"Data.exceptions.delete",scope:"route"}],issues:[{route:{name:"/api/bucket/:id/data/issues/list",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"server_name",type:"string",description:"filter exceptions by server source",optional:!0,defaultvalue:null},{name:"app_name",type:"string",description:"filter exceptions by app source needed if initiator+source not provided",optional:!0,defaultvalue:null},{name:"before",type:"string",description:"exclude exceptions older than 'before' minutes",optional:!0,defaultvalue:null},{name:"initiator",type:"string",description:"filter exceptions by initiator (node/golang/browser/webcheck...) needed with source",optional:!0,defaultvalue:null},{name:"source",type:"string",description:"filter exceptions by source (browser app id, webcheck id...)",optional:!0,defaultvalue:null},{name:"tags",type:"array",description:"array of string to filter tags",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of exceptions",optional:!1,defaultvalue:null}],name:"list",longname:"Data.issues.list",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/issues/occurrences/:identifier",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":identifier",type:"string",description:"issue identifier",optional:!1}],query:[{name:"from",type:"number",description:"",optional:!0,defaultvalue:null},{name:"search_after",type:"number",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of occurrences id",optional:!1,defaultvalue:null}],name:"listOccurencesForIdentifier",longname:"Data.issues.listOccurencesForIdentifier",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/issues/replay/:uuid",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":uuid",type:"string",description:"replay id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"replay",type:"string",description:"",optional:!1,defaultvalue:null}],name:"getReplay",longname:"Data.issues.getReplay",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/issues/histogram",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"a specific app name",optional:!0,defaultvalue:null},{name:"start",type:"string",description:"ignore issue before this date",optional:!0,defaultvalue:null},{name:"identifier",type:"string",description:"a specific issue identifier",optional:!0,defaultvalue:null},{name:"interval",type:"string",description:"ignore issue before this date",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"ignore issue after this date",optional:!0,defaultvalue:null},{name:"includeFixed",type:"boolean",description:"choose to ignore or not the fixed occurences",optional:!0,defaultvalue:!1},{name:"initiator",type:"string",description:"filter exceptions by initiator (node/golang/browser/webcheck...) needed with source",optional:!0,defaultvalue:null},{name:"source",type:"string",description:"filter exceptions by source (browser app id, webcheck id...)",optional:!0,defaultvalue:null},{name:"tags",type:"array",description:"array of string to filter tags",optional:!0,defaultvalue:null},{name:"includeEmptyDocs",type:"boolean",description:"add empty docs",optional:!0,defaultvalue:!1},{name:"invertedTags",type:"boolean",description:"filter issue without tags",optional:!0,defaultvalue:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object containing exceptions for each application for each server",optional:!1,defaultvalue:null}],name:"retrieveHistogram",longname:"Data.issues.retrieveHistogram",scope:"route"},{route:{name:"/api/bucket/:id/data/issues/ocurrences",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"identifier",type:"object",description:"find occurence by using an issue identifier",optional:!0,defaultvalue:null},{name:"occurrence_id",type:"object",description:"find ocurrence by his id",optional:!0,defaultvalue:null},{name:"includeFixed",type:"boolean",description:"choose to ignore or not the fixed occurences",optional:!0,defaultvalue:!1},{name:"limit",type:"number",description:"limit",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object containing ocurrences",optional:!1,defaultvalue:null}],name:"findOccurences",longname:"Data.issues.findOccurences",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/issues/search",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"message",type:"string",description:"find occurence that match this message",optional:!1,defaultvalue:null},{name:"includeFixed",type:"boolean",description:"choose to ignore or not the fixed occurences",optional:!0,defaultvalue:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object containing exceptions for each application for each server",optional:!1,defaultvalue:null}],name:"search",longname:"Data.issues.search",scope:"route"},{route:{name:"/api/bucket/:id/data/issues/summary/:aggregateBy",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":aggregateBy",type:"string",description:"servers, apps, initiators or sources",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"issues count aggregated",optional:!1,defaultvalue:null}],name:"summary",longname:"Data.issues.summary",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/issues",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],query:[{name:"app_name",type:"string",description:"an specific application to delete application",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],name:"deleteAll",longname:"Data.issues.deleteAll",scope:"route"},{route:{name:"/api/bucket/:id/data/issues/:identifier",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":identifier",type:"string",description:"the identifier of issue that you want to delete",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"missing/invalid parameters",optional:!1}],response:[{name:".",type:"array",description:"array of deleted exceptions",optional:!1,defaultvalue:null}],name:"delete",longname:"Data.issues.delete",scope:"route"}],logs:[{route:{name:"/api/bucket/:id/data/logs",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"the application name",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter by server name",optional:!0,defaultvalue:null},{name:"before",type:"string",description:"only search log oldest than ",optional:!0,defaultvalue:null},{name:"after",type:"string",description:"only search log newer than ",optional:!0,defaultvalue:null},{name:"size",type:"integer",description:"line limit, default to 100",optional:!0,defaultvalue:null},{name:"from",type:"integer",description:"offset limit",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"missing parameters",optional:!1}],response:[{name:".",type:"array",description:"recorded dependencies",optional:!1,defaultvalue:null}],examples:["km.data.logs.retrieve(bucket._id, {\n app_name: 'my_api'\n })"],name:"retrieve",longname:"Data.logs.retrieve",scope:"route"},{route:{name:"/api/bucket/:id/data/logs/histogram",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"object",description:"a specific app name",optional:!0,defaultvalue:null},{name:"start",type:"object",description:"ignore log before this date",optional:!0,defaultvalue:null},{name:"interval",type:"object",description:"ignore log before this date",optional:!0,defaultvalue:null},{name:"end",type:"object",description:"ignore log after this date",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object containing exceptions for each application for each server",optional:!1,defaultvalue:null}],name:"retrieveHistogram",longname:"Data.logs.retrieveHistogram",scope:"route"}],metrics:[{route:{name:"/api/bucket/:id/data/metrics/aggregations",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"aggregations",type:"object",description:"array of aggregations to compute",optional:!1,defaultvalue:null},{name:"aggregations[].name",type:"string",description:"the name of metric to compute the graph",optional:!1,defaultvalue:null},{name:"aggregations[].types",type:"array",description:"type of aggregation (e.g. ['histogram', 'servers'])",optional:!1,defaultvalue:null},{name:"aggregations[].start",type:"date",description:"oldest documents to aggregate on",optional:!1,defaultvalue:null},{name:"aggregations[].end",type:"date",description:"newest documents to aggregate on",optional:!0,defaultvalue:null},{name:"aggregations[].apps",type:"array",description:"filter source applications to aggregate on",optional:!0,defaultvalue:null},{name:"aggregations[].interval",type:"number",description:"interval between two points",optional:!0,defaultvalue:null},{name:"aggregations[].servers",type:"array",description:"filter source server to aggregate on",optional:!0,defaultvalue:null},{name:"aggregations[].initiator",type:"string",description:"filter source initiator to aggregate on",optional:!0,defaultvalue:null},{name:"aggregations[].webcheck",type:"string",description:"filter source webcheck to aggregate on",optional:!0,defaultvalue:null},{name:"aggregations[].collector",type:"string",description:"filter source collector to aggregate on",optional:!0,defaultvalue:null},{name:"aggregations[].tags",type:"array",description:"filter tags to aggregate on",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"aggregations",optional:!1,defaultvalue:null}],examples:["// Example #1: Retrieve HTTP metrics of app INTERACTION, WEB-API, WORKER from all servers\n km.data.metrics.retrieveAggregations(bucket._id, {\n aggregations: [\n {\n 'start': 'now-5m',\n 'apps': ['INTERACTION', 'WEB-API', 'WORKER'],\n 'types': ['histogram', 'apps', 'servers'],\n 'name': 'HTTP'\n }\n ]\n})\n\n // Example #2: Retrieve HTTP metrics of ALL apps from all servers\n km.data.metrics.retrieveAggregations(bucket._id, {\n aggregations: [\n {\n 'start': 'now-1d',\n 'types': ['histogram', 'apps', 'servers'],\n 'name': 'HTTP'\n }\n ]\n})"],name:"retrieveAggregations",longname:"Data.metrics.retrieveAggregations",scope:"route"},{route:{name:"/api/bucket/:id/data/metrics/histogram",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"filter probes by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter probes by server source",optional:!0,defaultvalue:null},{name:"interval",type:"string",description:"interval of time between two point",optional:!0,defaultvalue:"minute"},{name:"before",type:"string",description:"filter out probes that are after X minute",optional:!0,defaultvalue:60}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"server_name",type:"object",description:"",optional:!1,defaultvalue:null},{name:"server_name.app_name",type:"object",description:"",optional:!1,defaultvalue:null},{name:"server_name.app_name.metrics",type:"object",description:"",optional:!1,defaultvalue:null},{name:"server_name.app_name.metrics.agg_type",type:"string",description:"the type of aggregation for this probe",optional:!1,defaultvalue:null},{name:"server_name.app_name.metrics_name.timestamps_and_stats",type:"array",description:"array of point",optional:!1,defaultvalue:null}],name:"retrieveHistogram",longname:"Data.metrics.retrieveHistogram",scope:"route"},{route:{name:"/api/bucket/:id/data/metrics/histogramPrecise",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"probe",type:"string",description:"probe name",optional:!1,defaultvalue:null},{name:"app",type:"string",description:"filter probes by app source",optional:!1,defaultvalue:null},{name:"server",type:"string",description:"filter probes by server source",optional:!1,defaultvalue:null},{name:"after",type:"string",description:"interval of time between two point (now-5d, now-5m...)",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"Array",type:"array",description:"of points",optional:!1,defaultvalue:null}],name:"retrieveHistogramPrecise",longname:"Data.metrics.retrieveHistogramPrecise",scope:"route"},{route:{name:"/api/bucket/:id/data/metrics/list",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"servers",type:"object",description:"filter metrics by app name",optional:!0,defaultvalue:null},{name:"apps",type:"object",description:"filter metrics by server name",optional:!0,defaultvalue:null},{name:"initiator",type:"string",description:"filter metrics by a specific initiator",optional:!0,defaultvalue:null},{name:"source",type:"string",description:"filter metrics by a specific source",optional:!0,defaultvalue:null},{name:"collector",type:"string",description:"filter metrics by a specific collector",optional:!0,defaultvalue:null},{name:"webcheck",type:"string",description:"filter metrics by a specific webcheck",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],name:"retrieveList",longname:"Data.metrics.retrieveList",scope:"route"},{route:{name:"/api/bucket/:id/data/metrics",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"filter metrics by app source",optional:!1,defaultvalue:null},{name:"server_name",type:"string",description:"filter metrics by server source",optional:!0,defaultvalue:null},{name:"before",type:"string",description:"filter out metrics that are after X minute",optional:!0,defaultvalue:720}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],name:"retrieveMetadatas",longname:"Data.metrics.retrieveMetadatas",scope:"route"}],notifications:[{route:{name:"/api/bucket/:id/data/notifications",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"type",type:"string",description:"Type of notification",optional:!0,defaultvalue:null},{name:"before",type:"string",description:"we search logs before this date (lower than)",optional:!0,defaultvalue:null},{name:"after",type:"string",description:"we search logs after this date (greater than)",optional:!0,defaultvalue:null},{name:"size",type:"number",description:"",optional:!0,defaultvalue:null},{name:"from",type:"number",description:"",optional:!0,defaultvalue:null},{name:"type",type:"string",description:"type of notification",optional:!0,defaultvalue:null},{name:"providers",type:"array",description:"find notifications with this providers",optional:!0,defaultvalue:null},{name:"contacts",type:"array",description:"find notifications with this contact",optional:!0,defaultvalue:null},{name:"size",type:"integer",description:"line limit, default to 20",optional:!0,defaultvalue:null},{name:"from",type:"integer",description:"offset limit",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],tags:[{originalTitle:"reponse",title:"reponse",text:"{Array} . array of traces",value:"{Array} . array of traces",optional:!1,type:null}],name:"list",longname:"Data.notifications.list",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/notifications/:notification",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":notification",type:"string",description:"notification id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],tags:[{originalTitle:"reponse",title:"reponse",text:"{Object} . notification",value:"{Object} . notification",optional:!1,type:null}],name:"retrieve",longname:"Data.notifications.retrieve",scope:"route",async:!0}],outliers:[{route:{name:"/api/bucket/:id/data/outliers/",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"the application name",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter by server name",optional:!0,defaultvalue:null},{name:"start",type:"string",description:"only search outlier newer than ",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"only search outlier older than ",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"missing parameters",optional:!1}],response:[{name:".",type:"array",description:"recorded dependencies",optional:!1,defaultvalue:null}],examples:["km.data.outliers.retrieve(bucket._id, {\n app_name: 'my_api'\n })"],name:"retrieve",longname:"Data.outliers.retrieve",scope:"route"}],processes:[{route:{name:"/api/bucket/:id/data/processEvents",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"filter events by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter events by server source",optional:!0,defaultvalue:null},{name:"before",type:"string",description:"filter out events that are after X minute",optional:!0,defaultvalue:60}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of process events",optional:!1,defaultvalue:null}],name:"retrieveEvents",longname:"Data.processes.retrieveEvents",scope:"route"},{route:{name:"/api/bucket/:id/data/processEvents/deployments",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"filter events by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter events by server source",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of deployments",optional:!1,defaultvalue:null}],name:"retrieveDeployments",longname:"Data.processes.retrieveDeployments",scope:"route"}],profiling:[{route:{name:"/api/bucket/:id/data/profilings/:filename",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":filename",type:"string",description:"filename",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters",optional:!1}],response:[{name:".",type:"object",description:"return profile data",optional:!1,defaultvalue:null}],name:"retrieve",longname:"Data.profiling.retrieve",scope:"route"},{route:{name:"/api/bucket/:id/data/profilings/:filename/download",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":filename",type:"string",description:"filename",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters",optional:!1}],response:[{name:".",type:"file",description:"return a file",optional:!1,defaultvalue:null}],name:"download",longname:"Data.profiling.download",scope:"route"},{route:{name:"/api/bucket/:id/data/profilings",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"apps",type:"object",description:"",optional:!0,defaultvalue:null},{name:"servers",type:"object",description:"",optional:!0,defaultvalue:null},{name:"from",type:"object",description:"",optional:!0,defaultvalue:null},{name:"size",type:"object",description:"",optional:!0,defaultvalue:null},{name:"type",type:"object",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of object containing profilings",optional:!1,defaultvalue:null}],name:"list",longname:"Data.profiling.list",scope:"route"},{route:{name:"/api/bucket/:id/data/profilings/:filename",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":filename",type:"string",description:"filename",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters",optional:!1}],response:[{name:".",type:"file",description:"return a file",optional:!1,defaultvalue:null}],name:"delete",longname:"Data.profiling.delete",scope:"route"}],status:[{route:{name:"/api/bucket/:id/data/status",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],tags:[{originalTitle:"reponse",title:"reponse",text:"{Array} . array of servers status",value:"{Array} . array of servers status",optional:!1,type:null}],name:"retrieve",longname:"Data.status.retrieve",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/status/blacklisted",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],tags:[{originalTitle:"reponse",title:"reponse",text:"{Array} . array of servers status",value:"{Array} . array of servers status",optional:!1,type:null}],name:"retrieveBlacklisted",longname:"Data.status.retrieveBlacklisted",scope:"route",async:!0}],traces:[{route:{name:"/api/bucket/:id/data/traces",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"includeSpans",type:"boolean",description:"",optional:!0,defaultvalue:!0},{name:"serviceName",type:"string",description:"",optional:!0,defaultvalue:null},{name:"limit",type:"string",description:"default: 10, max: 100",optional:!0,defaultvalue:null},{name:"kind",type:"string",description:"",optional:!0,defaultvalue:null},{name:"minDuration",type:"number",description:"",optional:!0,defaultvalue:null},{name:"start",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"tags",type:"array",description:"Query string array like [error=500, error, ...]",optional:!0,defaultvalue:null},{name:"orderBy",type:"string",description:"Default: newest, enum: oldest, newest, shortest, longest",optional:!0,defaultvalue:null},{name:"spanName",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],tags:[{originalTitle:"reponse",title:"reponse",text:"{Array} . array of traces",value:"{Array} . array of traces",optional:!1,type:null}],name:"list",longname:"Data.traces.list",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/traces/:trace",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1},{name:":trace",type:"string",description:"trace id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],tags:[{originalTitle:"reponse",title:"reponse",text:"{Object} . trace",value:"{Object} . trace",optional:!1,type:null}],name:"retrieve",longname:"Data.traces.retrieve",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/traces/services",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"services,",type:"object",description:"spans names",optional:!1,defaultvalue:null}],name:"getServices",longname:"Data.traces.getServices",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/traces/tags",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"tags",type:"array",description:"",optional:!1,defaultvalue:null}],name:"getTags",longname:"Data.traces.getTags",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/traces/histogram/tag",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"tag",type:"string",description:"",optional:!1,defaultvalue:null},{name:"start",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"serviceName",type:"string",description:"",optional:!0,defaultvalue:null},{name:"spanName",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"aggregation",type:"array",description:"",optional:!1,defaultvalue:null}],name:"getHistogramByTag",longname:"Data.traces.getHistogramByTag",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/traces/aggregation/tag",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"tag",type:"string",description:"",optional:!1,defaultvalue:null},{name:"start",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"serviceName",type:"string",description:"",optional:!0,defaultvalue:null},{name:"spanName",type:"string",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"aggregation",type:"array",description:"",optional:!1,defaultvalue:null}],name:"getTagsValue",longname:"Data.traces.getTagsValue",scope:"route",async:!0},{route:{name:"/api/bucket/:id/data/traces/aggregation/duration",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"start",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"end",type:"string",description:"date",optional:!0,defaultvalue:null},{name:"serviceName",type:"string",description:"",optional:!0,defaultvalue:null},{name:"spanName",type:"string",description:"",optional:!0,defaultvalue:null},{name:"tags",type:"array",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"aggregation",type:"array",description:"",optional:!1,defaultvalue:null}],name:"getDurationAvg",longname:"Data.traces.getDurationAvg",scope:"route",async:!0}],transactions:[{route:{name:"/api/bucket/:id/data/transactions/v2/histogram",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"filter transactions by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter transactions by server source",optional:!0,defaultvalue:null},{name:"interval",type:"string",description:"interval of time between two point",optional:!0,defaultvalue:"minute"},{name:"before",type:"string",description:"filter out transactions that are after X minute",optional:!0,defaultvalue:60}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:".",type:"array",description:"array of times series containing points",optional:!1,defaultvalue:null}],name:"retrieveHistogram",longname:"Data.transactions.retrieveHistogram",scope:"route"},{route:{name:"/api/bucket/:id/data/transactions/v2/summary",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],body:[{name:"app_name",type:"string",description:"filter transactions by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter transactions by server source",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"server_name",type:"object",description:"",optional:!1,defaultvalue:null},{name:"server_name.app_name",type:"object",description:"transaction object",optional:!1,defaultvalue:null}],name:"retrieveSummary",longname:"Data.transactions.retrieveSummary",scope:"route"},{route:{name:"/api/bucket/:id/data/transactions/v2/delete",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"bucket id",optional:!1}],query:[{name:"app_name",type:"string",description:"filter transactions by app source",optional:!0,defaultvalue:null},{name:"server_name",type:"string",description:"filter transactions by server source",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1}],response:[{name:"server_name",type:"object",description:"",optional:!1,defaultvalue:null},{name:"server_name.app_name",type:"object",description:"transaction object",optional:!1,defaultvalue:null}],name:"delete",longname:"Data.transactions.delete",scope:"route"}]},misc:[{route:{name:"/api/misc/changelog",type:"GET"},code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:"changelog",type:"array",description:"articles",optional:!1,defaultvalue:null}],name:"listChangelogArticles",longname:"Misc.listChangelogArticles",scope:"route",params:[],authentication:!1},{route:{name:"/api/misc/release/pm2",type:"GET"},code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:"pm2_version",type:"string",description:"latest version",optional:!1,defaultvalue:null}],name:"retrievePM2Version",longname:"Misc.retrievePM2Version",scope:"route",params:[],authentication:!1},{route:{name:"/api/misc/release/nodejs/:version",type:"GET"},params:[{name:":version",type:"string",description:"semver version range",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"array",description:"array of releases matching the range requested",optional:!1,defaultvalue:null}],name:"retrieveNodeRelease",longname:"Misc.retrieveNodeRelease",scope:"route",authentication:!1},{route:{name:"/api/misc/plans",type:"GET"},code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"succesfully retrieved data",optional:!1},{type:"400",description:"Invalid params",optional:!1}],response:[{name:".",type:"object",description:"list of plans keyed by plan name",optional:!1,defaultvalue:null}],name:"retrievePlans",longname:"Misc.retrievePlans",scope:"route",params:[],authentication:!1},{route:{name:"/api/misc/stripe/retrieveCoupon",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"coupon",type:"string",description:"the coupon name",optional:!1,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"200",description:"succesfully retrieved the metadata",optional:!1}],response:[{name:"coupon",type:"object",description:"the coupon object",optional:!1,defaultvalue:null}],name:"retrieveCoupon",longname:"Misc.retrieveCoupon",scope:"route",params:[]},{route:{name:"/api/misc/stripe/retrieveCompany",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"vat_id",type:"string",description:"the vat id of the company",optional:!1,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"200",description:"succesfully retrieved the metadata",optional:!1}],response:[{name:".",type:"object",description:"metadata about company",optional:!1,defaultvalue:null}],name:"retrieveCompany",longname:"Misc.retrieveCompany",scope:"route",params:[]},{route:{name:"/api/misc/stripe/retrieveVat",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"country",type:"string",description:"country code of the user",optional:!0,defaultvalue:null}],code:[{type:"500",description:"stripe error",optional:!1},{type:"200",description:"succesfully retrieved the metadata",optional:!1}],response:[{name:"coupon",type:"object",description:"the coupon object",optional:!1,defaultvalue:null}],name:"retrieveVAT",longname:"Misc.retrieveVAT",scope:"route",params:[]}],node:[{route:{name:"/api/node/default",type:"GET"},response:[{name:"node",type:"object",description:"Return node object",optional:!1,defaultvalue:null}],name:"getDefaultNode",longname:"Node.getDefaultNode",scope:"route",params:[],authentication:!1}],orchestration:[{route:{name:"/api/bucket/:id/balance",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"500",description:"balancing error",optional:!1},{type:"403",description:"already on new node or not premium",optional:!1},{type:"200",description:"succesfully balanced the bucket",optional:!1}],response:[{name:"migration",type:"object",description:"is equal true if succesfull",optional:!1,defaultvalue:null}],name:"selfSend",longname:"Orchestration.selfSend",scope:"route",params:[]}],tokens:[{route:{name:"/api/users/token/",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"200",description:"successfully retrieved",optional:!1}],response:[{name:".",type:"object",description:"array of tokens",optional:!1,defaultvalue:null}],name:"retrieve",longname:"Tokens.retrieve",scope:"route",params:[]},{route:{name:"/api/users/token/:id",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],params:[{name:":id",type:"string",description:"token id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"404",description:"token not found",optional:!1},{type:"200",description:"refresh token has been deleted and all access token that have been created with it",optional:!1}],response:[{name:".",type:"object",description:"array of tokens",optional:!1,defaultvalue:null}],name:"remove",longname:"Tokens.remove",scope:"route"},{route:{name:"/api/users/token/",type:"PUT"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"scope",type:"object",description:"a valid oauth scope",optional:!1,defaultvalue:null}],code:[{type:"409",description:"the otp is already enabled for the user, you can only delete it",optional:!1},{type:"200",description:"the otp can be registered for the account, return the full response",optional:!1}],response:[{name:".",type:"object",description:"generated token",optional:!1,defaultvalue:null}],name:"create",longname:"Tokens.create",scope:"route",params:[]}],user:{otp:[{route:{name:"/api/users/otp",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"409",description:"the otp is already enabled for the user, you can only delete it",optional:!1},{type:"200",description:"the otp can be registered for the account, return the full response",optional:!1}],response:[{name:"user",type:"object",description:"user model",optional:!1,defaultvalue:null},{name:"key",type:"string",description:"otp secret key",optional:!1,defaultvalue:null},{name:"qrImage",type:"string",description:"url to the QrCode",optional:!1,defaultvalue:null}],name:"retrieve",longname:"User.otp.retrieve",scope:"route",params:[]},{route:{name:"/api/users/otp",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"otpKey",type:"string",description:"secret key used to generate OTP code",optional:!1,defaultvalue:null},{name:"otpToken",type:"string",description:"a currently valid OTP code generated with the otpKey",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing parameters",optional:!1},{type:"403",description:"the code asked to add the OTP from user account is invalid",optional:!1},{type:"500",description:"error from database",optional:!1},{type:"200",description:"the otp has been registered for the user",optional:!1}],name:"enable",longname:"User.otp.enable",scope:"route",params:[]},{route:{name:"/api/users/otp",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],query:[{name:"otpToken",type:"string",description:"a currently valid OTP code",optional:!1,defaultvalue:null}],code:[{type:"400",description:"missing parameters",optional:!1},{type:"403",description:"the code asked to remove the OTP from user account is invalid",optional:!1},{type:"500",description:"error from database",optional:!1},{type:"200",description:"the otp has been deleted for the user",optional:!1}],name:"disable",longname:"User.otp.disable",scope:"route",params:[]}],providers:[{route:{name:"/api/users/integrations",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"200",description:"succesfully retrieved providers",optional:!1}],response:[{name:".",type:"array",description:"array of providers for user account",optional:!1,defaultvalue:null}],name:"retrieve",longname:"User.providers.retrieve",scope:"route",params:[]},{route:{name:"/api/users/integrations",type:"POST"},authentication:!0,body:[{name:"name",type:"string",description:"the provider name",optional:!1,defaultvalue:null}],header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"400",description:"invalid parameters",optional:!1},{type:"403",description:"the user already have this provider",optional:!1},{type:"200",description:"succesfully added the provider",optional:!1}],name:"add",longname:"User.providers.add",scope:"route",params:[]},{route:{name:"/api/users/integrations/:name",type:"DELETE"},authentication:!0,params:[{name:":name",type:"string",description:"the provider name",optional:!1}],header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"400",description:"invalid parameters or provider isn't implemented",optional:!1},{type:"403",description:"the provider isn't enabled",optional:!1},{type:"200",description:"succesfully removed the provider",optional:!1}],name:"remove",longname:"User.providers.remove",scope:"route"}],default:[{name:"retrieve",route:{name:"/api/users/isLogged",type:"GET"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"200",description:"the user has been retrieved",optional:!1}],response:[{name:"user",type:"object",description:"user model",optional:!1,defaultvalue:null}],longname:"User.retrieve",scope:"route"},{route:{name:"/api/users/show/:id",type:"GET"},params:[{name:":id",type:"string",description:"user id",optional:!1}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"invalid parameters (no id provided)",optional:!1},{type:"404",description:"no user account where found",optional:!1},{type:"200",description:"the mail has been sent to the provided email",optional:!1}],response:[{name:"String",type:"",description:"email user email",optional:!1,defaultvalue:null},{name:"String",type:"",description:"username user pseudo",optional:!1,defaultvalue:null}],name:"show",longname:"User.show",scope:"route",authentication:!1},{route:{name:"/api/users/update",type:"POST"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],body:[{name:"username",type:"string",description:"",optional:!0,defaultvalue:null},{name:"email",type:"string",description:"",optional:!0,defaultvalue:null},{name:"old_password",type:"string",description:"",optional:!0,defaultvalue:null},{name:"new_password",type:"string",description:"",optional:!0,defaultvalue:null},{name:"info",type:"object",description:"",optional:!0,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"400",description:"missing parameters, no data to update",optional:!1},{type:"403",description:"when updating the password, it need a new one",optional:!1},{type:"406",description:"when updating the password, the old one is false",optional:!1},{type:"409",description:"when updating email or username\n another user already have one of those two",optional:!1},{type:"200",description:"succesfully updated the card",optional:!1}],response:[{name:".",type:"object",description:"user object",optional:!1,defaultvalue:null}],name:"update",longname:"User.update",scope:"route",params:[]},{route:{name:"/api/users/delete",type:"DELETE"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"500",description:"database error",optional:!1},{type:"403",description:"permission denied (hold buckets)",optional:!1},{type:"200",description:"succesfully deleted the user",optional:!1}],response:[{name:".",type:"object",description:"user object",optional:!1,defaultvalue:null}],name:"delete",longname:"User.delete",scope:"route",params:[]}]},auth:[{name:"retrieveToken",route:{name:"/api/oauth/token",type:"POST"},service:{name:"OAUTH"},body:[{name:"client_id",type:"string",description:"the public id of your oauth application",optional:!1,defaultvalue:null},{name:"refresh_token",type:"string",description:"refresh token you retrieved via authorize endpoint",optional:!1,defaultvalue:null},{name:"grant_type",type:"string",description:"",optional:!1,defaultvalue:"refresh_token"}],code:[{type:"400",description:"invalid parameters (missing or not correct)",optional:!1}],response:[{name:"access_token",type:"string",description:"a fresh access_token",optional:!1,defaultvalue:null},{name:"refresh_token",type:"string",description:"the refresh token you used",optional:!1,defaultvalue:null},{name:"expire_at",type:"string",description:"UTC date at which the token will be considered\n as invalid",optional:!1,defaultvalue:null},{name:"token_type",type:"string",description:"the type of token to use, for now its always Bearer",optional:!1,defaultvalue:null}],longname:"Auth.retrieveToken",scope:"route",authentication:!1},{name:"requestNewPassword",route:{name:"/api/oauth/reset_password",type:"POST"},service:{name:"OAUTH"},body:[{name:"email",type:"string",description:"email of the account that want a password reset",optional:!1,defaultvalue:null}],code:[{type:"500",description:"the database failed to register the token to reset the mail",optional:!1},{type:"400",description:"missing parameters",optional:!1},{type:"404",description:"no user account where found with the provided email",optional:!1},{type:"200",description:"the mail has been sent to the provided email",optional:!1}],longname:"Auth.requestNewPassword",scope:"route",authentication:!1},{name:"sendEmailLink",route:{name:"/api/oauth/send_email_link",type:"POST"},service:{name:"OAUTH"},code:[{type:"500",description:"the database failed to register the token to reset the mail",optional:!1},{type:"401",description:"need to authenticated",optional:!1},{type:"200",description:"the mail has been sent to the provided email",optional:!1}],longname:"Auth.sendEmailLink",scope:"route",authentication:!1},{name:"validEmail",route:{name:"/api/oauth/valid_email/:token",type:"GET"},params:[{description:"the token to validate the account",name:":token",optional:!1,type:null}],service:{name:"OAUTH"},code:[{type:"500",description:"the database failed to valid email",optional:!1},{type:"404",description:"need to authenticated",optional:!1},{type:"301",description:"the email has been valided",optional:!1}],longname:"Auth.validEmail",scope:"route",authentication:!1},{route:{name:"/api/oauth/register",type:"GET"},service:{name:"OAUTH"},body:[{name:"username",type:"string",description:"",optional:!1,defaultvalue:null},{name:"email",type:"string",description:"",optional:!1,defaultvalue:null},{name:"password",type:"string",description:"",optional:!1,defaultvalue:null},{name:"role",type:"string",description:"job title in user company",optional:!0,defaultvalue:null},{name:"company",type:"string",description:"company name",optional:!0,defaultvalue:null},{name:"accept_terms",type:"integer",description:"",optional:!1,defaultvalue:null}],code:[{type:"500",description:"either the registeration of new user is disabled or\nthe database failed to register the user",optional:!1},{type:"409",description:"the user field are already used by another user",optional:!1},{type:"200",description:"the user has been created",optional:!1}],response:[{name:"user",type:"object",description:"user model",optional:!1,defaultvalue:null},{name:"access_token",type:"object",description:"access token issued for the user",optional:!1,defaultvalue:null},{name:"refreshToken",type:"object",description:"refresh token issued for the user",optional:!1,defaultvalue:null}],name:"register",longname:"Auth.register",scope:"route",authentication:!1},{route:{name:"/api/oauth/revoke",type:"POST"},service:{name:"OAUTH"},authentication:!0,header:[{name:"Authorization",type:"string",description:"bearer access token issued for the user",optional:!1,defaultvalue:null}],code:[{type:"404",description:"token not found",optional:!1},{type:"500",description:"database error",optional:!1},{type:"200",description:"the token has been succesfully deleted,\n if there was access token generated with this token, they\n have been deleted too",optional:!1}],name:"revoke",longname:"Auth.revoke",scope:"route"}]}},{}],39:[function(e,t,n){"use strict";function o(e){"@babel/helpers - typeof";return(o="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 i(e,t){for(var n=0;n0&&a("Call to '".concat(t.route.name,"' from ").concat(o.replace(" at ",""))),new Promise(function(o,a){i.extract(t,Array.prototype.slice.call(n)).then(function(n){if(t.service&&t.service.baseURL){var i=t.service.baseURL;i="/"===i[i.length-1]?i.substr(0,i.length-1):i,n.url=i+n.url}e.request(n).then(o,a)}).catch(a)})}}}])&&o(t.prototype,n),r&&o(t,r),e}()},{"./utils/validator":46,debug:31}],43:[function(e,t,n){"use strict";function o(e,t){for(var n=0;n0&&r("namespace ".concat(this.name," contains namespaces : \n").concat(this.namespaces.map(function(e){return e.name}).join("\n"),"\n")),this.endpoints.length>0&&r("Namespace ".concat(this.name," contains endpoints : \n").concat(this.endpoints.map(function(e){return e.route.name}).join("\n"),"\n"))}var t,n,s;return t=e,(n=[{key:"addNamespace",value:function(t){if(!t||t.name===this.name)throw new Error("A namespace must not have the same name as the parent namespace");if(!(t instanceof e))throw new Error("addNamespace only accept Namespace instance");this.namespaces.push(t),this[t.name]=t}},{key:"addEndpoint",value:function(e){if(!e||e.name===this.name)throw new Error("A endpoint must not have the same name as a namespace");if(!(e instanceof a))throw new Error("addNamespace only accept Namespace instance");this.endpoints.push(e),this[e.name]=e.build(this.http)}}])&&i(t.prototype,n),s&&i(t,s),e}()},{"./endpoint":42,debug:31}],45:[function(e,t,n){"use strict";function o(e){"@babel/helpers - typeof";return(o="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 i(e,t){for(var n=0;n0&&l("Emptying requests queue (size: ".concat(this._queue.length,")"));this._queue.length>0;){var e=this._queue.shift();this.request(e.request).then(e.resolve,e.reject)}}},{key:"_resolveBucketEndpoint",value:function(e){var t=this;if(!e)return Promise.reject(new Error("Missing argument : bucketID"));if(!this._endpoints.has(e)){var n=this._axios.request({url:"/api/bucket/".concat(e),method:"GET",headers:{Authorization:"Bearer ".concat(this.tokens.access_token)}}).then(function(e){return e.data.node.endpoints.web}).catch(function(n){throw t._endpoints.delete(e),n});this._endpoints.set(e,n)}return this._endpoints.get(e)}},{key:"request",value:function(e){var t=this;return new Promise(function(n,o){f.series([function(i){return!0===t.authenticated||!1===e.authentication?i():(p("Queued request to ".concat(e.url)),t._queue.push({resolve:n,reject:o,request:e}),i(-1))},function(n){if(!e.url.match(/bucket\/[0-9a-fA-F]{24}/))return n();var o=e.url.split("/")[3];t._resolveBucketEndpoint(o).then(function(t){return e.baseURL=t,n()}).catch(n)},function(n){var o=function(e){return n(null,e)};p("Making request to ".concat(e.url)),e.headers||(e.headers={}),e.headers.Authorization="Bearer ".concat(t.tokens.access_token),t._axios.request(e).then(o).catch(function(i){var a=i.response;if(a&&401!==a.status)return n(a);p("Got unautenticated response, buffering request from now ..."),t.authenticated=!1,p("Asking to the oauth flow to retrieve new tokens");var r=function(){t.oauth_flow.retrieveTokens(t.km,function(i,r){if(i)return p("Failed to retrieve new tokens : ".concat(i.message||i)),n(a);p("Succesfully retrieved new tokens"),t._updateTokens(null,r,function(i,r){return i?n(a):(p("Re-buffering call to ".concat(e.url," since authenticated now")),e.headers.Authorization="Bearer ".concat(t.tokens.access_token),t._axios.request(e).then(o).catch(n))})})};if(e.url==t.opts.services.OAUTH+"/api/oauth/token")return setTimeout(r.bind(t),500);r()})}],function(e,t){if(-1!==e)return e?o(e):n(t[2])})})}},{key:"_updateTokens",value:function(e,t,n){var o=this;if(e)return console.error("Error while retrieving tokens:",e),this.oauth_flow.deleteTokens(this.km),console.error(e.response?e.response.data:e.stack);if(!t||!t.access_token||!t.refresh_token)throw new Error("Invalid tokens");this.tokens=t,p("Registered new access_token : ".concat(t.access_token)),this._websockets.forEach(function(e){return e.updateAuthorization(t.access_token)}),this._axios.defaults.headers.common.Authorization="Bearer ".concat(t.access_token),this._axios.request({url:"/api/bucket",method:"GET",headers:{Authorization:"Bearer ".concat(t.access_token)}}).then(function(e){return p("Cached ".concat(e.data.length," buckets for current user")),o.authenticated=!0,o._queueUpdater(),"function"==typeof n?n(null,!0):null}).catch(function(e){return console.error("Error while retrieving buckets"),console.error(e.response?e.response.data:e),"function"==typeof n?n(e):null})}},{key:"useStrategy",value:function(e,t){if(t||(t={}),t.client_id||(t.client_id=this.opts.OAUTH_CLIENT_ID),"object"===o(e)){if(this.oauth_flow=e,!this.oauth_flow.retrieveTokens||!this.oauth_flow.deleteTokens)throw new Error("You must implement the Strategy interface to use it");return this.oauth_flow.retrieveTokens(this.km,this._updateTokens.bind(this))}if(void 0===r.implementations(e))throw new Error("The flow named ".concat(e," doesn't exist"));var n=r.implementations(e);if(n.condition&&s.ENVIRONNEMENT!==n.condition)throw new Error("The flow ".concat(e," is reserved for ").concat(n.condition," environment"));var i=n.nodule;return this.oauth_flow=new i(t),this.oauth_flow.retrieveTokens(this.km,this._updateTokens.bind(this))}},{key:"editSocketFilters",value:function(e,t){if(0===t.indexOf("**"))throw new Error("You need to provide a bucket public id.");var n=(t=t.split(":"))[0],o=t.slice(2).join(":"),i=this._websockets.find(function(e){return e.bucketPublic===n});this._bucketFilters.has(n)||this._bucketFilters.set(n,[]);var a=this._bucketFilters.get(n);"push"===e?a.push(o):a.splice(a.indexOf(o),1),i&&i.send(JSON.stringify({action:"sub",public_id:n,filters:Array.from(new Set(a))}))}},{key:"subscribe",value:function(e,t){var n=this;return new Promise(function(t,o){l("Request endpoints for ".concat(e)),n.km.bucket.retrieve(e).then(function(i){var a=i.data,r=!1,s=a.node.endpoints,p=s.realtime||s.web;p=p.replace("http","ws"),n.opts.IS_DEBUG&&(p=p.replace(":3000",":4020")),u("Found endpoint for ".concat(e," : ").concat(p));var d=new c("".concat(p,"/primus"),n.tokens.access_token);d.bucketPublic=a.public_id,d.connected=!1,d.bucket=e;var f=null;d.onmaxreconnect=function(e){if(!r)return r=!0,o(new Error("Connection timeout"))},d.onopen=function(){if(l("Connected to ws endpoint : ".concat(p," (bucket: ").concat(e,")")),d.connected=!0,n.realtime.emit("".concat(a.public_id,":connected")),d.send(JSON.stringify({action:"sub",public_id:a.public_id,filters:Array.from(new Set(n._bucketFilters.get(a.public_id)))})),null!==f&&(clearInterval(f),f=null),f=setInterval(function(){d.ping()}.bind(n),5e3),!r)return r=!0,t(d)},d.onunexpectedresponse=function(e,t){return 401===t.statusCode?n.oauth_flow.retrieveTokens(n.km,function(e,t){if(e)return l("Failed to retrieve tokens for ws: ".concat(e.message));l("Succesfully retrieved new tokens for ws"),n._updateTokens(null,t,function(e,t){return e?l("Failed to update tokens for ws: ".concat(e.message)):d._tryReconnect()})}):d._tryReconnect()},d.onerror=function(t){u("Error on ".concat(p," (bucket: ").concat(e,")")),u(t),n.realtime.emit("".concat(a.public_id,":error"),t)},d.onclose=function(){l("Closing ws connection ".concat(p," (bucket: ").concat(e,")")),d.connected=!1,n.realtime.emit("".concat(a.public_id,":disconnected")),null!==f&&(clearInterval(f),f=null)},d.onmessage=function(t){u("Received message for bucket ".concat(e," (").concat((t.data.length/1e3).toFixed(1)," Kb)"));var o=null;try{o=JSON.parse(t.data)}catch(t){return u("Receive not json message for bucket ".concat(e))}var i=o.data[1];Object.keys(i).forEach(function(e){"server_name"!==e&&n.realtime.emit("".concat(a.public_id,":").concat(i.server_name||"none",":").concat(e),i[e])})},n._websockets.push(d)}).catch(o)})}},{key:"unsubscribe",value:function(e,t){var n=this;return new Promise(function(t,o){l("Unsubscribe from realtime for ".concat(e));var i=n._websockets.find(function(t){return t.bucket===e});return i?(i.close(1e3,"Disconnecting"),l("Succesfully unsubscribed from realtime for ".concat(e)),t()):o(new Error("Realtime wasn't connected to ".concat(e)))})}}])&&i(t.prototype,n),m&&i(t,m),e}()},{"../constants":1,"./auth_strategies/strategy":41,"./utils/websocket":47,async:2,axios:3,debug:31,eventemitter2:33}],46:[function(e,t,n){"use strict";function o(e){"@babel/helpers - typeof";return(o="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 i(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}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 r,s=!0,l=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){l=!0,r=e},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw r}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n0)return r(new Error("Expected to receive an object for post data but received ".concat(o(A))));var j,E=i(e.body||[]);try{for(E.s();!(j=E.n()).done;){var S=j.value,x=!0===S.name.includes("[]");if(!n(A[S.name])&&!1===x&&!1===S.optional&&null===S.defaultvalue)return r(new Error("Missing mandatory field ".concat(S.name," to make a POST request on ").concat(e.route.name)));if(o(A[S.name])!==S.type&&!1===x&&!1===S.optional&&null===S.defaultvalue)return r(new Error("Invalid type for field ".concat(S.name,", expected ").concat(S.type," but got ").concat(o(A[S.name]))));n(A[S.name])&&(s.data[S.name]=A[S.name]),!1===S.optional&&null!==S.defaultvalue&&(s.data[S.name]=S.defaultvalue)}}catch(e){E.e(e)}finally{E.f()}break;case"DELETE":var O,C=i(e.params||[]);try{for(C.s();!(O=C.n()).done;){var L=O.value,P=t.shift();if("string"!=typeof P&&!1===L.optional)return r(new Error("Expected to receive string argument for ".concat(L.name," to match but got ").concat(P)));P?s.url=s.url.replace(L.name,P):!1===L.optional&&null!==L.defaultvalue&&(s.url=s.url.replace(L.name,L.defaultvalue))}}catch(e){C.e(e)}finally{C.f()}var z,B=i(e.query||[]);try{for(B.s();!(z=B.n()).done;){var D=z.value,F=t.shift();if("string"!=typeof F&&!1===D.optional)return r(new Error("Expected to receive string argument for ".concat(D.name," query but got ").concat(F)));F?s.params[D.name]=F:!1===D.optional&&null!==D.defaultvalue&&(s.params[D.name]=D.defaultvalue)}}catch(e){B.e(e)}finally{B.f()}break;default:return r(new Error("Invalid endpoint declaration, invalid method ".concat(e.route.type," found")))}return a(s)})}}],(n=null)&&r(t.prototype,n),a&&r(t,a),e}()},{}],47:[function(e,t,n){"use strict";var o=e("ws"),i=e("debug")("kmjs:network:_ws"),a="function"!=typeof o?WebSocket:o,r={debug:!1,automaticOpen:!0,reconnectOnError:!0,reconnectInterval:1e3,maxReconnectInterval:1e4,reconnectDecay:1,timeoutInterval:2e3,maxReconnectAttempts:1/0,randomRatio:3,reconnectOnCleanClose:!1},s=function(e,t,n,o){n||(n=[]),o||(o=[]),this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this.CLOSED=3,this._url=e,this._token=t,this._protocols=n,this._options=Object.assign({},r,o),this._messageQueue=[],this._reconnectAttempts=0,this.readyState=this.CONNECTING,"function"==typeof this._options.debug?this._debug=this._options.debug:this._options.debug?this._debug=console.log.bind(console):this._debug=function(){},this._options.automaticOpen&&this.open()};s.prototype.updateAuthorization=function(e){this._token=e},s.prototype.open=function(){i("open");var e=this._socket=new a("".concat(this._url,"?token=").concat(this._token),this._protocols);if(this._options.binaryType&&(e.binaryType=this._options.binaryType),this._options.maxReconnectAttempts&&this._options.maxReconnectAttemptsthis._options.maxReconnectInterval?this._options.maxReconnectInterval:n,this._options.randomRatio?(e=n/this._options.randomRatio,t=n,Math.random()*(t-e)+e):n},s.prototype._syncState=function(){this.readyState=this._socket.readyState},t.exports=s},{debug:31,ws:30}],"/":[function(e,t,n){"use strict";t.exports=e("./src/keymetrics.js")},{"./src/keymetrics.js":43}]},{},[])("/")});