@influxdata/influxdb-client
Advanced tools
Comparing version 1.6.0-nightly.8 to 1.6.0-nightly.9
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self)["@influxdata/influxdb-client"]={})}(this,(function(t){"use strict";const e=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),r=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,writeFailed:function(){},maxRetries:2,maxBufferLines:32e3},e)),s=[404,408,425,429,500,502,503,504];function i(t){return s.includes(t)}class n extends Error{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}}class o extends Error{constructor(t,e,r,s){super(),this.statusCode=t,this.statusMessage=e,this.body=r,Object.setPrototypeOf(this,o.prototype),this.message=r?`${t} ${e} : ${r}`:`${t} ${e}`,this.setRetryAfter(s)}setRetryAfter(t){"string"==typeof t&&/^[0-9]+$/.test(t)?this._retryAfter=parseInt(t):this._retryAfter=0}canRetry(){return i(this.statusCode)}retryAfter(){return this._retryAfter}}const l=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function a(t,e){if(t){let r;return"function"==typeof t.retryAfter?t.retryAfter():(r=0,e&&e>0?r+Math.round(Math.random()*e):r)}return 0}class h extends Error{constructor(){super(),Object.setPrototypeOf(this,h.prototype),this.message="Request timed out"}canRetry(){return!0}retryAfter(){return 0}}class c extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,c.prototype),this.message="Response aborted"}canRetry(){return!0}retryAfter(){return 0}}const u=/[-|\\{()[\]^$+*?.]/g;class f{constructor(t,e=""){this.config=t,this.wrap=e;const r=Object.keys(t).join("|").replace(u,"\\$&");this._re=new RegExp("["+r+"]","g")}escape(t){this._re.lastIndex=0;let e=this._re.lastIndex,r="",s=this._re.exec(t);for(;s;){const i=s[0],n=this.config[i].escapeChar,o=this.config[i].replaceChar;r+=t.slice(e,s.index),r+=null!=o?o:n+i,e=this._re.lastIndex,s=this._re.exec(t)}return 0===e?this.wrap+t+this.wrap:e<t.length?this.wrap+r+t.slice(e)+this.wrap:this.wrap+r+this.wrap}}class d{constructor(t,e){this.escapeChar=t,this.replaceChar=e}}const p=new d("\\"),g=t=>t.escape.bind(t),y={measurement:g(new f({",":p," ":p,"\n":new d(void 0,"\\n"),"\r":new d(void 0,"\\r"),"\t":new d(void 0,"\\t")})),quoted:g(new f({'"':p,"\\\\":p},'"')),tag:g(new f({",":p,"=":p," ":p,"\n":new d(void 0,"\\n"),"\r":new d(void 0,"\\r"),"\t":new d(void 0,"\\t")}))};let m=Date.now(),w=0;function b(){{const t=Date.now();t!==m?(m=t,w=0):w++;const e=String(w);return String(t)+"000000000".substr(0,6-e.length)+e}}function x(){return String(Date.now())+"000000000".substr(0,3)}function v(){return String(Date.now())}function O(){return String(Math.floor(Date.now()/1e3))}const S=Object.freeze({[String("s")]:O,[String("ms")]:v,[String("us")]:x,[String("ns")]:b,seconds:O,millis:v,micros:x,nanos:b}),T={[String("s")]:t=>`${Math.floor(t.getTime()/1e3)}`,[String("ms")]:t=>`${t.getTime()}`,[String("us")]:t=>`${t.getTime()}000`,[String("ns")]:t=>`${t.getTime()}000000`},R=t=>t,E={boolean:t=>"true"===t,unsignedLong:R,long:R,double:t=>+t,string:R,base64Binary:R,dateTime:R,duration:R};class C{constructor(t){t.forEach((t,e)=>t.index=e),this.columns=t}column(t){for(let e=0;e<this.columns.length;e++){const r=this.columns[e];if(r.label===t)return r}throw new n(`Column ${t} not found!`)}toObject(t){const e={};for(let r=0;r<this.columns.length&&r<t.length;r++){let s=t[r];const i=this.columns[r];""===s&&i.defaultValue&&(s=i.defaultValue),e[i.label]=(E[i.dataType]||R)(s)}return e}}class ${static from(t){const e=new $;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const j=Symbol("FLUX_VALUE");class _{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[j](){return this.fluxValue}}function D(t){if(null==t)return"";t=t.toString();let e=void 0,r=0;function s(){void 0===e&&(e=t.substring(0,r))}for(;r<t.length;r++){const i=t.charAt(r);switch(i){case"\r":s(),e+="\\r";break;case"\n":s(),e+="\\n";break;case"\t":s(),e+="\\t";break;case'"':case"\\":s(),e=e+"\\"+i;break;case"$":if(r+1<t.length&&"{"===t.charAt(r+1)){s(),r++,e+="\\${";break}null!=e&&(e+=i);break;default:null!=e&&(e+=i)}}return void 0!==e?e:t}function A(t){const e=String(t);let r=!1;for(const t of e){if("."===t){if(r)throw new Error(`not a flux float: ${e}`);r=!r}if("."!==t&&(t<"0"||t>"9"))throw new Error(`not a flux float: ${e}`)}return e}function L(t){return`regexp.compile(v: "${D(t)}")`}function P(t){return new _(String(t))}function B(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${D(t)}"`:"number"==typeof t?A(t):"object"==typeof t&&"function"==typeof t[j]?t[j]():t instanceof Date?t.toISOString():t instanceof RegExp?L(t):Array.isArray(t)?`[${t.map(B).join(",")}]`:B(t.toString())}function k(t,e,r,s){return new(r||(r=Promise))((function(i,n){function o(t){try{a(s.next(t))}catch(t){n(t)}}function l(t){try{a(s.throw(t))}catch(t){n(t)}}function a(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(o,l)}a((s=s.apply(t,e||[])).next())}))}let F=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const U={error(t,e){F.error(t,e)},warn(t,e){F.warn(t,e)}};class z{constructor(t){this.options=Object.assign(Object.assign({},e),t),this.success()}nextDelay(t){const e=a(t);return e&&e>0?Math.min(e+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):(this.currentDelay?this.currentDelay=Math.min(Math.max(2*this.currentDelay,1)+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):this.currentDelay=this.options.minRetryDelay+Math.round(Math.random()*this.options.retryJitter),this.currentDelay)}success(){this.currentDelay=void 0}}class M{constructor(t,e){this.maxLines=t,this.retryLines=e,this.size=0,this.nextRetryTime=0,this.closed=!1,this._timeoutHandle=void 0}addLines(t,e,r){if(this.closed)return;if(!t.length)return;const s=Date.now()+r;if(s>this.nextRetryTime&&(this.nextRetryTime=s),this.first&&this.size+t.length>this.maxLines){const e=this.size,r=.7*e;do{const t=this.first.next;this.size-=this.first.lines.length,this.first=t}while(this.first&&this.size+t.length>r);U.error(`RetryBuffer: ${e-this.size} oldest lines removed to keep buffer size under the limit of ${this.maxLines} lines`)}const i={lines:t,retryCount:e};this.last?(this.last.next=i,this.last=i):(this.first=i,this.last=i,this.scheduleRetry(r)),this.size+=t.length}removeLines(){if(this.first){const t=this.first;return this.first=this.first.next,this.size-=t.lines.length,this.first||(this.last=void 0),t}}scheduleRetry(t){this._timeoutHandle=setTimeout(()=>{const t=this.removeLines();t?this.retryLines(t.lines,t.retryCount).then(()=>{this.scheduleRetry(1)}).catch(t=>{this.scheduleRetry(this.nextRetryTime-Date.now())}):this._timeoutHandle=void 0},t)}flush(){return k(this,void 0,void 0,(function*(){let t;for(;t=this.removeLines();)yield this.retryLines(t.lines,t.retryCount)}))}close(){return this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this.closed=!0,this.size}}class H{constructor(t,e,r){this.maxChunkRecords=t,this.flushFn=e,this.scheduleSend=r,this.length=0,this.lines=new Array(t)}add(t){0===this.length&&this.scheduleSend(),this.lines[this.length]=t,this.length++,this.length>=this.maxChunkRecords&&this.flush().catch(t=>{})}flush(){const t=this.reset();return t.length>0?this.flushFn(t):Promise.resolve()}reset(){const t=this.lines.slice(0,this.length);return this.length=0,t}}class I{constructor(t,e,s,i,n){this.transport=t,this.closed=!1,this.sendOptions={method:"POST",headers:{"content-type":"text/plain; charset=utf-8"}},this._timeoutHandle=void 0,this.httpPath=`/api/v2/write?org=${encodeURIComponent(e)}&bucket=${encodeURIComponent(s)}&precision=${i}`,this.writeOptions=Object.assign(Object.assign({},r),n),this.currentTime=S[i],this.dateToProtocolTimestamp=T[i],this.writeOptions.defaultTags&&this.useDefaultTags(this.writeOptions.defaultTags);var o;this.writeBuffer=new H(this.writeOptions.batchSize,t=>(this._clearFlushTimeout(),this.sendBatch(t,this.writeOptions.maxRetries+1)),()=>{this.writeOptions.flushInterval>0&&(this._clearFlushTimeout(),this.closed||(this._timeoutHandle=setTimeout(()=>this.sendBatch(this.writeBuffer.reset(),this.writeOptions.maxRetries+1).catch(t=>{}),this.writeOptions.flushInterval)))}),this.sendBatch=this.sendBatch.bind(this),this.retryStrategy=(o=this.writeOptions,new z(o)),this.retryBuffer=new M(this.writeOptions.maxBufferLines,this.sendBatch)}sendBatch(t,e){const r=this;return!this.closed&&t.length>0?new Promise((s,i)=>{this.transport.send(this.httpPath,t.join("\n"),this.sendOptions,{error(n){const l=r.writeOptions.writeFailed.call(r,n,t,r.writeOptions.maxRetries+2-e);if(l)l.then(s,i);else{if(!r.closed&&e>1&&(!(n instanceof o)||n.statusCode>=429))return U.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,n),r.retryBuffer.addLines(t,e-1,r.retryStrategy.nextDelay(n)),void i(n);U.error("Write to influx DB failed.",n),i(n)}},complete(){r.retryStrategy.success(),s()}})}):Promise.resolve()}_clearFlushTimeout(){void 0!==this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0)}writeRecord(t){this.writeBuffer.add(t)}writeRecords(t){for(let e=0;e<t.length;e++)this.writeBuffer.add(t[e])}writePoint(t){const e=t.toLineProtocol(this);e&&this.writeBuffer.add(e)}writePoints(t){for(let e=0;e<t.length;e++)this.writePoint(t[e])}flush(){return k(this,void 0,void 0,(function*(){return yield this.writeBuffer.flush(),yield this.retryBuffer.flush()}))}close(){return this.writeBuffer.flush().finally(()=>{const t=this.retryBuffer.close();t&&U.error(`Retry buffer closed with ${t} items that were not written to InfluxDB!`,null),this.closed=!0})}dispose(){this._clearFlushTimeout(),this.closed=!0}useDefaultTags(t){return this.defaultTags=void 0,Object.keys(t).forEach(e=>{(this.defaultTags||(this.defaultTags={}))[e]=y.tag(t[e])}),this}convertTime(t){return void 0===t?this.currentTime():"string"==typeof t?t.length>0?t:void 0:t instanceof Date?this.dateToProtocolTimestamp(t):String("number"==typeof t?Math.floor(t):t)}}const N={concat(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r},toUtf8String(t,e,r){let s,i,n,o,l="",a=e;for(;a<r;)switch(s=t[a++],s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(s);break;case 12:case 13:i=t[a++],l+=String.fromCharCode((31&s)<<6|63&i);break;case 14:i=t[a++],n=t[a++],l+=String.fromCharCode((15&s)<<12|(63&i)<<6|63&n);break;case 15:i=t[a++],n=t[a++],o=t[a++],l+=String.fromCodePoint((7&s)<<18|(63&i)<<12|(63&n)<<6|63&o)}return l},copy(t,e,r){const s=new Uint8Array(r-e);return s.set(t.slice(e,r)),s}};class V{constructor(t){this.connectionOptions=t,this.chunkCombiner=N,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.6.0.nightly"},this.connectionOptions.token&&(this.defaultHeaders.Authorization="Token "+this.connectionOptions.token)}send(t,e,r,s){const i=function(t={}){let e=0;return{next:r=>{0===e&&t.next&&null!=r&&t.next(r)},error:r=>{0===e&&(e=1,t.error&&t.error(r))},complete:()=>{0===e&&(e=2,t.complete&&t.complete())},responseStarted:e=>{t.responseStarted&&t.responseStarted(e)}}}(s);if(s&&s.useCancellable&&!r.signal){const t=new AbortController,e=t.signal;s.useCancellable({cancel(){t.abort()},isCancelled:()=>e.aborted})}this.fetch(t,e,r).then(t=>k(this,void 0,void 0,(function*(){if(null==s?void 0:s.responseStarted){const e={};t.headers.forEach((t,r)=>{const s=e[r];void 0===s?e[r]=t:Array.isArray(s)?s.push(t):e[r]=[s,t]}),i.responseStarted(e)}if(t.status>=300)return t.text().then(e=>{if(!e){const r=t.headers.get("x-influxdb-error");r&&(e=r)}i.error(new o(t.status,t.statusText,e,t.headers.get("retry-after")))}).catch(e=>{U.warn("Unable to receive error body",e),i.error(new o(t.status,t.statusText,void 0,t.headers.get("retry-after")))});if(t.body){const e=t.body.getReader();let r;do{r=yield e.read(),i.next(r.value)}while(!r.done)}else if(t.arrayBuffer){const e=yield t.arrayBuffer();i.next(new Uint8Array(e))}else{const e=yield t.text();i.next((new TextEncoder).encode(e))}}))).catch(t=>i.error(t)).finally(()=>i.complete())}request(t,e,r){return k(this,void 0,void 0,(function*(){const s=yield this.fetch(t,e,r),{status:i,headers:n}=s,l=n.get("content-type")||"";let a=void 0;try{l.includes("json")?a=yield s.json():l.includes("text")&&(a=yield s.text())}catch(t){U.warn("Unable to read error body",t)}if(i>=300){if(!a){const t=n.get("x-influxdb-error");t&&(a=t)}throw new o(i,s.statusText,a,s.headers.get("retry-after"))}return a}))}fetch(t,e,r){const{method:s,headers:i}=r,n= | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self)["@influxdata/influxdb-client"]={})}(this,(function(t){"use strict";const e=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),r=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,writeFailed:function(){},maxRetries:2,maxBufferLines:32e3},e)),s=[404,408,425,429,500,502,503,504];function i(t){return s.includes(t)}class n extends Error{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}}class o extends Error{constructor(t,e,r,s){super(),this.statusCode=t,this.statusMessage=e,this.body=r,Object.setPrototypeOf(this,o.prototype),this.message=r?`${t} ${e} : ${r}`:`${t} ${e}`,this.setRetryAfter(s)}setRetryAfter(t){"string"==typeof t&&/^[0-9]+$/.test(t)?this._retryAfter=parseInt(t):this._retryAfter=0}canRetry(){return i(this.statusCode)}retryAfter(){return this._retryAfter}}const l=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function a(t,e){if(t){let r;return"function"==typeof t.retryAfter?t.retryAfter():(r=0,e&&e>0?r+Math.round(Math.random()*e):r)}return 0}class h extends Error{constructor(){super(),Object.setPrototypeOf(this,h.prototype),this.message="Request timed out"}canRetry(){return!0}retryAfter(){return 0}}class c extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,c.prototype),this.message="Response aborted"}canRetry(){return!0}retryAfter(){return 0}}const u=/[-|\\{()[\]^$+*?.]/g;class f{constructor(t,e=""){this.config=t,this.wrap=e;const r=Object.keys(t).join("|").replace(u,"\\$&");this._re=new RegExp("["+r+"]","g")}escape(t){this._re.lastIndex=0;let e=this._re.lastIndex,r="",s=this._re.exec(t);for(;s;){const i=s[0],n=this.config[i].escapeChar,o=this.config[i].replaceChar;r+=t.slice(e,s.index),r+=null!=o?o:n+i,e=this._re.lastIndex,s=this._re.exec(t)}return 0===e?this.wrap+t+this.wrap:e<t.length?this.wrap+r+t.slice(e)+this.wrap:this.wrap+r+this.wrap}}class d{constructor(t,e){this.escapeChar=t,this.replaceChar=e}}const p=new d("\\"),g=t=>t.escape.bind(t),y={measurement:g(new f({",":p," ":p,"\n":new d(void 0,"\\n"),"\r":new d(void 0,"\\r"),"\t":new d(void 0,"\\t")})),quoted:g(new f({'"':p,"\\\\":p},'"')),tag:g(new f({",":p,"=":p," ":p,"\n":new d(void 0,"\\n"),"\r":new d(void 0,"\\r"),"\t":new d(void 0,"\\t")}))};let m=Date.now(),w=0;function b(){{const t=Date.now();t!==m?(m=t,w=0):w++;const e=String(w);return String(t)+"000000000".substr(0,6-e.length)+e}}function x(){return String(Date.now())+"000000000".substr(0,3)}function v(){return String(Date.now())}function O(){return String(Math.floor(Date.now()/1e3))}const S=Object.freeze({[String("s")]:O,[String("ms")]:v,[String("us")]:x,[String("ns")]:b,seconds:O,millis:v,micros:x,nanos:b}),T={[String("s")]:t=>`${Math.floor(t.getTime()/1e3)}`,[String("ms")]:t=>`${t.getTime()}`,[String("us")]:t=>`${t.getTime()}000`,[String("ns")]:t=>`${t.getTime()}000000`},R=t=>t,E={boolean:t=>"true"===t,unsignedLong:R,long:R,double:t=>+t,string:R,base64Binary:R,dateTime:R,duration:R};class C{constructor(t){t.forEach((t,e)=>t.index=e),this.columns=t}column(t){for(let e=0;e<this.columns.length;e++){const r=this.columns[e];if(r.label===t)return r}throw new n(`Column ${t} not found!`)}toObject(t){const e={};for(let r=0;r<this.columns.length&&r<t.length;r++){let s=t[r];const i=this.columns[r];""===s&&i.defaultValue&&(s=i.defaultValue),e[i.label]=(E[i.dataType]||R)(s)}return e}}class ${static from(t){const e=new $;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const _=Symbol("FLUX_VALUE");class j{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[_](){return this.fluxValue}}function D(t){if(null==t)return"";t=t.toString();let e=void 0,r=0;function s(){void 0===e&&(e=t.substring(0,r))}for(;r<t.length;r++){const i=t.charAt(r);switch(i){case"\r":s(),e+="\\r";break;case"\n":s(),e+="\\n";break;case"\t":s(),e+="\\t";break;case'"':case"\\":s(),e=e+"\\"+i;break;case"$":if(r+1<t.length&&"{"===t.charAt(r+1)){s(),r++,e+="\\${";break}null!=e&&(e+=i);break;default:null!=e&&(e+=i)}}return void 0!==e?e:t}function A(t){const e=String(t);let r=!1;for(const t of e){if("."===t){if(r)throw new Error(`not a flux float: ${e}`);r=!r}if("."!==t&&(t<"0"||t>"9"))throw new Error(`not a flux float: ${e}`)}return e}function L(t){return`regexp.compile(v: "${D(t)}")`}function P(t){return new j(String(t))}function B(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${D(t)}"`:"number"==typeof t?A(t):"object"==typeof t&&"function"==typeof t[_]?t[_]():t instanceof Date?t.toISOString():t instanceof RegExp?L(t):B(t.toString())}function k(t,e,r,s){return new(r||(r=Promise))((function(i,n){function o(t){try{a(s.next(t))}catch(t){n(t)}}function l(t){try{a(s.throw(t))}catch(t){n(t)}}function a(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(o,l)}a((s=s.apply(t,e||[])).next())}))}let F=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const U={error(t,e){F.error(t,e)},warn(t,e){F.warn(t,e)}};class z{constructor(t){this.options=Object.assign(Object.assign({},e),t),this.success()}nextDelay(t){const e=a(t);return e&&e>0?Math.min(e+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):(this.currentDelay?this.currentDelay=Math.min(Math.max(2*this.currentDelay,1)+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):this.currentDelay=this.options.minRetryDelay+Math.round(Math.random()*this.options.retryJitter),this.currentDelay)}success(){this.currentDelay=void 0}}class M{constructor(t,e){this.maxLines=t,this.retryLines=e,this.size=0,this.nextRetryTime=0,this.closed=!1,this._timeoutHandle=void 0}addLines(t,e,r){if(this.closed)return;if(!t.length)return;const s=Date.now()+r;if(s>this.nextRetryTime&&(this.nextRetryTime=s),this.first&&this.size+t.length>this.maxLines){const e=this.size,r=.7*e;do{const t=this.first.next;this.size-=this.first.lines.length,this.first=t}while(this.first&&this.size+t.length>r);U.error(`RetryBuffer: ${e-this.size} oldest lines removed to keep buffer size under the limit of ${this.maxLines} lines`)}const i={lines:t,retryCount:e};this.last?(this.last.next=i,this.last=i):(this.first=i,this.last=i,this.scheduleRetry(r)),this.size+=t.length}removeLines(){if(this.first){const t=this.first;return this.first=this.first.next,this.size-=t.lines.length,this.first||(this.last=void 0),t}}scheduleRetry(t){this._timeoutHandle=setTimeout(()=>{const t=this.removeLines();t?this.retryLines(t.lines,t.retryCount).then(()=>{this.scheduleRetry(1)}).catch(t=>{this.scheduleRetry(this.nextRetryTime-Date.now())}):this._timeoutHandle=void 0},t)}flush(){return k(this,void 0,void 0,(function*(){let t;for(;t=this.removeLines();)yield this.retryLines(t.lines,t.retryCount)}))}close(){return this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this.closed=!0,this.size}}class H{constructor(t,e,r){this.maxChunkRecords=t,this.flushFn=e,this.scheduleSend=r,this.length=0,this.lines=new Array(t)}add(t){0===this.length&&this.scheduleSend(),this.lines[this.length]=t,this.length++,this.length>=this.maxChunkRecords&&this.flush().catch(t=>{})}flush(){const t=this.reset();return t.length>0?this.flushFn(t):Promise.resolve()}reset(){const t=this.lines.slice(0,this.length);return this.length=0,t}}class I{constructor(t,e,s,i,n){this.transport=t,this.closed=!1,this.sendOptions={method:"POST",headers:{"content-type":"text/plain; charset=utf-8"}},this._timeoutHandle=void 0,this.httpPath=`/api/v2/write?org=${encodeURIComponent(e)}&bucket=${encodeURIComponent(s)}&precision=${i}`,this.writeOptions=Object.assign(Object.assign({},r),n),this.currentTime=S[i],this.dateToProtocolTimestamp=T[i],this.writeOptions.defaultTags&&this.useDefaultTags(this.writeOptions.defaultTags);var o;this.writeBuffer=new H(this.writeOptions.batchSize,t=>(this._clearFlushTimeout(),this.sendBatch(t,this.writeOptions.maxRetries+1)),()=>{this.writeOptions.flushInterval>0&&(this._clearFlushTimeout(),this.closed||(this._timeoutHandle=setTimeout(()=>this.sendBatch(this.writeBuffer.reset(),this.writeOptions.maxRetries+1).catch(t=>{}),this.writeOptions.flushInterval)))}),this.sendBatch=this.sendBatch.bind(this),this.retryStrategy=(o=this.writeOptions,new z(o)),this.retryBuffer=new M(this.writeOptions.maxBufferLines,this.sendBatch)}sendBatch(t,e){const r=this;return!this.closed&&t.length>0?new Promise((s,i)=>{this.transport.send(this.httpPath,t.join("\n"),this.sendOptions,{error(n){const l=r.writeOptions.writeFailed.call(r,n,t,r.writeOptions.maxRetries+2-e);if(l)l.then(s,i);else{if(!r.closed&&e>1&&(!(n instanceof o)||n.statusCode>=429))return U.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,n),r.retryBuffer.addLines(t,e-1,r.retryStrategy.nextDelay(n)),void i(n);U.error("Write to influx DB failed.",n),i(n)}},complete(){r.retryStrategy.success(),s()}})}):Promise.resolve()}_clearFlushTimeout(){void 0!==this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0)}writeRecord(t){this.writeBuffer.add(t)}writeRecords(t){for(let e=0;e<t.length;e++)this.writeBuffer.add(t[e])}writePoint(t){const e=t.toLineProtocol(this);e&&this.writeBuffer.add(e)}writePoints(t){for(let e=0;e<t.length;e++)this.writePoint(t[e])}flush(){return k(this,void 0,void 0,(function*(){return yield this.writeBuffer.flush(),yield this.retryBuffer.flush()}))}close(){return this.writeBuffer.flush().finally(()=>{const t=this.retryBuffer.close();t&&U.error(`Retry buffer closed with ${t} items that were not written to InfluxDB!`,null),this.closed=!0})}dispose(){this._clearFlushTimeout(),this.closed=!0}useDefaultTags(t){return this.defaultTags=void 0,Object.keys(t).forEach(e=>{(this.defaultTags||(this.defaultTags={}))[e]=y.tag(t[e])}),this}convertTime(t){return void 0===t?this.currentTime():"string"==typeof t?t.length>0?t:void 0:t instanceof Date?this.dateToProtocolTimestamp(t):String("number"==typeof t?Math.floor(t):t)}}const N={concat(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r},toUtf8String(t,e,r){let s,i,n,o,l="",a=e;for(;a<r;)switch(s=t[a++],s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(s);break;case 12:case 13:i=t[a++],l+=String.fromCharCode((31&s)<<6|63&i);break;case 14:i=t[a++],n=t[a++],l+=String.fromCharCode((15&s)<<12|(63&i)<<6|63&n);break;case 15:i=t[a++],n=t[a++],o=t[a++],l+=String.fromCodePoint((7&s)<<18|(63&i)<<12|(63&n)<<6|63&o)}return l},copy(t,e,r){const s=new Uint8Array(r-e);return s.set(t.slice(e,r)),s}};class V{constructor(t){this.connectionOptions=t,this.chunkCombiner=N,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.6.0.nightly"},this.connectionOptions.token&&(this.defaultHeaders.Authorization="Token "+this.connectionOptions.token)}send(t,e,r,s){const i=function(t={}){let e=0;return{next:r=>{0===e&&t.next&&null!=r&&t.next(r)},error:r=>{0===e&&(e=1,t.error&&t.error(r))},complete:()=>{0===e&&(e=2,t.complete&&t.complete())},responseStarted:e=>{t.responseStarted&&t.responseStarted(e)}}}(s);if(s&&s.useCancellable&&!r.signal){const t=new AbortController,e=t.signal;s.useCancellable({cancel(){t.abort()},isCancelled:()=>e.aborted})}this.fetch(t,e,r).then(t=>k(this,void 0,void 0,(function*(){if(null==s?void 0:s.responseStarted){const e={};t.headers.forEach((t,r)=>{const s=e[r];void 0===s?e[r]=t:Array.isArray(s)?s.push(t):e[r]=[s,t]}),i.responseStarted(e)}if(t.status>=300)return t.text().then(e=>{if(!e){const r=t.headers.get("x-influxdb-error");r&&(e=r)}i.error(new o(t.status,t.statusText,e,t.headers.get("retry-after")))}).catch(e=>{U.warn("Unable to receive error body",e),i.error(new o(t.status,t.statusText,void 0,t.headers.get("retry-after")))});if(t.body){const e=t.body.getReader();let r;do{r=yield e.read(),i.next(r.value)}while(!r.done)}else if(t.arrayBuffer){const e=yield t.arrayBuffer();i.next(new Uint8Array(e))}else{const e=yield t.text();i.next((new TextEncoder).encode(e))}}))).catch(t=>i.error(t)).finally(()=>i.complete())}request(t,e,r){return k(this,void 0,void 0,(function*(){const s=yield this.fetch(t,e,r),{status:i,headers:n}=s,l=n.get("content-type")||"";let a=void 0;try{l.includes("json")?a=yield s.json():l.includes("text")&&(a=yield s.text())}catch(t){U.warn("Unable to read error body",t)}if(i>=300){if(!a){const t=n.get("x-influxdb-error");t&&(a=t)}throw new o(i,s.statusText,a,s.headers.get("retry-after"))}return a}))}fetch(t,e,r){const{method:s,headers:i}=r,n= | ||
/*! ***************************************************************************** | ||
@@ -16,3 +16,3 @@ Copyright (c) Microsoft Corporation. All rights reserved. | ||
***************************************************************************** */ | ||
function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(r[s[i]]=t[s[i]])}return r}(r,["method","headers"]);return fetch(`${this.connectionOptions.url}${t}`,Object.assign({method:s,body:"GET"===s||"HEAD"===s?void 0:"string"==typeof e?e:JSON.stringify(e),headers:Object.assign(Object.assign({},this.defaultHeaders),i),credentials:"omit"},n))}}function q(t,e){return e.toObject(t)}class W{constructor(t,e){this.target=t,this.chunks=e,this.finished=!1}next(t){if(!this.finished)try{this.bufferReceived(t)}catch(t){this.error(t)}}error(t){this.finished||(this.finished=!0,this.target.error(t))}complete(){this.finished||(this.previous&&this.target.next(this.chunks.toUtf8String(this.previous,0,this.previous.length)),this.finished=!0,this.target.complete())}useCancellable(t){this.target.useCancellable&&this.target.useCancellable(t)}bufferReceived(t){let e,r=0;this.previous?(t=this.chunks.concat(this.previous,t),e=this.previous.length):e=0;let s=!1;for(;e<t.length;){const i=t[e];if(10===i){if(!s){const s=e>0&&13===t[e-1]?e-1:e;this.target.next(this.chunks.toUtf8String(t,r,s)),r=e+1}}else 34===i&&(s=!s);e++}this.previous=r<e?this.chunks.copy(t,r,e):void 0}}class J{constructor(){this._reuse=!1}get reuse(){return this._reuse}set reuse(t){t&&!this.reusedValues&&(this.reusedValues=new Array(10)),this._reuse=t}withReuse(){return this.reuse=!0,this}splitLine(t){if(null==t)return this.lastSplitLength=0,[];let e=0,r=0;const s=this._reuse?this.reusedValues:[];let i=0;for(let n=0;n<t.length;n++){const o=t[n];if(","===o){if(e%2==0){const o=this.getValue(t,r,n,e);this._reuse?s[i++]=o:s.push(o),r=n+1,e=0}}else'"'===o&&e++}const n=this.getValue(t,r,t.length,e);return this._reuse?(s[i]=n,this.lastSplitLength=i+1):(s.push(n),this.lastSplitLength=s.length),s}getValue(t,e,r,s){return e===t.length?"":0===s?t.substring(e,r):2===s?t.substring(e+1,r-1):t.substring(e+1,r-1).replace(/""/gi,'"')}}function X(t){const e=(new J).withReuse();let r,s,i=!0,n=0;return{error(e){t.error(e)},next(o){if(""===o)i=!0,r=void 0;else{const l=e.splitLine(o),a=e.lastSplitLength;if(i){if(!r){r=new Array(a);for(let t=0;t<a;t++)r[t]=new $}if(l[0].startsWith("#")){if("#datatype"===l[0])for(let t=1;t<a;t++)r[t].dataType=l[t];else if("#default"===l[0])for(let t=1;t<a;t++)r[t].defaultValue=l[t];else if("#group"===l[0])for(let t=1;t<a;t++)r[t].group="t"===l[t][0]}else{""===l[0]?(n=1,r=r.slice(1)):n=0;for(let t=n;t<a;t++)r[t-n].label=l[t];s=new C(r),i=!1}}else t.next(l.slice(n,a),s)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const G="function"==typeof Symbol&&Symbol.observable||"@@observable";class K{constructor(t,e){this.isClosed=!1;try{e({next:e=>{t.next(e)},error:e=>{this.isClosed=!0,t.error(e)},complete:()=>{this.isClosed=!0,t.complete()},useCancellable:t=>{this.cancellable=t}})}catch(e){this.isClosed=!0,t.error(e)}}get closed(){return this.isClosed}unsubscribe(){var t;null===(t=this.cancellable)||void 0===t||t.cancel(),this.isClosed=!0}}function Q(){}class Y{constructor(t,e){this.executor=t,this.decorator=e}subscribe(t,e,r){const s=function(t){const{next:e,error:r,complete:s}=t;return{next:e?e.bind(t):Q,error:r?r.bind(t):Q,complete:s?s.bind(t):Q}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new K(this.decorator(s),this.executor)}[G](){return this}}const Z={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},tt=t=>t;class et{constructor(t,e){this.transport=t,this.options={org:e}}with(t){return this.options=Object.assign(Object.assign({},this.options),t),this}lines(t){return new Y(this.createExecutor(t),tt)}rows(t){return new Y(this.createExecutor(t),t=>X({next(e,r){t.next({values:e,tableMeta:r})},error(e){t.error(e)},complete(){t.complete()}}))}queryLines(t,e){this.createExecutor(t)(e)}queryRows(t,e){this.createExecutor(t)(X(e))}collectRows(t,e=q){const r=[];return new Promise((s,i)=>{this.queryRows(t,{next(t,s){const i=e.call(this,t,s);void 0!==i&&r.push(i)},error(t){i(t)},complete(){s(r)}})})}collectLines(t){const e=[];return new Promise((r,s)=>{this.queryLines(t,{next(t){e.push(t)},error(t){s(t)},complete(){r(e)}})})}createExecutor(t){const{org:e,type:r,gzip:s}=this.options;return i=>{this.transport.send(`/api/v2/query?org=${encodeURIComponent(e)}`,JSON.stringify(this.decorateRequest({query:t.toString(),dialect:Z,type:r})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":s?"gzip":"identity"}},new W(i,this.transport.chunkCombiner))}}decorateRequest(t){return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=this.options.type||"flux",t}}t.AbortError=c,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=e,t.DEFAULT_WriteOptions=r,t.FLUX_VALUE=j,t.FluxTableColumn=$,t.FluxTableMetaData=C,t.HttpError=o,t.IllegalArgumentError=n,t.InfluxDB=class{constructor(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new n("No url or configuration specified!");this._options=t}const e=this._options.url;if("string"!=typeof e)throw new n("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new V(this._options)}getWriteApi(t,e,r="ns",s){return new I(this.transport,t,e,r,s||this._options.writeOptions)}getQueryApi(t){return new et(this.transport,t)}},t.Point=class{constructor(t){this.tags={},this.fields={},t&&(this.name=t)}measurement(t){return this.name=t,this}tag(t,e){return this.tags[t]=e,this}booleanField(t,e){return this.fields[t]=e?"T":"F",this}intField(t,e){if("number"!=typeof e){let r;if(isNaN(r=parseInt(String(e))))throw new Error(`Expected integer value for field ${t}, but got '${e}'!`);e=r}return this.fields[t]=`${Math.floor(e)}i`,this}floatField(t,e){if("number"!=typeof e){let r;if(isNaN(r=parseFloat(e)))throw new Error(`Expected float value for field ${t}, but got '${e}'!`);e=r}return this.fields[t]=String(e),this}stringField(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=y.quoted(e)),this}timestamp(t){return this.time=t,this}toLineProtocol(t){if(!this.name)return;let e="";if(Object.keys(this.fields).sort().forEach(t=>{if(t){const r=this.fields[t];e.length>0&&(e+=","),e+=`${y.tag(t)}=${r}`}}),0===e.length)return;let r="";const s=t&&t.defaultTags?Object.assign(Object.assign({},t.defaultTags),this.tags):this.tags;Object.keys(s).sort().forEach(t=>{if(t){const e=s[t];e&&(r+=",",r+=`${y.tag(t)}=${y.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${y.measurement(this.name)}${r} ${e}${void 0!==i?" "+i:""}`}toString(){const t=this.toLineProtocol(void 0);return t||`invalid point: ${JSON.stringify(this,void 0)}`}},t.RequestTimedOutError=h,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!l.includes(t.code)))},t.currentTime=S,t.dateToProtocolTimestamp=T,t.escape=y,t.flux=function(t,...e){if(1==t.length&&(!e||0===e.length))return t[0];const r=new Array(t.length+e.length);let s=0;for(let i=0;i<t.length;i++){const n=t[i];if(r[s++]=n,i<e.length){const o=e[i];let l;if(n.endsWith('"')&&i+1<t.length&&t[i+1].startsWith('"'))l=D(o);else if(l=B(o),""===l)throw new Error(`Unsupported parameter literal '${o}' at index: ${i}, type: ${typeof o}`);r[s++]=l}else if(i<t.length-1)throw new Error("Too few parameters supplied!")}return P(r.join(""))},t.fluxBool=function(t){return new _("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new _(function(t){return`time(v: "${D(t)}")`}(t))},t.fluxDuration=function(t){return new _(`duration(v: "${D(t)}")`)},t.fluxExpression=P,t.fluxFloat=function(t){return new _(A(t))},t.fluxInteger=function(t){const e=String(t);for(const t of e)if(t<"0"||t>"9")throw new Error(`not a flux integer: ${e}`);return new _(e)},t.fluxRegExp=function(t){return new _(L(t))},t.fluxString=function(t){return new _(`"${D(t)}"`)},t.getRetryDelay=a,t.isStatusCodeRetriable=i,t.sanitizeFloat=A,t.toFluxValue=B,t.typeSerializers=E,t.useProcessHrtime=function(t){return!1},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(r[s[i]]=t[s[i]])}return r}(r,["method","headers"]);return fetch(`${this.connectionOptions.url}${t}`,Object.assign({method:s,body:"GET"===s||"HEAD"===s?void 0:"string"==typeof e?e:JSON.stringify(e),headers:Object.assign(Object.assign({},this.defaultHeaders),i),credentials:"omit"},n))}}function q(t,e){return e.toObject(t)}class W{constructor(t,e){this.target=t,this.chunks=e,this.finished=!1}next(t){if(!this.finished)try{this.bufferReceived(t)}catch(t){this.error(t)}}error(t){this.finished||(this.finished=!0,this.target.error(t))}complete(){this.finished||(this.previous&&this.target.next(this.chunks.toUtf8String(this.previous,0,this.previous.length)),this.finished=!0,this.target.complete())}useCancellable(t){this.target.useCancellable&&this.target.useCancellable(t)}bufferReceived(t){let e,r=0;this.previous?(t=this.chunks.concat(this.previous,t),e=this.previous.length):e=0;let s=!1;for(;e<t.length;){const i=t[e];if(10===i){if(!s){const s=e>0&&13===t[e-1]?e-1:e;this.target.next(this.chunks.toUtf8String(t,r,s)),r=e+1}}else 34===i&&(s=!s);e++}this.previous=r<e?this.chunks.copy(t,r,e):void 0}}class J{constructor(){this._reuse=!1}get reuse(){return this._reuse}set reuse(t){t&&!this.reusedValues&&(this.reusedValues=new Array(10)),this._reuse=t}withReuse(){return this.reuse=!0,this}splitLine(t){if(null==t)return this.lastSplitLength=0,[];let e=0,r=0;const s=this._reuse?this.reusedValues:[];let i=0;for(let n=0;n<t.length;n++){const o=t[n];if(","===o){if(e%2==0){const o=this.getValue(t,r,n,e);this._reuse?s[i++]=o:s.push(o),r=n+1,e=0}}else'"'===o&&e++}const n=this.getValue(t,r,t.length,e);return this._reuse?(s[i]=n,this.lastSplitLength=i+1):(s.push(n),this.lastSplitLength=s.length),s}getValue(t,e,r,s){return e===t.length?"":0===s?t.substring(e,r):2===s?t.substring(e+1,r-1):t.substring(e+1,r-1).replace(/""/gi,'"')}}function X(t){const e=(new J).withReuse();let r,s,i=!0,n=0;return{error(e){t.error(e)},next(o){if(""===o)i=!0,r=void 0;else{const l=e.splitLine(o),a=e.lastSplitLength;if(i){if(!r){r=new Array(a);for(let t=0;t<a;t++)r[t]=new $}if(l[0].startsWith("#")){if("#datatype"===l[0])for(let t=1;t<a;t++)r[t].dataType=l[t];else if("#default"===l[0])for(let t=1;t<a;t++)r[t].defaultValue=l[t];else if("#group"===l[0])for(let t=1;t<a;t++)r[t].group="t"===l[t][0]}else{""===l[0]?(n=1,r=r.slice(1)):n=0;for(let t=n;t<a;t++)r[t-n].label=l[t];s=new C(r),i=!1}}else t.next(l.slice(n,a),s)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const G="function"==typeof Symbol&&Symbol.observable||"@@observable";class K{constructor(t,e){this.isClosed=!1;try{e({next:e=>{t.next(e)},error:e=>{this.isClosed=!0,t.error(e)},complete:()=>{this.isClosed=!0,t.complete()},useCancellable:t=>{this.cancellable=t}})}catch(e){this.isClosed=!0,t.error(e)}}get closed(){return this.isClosed}unsubscribe(){var t;null===(t=this.cancellable)||void 0===t||t.cancel(),this.isClosed=!0}}function Q(){}class Y{constructor(t,e){this.executor=t,this.decorator=e}subscribe(t,e,r){const s=function(t){const{next:e,error:r,complete:s}=t;return{next:e?e.bind(t):Q,error:r?r.bind(t):Q,complete:s?s.bind(t):Q}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new K(this.decorator(s),this.executor)}[G](){return this}}const Z={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},tt=t=>t;class et{constructor(t,e){this.transport=t,this.options={org:e}}with(t){return this.options=Object.assign(Object.assign({},this.options),t),this}lines(t){return new Y(this.createExecutor(t),tt)}rows(t){return new Y(this.createExecutor(t),t=>X({next(e,r){t.next({values:e,tableMeta:r})},error(e){t.error(e)},complete(){t.complete()}}))}queryLines(t,e){this.createExecutor(t)(e)}queryRows(t,e){this.createExecutor(t)(X(e))}collectRows(t,e=q){const r=[];return new Promise((s,i)=>{this.queryRows(t,{next(t,s){const i=e.call(this,t,s);void 0!==i&&r.push(i)},error(t){i(t)},complete(){s(r)}})})}collectLines(t){const e=[];return new Promise((r,s)=>{this.queryLines(t,{next(t){e.push(t)},error(t){s(t)},complete(){r(e)}})})}createExecutor(t){const{org:e,type:r,gzip:s}=this.options;return i=>{this.transport.send(`/api/v2/query?org=${encodeURIComponent(e)}`,JSON.stringify(this.decorateRequest({query:t.toString(),dialect:Z,type:r})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":s?"gzip":"identity"}},new W(i,this.transport.chunkCombiner))}}decorateRequest(t){return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=this.options.type||"flux",t}}t.AbortError=c,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=e,t.DEFAULT_WriteOptions=r,t.FLUX_VALUE=_,t.FluxTableColumn=$,t.FluxTableMetaData=C,t.HttpError=o,t.IllegalArgumentError=n,t.InfluxDB=class{constructor(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new n("No url or configuration specified!");this._options=t}const e=this._options.url;if("string"!=typeof e)throw new n("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new V(this._options)}getWriteApi(t,e,r="ns",s){return new I(this.transport,t,e,r,s||this._options.writeOptions)}getQueryApi(t){return new et(this.transport,t)}},t.Point=class{constructor(t){this.tags={},this.fields={},t&&(this.name=t)}measurement(t){return this.name=t,this}tag(t,e){return this.tags[t]=e,this}booleanField(t,e){return this.fields[t]=e?"T":"F",this}intField(t,e){if("number"!=typeof e){let r;if(isNaN(r=parseInt(String(e))))throw new Error(`Expected integer value for field ${t}, but got '${e}'!`);e=r}return this.fields[t]=`${Math.floor(e)}i`,this}floatField(t,e){if("number"!=typeof e){let r;if(isNaN(r=parseFloat(e)))throw new Error(`Expected float value for field ${t}, but got '${e}'!`);e=r}return this.fields[t]=String(e),this}stringField(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=y.quoted(e)),this}timestamp(t){return this.time=t,this}toLineProtocol(t){if(!this.name)return;let e="";if(Object.keys(this.fields).sort().forEach(t=>{if(t){const r=this.fields[t];e.length>0&&(e+=","),e+=`${y.tag(t)}=${r}`}}),0===e.length)return;let r="";const s=t&&t.defaultTags?Object.assign(Object.assign({},t.defaultTags),this.tags):this.tags;Object.keys(s).sort().forEach(t=>{if(t){const e=s[t];e&&(r+=",",r+=`${y.tag(t)}=${y.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${y.measurement(this.name)}${r} ${e}${void 0!==i?" "+i:""}`}toString(){const t=this.toLineProtocol(void 0);return t||`invalid point: ${JSON.stringify(this,void 0)}`}},t.RequestTimedOutError=h,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!l.includes(t.code)))},t.currentTime=S,t.dateToProtocolTimestamp=T,t.escape=y,t.flux=function(t,...e){if(1==t.length&&(!e||0===e.length))return t[0];const r=new Array(t.length+e.length);let s=0;for(let i=0;i<t.length;i++){const n=t[i];if(r[s++]=n,i<e.length){const o=e[i];let l;if(n.endsWith('"')&&i+1<t.length&&t[i+1].startsWith('"'))l=D(o);else if(l=B(o),""===l)throw new Error(`Unsupported parameter literal '${o}' at index: ${i}, type: ${typeof o}`);r[s++]=l}else if(i<t.length-1)throw new Error("Too few parameters supplied!")}return P(r.join(""))},t.fluxBool=function(t){return new j("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new j(function(t){return`time(v: "${D(t)}")`}(t))},t.fluxDuration=function(t){return new j(`duration(v: "${D(t)}")`)},t.fluxExpression=P,t.fluxFloat=function(t){return new j(A(t))},t.fluxInteger=function(t){const e=String(t);for(const t of e)if(t<"0"||t>"9")throw new Error(`not a flux integer: ${e}`);return new j(e)},t.fluxRegExp=function(t){return new j(L(t))},t.fluxString=function(t){return new j(`"${D(t)}"`)},t.getRetryDelay=a,t.isStatusCodeRetriable=i,t.sanitizeFloat=A,t.toFluxValue=B,t.typeSerializers=E,t.useProcessHrtime=function(t){return!1},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.browser.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("url"),s=require("http"),r=require("https"),i=require("buffer"),n=(t=require("zlib"))&&"object"==typeof t&&"default"in t?t.default:t;const o={timeout:1e4},l=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),h=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,writeFailed:function(){},maxRetries:2,maxBufferLines:32e3},l)),a=[404,408,425,429,500,502,503,504];function u(t){return a.includes(t)}class c extends Error{constructor(t){super(t),Object.setPrototypeOf(this,c.prototype)}}class f extends Error{constructor(t,e,s,r){super(),this.statusCode=t,this.statusMessage=e,this.body=s,Object.setPrototypeOf(this,f.prototype),this.message=s?`${t} ${e} : ${s}`:`${t} ${e}`,this.setRetryAfter(r)}setRetryAfter(t){"string"==typeof t&&/^[0-9]+$/.test(t)?this._retryAfter=parseInt(t):this._retryAfter=0}canRetry(){return u(this.statusCode)}retryAfter(){return this._retryAfter}}const p=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function d(t,e){if(t){let s;return"function"==typeof t.retryAfter?t.retryAfter():(s=0,e&&e>0?s+Math.round(Math.random()*e):s)}return 0}class g extends Error{constructor(){super(),Object.setPrototypeOf(this,g.prototype),this.message="Request timed out"}canRetry(){return!0}retryAfter(){return 0}}class m extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,m.prototype),this.message="Response aborted"}canRetry(){return!0}retryAfter(){return 0}}const y=/[-|\\{()[\]^$+*?.]/g;class w{constructor(t,e=""){this.config=t,this.wrap=e;const s=Object.keys(t).join("|").replace(y,"\\$&");this._re=new RegExp("["+s+"]","g")}escape(t){this._re.lastIndex=0;let e=this._re.lastIndex,s="",r=this._re.exec(t);for(;r;){const i=r[0],n=this.config[i].escapeChar,o=this.config[i].replaceChar;s+=t.slice(e,r.index),s+=null!=o?o:n+i,e=this._re.lastIndex,r=this._re.exec(t)}return 0===e?this.wrap+t+this.wrap:e<t.length?this.wrap+s+t.slice(e)+this.wrap:this.wrap+s+this.wrap}}class x{constructor(t,e){this.escapeChar=t,this.replaceChar=e}}const b=new x("\\"),S=t=>t.escape.bind(t),O={measurement:S(new w({",":b," ":b,"\n":new x(void 0,"\\n"),"\r":new x(void 0,"\\r"),"\t":new x(void 0,"\\t")})),quoted:S(new w({'"':b,"\\\\":b},'"')),tag:S(new w({",":b,"=":b," ":b,"\n":new x(void 0,"\\n"),"\r":new x(void 0,"\\r"),"\t":new x(void 0,"\\t")}))};let v=!1;function T(t){return v=t&&process&&"function"==typeof process.hrtime}T(!0);let R=void 0,E=void 0,$=Date.now(),_=0;function C(){if(v){const t=process.hrtime();let e=Date.now();E?(t[0]=t[0]-E[0],t[1]=t[1]-E[1],t[1]<0&&(t[0]-=1,t[1]+=1e9),e=R+1e3*t[0]+Math.floor(t[1]/1e6)):(E=t,R=e);const s=String(t[1]%1e6);return String(e)+"000000000".substr(0,6-s.length)+s}{const t=Date.now();t!==$?($=t,_=0):_++;const e=String(_);return String(t)+"000000000".substr(0,6-e.length)+e}}function j(){if(v){const t=process.hrtime(),e=String(Math.trunc(t[1]/1e3)%1e3);return String(Date.now())+"000000000".substr(0,3-e.length)+e}return String(Date.now())+"000000000".substr(0,3)}function D(){return String(Date.now())}function L(){return String(Math.floor(Date.now()/1e3))}const A=Object.freeze({[String("s")]:L,[String("ms")]:D,[String("us")]:j,[String("ns")]:C,seconds:L,millis:D,micros:j,nanos:C}),B={[String("s")]:t=>`${Math.floor(t.getTime()/1e3)}`,[String("ms")]:t=>`${t.getTime()}`,[String("us")]:t=>`${t.getTime()}000`,[String("ns")]:t=>`${t.getTime()}000000`},P=t=>t,F={boolean:t=>"true"===t,unsignedLong:P,long:P,double:t=>+t,string:P,base64Binary:P,dateTime:P,duration:P};class q{constructor(t){t.forEach((t,e)=>t.index=e),this.columns=t}column(t){for(let e=0;e<this.columns.length;e++){const s=this.columns[e];if(s.label===t)return s}throw new c(`Column ${t} not found!`)}toObject(t){const e={};for(let s=0;s<this.columns.length&&s<t.length;s++){let r=t[s];const i=this.columns[s];""===r&&i.defaultValue&&(r=i.defaultValue),e[i.label]=(F[i.dataType]||P)(r)}return e}}class M{static from(t){const e=new M;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const U=Symbol("FLUX_VALUE");class k{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[U](){return this.fluxValue}}function z(t){if(null==t)return"";t=t.toString();let e=void 0,s=0;function r(){void 0===e&&(e=t.substring(0,s))}for(;s<t.length;s++){const i=t.charAt(s);switch(i){case"\r":r(),e+="\\r";break;case"\n":r(),e+="\\n";break;case"\t":r(),e+="\\t";break;case'"':case"\\":r(),e=e+"\\"+i;break;case"$":if(s+1<t.length&&"{"===t.charAt(s+1)){r(),s++,e+="\\${";break}null!=e&&(e+=i);break;default:null!=e&&(e+=i)}}return void 0!==e?e:t}function N(t){const e=String(t);let s=!1;for(const t of e){if("."===t){if(s)throw new Error(`not a flux float: ${e}`);s=!s}if("."!==t&&(t<"0"||t>"9"))throw new Error(`not a flux float: ${e}`)}return e}function I(t){return`regexp.compile(v: "${z(t)}")`}function H(t){return new k(String(t))}function V(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${z(t)}"`:"number"==typeof t?N(t):"object"==typeof t&&"function"==typeof t[U]?t[U]():t instanceof Date?t.toISOString():t instanceof RegExp?I(t):Array.isArray(t)?`[${t.map(V).join(",")}]`:V(t.toString())} | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("url"),s=require("http"),r=require("https"),i=require("buffer"),n=(t=require("zlib"))&&"object"==typeof t&&"default"in t?t.default:t;const o={timeout:1e4},l=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),h=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,writeFailed:function(){},maxRetries:2,maxBufferLines:32e3},l)),a=[404,408,425,429,500,502,503,504];function u(t){return a.includes(t)}class c extends Error{constructor(t){super(t),Object.setPrototypeOf(this,c.prototype)}}class f extends Error{constructor(t,e,s,r){super(),this.statusCode=t,this.statusMessage=e,this.body=s,Object.setPrototypeOf(this,f.prototype),this.message=s?`${t} ${e} : ${s}`:`${t} ${e}`,this.setRetryAfter(r)}setRetryAfter(t){"string"==typeof t&&/^[0-9]+$/.test(t)?this._retryAfter=parseInt(t):this._retryAfter=0}canRetry(){return u(this.statusCode)}retryAfter(){return this._retryAfter}}const p=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function d(t,e){if(t){let s;return"function"==typeof t.retryAfter?t.retryAfter():(s=0,e&&e>0?s+Math.round(Math.random()*e):s)}return 0}class g extends Error{constructor(){super(),Object.setPrototypeOf(this,g.prototype),this.message="Request timed out"}canRetry(){return!0}retryAfter(){return 0}}class m extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,m.prototype),this.message="Response aborted"}canRetry(){return!0}retryAfter(){return 0}}const y=/[-|\\{()[\]^$+*?.]/g;class w{constructor(t,e=""){this.config=t,this.wrap=e;const s=Object.keys(t).join("|").replace(y,"\\$&");this._re=new RegExp("["+s+"]","g")}escape(t){this._re.lastIndex=0;let e=this._re.lastIndex,s="",r=this._re.exec(t);for(;r;){const i=r[0],n=this.config[i].escapeChar,o=this.config[i].replaceChar;s+=t.slice(e,r.index),s+=null!=o?o:n+i,e=this._re.lastIndex,r=this._re.exec(t)}return 0===e?this.wrap+t+this.wrap:e<t.length?this.wrap+s+t.slice(e)+this.wrap:this.wrap+s+this.wrap}}class x{constructor(t,e){this.escapeChar=t,this.replaceChar=e}}const b=new x("\\"),S=t=>t.escape.bind(t),O={measurement:S(new w({",":b," ":b,"\n":new x(void 0,"\\n"),"\r":new x(void 0,"\\r"),"\t":new x(void 0,"\\t")})),quoted:S(new w({'"':b,"\\\\":b},'"')),tag:S(new w({",":b,"=":b," ":b,"\n":new x(void 0,"\\n"),"\r":new x(void 0,"\\r"),"\t":new x(void 0,"\\t")}))};let v=!1;function T(t){return v=t&&process&&"function"==typeof process.hrtime}T(!0);let R=void 0,E=void 0,$=Date.now(),_=0;function C(){if(v){const t=process.hrtime();let e=Date.now();E?(t[0]=t[0]-E[0],t[1]=t[1]-E[1],t[1]<0&&(t[0]-=1,t[1]+=1e9),e=R+1e3*t[0]+Math.floor(t[1]/1e6)):(E=t,R=e);const s=String(t[1]%1e6);return String(e)+"000000000".substr(0,6-s.length)+s}{const t=Date.now();t!==$?($=t,_=0):_++;const e=String(_);return String(t)+"000000000".substr(0,6-e.length)+e}}function j(){if(v){const t=process.hrtime(),e=String(Math.trunc(t[1]/1e3)%1e3);return String(Date.now())+"000000000".substr(0,3-e.length)+e}return String(Date.now())+"000000000".substr(0,3)}function D(){return String(Date.now())}function L(){return String(Math.floor(Date.now()/1e3))}const A=Object.freeze({[String("s")]:L,[String("ms")]:D,[String("us")]:j,[String("ns")]:C,seconds:L,millis:D,micros:j,nanos:C}),B={[String("s")]:t=>`${Math.floor(t.getTime()/1e3)}`,[String("ms")]:t=>`${t.getTime()}`,[String("us")]:t=>`${t.getTime()}000`,[String("ns")]:t=>`${t.getTime()}000000`},P=t=>t,F={boolean:t=>"true"===t,unsignedLong:P,long:P,double:t=>+t,string:P,base64Binary:P,dateTime:P,duration:P};class q{constructor(t){t.forEach((t,e)=>t.index=e),this.columns=t}column(t){for(let e=0;e<this.columns.length;e++){const s=this.columns[e];if(s.label===t)return s}throw new c(`Column ${t} not found!`)}toObject(t){const e={};for(let s=0;s<this.columns.length&&s<t.length;s++){let r=t[s];const i=this.columns[s];""===r&&i.defaultValue&&(r=i.defaultValue),e[i.label]=(F[i.dataType]||P)(r)}return e}}class M{static from(t){const e=new M;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const U=Symbol("FLUX_VALUE");class k{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[U](){return this.fluxValue}}function z(t){if(null==t)return"";t=t.toString();let e=void 0,s=0;function r(){void 0===e&&(e=t.substring(0,s))}for(;s<t.length;s++){const i=t.charAt(s);switch(i){case"\r":r(),e+="\\r";break;case"\n":r(),e+="\\n";break;case"\t":r(),e+="\\t";break;case'"':case"\\":r(),e=e+"\\"+i;break;case"$":if(s+1<t.length&&"{"===t.charAt(s+1)){r(),s++,e+="\\${";break}null!=e&&(e+=i);break;default:null!=e&&(e+=i)}}return void 0!==e?e:t}function N(t){const e=String(t);let s=!1;for(const t of e){if("."===t){if(s)throw new Error(`not a flux float: ${e}`);s=!s}if("."!==t&&(t<"0"||t>"9"))throw new Error(`not a flux float: ${e}`)}return e}function I(t){return`regexp.compile(v: "${z(t)}")`}function H(t){return new k(String(t))}function V(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${z(t)}"`:"number"==typeof t?N(t):"object"==typeof t&&"function"==typeof t[U]?t[U]():t instanceof Date?t.toISOString():t instanceof RegExp?I(t):V(t.toString())} | ||
/*! ***************************************************************************** | ||
@@ -3,0 +3,0 @@ Copyright (c) Microsoft Corporation. All rights reserved. |
@@ -15,3 +15,3 @@ var influxdb=function(t){"use strict"; | ||
and limitations under the License. | ||
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var s=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),u=Object.freeze(n({batchSize:1e3,flushInterval:6e4,writeFailed:function(){},maxRetries:2,maxBufferLines:32e3},s)),a=[404,408,425,429,500,502,503,504];function c(t){return a.includes(t)}var f=function(t){function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return r(e,t),e}(Error),l=function(t){function e(r,n,i,o){var s=t.call(this)||this;return s.statusCode=r,s.statusMessage=n,s.body=i,Object.setPrototypeOf(s,e.prototype),s.message=i?r+" "+n+" : "+i:r+" "+n,s.setRetryAfter(o),s}return r(e,t),e.prototype.setRetryAfter=function(t){"string"==typeof t&&/^[0-9]+$/.test(t)?this._retryAfter=parseInt(t):this._retryAfter=0},e.prototype.canRetry=function(){return c(this.statusCode)},e.prototype.retryAfter=function(){return this._retryAfter},e}(Error),h=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function p(t,e){if(t){var r=void 0;return"function"==typeof t.retryAfter?t.retryAfter():(r=0,e&&e>0?r+Math.round(Math.random()*e):r)}return 0}var d,y,g=function(t){function e(){var r=t.call(this)||this;return Object.setPrototypeOf(r,e.prototype),r.message="Request timed out",r}return r(e,t),e.prototype.canRetry=function(){return!0},e.prototype.retryAfter=function(){return 0},e}(Error),v=function(t){function e(){var r=t.call(this)||this;return r.name="AbortError",Object.setPrototypeOf(r,e.prototype),r.message="Response aborted",r}return r(e,t),e.prototype.canRetry=function(){return!0},e.prototype.retryAfter=function(){return 0},e}(Error),m=/[-|\\{()[\]^$+*?.]/g,w=function(){function t(t,e){void 0===e&&(e=""),this.config=t,this.wrap=e;var r=Object.keys(t).join("|").replace(m,"\\$&");this._re=new RegExp("["+r+"]","g")}return t.prototype.escape=function(t){this._re.lastIndex=0;for(var e=this._re.lastIndex,r="",n=this._re.exec(t);n;){var i=n[0],o=this.config[i].escapeChar,s=this.config[i].replaceChar;r+=t.slice(e,n.index),r+=null!=s?s:o+i,e=this._re.lastIndex,n=this._re.exec(t)}return 0===e?this.wrap+t+this.wrap:e<t.length?this.wrap+r+t.slice(e)+this.wrap:this.wrap+r+this.wrap},t}(),b=function(t,e){this.escapeChar=t,this.replaceChar=e},x=new b("\\"),O=function(t){return t.escape.bind(t)},S={measurement:O(new w({",":x," ":x,"\n":new b(void 0,"\\n"),"\r":new b(void 0,"\\r"),"\t":new b(void 0,"\\t")})),quoted:O(new w({'"':x,"\\\\":x},'"')),tag:O(new w({",":x,"=":x," ":x,"\n":new b(void 0,"\\n"),"\r":new b(void 0,"\\r"),"\t":new b(void 0,"\\t")}))};var T=Date.now(),R=0;function E(){var t=Date.now();t!==T?(T=t,R=0):R++;var e=String(R);return String(t)+"000000000".substr(0,6-e.length)+e}function C(){return String(Date.now())+"000000000".substr(0,3)}function _(){return String(Date.now())}function D(){return String(Math.floor(Date.now()/1e3))}var A=Object.freeze(((d={})[String("s")]=D,d[String("ms")]=_,d[String("us")]=C,d[String("ns")]=E,d.seconds=D,d.millis=_,d.micros=C,d.nanos=E,d)),P=((y={})[String("s")]=function(t){return""+Math.floor(t.getTime()/1e3)},y[String("ms")]=function(t){return""+t.getTime()},y[String("us")]=function(t){return t.getTime()+"000"},y[String("ns")]=function(t){return t.getTime()+"000000"},y),j=function(t){return t},L={boolean:function(t){return"true"===t},unsignedLong:j,long:j,double:function(t){return+t},string:j,base64Binary:j,dateTime:j,duration:j},k=function(){function t(t){t.forEach((function(t,e){return t.index=e})),this.columns=t}return t.prototype.column=function(t){for(var e=0;e<this.columns.length;e++){var r=this.columns[e];if(r.label===t)return r}throw new f("Column "+t+" not found!")},t.prototype.toObject=function(t){for(var e={},r=0;r<this.columns.length&&r<t.length;r++){var n=t[r],i=this.columns[r];""===n&&i.defaultValue&&(n=i.defaultValue),e[i.label]=(L[i.dataType]||j)(n)}return e},t}(),B=function(){function t(){}return t.from=function(e){var r=new t;return r.label=e.label,r.dataType=e.dataType,r.group=Boolean(e.group),r.defaultValue=e.defaultValue||"",r},t}(),F=Symbol("FLUX_VALUE"),U=function(){function t(t){this.fluxValue=t}return t.prototype.toString=function(){return this.fluxValue},t.prototype[F]=function(){return this.fluxValue},t}();function z(t){if(null==t)return"";t=t.toString();var e=void 0,r=0;function n(){void 0===e&&(e=t.substring(0,r))}for(;r<t.length;r++){var i=t.charAt(r);switch(i){case"\r":n(),e+="\\r";break;case"\n":n(),e+="\\n";break;case"\t":n(),e+="\\t";break;case'"':case"\\":n(),e=e+"\\"+i;break;case"$":if(r+1<t.length&&"{"===t.charAt(r+1)){n(),r++,e+="\\${";break}null!=e&&(e+=i);break;default:null!=e&&(e+=i)}}return void 0!==e?e:t}function H(t){for(var e=String(t),r=!1,n=0,i=e;n<i.length;n++){var o=i[n];if("."===o){if(r)throw new Error("not a flux float: "+e);r=!r}if("."!==o&&(o<"0"||o>"9"))throw new Error("not a flux float: "+e)}return e}function I(t){return'regexp.compile(v: "'+z(t)+'")'}function M(t){return new U(String(t))}function N(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?'"'+z(t)+'"':"number"==typeof t?H(t):"object"==typeof t&&"function"==typeof t[F]?t[F]():t instanceof Date?t.toISOString():t instanceof RegExp?I(t):Array.isArray(t)?"["+t.map(N).join(",")+"]":N(t.toString())}var V=function(){function t(t){this.tags={},this.fields={},t&&(this.name=t)}return t.prototype.measurement=function(t){return this.name=t,this},t.prototype.tag=function(t,e){return this.tags[t]=e,this},t.prototype.booleanField=function(t,e){return this.fields[t]=e?"T":"F",this},t.prototype.intField=function(t,e){if("number"!=typeof e){var r;if(isNaN(r=parseInt(String(e))))throw new Error("Expected integer value for field "+t+", but got '"+e+"'!");e=r}return this.fields[t]=Math.floor(e)+"i",this},t.prototype.floatField=function(t,e){if("number"!=typeof e){var r;if(isNaN(r=parseFloat(e)))throw new Error("Expected float value for field "+t+", but got '"+e+"'!");e=r}return this.fields[t]=String(e),this},t.prototype.stringField=function(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=S.quoted(e)),this},t.prototype.timestamp=function(t){return this.time=t,this},t.prototype.toLineProtocol=function(t){var e=this;if(this.name){var r="";if(Object.keys(this.fields).sort().forEach((function(t){if(t){var n=e.fields[t];r.length>0&&(r+=","),r+=S.tag(t)+"="+n}})),0!==r.length){var i="",o=t&&t.defaultTags?n(n({},t.defaultTags),this.tags):this.tags;Object.keys(o).sort().forEach((function(t){if(t){var e=o[t];e&&(i+=",",i+=S.tag(t)+"="+S.tag(e))}}));var s=this.time;return t&&t.convertTime&&(s=t.convertTime(s)),""+S.measurement(this.name)+i+" "+r+(void 0!==s?" "+s:"")}}},t.prototype.toString=function(){var t=this.toLineProtocol(void 0);return t||"invalid point: "+JSON.stringify(this,void 0)},t}(),q=Object.freeze({error:function(t,e){console.error("ERROR: "+t,e||"")},warn:function(t,e){console.warn("WARN: "+t,e||"")}}),W=function(t,e){q.error(t,e)},J=function(t,e){q.warn(t,e)},$=function(){function t(t){this.options=n(n({},s),t),this.success()}return t.prototype.nextDelay=function(t){var e=p(t);return e&&e>0?Math.min(e+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):(this.currentDelay?this.currentDelay=Math.min(Math.max(2*this.currentDelay,1)+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):this.currentDelay=this.options.minRetryDelay+Math.round(Math.random()*this.options.retryJitter),this.currentDelay)},t.prototype.success=function(){this.currentDelay=void 0},t}();var G=function(){function t(t,e){this.maxLines=t,this.retryLines=e,this.size=0,this.nextRetryTime=0,this.closed=!1,this._timeoutHandle=void 0}return t.prototype.addLines=function(t,e,r){if(!this.closed&&t.length){var n=Date.now()+r;if(n>this.nextRetryTime&&(this.nextRetryTime=n),this.first&&this.size+t.length>this.maxLines){var i=this.size,o=.7*i;do{var s=this.first.next;this.size-=this.first.lines.length,this.first=s}while(this.first&&this.size+t.length>o);W("RetryBuffer: "+(i-this.size)+" oldest lines removed to keep buffer size under the limit of "+this.maxLines+" lines")}var u={lines:t,retryCount:e};this.last?(this.last.next=u,this.last=u):(this.first=u,this.last=u,this.scheduleRetry(r)),this.size+=t.length}},t.prototype.removeLines=function(){if(this.first){var t=this.first;return this.first=this.first.next,this.size-=t.lines.length,this.first||(this.last=void 0),t}},t.prototype.scheduleRetry=function(t){var e=this;this._timeoutHandle=setTimeout((function(){var t=e.removeLines();t?e.retryLines(t.lines,t.retryCount).then((function(){e.scheduleRetry(1)})).catch((function(t){e.scheduleRetry(e.nextRetryTime-Date.now())})):e._timeoutHandle=void 0}),t)},t.prototype.flush=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return(t=this.removeLines())?[4,this.retryLines(t.lines,t.retryCount)]:[3,2];case 1:return e.sent(),[3,0];case 2:return[2]}}))}))},t.prototype.close=function(){return this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this.closed=!0,this.size},t}(),X=function(){function t(t,e,r){this.maxChunkRecords=t,this.flushFn=e,this.scheduleSend=r,this.length=0,this.lines=new Array(t)}return t.prototype.add=function(t){0===this.length&&this.scheduleSend(),this.lines[this.length]=t,this.length++,this.length>=this.maxChunkRecords&&this.flush().catch((function(t){}))},t.prototype.flush=function(){var t=this.reset();return t.length>0?this.flushFn(t):Promise.resolve()},t.prototype.reset=function(){var t=this.lines.slice(0,this.length);return this.length=0,t},t}(),K=function(){function t(t,e,r,i,o){var s=this;this.transport=t,this.closed=!1,this.sendOptions={method:"POST",headers:{"content-type":"text/plain; charset=utf-8"}},this._timeoutHandle=void 0,this.httpPath="/api/v2/write?org="+encodeURIComponent(e)+"&bucket="+encodeURIComponent(r)+"&precision="+i,this.writeOptions=n(n({},u),o),this.currentTime=A[i],this.dateToProtocolTimestamp=P[i],this.writeOptions.defaultTags&&this.useDefaultTags(this.writeOptions.defaultTags);var a;this.writeBuffer=new X(this.writeOptions.batchSize,(function(t){return s._clearFlushTimeout(),s.sendBatch(t,s.writeOptions.maxRetries+1)}),(function(){s.writeOptions.flushInterval>0&&(s._clearFlushTimeout(),s.closed||(s._timeoutHandle=setTimeout((function(){return s.sendBatch(s.writeBuffer.reset(),s.writeOptions.maxRetries+1).catch((function(t){}))}),s.writeOptions.flushInterval)))})),this.sendBatch=this.sendBatch.bind(this),this.retryStrategy=(a=this.writeOptions,new $(a)),this.retryBuffer=new G(this.writeOptions.maxBufferLines,this.sendBatch)}return t.prototype.sendBatch=function(t,e){var r=this,n=this;return!this.closed&&t.length>0?new Promise((function(i,o){r.transport.send(r.httpPath,t.join("\n"),r.sendOptions,{error:function(r){var s=n.writeOptions.writeFailed.call(n,r,t,n.writeOptions.maxRetries+2-e);if(s)s.then(i,o);else{if(!n.closed&&e>1&&(!(r instanceof l)||r.statusCode>=429))return J("Write to influx DB failed (remaining attempts: "+(e-1)+").",r),n.retryBuffer.addLines(t,e-1,n.retryStrategy.nextDelay(r)),void o(r);W("Write to influx DB failed.",r),o(r)}},complete:function(){n.retryStrategy.success(),i()}})})):Promise.resolve()},t.prototype._clearFlushTimeout=function(){void 0!==this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0)},t.prototype.writeRecord=function(t){this.writeBuffer.add(t)},t.prototype.writeRecords=function(t){for(var e=0;e<t.length;e++)this.writeBuffer.add(t[e])},t.prototype.writePoint=function(t){var e=t.toLineProtocol(this);e&&this.writeBuffer.add(e)},t.prototype.writePoints=function(t){for(var e=0;e<t.length;e++)this.writePoint(t[e])},t.prototype.flush=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.writeBuffer.flush()];case 1:return t.sent(),[4,this.retryBuffer.flush()];case 2:return[2,t.sent()]}}))}))},t.prototype.close=function(){var t=this;return this.writeBuffer.flush().finally((function(){var e=t.retryBuffer.close();e&&W("Retry buffer closed with "+e+" items that were not written to InfluxDB!",null),t.closed=!0}))},t.prototype.dispose=function(){this._clearFlushTimeout(),this.closed=!0},t.prototype.useDefaultTags=function(t){var e=this;return this.defaultTags=void 0,Object.keys(t).forEach((function(r){(e.defaultTags||(e.defaultTags={}))[r]=S.tag(t[r])})),this},t.prototype.convertTime=function(t){return void 0===t?this.currentTime():"string"==typeof t?t.length>0?t:void 0:t instanceof Date?this.dateToProtocolTimestamp(t):String("number"==typeof t?Math.floor(t):t)},t}(),Q={concat:function(t,e){var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r},toUtf8String:function(t,e,r){for(var n,i,o,s,u="",a=e;a<r;)switch((n=t[a++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(n);break;case 12:case 13:i=t[a++],u+=String.fromCharCode((31&n)<<6|63&i);break;case 14:i=t[a++],o=t[a++],u+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o);break;case 15:i=t[a++],o=t[a++],s=t[a++],u+=String.fromCodePoint((7&n)<<18|(63&i)<<12|(63&o)<<6|63&s)}return u},copy:function(t,e,r){var n=new Uint8Array(r-e);return n.set(t.slice(e,r)),n}};var Y=function(){function t(t){this.connectionOptions=t,this.chunkCombiner=Q,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.6.0.nightly"},this.connectionOptions.token&&(this.defaultHeaders.Authorization="Token "+this.connectionOptions.token)}return t.prototype.send=function(t,e,r,n){var s=this,u=function(t){void 0===t&&(t={});var e=0;return{next:function(r){0===e&&t.next&&null!=r&&t.next(r)},error:function(r){0===e&&(e=1,t.error&&t.error(r))},complete:function(){0===e&&(e=2,t.complete&&t.complete())},responseStarted:function(e){t.responseStarted&&t.responseStarted(e)}}}(n);if(n&&n.useCancellable&&!r.signal){var a=new AbortController,c=a.signal;n.useCancellable({cancel:function(){a.abort()},isCancelled:function(){return c.aborted}})}this.fetch(t,e,r).then((function(t){return i(s,void 0,void 0,(function(){var e,r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return(null==n?void 0:n.responseStarted)&&(e={},t.headers.forEach((function(t,r){var n=e[r];void 0===n?e[r]=t:Array.isArray(n)?n.push(t):e[r]=[n,t]})),u.responseStarted(e)),t.status>=300?[2,t.text().then((function(e){if(!e){var r=t.headers.get("x-influxdb-error");r&&(e=r)}u.error(new l(t.status,t.statusText,e,t.headers.get("retry-after")))})).catch((function(e){J("Unable to receive error body",e),u.error(new l(t.status,t.statusText,void 0,t.headers.get("retry-after")))}))]:[3,1];case 1:if(!t.body)return[3,6];r=t.body.getReader(),i=void 0,o.label=2;case 2:return[4,r.read()];case 3:i=o.sent(),u.next(i.value),o.label=4;case 4:if(!i.done)return[3,2];o.label=5;case 5:return[3,10];case 6:return t.arrayBuffer?[4,t.arrayBuffer()]:[3,8];case 7:return s=o.sent(),u.next(new Uint8Array(s)),[3,10];case 8:return[4,t.text()];case 9:a=o.sent(),u.next((new TextEncoder).encode(a)),o.label=10;case 10:return[2]}}))}))})).catch((function(t){return u.error(t)})).finally((function(){return u.complete()}))},t.prototype.request=function(t,e,r){return i(this,void 0,void 0,(function(){var n,i,s,u,a,c,f;return o(this,(function(o){switch(o.label){case 0:return[4,this.fetch(t,e,r)];case 1:n=o.sent(),i=n.status,s=n.headers,u=s.get("content-type")||"",a=void 0,o.label=2;case 2:return o.trys.push([2,7,,8]),u.includes("json")?[4,n.json()]:[3,4];case 3:return a=o.sent(),[3,6];case 4:return u.includes("text")?[4,n.text()]:[3,6];case 5:a=o.sent(),o.label=6;case 6:return[3,8];case 7:return c=o.sent(),J("Unable to read error body",c),[3,8];case 8:if(i>=300)throw a||(f=s.get("x-influxdb-error"))&&(a=f),new l(i,n.statusText,a,n.headers.get("retry-after"));return[2,a]}}))}))},t.prototype.fetch=function(t,e,r){var i=r.method,o=r.headers,s=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(r,["method","headers"]);return fetch(""+this.connectionOptions.url+t,n({method:i,body:"GET"===i||"HEAD"===i?void 0:"string"==typeof e?e:JSON.stringify(e),headers:n(n({},this.defaultHeaders),o),credentials:"omit"},s))},t}();function Z(t,e){return e.toObject(t)}var tt=function(){function t(t,e){this.target=t,this.chunks=e,this.finished=!1}return t.prototype.next=function(t){if(!this.finished)try{this.bufferReceived(t)}catch(t){this.error(t)}},t.prototype.error=function(t){this.finished||(this.finished=!0,this.target.error(t))},t.prototype.complete=function(){this.finished||(this.previous&&this.target.next(this.chunks.toUtf8String(this.previous,0,this.previous.length)),this.finished=!0,this.target.complete())},t.prototype.useCancellable=function(t){this.target.useCancellable&&this.target.useCancellable(t)},t.prototype.bufferReceived=function(t){var e,r=0;this.previous?(t=this.chunks.concat(this.previous,t),e=this.previous.length):e=0;for(var n=!1;e<t.length;){var i=t[e];if(10===i){if(!n){var o=e>0&&13===t[e-1]?e-1:e;this.target.next(this.chunks.toUtf8String(t,r,o)),r=e+1}}else 34===i&&(n=!n);e++}this.previous=r<e?this.chunks.copy(t,r,e):void 0},t}(),et=function(){function t(){this._reuse=!1}return Object.defineProperty(t.prototype,"reuse",{get:function(){return this._reuse},set:function(t){t&&!this.reusedValues&&(this.reusedValues=new Array(10)),this._reuse=t},enumerable:!0,configurable:!0}),t.prototype.withReuse=function(){return this.reuse=!0,this},t.prototype.splitLine=function(t){if(null==t)return this.lastSplitLength=0,[];for(var e=0,r=0,n=this._reuse?this.reusedValues:[],i=0,o=0;o<t.length;o++){var s=t[o];if(","===s){if(e%2==0){var u=this.getValue(t,r,o,e);this._reuse?n[i++]=u:n.push(u),r=o+1,e=0}}else'"'===s&&e++}var a=this.getValue(t,r,t.length,e);return this._reuse?(n[i]=a,this.lastSplitLength=i+1):(n.push(a),this.lastSplitLength=n.length),n},t.prototype.getValue=function(t,e,r,n){return e===t.length?"":0===n?t.substring(e,r):2===n?t.substring(e+1,r-1):t.substring(e+1,r-1).replace(/""/gi,'"')},t}();function rt(t){var e,r,n=(new et).withReuse(),i=!0,o=0;return{error:function(e){t.error(e)},next:function(s){if(""===s)i=!0,e=void 0;else{var u=n.splitLine(s),a=n.lastSplitLength;if(i){if(!e){e=new Array(a);for(var c=0;c<a;c++)e[c]=new B}if(u[0].startsWith("#")){if("#datatype"===u[0])for(c=1;c<a;c++)e[c].dataType=u[c];else if("#default"===u[0])for(c=1;c<a;c++)e[c].defaultValue=u[c];else if("#group"===u[0])for(c=1;c<a;c++)e[c].group="t"===u[c][0]}else{""===u[0]?(o=1,e=e.slice(1)):o=0;for(var c=o;c<a;c++)e[c-o].label=u[c];r=new k(e),i=!1}}else t.next(u.slice(o,a),r)}},complete:function(){t.complete()},useCancellable:function(e){t.useCancellable&&t.useCancellable(e)}}}var nt="function"==typeof Symbol&&Symbol.observable||"@@observable",it=function(){function t(t,e){var r=this;this.isClosed=!1;try{e({next:function(e){t.next(e)},error:function(e){r.isClosed=!0,t.error(e)},complete:function(){r.isClosed=!0,t.complete()},useCancellable:function(t){r.cancellable=t}})}catch(e){this.isClosed=!0,t.error(e)}}return Object.defineProperty(t.prototype,"closed",{get:function(){return this.isClosed},enumerable:!0,configurable:!0}),t.prototype.unsubscribe=function(){var t;null===(t=this.cancellable)||void 0===t||t.cancel(),this.isClosed=!0},t}();function ot(){}var st=function(){function t(t,e){this.executor=t,this.decorator=e}return t.prototype.subscribe=function(t,e,r){var n=function(t){var e=t.next,r=t.error,n=t.complete;return{next:e?e.bind(t):ot,error:r?r.bind(t):ot,complete:n?n.bind(t):ot}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new it(this.decorator(n),this.executor)},t.prototype[nt]=function(){return this},t}(),ut={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},at=function(t){return t},ct=function(){function t(t,e){this.transport=t,this.options={org:e}}return t.prototype.with=function(t){return this.options=n(n({},this.options),t),this},t.prototype.lines=function(t){return new st(this.createExecutor(t),at)},t.prototype.rows=function(t){return new st(this.createExecutor(t),(function(t){return rt({next:function(e,r){t.next({values:e,tableMeta:r})},error:function(e){t.error(e)},complete:function(){t.complete()}})}))},t.prototype.queryLines=function(t,e){this.createExecutor(t)(e)},t.prototype.queryRows=function(t,e){this.createExecutor(t)(rt(e))},t.prototype.collectRows=function(t,e){var r=this;void 0===e&&(e=Z);var n=[];return new Promise((function(i,o){r.queryRows(t,{next:function(t,r){var i=e.call(this,t,r);void 0!==i&&n.push(i)},error:function(t){o(t)},complete:function(){i(n)}})}))},t.prototype.collectLines=function(t){var e=this,r=[];return new Promise((function(n,i){e.queryLines(t,{next:function(t){r.push(t)},error:function(t){i(t)},complete:function(){n(r)}})}))},t.prototype.createExecutor=function(t){var e=this,r=this.options,n=r.org,i=r.type,o=r.gzip;return function(r){e.transport.send("/api/v2/query?org="+encodeURIComponent(n),JSON.stringify(e.decorateRequest({query:t.toString(),dialect:ut,type:i})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":o?"gzip":"identity"}},new tt(r,e.transport.chunkCombiner))}},t.prototype.decorateRequest=function(t){return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=this.options.type||"flux",t},t}(),ft=function(){function t(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new f("No url or configuration specified!");this._options=t}var e=this._options.url;if("string"!=typeof e)throw new f("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new Y(this._options)}return t.prototype.getWriteApi=function(t,e,r,n){return void 0===r&&(r="ns"),new K(this.transport,t,e,r,n||this._options.writeOptions)},t.prototype.getQueryApi=function(t){return new ct(this.transport,t)},t}();return t.AbortError=v,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=s,t.DEFAULT_WriteOptions=u,t.FLUX_VALUE=F,t.FluxTableColumn=B,t.FluxTableMetaData=k,t.HttpError=l,t.IllegalArgumentError=f,t.InfluxDB=ft,t.Point=V,t.RequestTimedOutError=g,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.currentTime=A,t.dateToProtocolTimestamp=P,t.escape=S,t.flux=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(1==t.length&&(!e||0===e.length))return t[0];for(var n=new Array(t.length+e.length),i=0,o=0;o<t.length;o++){var s=t[o];if(n[i++]=s,o<e.length){var u=e[o],a=void 0;if(s.endsWith('"')&&o+1<t.length&&t[o+1].startsWith('"'))a=z(u);else if(""===(a=N(u)))throw new Error("Unsupported parameter literal '"+u+"' at index: "+o+", type: "+typeof u);n[i++]=a}else if(o<t.length-1)throw new Error("Too few parameters supplied!")}return M(n.join(""))},t.fluxBool=function(t){return new U("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new U(function(t){return'time(v: "'+z(t)+'")'}(t))},t.fluxDuration=function(t){return new U('duration(v: "'+z(t)+'")')},t.fluxExpression=M,t.fluxFloat=function(t){return new U(H(t))},t.fluxInteger=function(t){for(var e=String(t),r=0,n=e;r<n.length;r++){var i=n[r];if(i<"0"||i>"9")throw new Error("not a flux integer: "+e)}return new U(e)},t.fluxRegExp=function(t){return new U(I(t))},t.fluxString=function(t){return new U('"'+z(t)+'"')},t.getRetryDelay=p,t.isStatusCodeRetriable=c,t.sanitizeFloat=H,t.toFluxValue=N,t.typeSerializers=L,t.useProcessHrtime=function(t){return!1},t}({}); | ||
***************************************************************************** */var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,e,r,n){return new(r||(r=Promise))((function(i,o){function s(t){try{a(n.next(t))}catch(t){o(t)}}function u(t){try{a(n.throw(t))}catch(t){o(t)}}function a(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(s,u)}a((n=n.apply(t,e||[])).next())}))}function o(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var s=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),u=Object.freeze(n({batchSize:1e3,flushInterval:6e4,writeFailed:function(){},maxRetries:2,maxBufferLines:32e3},s)),a=[404,408,425,429,500,502,503,504];function c(t){return a.includes(t)}var f=function(t){function e(r){var n=t.call(this,r)||this;return Object.setPrototypeOf(n,e.prototype),n}return r(e,t),e}(Error),l=function(t){function e(r,n,i,o){var s=t.call(this)||this;return s.statusCode=r,s.statusMessage=n,s.body=i,Object.setPrototypeOf(s,e.prototype),s.message=i?r+" "+n+" : "+i:r+" "+n,s.setRetryAfter(o),s}return r(e,t),e.prototype.setRetryAfter=function(t){"string"==typeof t&&/^[0-9]+$/.test(t)?this._retryAfter=parseInt(t):this._retryAfter=0},e.prototype.canRetry=function(){return c(this.statusCode)},e.prototype.retryAfter=function(){return this._retryAfter},e}(Error),h=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function p(t,e){if(t){var r=void 0;return"function"==typeof t.retryAfter?t.retryAfter():(r=0,e&&e>0?r+Math.round(Math.random()*e):r)}return 0}var d,y,g=function(t){function e(){var r=t.call(this)||this;return Object.setPrototypeOf(r,e.prototype),r.message="Request timed out",r}return r(e,t),e.prototype.canRetry=function(){return!0},e.prototype.retryAfter=function(){return 0},e}(Error),v=function(t){function e(){var r=t.call(this)||this;return r.name="AbortError",Object.setPrototypeOf(r,e.prototype),r.message="Response aborted",r}return r(e,t),e.prototype.canRetry=function(){return!0},e.prototype.retryAfter=function(){return 0},e}(Error),m=/[-|\\{()[\]^$+*?.]/g,w=function(){function t(t,e){void 0===e&&(e=""),this.config=t,this.wrap=e;var r=Object.keys(t).join("|").replace(m,"\\$&");this._re=new RegExp("["+r+"]","g")}return t.prototype.escape=function(t){this._re.lastIndex=0;for(var e=this._re.lastIndex,r="",n=this._re.exec(t);n;){var i=n[0],o=this.config[i].escapeChar,s=this.config[i].replaceChar;r+=t.slice(e,n.index),r+=null!=s?s:o+i,e=this._re.lastIndex,n=this._re.exec(t)}return 0===e?this.wrap+t+this.wrap:e<t.length?this.wrap+r+t.slice(e)+this.wrap:this.wrap+r+this.wrap},t}(),b=function(t,e){this.escapeChar=t,this.replaceChar=e},x=new b("\\"),O=function(t){return t.escape.bind(t)},S={measurement:O(new w({",":x," ":x,"\n":new b(void 0,"\\n"),"\r":new b(void 0,"\\r"),"\t":new b(void 0,"\\t")})),quoted:O(new w({'"':x,"\\\\":x},'"')),tag:O(new w({",":x,"=":x," ":x,"\n":new b(void 0,"\\n"),"\r":new b(void 0,"\\r"),"\t":new b(void 0,"\\t")}))};var T=Date.now(),R=0;function E(){var t=Date.now();t!==T?(T=t,R=0):R++;var e=String(R);return String(t)+"000000000".substr(0,6-e.length)+e}function C(){return String(Date.now())+"000000000".substr(0,3)}function _(){return String(Date.now())}function D(){return String(Math.floor(Date.now()/1e3))}var A=Object.freeze(((d={})[String("s")]=D,d[String("ms")]=_,d[String("us")]=C,d[String("ns")]=E,d.seconds=D,d.millis=_,d.micros=C,d.nanos=E,d)),P=((y={})[String("s")]=function(t){return""+Math.floor(t.getTime()/1e3)},y[String("ms")]=function(t){return""+t.getTime()},y[String("us")]=function(t){return t.getTime()+"000"},y[String("ns")]=function(t){return t.getTime()+"000000"},y),j=function(t){return t},L={boolean:function(t){return"true"===t},unsignedLong:j,long:j,double:function(t){return+t},string:j,base64Binary:j,dateTime:j,duration:j},k=function(){function t(t){t.forEach((function(t,e){return t.index=e})),this.columns=t}return t.prototype.column=function(t){for(var e=0;e<this.columns.length;e++){var r=this.columns[e];if(r.label===t)return r}throw new f("Column "+t+" not found!")},t.prototype.toObject=function(t){for(var e={},r=0;r<this.columns.length&&r<t.length;r++){var n=t[r],i=this.columns[r];""===n&&i.defaultValue&&(n=i.defaultValue),e[i.label]=(L[i.dataType]||j)(n)}return e},t}(),B=function(){function t(){}return t.from=function(e){var r=new t;return r.label=e.label,r.dataType=e.dataType,r.group=Boolean(e.group),r.defaultValue=e.defaultValue||"",r},t}(),F=Symbol("FLUX_VALUE"),U=function(){function t(t){this.fluxValue=t}return t.prototype.toString=function(){return this.fluxValue},t.prototype[F]=function(){return this.fluxValue},t}();function z(t){if(null==t)return"";t=t.toString();var e=void 0,r=0;function n(){void 0===e&&(e=t.substring(0,r))}for(;r<t.length;r++){var i=t.charAt(r);switch(i){case"\r":n(),e+="\\r";break;case"\n":n(),e+="\\n";break;case"\t":n(),e+="\\t";break;case'"':case"\\":n(),e=e+"\\"+i;break;case"$":if(r+1<t.length&&"{"===t.charAt(r+1)){n(),r++,e+="\\${";break}null!=e&&(e+=i);break;default:null!=e&&(e+=i)}}return void 0!==e?e:t}function H(t){for(var e=String(t),r=!1,n=0,i=e;n<i.length;n++){var o=i[n];if("."===o){if(r)throw new Error("not a flux float: "+e);r=!r}if("."!==o&&(o<"0"||o>"9"))throw new Error("not a flux float: "+e)}return e}function I(t){return'regexp.compile(v: "'+z(t)+'")'}function M(t){return new U(String(t))}function N(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?'"'+z(t)+'"':"number"==typeof t?H(t):"object"==typeof t&&"function"==typeof t[F]?t[F]():t instanceof Date?t.toISOString():t instanceof RegExp?I(t):N(t.toString())}var V=function(){function t(t){this.tags={},this.fields={},t&&(this.name=t)}return t.prototype.measurement=function(t){return this.name=t,this},t.prototype.tag=function(t,e){return this.tags[t]=e,this},t.prototype.booleanField=function(t,e){return this.fields[t]=e?"T":"F",this},t.prototype.intField=function(t,e){if("number"!=typeof e){var r;if(isNaN(r=parseInt(String(e))))throw new Error("Expected integer value for field "+t+", but got '"+e+"'!");e=r}return this.fields[t]=Math.floor(e)+"i",this},t.prototype.floatField=function(t,e){if("number"!=typeof e){var r;if(isNaN(r=parseFloat(e)))throw new Error("Expected float value for field "+t+", but got '"+e+"'!");e=r}return this.fields[t]=String(e),this},t.prototype.stringField=function(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=S.quoted(e)),this},t.prototype.timestamp=function(t){return this.time=t,this},t.prototype.toLineProtocol=function(t){var e=this;if(this.name){var r="";if(Object.keys(this.fields).sort().forEach((function(t){if(t){var n=e.fields[t];r.length>0&&(r+=","),r+=S.tag(t)+"="+n}})),0!==r.length){var i="",o=t&&t.defaultTags?n(n({},t.defaultTags),this.tags):this.tags;Object.keys(o).sort().forEach((function(t){if(t){var e=o[t];e&&(i+=",",i+=S.tag(t)+"="+S.tag(e))}}));var s=this.time;return t&&t.convertTime&&(s=t.convertTime(s)),""+S.measurement(this.name)+i+" "+r+(void 0!==s?" "+s:"")}}},t.prototype.toString=function(){var t=this.toLineProtocol(void 0);return t||"invalid point: "+JSON.stringify(this,void 0)},t}(),q=Object.freeze({error:function(t,e){console.error("ERROR: "+t,e||"")},warn:function(t,e){console.warn("WARN: "+t,e||"")}}),W=function(t,e){q.error(t,e)},J=function(t,e){q.warn(t,e)},$=function(){function t(t){this.options=n(n({},s),t),this.success()}return t.prototype.nextDelay=function(t){var e=p(t);return e&&e>0?Math.min(e+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):(this.currentDelay?this.currentDelay=Math.min(Math.max(2*this.currentDelay,1)+Math.round(Math.random()*this.options.retryJitter),this.options.maxRetryDelay):this.currentDelay=this.options.minRetryDelay+Math.round(Math.random()*this.options.retryJitter),this.currentDelay)},t.prototype.success=function(){this.currentDelay=void 0},t}();var G=function(){function t(t,e){this.maxLines=t,this.retryLines=e,this.size=0,this.nextRetryTime=0,this.closed=!1,this._timeoutHandle=void 0}return t.prototype.addLines=function(t,e,r){if(!this.closed&&t.length){var n=Date.now()+r;if(n>this.nextRetryTime&&(this.nextRetryTime=n),this.first&&this.size+t.length>this.maxLines){var i=this.size,o=.7*i;do{var s=this.first.next;this.size-=this.first.lines.length,this.first=s}while(this.first&&this.size+t.length>o);W("RetryBuffer: "+(i-this.size)+" oldest lines removed to keep buffer size under the limit of "+this.maxLines+" lines")}var u={lines:t,retryCount:e};this.last?(this.last.next=u,this.last=u):(this.first=u,this.last=u,this.scheduleRetry(r)),this.size+=t.length}},t.prototype.removeLines=function(){if(this.first){var t=this.first;return this.first=this.first.next,this.size-=t.lines.length,this.first||(this.last=void 0),t}},t.prototype.scheduleRetry=function(t){var e=this;this._timeoutHandle=setTimeout((function(){var t=e.removeLines();t?e.retryLines(t.lines,t.retryCount).then((function(){e.scheduleRetry(1)})).catch((function(t){e.scheduleRetry(e.nextRetryTime-Date.now())})):e._timeoutHandle=void 0}),t)},t.prototype.flush=function(){return i(this,void 0,void 0,(function(){var t;return o(this,(function(e){switch(e.label){case 0:return(t=this.removeLines())?[4,this.retryLines(t.lines,t.retryCount)]:[3,2];case 1:return e.sent(),[3,0];case 2:return[2]}}))}))},t.prototype.close=function(){return this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this.closed=!0,this.size},t}(),X=function(){function t(t,e,r){this.maxChunkRecords=t,this.flushFn=e,this.scheduleSend=r,this.length=0,this.lines=new Array(t)}return t.prototype.add=function(t){0===this.length&&this.scheduleSend(),this.lines[this.length]=t,this.length++,this.length>=this.maxChunkRecords&&this.flush().catch((function(t){}))},t.prototype.flush=function(){var t=this.reset();return t.length>0?this.flushFn(t):Promise.resolve()},t.prototype.reset=function(){var t=this.lines.slice(0,this.length);return this.length=0,t},t}(),K=function(){function t(t,e,r,i,o){var s=this;this.transport=t,this.closed=!1,this.sendOptions={method:"POST",headers:{"content-type":"text/plain; charset=utf-8"}},this._timeoutHandle=void 0,this.httpPath="/api/v2/write?org="+encodeURIComponent(e)+"&bucket="+encodeURIComponent(r)+"&precision="+i,this.writeOptions=n(n({},u),o),this.currentTime=A[i],this.dateToProtocolTimestamp=P[i],this.writeOptions.defaultTags&&this.useDefaultTags(this.writeOptions.defaultTags);var a;this.writeBuffer=new X(this.writeOptions.batchSize,(function(t){return s._clearFlushTimeout(),s.sendBatch(t,s.writeOptions.maxRetries+1)}),(function(){s.writeOptions.flushInterval>0&&(s._clearFlushTimeout(),s.closed||(s._timeoutHandle=setTimeout((function(){return s.sendBatch(s.writeBuffer.reset(),s.writeOptions.maxRetries+1).catch((function(t){}))}),s.writeOptions.flushInterval)))})),this.sendBatch=this.sendBatch.bind(this),this.retryStrategy=(a=this.writeOptions,new $(a)),this.retryBuffer=new G(this.writeOptions.maxBufferLines,this.sendBatch)}return t.prototype.sendBatch=function(t,e){var r=this,n=this;return!this.closed&&t.length>0?new Promise((function(i,o){r.transport.send(r.httpPath,t.join("\n"),r.sendOptions,{error:function(r){var s=n.writeOptions.writeFailed.call(n,r,t,n.writeOptions.maxRetries+2-e);if(s)s.then(i,o);else{if(!n.closed&&e>1&&(!(r instanceof l)||r.statusCode>=429))return J("Write to influx DB failed (remaining attempts: "+(e-1)+").",r),n.retryBuffer.addLines(t,e-1,n.retryStrategy.nextDelay(r)),void o(r);W("Write to influx DB failed.",r),o(r)}},complete:function(){n.retryStrategy.success(),i()}})})):Promise.resolve()},t.prototype._clearFlushTimeout=function(){void 0!==this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0)},t.prototype.writeRecord=function(t){this.writeBuffer.add(t)},t.prototype.writeRecords=function(t){for(var e=0;e<t.length;e++)this.writeBuffer.add(t[e])},t.prototype.writePoint=function(t){var e=t.toLineProtocol(this);e&&this.writeBuffer.add(e)},t.prototype.writePoints=function(t){for(var e=0;e<t.length;e++)this.writePoint(t[e])},t.prototype.flush=function(){return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.writeBuffer.flush()];case 1:return t.sent(),[4,this.retryBuffer.flush()];case 2:return[2,t.sent()]}}))}))},t.prototype.close=function(){var t=this;return this.writeBuffer.flush().finally((function(){var e=t.retryBuffer.close();e&&W("Retry buffer closed with "+e+" items that were not written to InfluxDB!",null),t.closed=!0}))},t.prototype.dispose=function(){this._clearFlushTimeout(),this.closed=!0},t.prototype.useDefaultTags=function(t){var e=this;return this.defaultTags=void 0,Object.keys(t).forEach((function(r){(e.defaultTags||(e.defaultTags={}))[r]=S.tag(t[r])})),this},t.prototype.convertTime=function(t){return void 0===t?this.currentTime():"string"==typeof t?t.length>0?t:void 0:t instanceof Date?this.dateToProtocolTimestamp(t):String("number"==typeof t?Math.floor(t):t)},t}(),Q={concat:function(t,e){var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r},toUtf8String:function(t,e,r){for(var n,i,o,s,u="",a=e;a<r;)switch((n=t[a++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(n);break;case 12:case 13:i=t[a++],u+=String.fromCharCode((31&n)<<6|63&i);break;case 14:i=t[a++],o=t[a++],u+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o);break;case 15:i=t[a++],o=t[a++],s=t[a++],u+=String.fromCodePoint((7&n)<<18|(63&i)<<12|(63&o)<<6|63&s)}return u},copy:function(t,e,r){var n=new Uint8Array(r-e);return n.set(t.slice(e,r)),n}};var Y=function(){function t(t){this.connectionOptions=t,this.chunkCombiner=Q,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.6.0.nightly"},this.connectionOptions.token&&(this.defaultHeaders.Authorization="Token "+this.connectionOptions.token)}return t.prototype.send=function(t,e,r,n){var s=this,u=function(t){void 0===t&&(t={});var e=0;return{next:function(r){0===e&&t.next&&null!=r&&t.next(r)},error:function(r){0===e&&(e=1,t.error&&t.error(r))},complete:function(){0===e&&(e=2,t.complete&&t.complete())},responseStarted:function(e){t.responseStarted&&t.responseStarted(e)}}}(n);if(n&&n.useCancellable&&!r.signal){var a=new AbortController,c=a.signal;n.useCancellable({cancel:function(){a.abort()},isCancelled:function(){return c.aborted}})}this.fetch(t,e,r).then((function(t){return i(s,void 0,void 0,(function(){var e,r,i,s,a;return o(this,(function(o){switch(o.label){case 0:return(null==n?void 0:n.responseStarted)&&(e={},t.headers.forEach((function(t,r){var n=e[r];void 0===n?e[r]=t:Array.isArray(n)?n.push(t):e[r]=[n,t]})),u.responseStarted(e)),t.status>=300?[2,t.text().then((function(e){if(!e){var r=t.headers.get("x-influxdb-error");r&&(e=r)}u.error(new l(t.status,t.statusText,e,t.headers.get("retry-after")))})).catch((function(e){J("Unable to receive error body",e),u.error(new l(t.status,t.statusText,void 0,t.headers.get("retry-after")))}))]:[3,1];case 1:if(!t.body)return[3,6];r=t.body.getReader(),i=void 0,o.label=2;case 2:return[4,r.read()];case 3:i=o.sent(),u.next(i.value),o.label=4;case 4:if(!i.done)return[3,2];o.label=5;case 5:return[3,10];case 6:return t.arrayBuffer?[4,t.arrayBuffer()]:[3,8];case 7:return s=o.sent(),u.next(new Uint8Array(s)),[3,10];case 8:return[4,t.text()];case 9:a=o.sent(),u.next((new TextEncoder).encode(a)),o.label=10;case 10:return[2]}}))}))})).catch((function(t){return u.error(t)})).finally((function(){return u.complete()}))},t.prototype.request=function(t,e,r){return i(this,void 0,void 0,(function(){var n,i,s,u,a,c,f;return o(this,(function(o){switch(o.label){case 0:return[4,this.fetch(t,e,r)];case 1:n=o.sent(),i=n.status,s=n.headers,u=s.get("content-type")||"",a=void 0,o.label=2;case 2:return o.trys.push([2,7,,8]),u.includes("json")?[4,n.json()]:[3,4];case 3:return a=o.sent(),[3,6];case 4:return u.includes("text")?[4,n.text()]:[3,6];case 5:a=o.sent(),o.label=6;case 6:return[3,8];case 7:return c=o.sent(),J("Unable to read error body",c),[3,8];case 8:if(i>=300)throw a||(f=s.get("x-influxdb-error"))&&(a=f),new l(i,n.statusText,a,n.headers.get("retry-after"));return[2,a]}}))}))},t.prototype.fetch=function(t,e,r){var i=r.method,o=r.headers,s=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(r,["method","headers"]);return fetch(""+this.connectionOptions.url+t,n({method:i,body:"GET"===i||"HEAD"===i?void 0:"string"==typeof e?e:JSON.stringify(e),headers:n(n({},this.defaultHeaders),o),credentials:"omit"},s))},t}();function Z(t,e){return e.toObject(t)}var tt=function(){function t(t,e){this.target=t,this.chunks=e,this.finished=!1}return t.prototype.next=function(t){if(!this.finished)try{this.bufferReceived(t)}catch(t){this.error(t)}},t.prototype.error=function(t){this.finished||(this.finished=!0,this.target.error(t))},t.prototype.complete=function(){this.finished||(this.previous&&this.target.next(this.chunks.toUtf8String(this.previous,0,this.previous.length)),this.finished=!0,this.target.complete())},t.prototype.useCancellable=function(t){this.target.useCancellable&&this.target.useCancellable(t)},t.prototype.bufferReceived=function(t){var e,r=0;this.previous?(t=this.chunks.concat(this.previous,t),e=this.previous.length):e=0;for(var n=!1;e<t.length;){var i=t[e];if(10===i){if(!n){var o=e>0&&13===t[e-1]?e-1:e;this.target.next(this.chunks.toUtf8String(t,r,o)),r=e+1}}else 34===i&&(n=!n);e++}this.previous=r<e?this.chunks.copy(t,r,e):void 0},t}(),et=function(){function t(){this._reuse=!1}return Object.defineProperty(t.prototype,"reuse",{get:function(){return this._reuse},set:function(t){t&&!this.reusedValues&&(this.reusedValues=new Array(10)),this._reuse=t},enumerable:!0,configurable:!0}),t.prototype.withReuse=function(){return this.reuse=!0,this},t.prototype.splitLine=function(t){if(null==t)return this.lastSplitLength=0,[];for(var e=0,r=0,n=this._reuse?this.reusedValues:[],i=0,o=0;o<t.length;o++){var s=t[o];if(","===s){if(e%2==0){var u=this.getValue(t,r,o,e);this._reuse?n[i++]=u:n.push(u),r=o+1,e=0}}else'"'===s&&e++}var a=this.getValue(t,r,t.length,e);return this._reuse?(n[i]=a,this.lastSplitLength=i+1):(n.push(a),this.lastSplitLength=n.length),n},t.prototype.getValue=function(t,e,r,n){return e===t.length?"":0===n?t.substring(e,r):2===n?t.substring(e+1,r-1):t.substring(e+1,r-1).replace(/""/gi,'"')},t}();function rt(t){var e,r,n=(new et).withReuse(),i=!0,o=0;return{error:function(e){t.error(e)},next:function(s){if(""===s)i=!0,e=void 0;else{var u=n.splitLine(s),a=n.lastSplitLength;if(i){if(!e){e=new Array(a);for(var c=0;c<a;c++)e[c]=new B}if(u[0].startsWith("#")){if("#datatype"===u[0])for(c=1;c<a;c++)e[c].dataType=u[c];else if("#default"===u[0])for(c=1;c<a;c++)e[c].defaultValue=u[c];else if("#group"===u[0])for(c=1;c<a;c++)e[c].group="t"===u[c][0]}else{""===u[0]?(o=1,e=e.slice(1)):o=0;for(var c=o;c<a;c++)e[c-o].label=u[c];r=new k(e),i=!1}}else t.next(u.slice(o,a),r)}},complete:function(){t.complete()},useCancellable:function(e){t.useCancellable&&t.useCancellable(e)}}}var nt="function"==typeof Symbol&&Symbol.observable||"@@observable",it=function(){function t(t,e){var r=this;this.isClosed=!1;try{e({next:function(e){t.next(e)},error:function(e){r.isClosed=!0,t.error(e)},complete:function(){r.isClosed=!0,t.complete()},useCancellable:function(t){r.cancellable=t}})}catch(e){this.isClosed=!0,t.error(e)}}return Object.defineProperty(t.prototype,"closed",{get:function(){return this.isClosed},enumerable:!0,configurable:!0}),t.prototype.unsubscribe=function(){var t;null===(t=this.cancellable)||void 0===t||t.cancel(),this.isClosed=!0},t}();function ot(){}var st=function(){function t(t,e){this.executor=t,this.decorator=e}return t.prototype.subscribe=function(t,e,r){var n=function(t){var e=t.next,r=t.error,n=t.complete;return{next:e?e.bind(t):ot,error:r?r.bind(t):ot,complete:n?n.bind(t):ot}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new it(this.decorator(n),this.executor)},t.prototype[nt]=function(){return this},t}(),ut={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},at=function(t){return t},ct=function(){function t(t,e){this.transport=t,this.options={org:e}}return t.prototype.with=function(t){return this.options=n(n({},this.options),t),this},t.prototype.lines=function(t){return new st(this.createExecutor(t),at)},t.prototype.rows=function(t){return new st(this.createExecutor(t),(function(t){return rt({next:function(e,r){t.next({values:e,tableMeta:r})},error:function(e){t.error(e)},complete:function(){t.complete()}})}))},t.prototype.queryLines=function(t,e){this.createExecutor(t)(e)},t.prototype.queryRows=function(t,e){this.createExecutor(t)(rt(e))},t.prototype.collectRows=function(t,e){var r=this;void 0===e&&(e=Z);var n=[];return new Promise((function(i,o){r.queryRows(t,{next:function(t,r){var i=e.call(this,t,r);void 0!==i&&n.push(i)},error:function(t){o(t)},complete:function(){i(n)}})}))},t.prototype.collectLines=function(t){var e=this,r=[];return new Promise((function(n,i){e.queryLines(t,{next:function(t){r.push(t)},error:function(t){i(t)},complete:function(){n(r)}})}))},t.prototype.createExecutor=function(t){var e=this,r=this.options,n=r.org,i=r.type,o=r.gzip;return function(r){e.transport.send("/api/v2/query?org="+encodeURIComponent(n),JSON.stringify(e.decorateRequest({query:t.toString(),dialect:ut,type:i})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":o?"gzip":"identity"}},new tt(r,e.transport.chunkCombiner))}},t.prototype.decorateRequest=function(t){return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=this.options.type||"flux",t},t}(),ft=function(){function t(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new f("No url or configuration specified!");this._options=t}var e=this._options.url;if("string"!=typeof e)throw new f("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new Y(this._options)}return t.prototype.getWriteApi=function(t,e,r,n){return void 0===r&&(r="ns"),new K(this.transport,t,e,r,n||this._options.writeOptions)},t.prototype.getQueryApi=function(t){return new ct(this.transport,t)},t}();return t.AbortError=v,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=s,t.DEFAULT_WriteOptions=u,t.FLUX_VALUE=F,t.FluxTableColumn=B,t.FluxTableMetaData=k,t.HttpError=l,t.IllegalArgumentError=f,t.InfluxDB=ft,t.Point=V,t.RequestTimedOutError=g,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.currentTime=A,t.dateToProtocolTimestamp=P,t.escape=S,t.flux=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(1==t.length&&(!e||0===e.length))return t[0];for(var n=new Array(t.length+e.length),i=0,o=0;o<t.length;o++){var s=t[o];if(n[i++]=s,o<e.length){var u=e[o],a=void 0;if(s.endsWith('"')&&o+1<t.length&&t[o+1].startsWith('"'))a=z(u);else if(""===(a=N(u)))throw new Error("Unsupported parameter literal '"+u+"' at index: "+o+", type: "+typeof u);n[i++]=a}else if(o<t.length-1)throw new Error("Too few parameters supplied!")}return M(n.join(""))},t.fluxBool=function(t){return new U("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new U(function(t){return'time(v: "'+z(t)+'")'}(t))},t.fluxDuration=function(t){return new U('duration(v: "'+z(t)+'")')},t.fluxExpression=M,t.fluxFloat=function(t){return new U(H(t))},t.fluxInteger=function(t){for(var e=String(t),r=0,n=e;r<n.length;r++){var i=n[r];if(i<"0"||i>"9")throw new Error("not a flux integer: "+e)}return new U(e)},t.fluxRegExp=function(t){return new U(I(t))},t.fluxString=function(t){return new U('"'+z(t)+'"')},t.getRetryDelay=p,t.isStatusCodeRetriable=c,t.sanitizeFloat=H,t.toFluxValue=N,t.typeSerializers=L,t.useProcessHrtime=function(t){return!1},t}({}); | ||
//# sourceMappingURL=influxdb.min.js.map |
{ | ||
"name": "@influxdata/influxdb-client", | ||
"version": "1.6.0-nightly.8+054729b", | ||
"version": "1.6.0-nightly.9+246bdef", | ||
"description": "InfluxDB 2.0 client", | ||
@@ -69,3 +69,3 @@ "scripts": { | ||
}, | ||
"gitHead": "054729bff6a0870dfda135c3e5043a0d011b1e86" | ||
"gitHead": "246bdef9e5ee6e7cd50d3b579e354bb6e6f9bbac" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
933192
3472