Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@influxdata/influxdb-client

Package Overview
Dependencies
Maintainers
21
Versions
731
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@influxdata/influxdb-client - npm Package Compare versions

Comparing version 1.4.0-nightly.6 to 1.4.0-nightly.7

4

dist/index.browser.js

@@ -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,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.wrap=e;const r=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;)r+=t.slice(e,s.index)+"\\"+s[0],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}}const d=t=>t.escape.bind(t),p={measurement:d(new f([","," "])),quoted:d(new f(['"',"\\\\"],'"')),tag:d(new f([",","="," "]))};let g=Date.now(),y=0;function m(){{const t=Date.now();t!==g?(g=t,y=0):y++;const e=String(y);return String(t)+"000000000".substr(0,6-e.length)+e}}function w(){return String(Date.now())+"000000000".substr(0,3)}function b(){return String(Date.now())}function x(){return String(Math.floor(Date.now()/1e3))}const v=Object.freeze({[String("s")]:x,[String("ms")]:b,[String("us")]:w,[String("ns")]:m,seconds:x,millis:b,micros:w,nanos:m}),O={[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`},S=t=>t,T={boolean:t=>"true"===t,unsignedLong:S,long:S,double:t=>+t,string:S,base64Binary:S,dateTime:S,duration:S};class E{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]=(T[i.dataType]||S)(s)}return e}}class R{static from(t){const e=new R;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const $=Symbol("FLUX_VALUE");class C{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[$](){return this.fluxValue}}function _(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 j(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 D(t){return`regexp.compile(v: "${_(t)}")`}function A(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${_(t)}"`:"number"==typeof t?j(t):"object"==typeof t&&"function"==typeof t[$]?t[$]():t instanceof Date?t.toISOString():t instanceof RegExp?D(t):A(t.toString())}function L(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 P=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const B={error(t,e){P.error(t,e)},warn(t,e){P.warn(t,e)}};class k{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 U{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);B.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 L(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 F{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 z{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=v[i],this.dateToProtocolTimestamp=O[i];var o;this.writeBuffer=new F(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 k(o)),this.retryBuffer=new U(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(s){!r.closed&&e>1&&(!(s instanceof o)||s.statusCode>=429)?(B.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,s),r.retryBuffer.addLines(t,e-1,r.retryStrategy.nextDelay(s)),i(s)):(B.error("Write to influx DB failed.",s),i(s))},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 L(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&&B.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]=p.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 M={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 H{constructor(t){this.connectionOptions=t,this.chunkCombiner=M,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.4.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=>L(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=>{i.error(new o(t.status,t.statusText,e,t.headers.get("retry-after")))}).catch(e=>{B.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 L(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){B.warn("Unable to read error body",t)}if(i>=300)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,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.wrap=e;const r=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;)r+=t.slice(e,s.index)+"\\"+s[0],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}}const d=t=>t.escape.bind(t),p={measurement:d(new f([","," "])),quoted:d(new f(['"',"\\\\"],'"')),tag:d(new f([",","="," "]))};let g=Date.now(),y=0;function m(){{const t=Date.now();t!==g?(g=t,y=0):y++;const e=String(y);return String(t)+"000000000".substr(0,6-e.length)+e}}function w(){return String(Date.now())+"000000000".substr(0,3)}function b(){return String(Date.now())}function x(){return String(Math.floor(Date.now()/1e3))}const v=Object.freeze({[String("s")]:x,[String("ms")]:b,[String("us")]:w,[String("ns")]:m,seconds:x,millis:b,micros:w,nanos:m}),O={[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`},S=t=>t,T={boolean:t=>"true"===t,unsignedLong:S,long:S,double:t=>+t,string:S,base64Binary:S,dateTime:S,duration:S};class E{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]=(T[i.dataType]||S)(s)}return e}}class R{static from(t){const e=new R;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const $=Symbol("FLUX_VALUE");class C{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[$](){return this.fluxValue}}function _(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 j(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 D(t){return`regexp.compile(v: "${_(t)}")`}function A(t){return new C(String(t))}function L(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${_(t)}"`:"number"==typeof t?j(t):"object"==typeof t&&"function"==typeof t[$]?t[$]():t instanceof Date?t.toISOString():t instanceof RegExp?D(t):L(t.toString())}function P(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 B=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const k={error(t,e){B.error(t,e)},warn(t,e){B.warn(t,e)}};class U{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 F{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);k.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 P(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 z{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 M{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=v[i],this.dateToProtocolTimestamp=O[i];var o;this.writeBuffer=new z(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 U(o)),this.retryBuffer=new F(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(s){!r.closed&&e>1&&(!(s instanceof o)||s.statusCode>=429)?(k.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,s),r.retryBuffer.addLines(t,e-1,r.retryStrategy.nextDelay(s)),i(s)):(k.error("Write to influx DB failed.",s),i(s))},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 P(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&&k.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]=p.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 H={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 I{constructor(t){this.connectionOptions=t,this.chunkCombiner=H,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.4.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=>P(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=>{i.error(new o(t.status,t.statusText,e,t.headers.get("retry-after")))}).catch(e=>{k.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 P(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){k.warn("Unable to read error body",t)}if(i>=300)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))}}class I{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 N{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 V(t){const e=(new N).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 R}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 E(r),i=!1}}else t.next(l.slice(n,a),s)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const q="function"==typeof Symbol&&Symbol.observable||"@@observable";class W{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 J(){}class X{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):J,error:r?r.bind(t):J,complete:s?s.bind(t):J}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new W(this.decorator(s),this.executor)}[q](){return this}}const G={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},K=t=>t;class Q{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 X(this.createExecutor(t),K)}rows(t){return new X(this.createExecutor(t),t=>V({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)(V(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:G,type:r})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":s?"gzip":"identity"}},new I(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=R,t.FluxTableMetaData=E,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 H(this._options)}getWriteApi(t,e,r="ns",s){return new z(this.transport,t,e,r,s||this._options.writeOptions)}getQueryApi(t){return new Q(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]=p.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+=`${p.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+=`${p.tag(t)}=${p.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${p.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=v,t.dateToProtocolTimestamp=O,t.escape=p,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=_(o);else if(l=A(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 r.join("")},t.fluxBool=function(t){return new C("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new C(function(t){return`time(v: "${_(t)}")`}(t))},t.fluxDuration=function(t){return new C(`duration(v: "${_(t)}")`)},t.fluxExpression=function(t){return new C(String(t))},t.fluxFloat=function(t){return new C(j(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 C(e)},t.fluxRegExp=function(t){return new C(D(t))},t.fluxString=function(t){return new C(`"${_(t)}"`)},t.getRetryDelay=a,t.isStatusCodeRetriable=i,t.sanitizeFloat=j,t.toFluxValue=A,t.typeSerializers=T,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))}}class N{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 V{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 q(t){const e=(new V).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 R}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 E(r),i=!1}}else t.next(l.slice(n,a),s)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const W="function"==typeof Symbol&&Symbol.observable||"@@observable";class J{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 X(){}class G{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):X,error:r?r.bind(t):X,complete:s?s.bind(t):X}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new J(this.decorator(s),this.executor)}[W](){return this}}const K={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},Q=t=>t;class Y{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 G(this.createExecutor(t),Q)}rows(t){return new G(this.createExecutor(t),t=>q({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)(q(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:K,type:r})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":s?"gzip":"identity"}},new N(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=R,t.FluxTableMetaData=E,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 I(this._options)}getWriteApi(t,e,r="ns",s){return new M(this.transport,t,e,r,s||this._options.writeOptions)}getQueryApi(t){return new Y(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]=p.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+=`${p.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+=`${p.tag(t)}=${p.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${p.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=v,t.dateToProtocolTimestamp=O,t.escape=p,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=_(o);else if(l=L(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 A(r.join(""))},t.fluxBool=function(t){return new C("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new C(function(t){return`time(v: "${_(t)}")`}(t))},t.fluxDuration=function(t){return new C(`duration(v: "${_(t)}")`)},t.fluxExpression=A,t.fluxFloat=function(t){return new C(j(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 C(e)},t.fluxRegExp=function(t){return new C(D(t))},t.fluxString=function(t){return new C(`"${_(t)}"`)},t.getRetryDelay=a,t.isStatusCodeRetriable=i,t.sanitizeFloat=j,t.toFluxValue=L,t.typeSerializers=T,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,maxRetries:2,maxBufferLines:32e3},l)),u=[404,408,425,429,500,502,503,504];function a(t){return u.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 a(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 x{constructor(t,e=""){this.wrap=e;const s=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;)s+=t.slice(e,r.index)+"\\"+r[0],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}}const w=t=>t.escape.bind(t),b={measurement:w(new x([","," "])),quoted:w(new x(['"',"\\\\"],'"')),tag:w(new x([",","="," "]))};let S=!1;function O(t){return S=t&&process&&"function"==typeof process.hrtime}O(!0);let v=void 0,T=void 0,R=Date.now(),E=0;function $(){if(S){const t=process.hrtime();let e=Date.now();T?(t[0]=t[0]-T[0],t[1]=t[1]-T[1],t[1]<0&&(t[0]-=1,t[1]+=1e9),e=v+1e3*t[0]+Math.floor(t[1]/1e6)):(T=t,v=e);const s=String(t[1]%1e6);return String(e)+"000000000".substr(0,6-s.length)+s}{const t=Date.now();t!==R?(R=t,E=0):E++;const e=String(E);return String(t)+"000000000".substr(0,6-e.length)+e}}function _(){if(S){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 C(){return String(Date.now())}function j(){return String(Math.floor(Date.now()/1e3))}const D=Object.freeze({[String("s")]:j,[String("ms")]:C,[String("us")]:_,[String("ns")]:$,seconds:j,millis:C,micros:_,nanos:$}),L={[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`},A=t=>t,B={boolean:t=>"true"===t,unsignedLong:A,long:A,double:t=>+t,string:A,base64Binary:A,dateTime:A,duration:A};class P{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]=(B[i.dataType]||A)(r)}return e}}class F{static from(t){const e=new F;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const q=Symbol("FLUX_VALUE");class M{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[q](){return this.fluxValue}}function U(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 z(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 k(t){return`regexp.compile(v: "${U(t)}")`}function N(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${U(t)}"`:"number"==typeof t?z(t):"object"==typeof t&&"function"==typeof t[q]?t[q]():t instanceof Date?t.toISOString():t instanceof RegExp?k(t):N(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,maxRetries:2,maxBufferLines:32e3},l)),u=[404,408,425,429,500,502,503,504];function a(t){return u.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 a(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 x{constructor(t,e=""){this.wrap=e;const s=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;)s+=t.slice(e,r.index)+"\\"+r[0],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}}const w=t=>t.escape.bind(t),b={measurement:w(new x([","," "])),quoted:w(new x(['"',"\\\\"],'"')),tag:w(new x([",","="," "]))};let S=!1;function O(t){return S=t&&process&&"function"==typeof process.hrtime}O(!0);let v=void 0,T=void 0,R=Date.now(),E=0;function $(){if(S){const t=process.hrtime();let e=Date.now();T?(t[0]=t[0]-T[0],t[1]=t[1]-T[1],t[1]<0&&(t[0]-=1,t[1]+=1e9),e=v+1e3*t[0]+Math.floor(t[1]/1e6)):(T=t,v=e);const s=String(t[1]%1e6);return String(e)+"000000000".substr(0,6-s.length)+s}{const t=Date.now();t!==R?(R=t,E=0):E++;const e=String(E);return String(t)+"000000000".substr(0,6-e.length)+e}}function _(){if(S){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 C(){return String(Date.now())}function j(){return String(Math.floor(Date.now()/1e3))}const D=Object.freeze({[String("s")]:j,[String("ms")]:C,[String("us")]:_,[String("ns")]:$,seconds:j,millis:C,micros:_,nanos:$}),L={[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`},A=t=>t,B={boolean:t=>"true"===t,unsignedLong:A,long:A,double:t=>+t,string:A,base64Binary:A,dateTime:A,duration:A};class P{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]=(B[i.dataType]||A)(r)}return e}}class F{static from(t){const e=new F;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}const q=Symbol("FLUX_VALUE");class M{constructor(t){this.fluxValue=t}toString(){return this.fluxValue}[q](){return this.fluxValue}}function U(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 z(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 k(t){return`regexp.compile(v: "${U(t)}")`}function N(t){return new M(String(t))}function I(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?`"${U(t)}"`:"number"==typeof t?z(t):"object"==typeof t&&"function"==typeof t[q]?t[q]():t instanceof Date?t.toISOString():t instanceof RegExp?k(t):I(t.toString())}
/*! *****************************************************************************

@@ -16,3 +16,3 @@ Copyright (c) Microsoft Corporation. All rights reserved.

***************************************************************************** */
function I(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function l(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){t.done?i(t.value):new s((function(e){e(t.value)})).then(o,l)}h((r=r.apply(t,e||[])).next())}))}let H=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const V={error(t,e){H.error(t,e)},warn(t,e){H.warn(t,e)}};class W{constructor(t){this.options=Object.assign(Object.assign({},l),t),this.success()}nextDelay(t){const e=d(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 J{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,s){if(this.closed)return;if(!t.length)return;const r=Date.now()+s;if(r>this.nextRetryTime&&(this.nextRetryTime=r),this.first&&this.size+t.length>this.maxLines){const e=this.size,s=.7*e;do{const t=this.first.next;this.size-=this.first.lines.length,this.first=t}while(this.first&&this.size+t.length>s);V.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(s)),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 I(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 X{constructor(t,e,s){this.maxChunkRecords=t,this.flushFn=e,this.scheduleSend=s,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 Y{constructor(t,e,s,r,i){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=${r}`,this.writeOptions=Object.assign(Object.assign({},h),i),this.currentTime=D[r],this.dateToProtocolTimestamp=L[r];var n;this.writeBuffer=new X(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=(n=this.writeOptions,new W(n)),this.retryBuffer=new J(this.writeOptions.maxBufferLines,this.sendBatch)}sendBatch(t,e){const s=this;return!this.closed&&t.length>0?new Promise((r,i)=>{this.transport.send(this.httpPath,t.join("\n"),this.sendOptions,{error(r){!s.closed&&e>1&&(!(r instanceof f)||r.statusCode>=429)?(V.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,r),s.retryBuffer.addLines(t,e-1,s.retryStrategy.nextDelay(r)),i(r)):(V.error("Write to influx DB failed.",r),i(r))},complete(){s.retryStrategy.success(),r()}})}):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 I(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&&V.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]=b.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 Z={concat:(t,e)=>i.Buffer.concat([t,e]),toUtf8String:(t,e,s)=>t.toString("utf-8",e,s),copy(t,e,s){const r=i.Buffer.allocUnsafe(s-e);return t.copy(r,0,e,s),r}};const G={flush:n.Z_SYNC_FLUSH,finishFlush:n.Z_SYNC_FLUSH},K=i.Buffer.allocUnsafe(0);class Q{constructor(){this.cancelled=!1}cancel(){this.cancelled=!0}isCancelled(){return this.cancelled}}class tt{constructor(t){this.connectionOptions=t,this.chunkCombiner=Z;const i=e.parse(t.url);if(this.defaultOptions=Object.assign(Object.assign(Object.assign(Object.assign({},o),t),t.transportOptions),{port:i.port,protocol:i.protocol,hostname:i.hostname}),"http:"===i.protocol)this.requestApi=s.request;else{if("https:"!==i.protocol)throw new Error(`Unsupported protocol "${i.protocol} in URL: "${t.url}"`);this.requestApi=r.request}}send(t,e,s,r){const i=this.createRequestMessage(t,e,s),n=new Q;r&&r.useCancellable&&r.useCancellable(n),this._request(i,n,r)}request(t,e,s){e?"string"!=typeof e&&(e=JSON.stringify(e)):e="";let r,n=K;return new Promise((o,l)=>{this.send(t,e,s,{responseStarted(t){r=String(t["content-type"])},next:t=>{n=i.Buffer.concat([n,t])},complete:()=>{try{r.includes("json")?o(JSON.parse(n.toString("utf8"))):r.includes("text")?o(n.toString("utf8")):o(n)}catch(t){l(t)}},error:t=>{l(t)}})})}createRequestMessage(t,e,s){const r=i.Buffer.from(e,"utf-8"),n={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.4.0.nightly"};this.connectionOptions.token&&(n.authorization="Token "+this.connectionOptions.token);const o=Object.assign(Object.assign({},this.defaultOptions),{path:t,method:s.method,headers:Object.assign(Object.assign({},n),s.headers),body:r});return o.headers["content-length"]=r.length,o}_request(t,e,s){const r=function(t={}){let e=0;return{next:s=>{0===e&&t.next&&null!=s&&t.next(s)},error:s=>{0===e&&(e=1,t.error&&t.error(s))},complete:()=>{0===e&&(e=2,t.complete&&t.complete())},responseStarted:e=>{t.responseStarted&&t.responseStarted(e)}}}(s);if(e.isCancelled())return void r.complete();const i=this.requestApi(t,t=>{if(e.isCancelled())return t.resume(),void r.complete();t.on("aborted",()=>{r.error(new m)}),r.responseStarted(t.headers);const s=t.statusCode||600;let i;if("gzip"===t.headers["content-encoding"]?(i=n.createGunzip(G),t.pipe(i)):i=t,i.on("error",r.error),s>=300){let e="";i.on("data",s=>{e+=s.toString(),e.length>1e3&&(e=e.slice(0,1e3),t.resume())}),i.on("end",()=>r.error(new f(s,t.statusMessage,e,t.headers["retry-after"])))}else i.on("data",s=>{e.isCancelled()?t.resume():r.next(s)}),i.on("end",r.complete)});"function"==typeof i.setTimeout&&i.setTimeout(t.timeout),i.on("timeout",()=>{r.error(new g)}),i.on("error",t=>{r.error(t)}),i.on("close",r.complete),t.body&&i.write(t.body),i.end()}}class et{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,s=0;this.previous?(t=this.chunks.concat(this.previous,t),e=this.previous.length):e=0;let r=!1;for(;e<t.length;){const i=t[e];if(10===i){if(!r){const r=e>0&&13===t[e-1]?e-1:e;this.target.next(this.chunks.toUtf8String(t,s,r)),s=e+1}}else 34===i&&(r=!r);e++}this.previous=s<e?this.chunks.copy(t,s,e):void 0}}class st{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,s=0;const r=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,s,n,e);this._reuse?r[i++]=o:r.push(o),s=n+1,e=0}}else'"'===o&&e++}const n=this.getValue(t,s,t.length,e);return this._reuse?(r[i]=n,this.lastSplitLength=i+1):(r.push(n),this.lastSplitLength=r.length),r}getValue(t,e,s,r){return e===t.length?"":0===r?t.substring(e,s):2===r?t.substring(e+1,s-1):t.substring(e+1,s-1).replace(/""/gi,'"')}}function rt(t){const e=(new st).withReuse();let s,r,i=!0,n=0;return{error(e){t.error(e)},next(o){if(""===o)i=!0,s=void 0;else{const l=e.splitLine(o),h=e.lastSplitLength;if(i){if(!s){s=new Array(h);for(let t=0;t<h;t++)s[t]=new F}if(l[0].startsWith("#")){if("#datatype"===l[0])for(let t=1;t<h;t++)s[t].dataType=l[t];else if("#default"===l[0])for(let t=1;t<h;t++)s[t].defaultValue=l[t];else if("#group"===l[0])for(let t=1;t<h;t++)s[t].group="t"===l[t][0]}else{""===l[0]?(n=1,s=s.slice(1)):n=0;for(let t=n;t<h;t++)s[t-n].label=l[t];r=new P(s),i=!1}}else t.next(l.slice(n,h),r)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const it="function"==typeof Symbol&&Symbol.observable||"@@observable";class nt{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 ot(){}class lt{constructor(t,e){this.executor=t,this.decorator=e}subscribe(t,e,s){const r=function(t){const{next:e,error:s,complete:r}=t;return{next:e?e.bind(t):ot,error:s?s.bind(t):ot,complete:r?r.bind(t):ot}}("object"!=typeof t||null===t?{next:t,error:e,complete:s}:t);return new nt(this.decorator(r),this.executor)}[it](){return this}}const ht={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},ut=t=>t;class at{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 lt(this.createExecutor(t),ut)}rows(t){return new lt(this.createExecutor(t),t=>rt({next(e,s){t.next({values:e,tableMeta:s})},error(e){t.error(e)},complete(){t.complete()}}))}queryLines(t,e){this.createExecutor(t)(e)}queryRows(t,e){this.createExecutor(t)(rt(e))}createExecutor(t){const{org:e,type:s,gzip:r}=this.options;return i=>{this.transport.send(`/api/v2/query?org=${encodeURIComponent(e)}`,JSON.stringify(this.decorateRequest({query:t.toString(),dialect:ht,type:s})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":r?"gzip":"identity"}},new et(i,this.transport.chunkCombiner))}}decorateRequest(t){return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=this.options.type||"flux",t}}exports.AbortError=m,exports.DEFAULT_ConnectionOptions=o,exports.DEFAULT_RetryDelayStrategyOptions=l,exports.DEFAULT_WriteOptions=h,exports.FLUX_VALUE=q,exports.FluxTableColumn=F,exports.FluxTableMetaData=P,exports.HttpError=f,exports.IllegalArgumentError=c,exports.InfluxDB=class{constructor(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new c("No url or configuration specified!");this._options=t}const e=this._options.url;if("string"!=typeof e)throw new c("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new tt(this._options)}getWriteApi(t,e,s="ns",r){return new Y(this.transport,t,e,s,r||this._options.writeOptions)}getQueryApi(t){return new at(this.transport,t)}},exports.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 s;if(isNaN(s=parseInt(String(e))))throw new Error(`Expected integer value for field ${t}, but got '${e}'!`);e=s}return this.fields[t]=`${Math.floor(e)}i`,this}floatField(t,e){if("number"!=typeof e){let s;if(isNaN(s=parseFloat(e)))throw new Error(`Expected float value for field ${t}, but got '${e}'!`);e=s}return this.fields[t]=String(e),this}stringField(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=b.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 s=this.fields[t];e.length>0&&(e+=","),e+=`${b.tag(t)}=${s}`}}),0===e.length)return;let s="";const r=t&&t.defaultTags?Object.assign(Object.assign({},t.defaultTags),this.tags):this.tags;Object.keys(r).sort().forEach(t=>{if(t){const e=r[t];e&&(s+=",",s+=`${b.tag(t)}=${b.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${b.measurement(this.name)}${s} ${e}${void 0!==i?" "+i:""}`}toString(){const t=this.toLineProtocol(void 0);return t||`invalid point: ${JSON.stringify(this,void 0)}`}},exports.RequestTimedOutError=g,exports.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!p.includes(t.code)))},exports.currentTime=D,exports.dateToProtocolTimestamp=L,exports.escape=b,exports.flux=function(t,...e){if(1==t.length&&(!e||0===e.length))return t[0];const s=new Array(t.length+e.length);let r=0;for(let i=0;i<t.length;i++){const n=t[i];if(s[r++]=n,i<e.length){const o=e[i];let l;if(n.endsWith('"')&&i+1<t.length&&t[i+1].startsWith('"'))l=U(o);else if(l=N(o),""===l)throw new Error(`Unsupported parameter literal '${o}' at index: ${i}, type: ${typeof o}`);s[r++]=l}else if(i<t.length-1)throw new Error("Too few parameters supplied!")}return s.join("")},exports.fluxBool=function(t){return new M("true"===t||"false"===t?t:(!!t).toString())},exports.fluxDateTime=function(t){return new M(function(t){return`time(v: "${U(t)}")`}(t))},exports.fluxDuration=function(t){return new M(`duration(v: "${U(t)}")`)},exports.fluxExpression=function(t){return new M(String(t))},exports.fluxFloat=function(t){return new M(z(t))},exports.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 M(e)},exports.fluxRegExp=function(t){return new M(k(t))},exports.fluxString=function(t){return new M(`"${U(t)}"`)},exports.getRetryDelay=d,exports.isStatusCodeRetriable=a,exports.sanitizeFloat=z,exports.toFluxValue=N,exports.typeSerializers=B,exports.useProcessHrtime=O;
function H(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{h(r.next(t))}catch(t){n(t)}}function l(t){try{h(r.throw(t))}catch(t){n(t)}}function h(t){t.done?i(t.value):new s((function(e){e(t.value)})).then(o,l)}h((r=r.apply(t,e||[])).next())}))}let V=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const W={error(t,e){V.error(t,e)},warn(t,e){V.warn(t,e)}};class J{constructor(t){this.options=Object.assign(Object.assign({},l),t),this.success()}nextDelay(t){const e=d(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 X{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,s){if(this.closed)return;if(!t.length)return;const r=Date.now()+s;if(r>this.nextRetryTime&&(this.nextRetryTime=r),this.first&&this.size+t.length>this.maxLines){const e=this.size,s=.7*e;do{const t=this.first.next;this.size-=this.first.lines.length,this.first=t}while(this.first&&this.size+t.length>s);W.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(s)),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 H(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 Y{constructor(t,e,s){this.maxChunkRecords=t,this.flushFn=e,this.scheduleSend=s,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 Z{constructor(t,e,s,r,i){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=${r}`,this.writeOptions=Object.assign(Object.assign({},h),i),this.currentTime=D[r],this.dateToProtocolTimestamp=L[r];var n;this.writeBuffer=new Y(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=(n=this.writeOptions,new J(n)),this.retryBuffer=new X(this.writeOptions.maxBufferLines,this.sendBatch)}sendBatch(t,e){const s=this;return!this.closed&&t.length>0?new Promise((r,i)=>{this.transport.send(this.httpPath,t.join("\n"),this.sendOptions,{error(r){!s.closed&&e>1&&(!(r instanceof f)||r.statusCode>=429)?(W.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,r),s.retryBuffer.addLines(t,e-1,s.retryStrategy.nextDelay(r)),i(r)):(W.error("Write to influx DB failed.",r),i(r))},complete(){s.retryStrategy.success(),r()}})}):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 H(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&&W.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]=b.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 G={concat:(t,e)=>i.Buffer.concat([t,e]),toUtf8String:(t,e,s)=>t.toString("utf-8",e,s),copy(t,e,s){const r=i.Buffer.allocUnsafe(s-e);return t.copy(r,0,e,s),r}};const K={flush:n.Z_SYNC_FLUSH,finishFlush:n.Z_SYNC_FLUSH},Q=i.Buffer.allocUnsafe(0);class tt{constructor(){this.cancelled=!1}cancel(){this.cancelled=!0}isCancelled(){return this.cancelled}}class et{constructor(t){this.connectionOptions=t,this.chunkCombiner=G;const i=e.parse(t.url);if(this.defaultOptions=Object.assign(Object.assign(Object.assign(Object.assign({},o),t),t.transportOptions),{port:i.port,protocol:i.protocol,hostname:i.hostname}),"http:"===i.protocol)this.requestApi=s.request;else{if("https:"!==i.protocol)throw new Error(`Unsupported protocol "${i.protocol} in URL: "${t.url}"`);this.requestApi=r.request}}send(t,e,s,r){const i=this.createRequestMessage(t,e,s),n=new tt;r&&r.useCancellable&&r.useCancellable(n),this._request(i,n,r)}request(t,e,s){e?"string"!=typeof e&&(e=JSON.stringify(e)):e="";let r,n=Q;return new Promise((o,l)=>{this.send(t,e,s,{responseStarted(t){r=String(t["content-type"])},next:t=>{n=i.Buffer.concat([n,t])},complete:()=>{try{r.includes("json")?o(JSON.parse(n.toString("utf8"))):r.includes("text")?o(n.toString("utf8")):o(n)}catch(t){l(t)}},error:t=>{l(t)}})})}createRequestMessage(t,e,s){const r=i.Buffer.from(e,"utf-8"),n={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.4.0.nightly"};this.connectionOptions.token&&(n.authorization="Token "+this.connectionOptions.token);const o=Object.assign(Object.assign({},this.defaultOptions),{path:t,method:s.method,headers:Object.assign(Object.assign({},n),s.headers),body:r});return o.headers["content-length"]=r.length,o}_request(t,e,s){const r=function(t={}){let e=0;return{next:s=>{0===e&&t.next&&null!=s&&t.next(s)},error:s=>{0===e&&(e=1,t.error&&t.error(s))},complete:()=>{0===e&&(e=2,t.complete&&t.complete())},responseStarted:e=>{t.responseStarted&&t.responseStarted(e)}}}(s);if(e.isCancelled())return void r.complete();const i=this.requestApi(t,t=>{if(e.isCancelled())return t.resume(),void r.complete();t.on("aborted",()=>{r.error(new m)}),r.responseStarted(t.headers);const s=t.statusCode||600;let i;if("gzip"===t.headers["content-encoding"]?(i=n.createGunzip(K),t.pipe(i)):i=t,i.on("error",r.error),s>=300){let e="";i.on("data",s=>{e+=s.toString(),e.length>1e3&&(e=e.slice(0,1e3),t.resume())}),i.on("end",()=>r.error(new f(s,t.statusMessage,e,t.headers["retry-after"])))}else i.on("data",s=>{e.isCancelled()?t.resume():r.next(s)}),i.on("end",r.complete)});"function"==typeof i.setTimeout&&i.setTimeout(t.timeout),i.on("timeout",()=>{r.error(new g)}),i.on("error",t=>{r.error(t)}),i.on("close",r.complete),t.body&&i.write(t.body),i.end()}}class st{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,s=0;this.previous?(t=this.chunks.concat(this.previous,t),e=this.previous.length):e=0;let r=!1;for(;e<t.length;){const i=t[e];if(10===i){if(!r){const r=e>0&&13===t[e-1]?e-1:e;this.target.next(this.chunks.toUtf8String(t,s,r)),s=e+1}}else 34===i&&(r=!r);e++}this.previous=s<e?this.chunks.copy(t,s,e):void 0}}class rt{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,s=0;const r=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,s,n,e);this._reuse?r[i++]=o:r.push(o),s=n+1,e=0}}else'"'===o&&e++}const n=this.getValue(t,s,t.length,e);return this._reuse?(r[i]=n,this.lastSplitLength=i+1):(r.push(n),this.lastSplitLength=r.length),r}getValue(t,e,s,r){return e===t.length?"":0===r?t.substring(e,s):2===r?t.substring(e+1,s-1):t.substring(e+1,s-1).replace(/""/gi,'"')}}function it(t){const e=(new rt).withReuse();let s,r,i=!0,n=0;return{error(e){t.error(e)},next(o){if(""===o)i=!0,s=void 0;else{const l=e.splitLine(o),h=e.lastSplitLength;if(i){if(!s){s=new Array(h);for(let t=0;t<h;t++)s[t]=new F}if(l[0].startsWith("#")){if("#datatype"===l[0])for(let t=1;t<h;t++)s[t].dataType=l[t];else if("#default"===l[0])for(let t=1;t<h;t++)s[t].defaultValue=l[t];else if("#group"===l[0])for(let t=1;t<h;t++)s[t].group="t"===l[t][0]}else{""===l[0]?(n=1,s=s.slice(1)):n=0;for(let t=n;t<h;t++)s[t-n].label=l[t];r=new P(s),i=!1}}else t.next(l.slice(n,h),r)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const nt="function"==typeof Symbol&&Symbol.observable||"@@observable";class ot{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 lt(){}class ht{constructor(t,e){this.executor=t,this.decorator=e}subscribe(t,e,s){const r=function(t){const{next:e,error:s,complete:r}=t;return{next:e?e.bind(t):lt,error:s?s.bind(t):lt,complete:r?r.bind(t):lt}}("object"!=typeof t||null===t?{next:t,error:e,complete:s}:t);return new ot(this.decorator(r),this.executor)}[nt](){return this}}const ut={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},at=t=>t;class ct{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 ht(this.createExecutor(t),at)}rows(t){return new ht(this.createExecutor(t),t=>it({next(e,s){t.next({values:e,tableMeta:s})},error(e){t.error(e)},complete(){t.complete()}}))}queryLines(t,e){this.createExecutor(t)(e)}queryRows(t,e){this.createExecutor(t)(it(e))}createExecutor(t){const{org:e,type:s,gzip:r}=this.options;return i=>{this.transport.send(`/api/v2/query?org=${encodeURIComponent(e)}`,JSON.stringify(this.decorateRequest({query:t.toString(),dialect:ut,type:s})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":r?"gzip":"identity"}},new st(i,this.transport.chunkCombiner))}}decorateRequest(t){return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=this.options.type||"flux",t}}exports.AbortError=m,exports.DEFAULT_ConnectionOptions=o,exports.DEFAULT_RetryDelayStrategyOptions=l,exports.DEFAULT_WriteOptions=h,exports.FLUX_VALUE=q,exports.FluxTableColumn=F,exports.FluxTableMetaData=P,exports.HttpError=f,exports.IllegalArgumentError=c,exports.InfluxDB=class{constructor(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new c("No url or configuration specified!");this._options=t}const e=this._options.url;if("string"!=typeof e)throw new c("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new et(this._options)}getWriteApi(t,e,s="ns",r){return new Z(this.transport,t,e,s,r||this._options.writeOptions)}getQueryApi(t){return new ct(this.transport,t)}},exports.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 s;if(isNaN(s=parseInt(String(e))))throw new Error(`Expected integer value for field ${t}, but got '${e}'!`);e=s}return this.fields[t]=`${Math.floor(e)}i`,this}floatField(t,e){if("number"!=typeof e){let s;if(isNaN(s=parseFloat(e)))throw new Error(`Expected float value for field ${t}, but got '${e}'!`);e=s}return this.fields[t]=String(e),this}stringField(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=b.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 s=this.fields[t];e.length>0&&(e+=","),e+=`${b.tag(t)}=${s}`}}),0===e.length)return;let s="";const r=t&&t.defaultTags?Object.assign(Object.assign({},t.defaultTags),this.tags):this.tags;Object.keys(r).sort().forEach(t=>{if(t){const e=r[t];e&&(s+=",",s+=`${b.tag(t)}=${b.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${b.measurement(this.name)}${s} ${e}${void 0!==i?" "+i:""}`}toString(){const t=this.toLineProtocol(void 0);return t||`invalid point: ${JSON.stringify(this,void 0)}`}},exports.RequestTimedOutError=g,exports.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!p.includes(t.code)))},exports.currentTime=D,exports.dateToProtocolTimestamp=L,exports.escape=b,exports.flux=function(t,...e){if(1==t.length&&(!e||0===e.length))return t[0];const s=new Array(t.length+e.length);let r=0;for(let i=0;i<t.length;i++){const n=t[i];if(s[r++]=n,i<e.length){const o=e[i];let l;if(n.endsWith('"')&&i+1<t.length&&t[i+1].startsWith('"'))l=U(o);else if(l=I(o),""===l)throw new Error(`Unsupported parameter literal '${o}' at index: ${i}, type: ${typeof o}`);s[r++]=l}else if(i<t.length-1)throw new Error("Too few parameters supplied!")}return N(s.join(""))},exports.fluxBool=function(t){return new M("true"===t||"false"===t?t:(!!t).toString())},exports.fluxDateTime=function(t){return new M(function(t){return`time(v: "${U(t)}")`}(t))},exports.fluxDuration=function(t){return new M(`duration(v: "${U(t)}")`)},exports.fluxExpression=N,exports.fluxFloat=function(t){return new M(z(t))},exports.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 M(e)},exports.fluxRegExp=function(t){return new M(k(t))},exports.fluxString=function(t){return new M(`"${U(t)}"`)},exports.getRetryDelay=d,exports.isStatusCodeRetriable=a,exports.sanitizeFloat=z,exports.toFluxValue=I,exports.typeSerializers=B,exports.useProcessHrtime=O;
//# sourceMappingURL=index.js.map

@@ -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,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,b=function(){function t(t,e){void 0===e&&(e=""),this.wrap=e;var r=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;)r+=t.slice(e,n.index)+"\\"+n[0],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}(),w=function(t){return t.escape.bind(t)},x={measurement:w(new b([","," "])),quoted:w(new b(['"',"\\\\"],'"')),tag:w(new b([",","="," "]))};var S=Date.now(),O=0;function T(){var t=Date.now();t!==S?(S=t,O=0):O++;var e=String(O);return String(t)+"000000000".substr(0,6-e.length)+e}function E(){return String(Date.now())+"000000000".substr(0,3)}function R(){return String(Date.now())}function _(){return String(Math.floor(Date.now()/1e3))}var C=Object.freeze(((d={})[String("s")]=_,d[String("ms")]=R,d[String("us")]=E,d[String("ns")]=T,d.seconds=_,d.millis=R,d.micros=E,d.nanos=T,d)),D=((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),A=function(t){return t},P={boolean:function(t){return"true"===t},unsignedLong:A,long:A,double:function(t){return+t},string:A,base64Binary:A,dateTime:A,duration:A},j=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]=(P[i.dataType]||A)(n)}return e},t}(),L=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}(),k=Symbol("FLUX_VALUE"),B=function(){function t(t){this.fluxValue=t}return t.prototype.toString=function(){return this.fluxValue},t.prototype[k]=function(){return this.fluxValue},t}();function U(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 F(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 z(t){return'regexp.compile(v: "'+U(t)+'")'}function H(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?'"'+U(t)+'"':"number"==typeof t?F(t):"object"==typeof t&&"function"==typeof t[k]?t[k]():t instanceof Date?t.toISOString():t instanceof RegExp?z(t):H(t.toString())}var I=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]=x.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+=x.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+=x.tag(t)+"="+x.tag(e))}}));var s=this.time;return t&&t.convertTime&&(s=t.convertTime(s)),""+x.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}(),M=Object.freeze({error:function(t,e){console.error("ERROR: "+t,e||"")},warn:function(t,e){console.warn("WARN: "+t,e||"")}}),N=function(t,e){M.error(t,e)},V=function(t,e){M.warn(t,e)},q=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 W=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);N("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}(),J=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}(),$=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=C[i],this.dateToProtocolTimestamp=D[i];var a;this.writeBuffer=new J(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 q(a)),this.retryBuffer=new W(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){!n.closed&&e>1&&(!(r instanceof l)||r.statusCode>=429)?(V("Write to influx DB failed (remaining attempts: "+(e-1)+").",r),n.retryBuffer.addLines(t,e-1,n.retryStrategy.nextDelay(r)),o(r)):(N("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&&N("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]=x.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}(),G={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 X=function(){function t(t){this.connectionOptions=t,this.chunkCombiner=G,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.4.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){u.error(new l(t.status,t.statusText,e,t.headers.get("retry-after")))})).catch((function(e){V("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;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(),V("Unable to read error body",c),[3,8];case 8:if(i>=300)throw 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}(),K=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}(),Q=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 Y(t){var e,r,n=(new Q).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 L}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 j(e),i=!1}}else t.next(u.slice(o,a),r)}},complete:function(){t.complete()},useCancellable:function(e){t.useCancellable&&t.useCancellable(e)}}}var Z="function"==typeof Symbol&&Symbol.observable||"@@observable",tt=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 et(){}var rt=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):et,error:r?r.bind(t):et,complete:n?n.bind(t):et}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new tt(this.decorator(n),this.executor)},t.prototype[Z]=function(){return this},t}(),nt={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},it=function(t){return t},ot=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 rt(this.createExecutor(t),it)},t.prototype.rows=function(t){return new rt(this.createExecutor(t),(function(t){return Y({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)(Y(e))},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:nt,type:i})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":o?"gzip":"identity"}},new K(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}(),st=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 X(this._options)}return t.prototype.getWriteApi=function(t,e,r,n){return void 0===r&&(r="ns"),new $(this.transport,t,e,r,n||this._options.writeOptions)},t.prototype.getQueryApi=function(t){return new ot(this.transport,t)},t}();return t.AbortError=v,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=s,t.DEFAULT_WriteOptions=u,t.FLUX_VALUE=k,t.FluxTableColumn=L,t.FluxTableMetaData=j,t.HttpError=l,t.IllegalArgumentError=f,t.InfluxDB=st,t.Point=I,t.RequestTimedOutError=g,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.currentTime=C,t.dateToProtocolTimestamp=D,t.escape=x,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=U(u);else if(""===(a=H(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 n.join("")},t.fluxBool=function(t){return new B("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new B(function(t){return'time(v: "'+U(t)+'")'}(t))},t.fluxDuration=function(t){return new B('duration(v: "'+U(t)+'")')},t.fluxExpression=function(t){return new B(String(t))},t.fluxFloat=function(t){return new B(F(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 B(e)},t.fluxRegExp=function(t){return new B(z(t))},t.fluxString=function(t){return new B('"'+U(t)+'"')},t.getRetryDelay=p,t.isStatusCodeRetriable=c,t.sanitizeFloat=F,t.toFluxValue=H,t.typeSerializers=P,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,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,b=function(){function t(t,e){void 0===e&&(e=""),this.wrap=e;var r=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;)r+=t.slice(e,n.index)+"\\"+n[0],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}(),w=function(t){return t.escape.bind(t)},x={measurement:w(new b([","," "])),quoted:w(new b(['"',"\\\\"],'"')),tag:w(new b([",","="," "]))};var S=Date.now(),O=0;function T(){var t=Date.now();t!==S?(S=t,O=0):O++;var e=String(O);return String(t)+"000000000".substr(0,6-e.length)+e}function E(){return String(Date.now())+"000000000".substr(0,3)}function R(){return String(Date.now())}function _(){return String(Math.floor(Date.now()/1e3))}var C=Object.freeze(((d={})[String("s")]=_,d[String("ms")]=R,d[String("us")]=E,d[String("ns")]=T,d.seconds=_,d.millis=R,d.micros=E,d.nanos=T,d)),D=((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),A=function(t){return t},P={boolean:function(t){return"true"===t},unsignedLong:A,long:A,double:function(t){return+t},string:A,base64Binary:A,dateTime:A,duration:A},j=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]=(P[i.dataType]||A)(n)}return e},t}(),L=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}(),k=Symbol("FLUX_VALUE"),B=function(){function t(t){this.fluxValue=t}return t.prototype.toString=function(){return this.fluxValue},t.prototype[k]=function(){return this.fluxValue},t}();function U(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 F(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 z(t){return'regexp.compile(v: "'+U(t)+'")'}function H(t){return new B(String(t))}function I(t){return void 0===t?"":null===t?"null":"boolean"==typeof t?t.toString():"string"==typeof t?'"'+U(t)+'"':"number"==typeof t?F(t):"object"==typeof t&&"function"==typeof t[k]?t[k]():t instanceof Date?t.toISOString():t instanceof RegExp?z(t):I(t.toString())}var M=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]=x.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+=x.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+=x.tag(t)+"="+x.tag(e))}}));var s=this.time;return t&&t.convertTime&&(s=t.convertTime(s)),""+x.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}(),N=Object.freeze({error:function(t,e){console.error("ERROR: "+t,e||"")},warn:function(t,e){console.warn("WARN: "+t,e||"")}}),V=function(t,e){N.error(t,e)},q=function(t,e){N.warn(t,e)},W=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 J=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);V("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}(),$=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}(),G=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=C[i],this.dateToProtocolTimestamp=D[i];var a;this.writeBuffer=new $(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 W(a)),this.retryBuffer=new J(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){!n.closed&&e>1&&(!(r instanceof l)||r.statusCode>=429)?(q("Write to influx DB failed (remaining attempts: "+(e-1)+").",r),n.retryBuffer.addLines(t,e-1,n.retryStrategy.nextDelay(r)),o(r)):(V("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&&V("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]=x.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}(),X={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 K=function(){function t(t){this.connectionOptions=t,this.chunkCombiner=X,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.4.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){u.error(new l(t.status,t.statusText,e,t.headers.get("retry-after")))})).catch((function(e){q("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;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(),q("Unable to read error body",c),[3,8];case 8:if(i>=300)throw 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}(),Q=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}(),Y=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 Z(t){var e,r,n=(new Y).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 L}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 j(e),i=!1}}else t.next(u.slice(o,a),r)}},complete:function(){t.complete()},useCancellable:function(e){t.useCancellable&&t.useCancellable(e)}}}var tt="function"==typeof Symbol&&Symbol.observable||"@@observable",et=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 rt(){}var nt=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):rt,error:r?r.bind(t):rt,complete:n?n.bind(t):rt}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new et(this.decorator(n),this.executor)},t.prototype[tt]=function(){return this},t}(),it={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},ot=function(t){return t},st=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 nt(this.createExecutor(t),ot)},t.prototype.rows=function(t){return new nt(this.createExecutor(t),(function(t){return Z({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)(Z(e))},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:it,type:i})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":o?"gzip":"identity"}},new Q(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}(),ut=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 K(this._options)}return t.prototype.getWriteApi=function(t,e,r,n){return void 0===r&&(r="ns"),new G(this.transport,t,e,r,n||this._options.writeOptions)},t.prototype.getQueryApi=function(t){return new st(this.transport,t)},t}();return t.AbortError=v,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=s,t.DEFAULT_WriteOptions=u,t.FLUX_VALUE=k,t.FluxTableColumn=L,t.FluxTableMetaData=j,t.HttpError=l,t.IllegalArgumentError=f,t.InfluxDB=ut,t.Point=M,t.RequestTimedOutError=g,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.currentTime=C,t.dateToProtocolTimestamp=D,t.escape=x,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=U(u);else if(""===(a=I(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 H(n.join(""))},t.fluxBool=function(t){return new B("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new B(function(t){return'time(v: "'+U(t)+'")'}(t))},t.fluxDuration=function(t){return new B('duration(v: "'+U(t)+'")')},t.fluxExpression=H,t.fluxFloat=function(t){return new B(F(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 B(e)},t.fluxRegExp=function(t){return new B(z(t))},t.fluxString=function(t){return new B('"'+U(t)+'"')},t.getRetryDelay=p,t.isStatusCodeRetriable=c,t.sanitizeFloat=F,t.toFluxValue=I,t.typeSerializers=P,t.useProcessHrtime=function(t){return!1},t}({});
//# sourceMappingURL=influxdb.min.js.map
{
"name": "@influxdata/influxdb-client",
"version": "1.4.0-nightly.6+3b54d4c",
"version": "1.4.0-nightly.7+245dfde",
"description": "InfluxDB 2.0 client",

@@ -69,3 +69,3 @@ "scripts": {

},
"gitHead": "3b54d4ccbb14fbd79791b1f84d06c8f0038a6a0d"
"gitHead": "245dfde14bf60f4f48b1147affeb73b28b702504"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc