New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.3.0-nightly.7 to 1.3.0-nightly.8

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}),s=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,maxRetries:2,maxBufferLines:32e3},e)),r=[404,408,425,429,500,502,503,504];function i(t){return r.includes(t)}class n extends Error{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}}class o extends Error{constructor(t,e,s,r){super(),this.statusCode=t,this.statusMessage=e,this.body=s,Object.setPrototypeOf(this,o.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 i(this.statusCode)}retryAfter(){return this._retryAfter}}const h=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function a(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 l extends Error{constructor(){super(),Object.setPrototypeOf(this,l.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 d{constructor(t,e=""){this.wrap=e;const s=t.join("").replace(u,"\\$&");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 f=t=>t.escape.bind(t),p={measurement:f(new d([","," "])),quoted:f(new d(['"',"\\\\"],'"')),tag:f(new d([",","="," "]))};let y=Date.now(),g=0;function m(){{const t=Date.now();t!==y?(y=t,g=0):g++;const e=String(g);return String(t)+"000000000".substr(0,6-e.length)+e}}function b(){return String(Date.now())+"000000000".substr(0,3)}function w(){return String(Date.now())}function x(){return String(Math.floor(Date.now()/1e3))}const O=Object.freeze({[String("s")]:x,[String("ms")]:w,[String("us")]:b,[String("ns")]:m,seconds:x,millis:w,micros:b,nanos:m}),v={[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`},T=t=>t,S={boolean:t=>"true"===t,unsignedLong:T,long:T,double:t=>+t,string:T,base64Binary:T,dateTime:T,duration:T};class R{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 n(`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]=(S[i.dataType]||T)(r)}return e}}class E{static from(t){const e=new E;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}function C(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{a(r.next(t))}catch(t){n(t)}}function h(t){try{a(r.throw(t))}catch(t){n(t)}}function a(t){t.done?i(t.value):new s((function(e){e(t.value)})).then(o,h)}a((r=r.apply(t,e||[])).next())}))}let _=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const j={error(t,e){_.error(t,e)},warn(t,e){_.warn(t,e)}};class D{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 ${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);j.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 C(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 A{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 P{constructor(t,e,r,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(r)}&precision=${i}`,this.writeOptions=Object.assign(Object.assign({},s),n),this.currentTime=O[i],this.dateToProtocolTimestamp=v[i];var o;this.writeBuffer=new A(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 D(o)),this.retryBuffer=new $(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 o)||r.statusCode>=429)?(j.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,r),s.retryBuffer.addLines(t,e-1,s.retryStrategy.nextDelay(r)),i(r)):(j.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 C(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&&j.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 B={concat(t,e){const s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},toUtf8String(t,e,s){let r,i,n,o,h="",a=e;for(;a<s;)switch(r=t[a++],r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:h+=String.fromCharCode(r);break;case 12:case 13:i=t[a++],h+=String.fromCharCode((31&r)<<6|63&i);break;case 14:i=t[a++],n=t[a++],h+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&n);break;case 15:i=t[a++],n=t[a++],o=t[a++],h+=String.fromCodePoint((7&r)<<18|(63&i)<<12|(63&n)<<6|63&o)}return h},copy(t,e,s){const r=new Uint8Array(s-e);return r.set(t.slice(e,s)),r}};class L{constructor(t){this.connectionOptions=t,this.chunkCombiner=B,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.3.0.nightly"},this.connectionOptions.token&&(this.defaultHeaders.Authorization="Token "+this.connectionOptions.token)}send(t,e,s,r){const i=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)}}}(r);if(r&&r.useCancellable&&!s.signal){const t=new AbortController,e=t.signal;r.useCancellable({cancel(){t.abort()},isCancelled:()=>e.aborted})}this.fetch(t,e,s).then(t=>C(this,void 0,void 0,(function*(){if(null==r?void 0:r.responseStarted){const e={};t.headers.forEach((t,s)=>{const r=e[s];void 0===r?e[s]=t:Array.isArray(r)?r.push(t):e[s]=[r,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=>{j.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 s;do{s=yield e.read(),i.next(s.value)}while(!s.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,s){return C(this,void 0,void 0,(function*(){const r=yield this.fetch(t,e,s),{status:i,headers:n}=r,h=n.get("content-type")||"";let a=void 0;try{h.includes("json")?a=yield r.json():h.includes("text")&&(a=yield r.text())}catch(t){j.warn("Unable to read error body",t)}if(i>=300)throw new o(i,r.statusText,a,r.headers.get("retry-after"));return a}))}fetch(t,e,s){const{method:r,headers:i}=s,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}),s=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,maxRetries:2,maxBufferLines:32e3},e)),r=[404,408,425,429,500,502,503,504];function i(t){return r.includes(t)}class n extends Error{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}}class o extends Error{constructor(t,e,s,r){super(),this.statusCode=t,this.statusMessage=e,this.body=s,Object.setPrototypeOf(this,o.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 i(this.statusCode)}retryAfter(){return this._retryAfter}}const h=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function a(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 l extends Error{constructor(){super(),Object.setPrototypeOf(this,l.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 d{constructor(t,e=""){this.wrap=e;const s=t.join("").replace(u,"\\$&");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 f=t=>t.escape.bind(t),p={measurement:f(new d([","," "])),quoted:f(new d(['"',"\\\\"],'"')),tag:f(new d([",","="," "]))};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 b(){return String(Date.now())+"000000000".substr(0,3)}function w(){return String(Date.now())}function x(){return String(Math.floor(Date.now()/1e3))}const O=Object.freeze({[String("s")]:x,[String("ms")]:w,[String("us")]:b,[String("ns")]:m,seconds:x,millis:w,micros:b,nanos:m}),v={[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`},T=t=>t,S={boolean:t=>"true"===t,unsignedLong:T,long:T,double:t=>+t,string:T,base64Binary:T,dateTime:T,duration:T};class R{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 n(`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]=(S[i.dataType]||T)(r)}return e}}class E{static from(t){const e=new E;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}function C(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{a(r.next(t))}catch(t){n(t)}}function h(t){try{a(r.throw(t))}catch(t){n(t)}}function a(t){t.done?i(t.value):new s((function(e){e(t.value)})).then(o,h)}a((r=r.apply(t,e||[])).next())}))}let _=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const j={error(t,e){_.error(t,e)},warn(t,e){_.warn(t,e)}};class D{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 ${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);j.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 C(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 A{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 P{constructor(t,e,r,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(r)}&precision=${i}`,this.writeOptions=Object.assign(Object.assign({},s),n),this.currentTime=O[i],this.dateToProtocolTimestamp=v[i];var o;this.writeBuffer=new A(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 D(o)),this.retryBuffer=new $(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 o)||r.statusCode>=429)?(j.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,r),s.retryBuffer.addLines(t,e-1,s.retryStrategy.nextDelay(r)),i(r)):(j.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 C(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&&j.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 B={concat(t,e){const s=new Uint8Array(t.length+e.length);return s.set(t),s.set(e,t.length),s},toUtf8String(t,e,s){let r,i,n,o,h="",a=e;for(;a<s;)switch(r=t[a++],r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:h+=String.fromCharCode(r);break;case 12:case 13:i=t[a++],h+=String.fromCharCode((31&r)<<6|63&i);break;case 14:i=t[a++],n=t[a++],h+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&n);break;case 15:i=t[a++],n=t[a++],o=t[a++],h+=String.fromCodePoint((7&r)<<18|(63&i)<<12|(63&n)<<6|63&o)}return h},copy(t,e,s){const r=new Uint8Array(s-e);return r.set(t.slice(e,s)),r}};class L{constructor(t){this.connectionOptions=t,this.chunkCombiner=B,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.3.0.nightly"},this.connectionOptions.token&&(this.defaultHeaders.Authorization="Token "+this.connectionOptions.token)}send(t,e,s,r){const i=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)}}}(r);if(r&&r.useCancellable&&!s.signal){const t=new AbortController,e=t.signal;r.useCancellable({cancel(){t.abort()},isCancelled:()=>e.aborted})}this.fetch(t,e,s).then(t=>C(this,void 0,void 0,(function*(){if(null==r?void 0:r.responseStarted){const e={};t.headers.forEach((t,s)=>{const r=e[s];void 0===r?e[s]=t:Array.isArray(r)?r.push(t):e[s]=[r,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=>{j.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 s;do{s=yield e.read(),i.next(s.value)}while(!s.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,s){return C(this,void 0,void 0,(function*(){const r=yield this.fetch(t,e,s),{status:i,headers:n}=r,h=n.get("content-type")||"";let a=void 0;try{h.includes("json")?a=yield r.json():h.includes("text")&&(a=yield r.text())}catch(t){j.warn("Unable to read error body",t)}if(i>=300)throw new o(i,r.statusText,a,r.headers.get("retry-after"));return a}))}fetch(t,e,s){const{method:r,headers:i}=s,n=
/*! *****************************************************************************

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

***************************************************************************** */
function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(s[r[i]]=t[r[i]])}return s}(s,["method","headers"]);return fetch(`${this.connectionOptions.url}${t}`,Object.assign({method:r,body:"GET"===r||"HEAD"===r?void 0:"string"==typeof e?e:JSON.stringify(e),headers:Object.assign(Object.assign({},this.defaultHeaders),i),credentials:"omit"},n))}}class M{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 k{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 z(t){const e=(new k).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 h=e.splitLine(o),a=e.lastSplitLength;if(i){if(!s){s=new Array(a);for(let t=0;t<a;t++)s[t]=new E}if(h[0].startsWith("#")){if("#datatype"===h[0])for(let t=1;t<a;t++)s[t].dataType=h[t];else if("#default"===h[0])for(let t=1;t<a;t++)s[t].defaultValue=h[t];else if("#group"===h[0])for(let t=1;t<a;t++)s[t].group="t"===h[t][0]}else{""===h[0]?(n=1,s=s.slice(1)):n=0;for(let t=n;t<a;t++)s[t-n].label=h[t];r=new R(s),i=!1}}else t.next(h.slice(n,a),r)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const H="function"==typeof Symbol&&Symbol.observable||"@@observable";class U{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 F(){}class I{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):F,error:s?s.bind(t):F,complete:r?r.bind(t):F}}("object"!=typeof t||null===t?{next:t,error:e,complete:s}:t);return new U(this.decorator(r),this.executor)}[H](){return this}}const N={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},q=t=>t;class V{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 I(this.createExecutor(t),q)}rows(t){return new I(this.createExecutor(t),t=>z({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)(z(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,dialect:N,type:s})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":r?"gzip":"identity"}},new M(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=s,t.FluxTableColumn=E,t.FluxTableMetaData=R,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}if(void 0===this._options.url)throw new n("No url specified!");this.transport=this._options.transport||new L(this._options)}getWriteApi(t,e,s="ns"){return new P(this.transport,t,e,s,this._options.writeOptions)}getQueryApi(t){return new V(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 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]=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 s=this.fields[t];e.length>0&&(e+=","),e+=`${p.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+=`${p.tag(t)}=${p.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${p.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)}`}},t.RequestTimedOutError=l,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.currentTime=O,t.dateToProtocolTimestamp=v,t.escape=p,t.getRetryDelay=a,t.isStatusCodeRetriable=i,t.typeSerializers=S,t.useProcessHrtime=function(t){return!1},Object.defineProperty(t,"__esModule",{value:!0})}));
function(t,e){var s={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(s[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(s[r[i]]=t[r[i]])}return s}(s,["method","headers"]);return fetch(`${this.connectionOptions.url}${t}`,Object.assign({method:r,body:"GET"===r||"HEAD"===r?void 0:"string"==typeof e?e:JSON.stringify(e),headers:Object.assign(Object.assign({},this.defaultHeaders),i),credentials:"omit"},n))}}class M{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 k{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 z(t){const e=(new k).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 h=e.splitLine(o),a=e.lastSplitLength;if(i){if(!s){s=new Array(a);for(let t=0;t<a;t++)s[t]=new E}if(h[0].startsWith("#")){if("#datatype"===h[0])for(let t=1;t<a;t++)s[t].dataType=h[t];else if("#default"===h[0])for(let t=1;t<a;t++)s[t].defaultValue=h[t];else if("#group"===h[0])for(let t=1;t<a;t++)s[t].group="t"===h[t][0]}else{""===h[0]?(n=1,s=s.slice(1)):n=0;for(let t=n;t<a;t++)s[t-n].label=h[t];r=new R(s),i=!1}}else t.next(h.slice(n,a),r)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const H="function"==typeof Symbol&&Symbol.observable||"@@observable";class U{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 F(){}class I{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):F,error:s?s.bind(t):F,complete:r?r.bind(t):F}}("object"!=typeof t||null===t?{next:t,error:e,complete:s}:t);return new U(this.decorator(r),this.executor)}[H](){return this}}const N={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},q=t=>t;class V{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 I(this.createExecutor(t),q)}rows(t){return new I(this.createExecutor(t),t=>z({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)(z(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,dialect:N,type:s})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":r?"gzip":"identity"}},new M(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=s,t.FluxTableColumn=E,t.FluxTableMetaData=R,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 L(this._options)}getWriteApi(t,e,s="ns"){return new P(this.transport,t,e,s,this._options.writeOptions)}getQueryApi(t){return new V(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 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]=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 s=this.fields[t];e.length>0&&(e+=","),e+=`${p.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+=`${p.tag(t)}=${p.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${p.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)}`}},t.RequestTimedOutError=l,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.currentTime=O,t.dateToProtocolTimestamp=v,t.escape=p,t.getRetryDelay=a,t.isStatusCodeRetriable=i,t.typeSerializers=S,t.useProcessHrtime=function(t){return!1},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.browser.js.map

@@ -16,3 +16,3 @@ "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},h=Object.freeze({retryJitter:200,minRetryDelay:1e3,maxRetryDelay:15e3}),l=Object.freeze(Object.assign({batchSize:1e3,flushInterval:6e4,maxRetries:2,maxBufferLines:32e3},h)),a=[404,408,425,429,500,502,503,504];function c(t){return a.includes(t)}class u extends Error{constructor(t){super(t),Object.setPrototypeOf(this,u.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 c(this.statusCode)}retryAfter(){return this._retryAfter}}const d=["ECONNRESET","ENOTFOUND","ESOCKETTIMEDOUT","ETIMEDOUT","ECONNREFUSED","EHOSTUNREACH","EPIPE"];function p(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 b{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),x={measurement:w(new b([","," "])),quoted:w(new b(['"',"\\\\"],'"')),tag:w(new b([",","="," "]))};let O=!1;function S(t){return O=t&&process&&"function"==typeof process.hrtime}S(!0);let v=void 0,T=void 0,R=Date.now(),_=0;function C(){if(O){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,_=0):_++;const e=String(_);return String(t)+"000000000".substr(0,6-e.length)+e}}function E(){if(O){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 j(){return String(Date.now())}function D(){return String(Math.floor(Date.now()/1e3))}const $=Object.freeze({[String("s")]:D,[String("ms")]:j,[String("us")]:E,[String("ns")]:C,seconds:D,millis:j,micros:E,nanos:C}),B={[String("s")]:t=>`${Math.floor(t.getTime()/1e3)}`,[String("ms")]:t=>`${t.getTime()}`,[String("us")]:t=>`${t.getTime()}000`,[String("ns")]:t=>`${t.getTime()}000000`},L=t=>t,P={boolean:t=>"true"===t,unsignedLong:L,long:L,double:t=>+t,string:L,base64Binary:L,dateTime:L,duration:L};class A{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 u(`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]=(P[i.dataType]||L)(r)}return e}}class q{static from(t){const e=new q;return e.label=t.label,e.dataType=t.dataType,e.group=Boolean(t.group),e.defaultValue=t.defaultValue||"",e}}

***************************************************************************** */
function M(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function h(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){t.done?i(t.value):new s((function(e){e(t.value)})).then(o,h)}l((r=r.apply(t,e||[])).next())}))}let z=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const F={error(t,e){z.error(t,e)},warn(t,e){z.warn(t,e)}};class U{constructor(t){this.options=Object.assign(Object.assign({},h),t),this.success()}nextDelay(t){const 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)}success(){this.currentDelay=void 0}}class N{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);F.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 M(this,void 0,void 0,(function*(){let t;for(;t=this.removeLines();)yield this.retryLines(t.lines,t.retryCount)}))}close(){return this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this.closed=!0,this.size}}class H{constructor(t,e,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 k{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({},l),i),this.currentTime=$[r],this.dateToProtocolTimestamp=B[r];var n;this.writeBuffer=new H(this.writeOptions.batchSize,t=>(this._clearFlushTimeout(),this.sendBatch(t,this.writeOptions.maxRetries+1)),()=>{this.writeOptions.flushInterval>0&&(this._clearFlushTimeout(),this.closed||(this._timeoutHandle=setTimeout(()=>this.sendBatch(this.writeBuffer.reset(),this.writeOptions.maxRetries+1).catch(t=>{}),this.writeOptions.flushInterval)))}),this.sendBatch=this.sendBatch.bind(this),this.retryStrategy=(n=this.writeOptions,new U(n)),this.retryBuffer=new N(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)?(F.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,r),s.retryBuffer.addLines(t,e-1,s.retryStrategy.nextDelay(r)),i(r)):(F.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 M(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&&F.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]=x.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 I={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 V={flush:n.Z_SYNC_FLUSH,finishFlush:n.Z_SYNC_FLUSH},J=i.Buffer.allocUnsafe(0);class W{constructor(){this.cancelled=!1}cancel(){this.cancelled=!0}isCancelled(){return this.cancelled}}class Y{constructor(t){this.connectionOptions=t,this.chunkCombiner=I;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 W;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=J;return new Promise((o,h)=>{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){h(t)}},error:t=>{h(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.3.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(V),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 Z{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 G{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 K(t){const e=(new G).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 h=e.splitLine(o),l=e.lastSplitLength;if(i){if(!s){s=new Array(l);for(let t=0;t<l;t++)s[t]=new q}if(h[0].startsWith("#")){if("#datatype"===h[0])for(let t=1;t<l;t++)s[t].dataType=h[t];else if("#default"===h[0])for(let t=1;t<l;t++)s[t].defaultValue=h[t];else if("#group"===h[0])for(let t=1;t<l;t++)s[t].group="t"===h[t][0]}else{""===h[0]?(n=1,s=s.slice(1)):n=0;for(let t=n;t<l;t++)s[t-n].label=h[t];r=new A(s),i=!1}}else t.next(h.slice(n,l),r)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const Q="function"==typeof Symbol&&Symbol.observable||"@@observable";class X{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 tt(){}class et{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):tt,error:s?s.bind(t):tt,complete:r?r.bind(t):tt}}("object"!=typeof t||null===t?{next:t,error:e,complete:s}:t);return new X(this.decorator(r),this.executor)}[Q](){return this}}const st={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},rt=t=>t;class it{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 et(this.createExecutor(t),rt)}rows(t){return new et(this.createExecutor(t),t=>K({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)(K(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,dialect:st,type:s})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":r?"gzip":"identity"}},new Z(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=h,exports.DEFAULT_WriteOptions=l,exports.FluxTableColumn=q,exports.FluxTableMetaData=A,exports.HttpError=f,exports.IllegalArgumentError=u,exports.InfluxDB=class{constructor(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new u("No url or configuration specified!");this._options=t}if(void 0===this._options.url)throw new u("No url specified!");this.transport=this._options.transport||new Y(this._options)}getWriteApi(t,e,s="ns"){return new k(this.transport,t,e,s,this._options.writeOptions)}getQueryApi(t){return new it(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]=x.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+=`${x.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+=`${x.tag(t)}=${x.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${x.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||!d.includes(t.code)))},exports.currentTime=$,exports.dateToProtocolTimestamp=B,exports.escape=x,exports.getRetryDelay=p,exports.isStatusCodeRetriable=c,exports.typeSerializers=P,exports.useProcessHrtime=S;
function M(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function h(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){t.done?i(t.value):new s((function(e){e(t.value)})).then(o,h)}l((r=r.apply(t,e||[])).next())}))}let z=Object.freeze({error(t,e){console.error("ERROR: "+t,e||"")},warn(t,e){console.warn("WARN: "+t,e||"")}});const F={error(t,e){z.error(t,e)},warn(t,e){z.warn(t,e)}};class U{constructor(t){this.options=Object.assign(Object.assign({},h),t),this.success()}nextDelay(t){const 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)}success(){this.currentDelay=void 0}}class N{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);F.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 M(this,void 0,void 0,(function*(){let t;for(;t=this.removeLines();)yield this.retryLines(t.lines,t.retryCount)}))}close(){return this._timeoutHandle&&(clearTimeout(this._timeoutHandle),this._timeoutHandle=void 0),this.closed=!0,this.size}}class H{constructor(t,e,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 k{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({},l),i),this.currentTime=$[r],this.dateToProtocolTimestamp=B[r];var n;this.writeBuffer=new H(this.writeOptions.batchSize,t=>(this._clearFlushTimeout(),this.sendBatch(t,this.writeOptions.maxRetries+1)),()=>{this.writeOptions.flushInterval>0&&(this._clearFlushTimeout(),this.closed||(this._timeoutHandle=setTimeout(()=>this.sendBatch(this.writeBuffer.reset(),this.writeOptions.maxRetries+1).catch(t=>{}),this.writeOptions.flushInterval)))}),this.sendBatch=this.sendBatch.bind(this),this.retryStrategy=(n=this.writeOptions,new U(n)),this.retryBuffer=new N(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)?(F.warn(`Write to influx DB failed (remaining attempts: ${e-1}).`,r),s.retryBuffer.addLines(t,e-1,s.retryStrategy.nextDelay(r)),i(r)):(F.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 M(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&&F.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]=x.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 I={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 V={flush:n.Z_SYNC_FLUSH,finishFlush:n.Z_SYNC_FLUSH},J=i.Buffer.allocUnsafe(0);class W{constructor(){this.cancelled=!1}cancel(){this.cancelled=!0}isCancelled(){return this.cancelled}}class Y{constructor(t){this.connectionOptions=t,this.chunkCombiner=I;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 W;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=J;return new Promise((o,h)=>{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){h(t)}},error:t=>{h(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.3.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(V),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 Z{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 G{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 K(t){const e=(new G).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 h=e.splitLine(o),l=e.lastSplitLength;if(i){if(!s){s=new Array(l);for(let t=0;t<l;t++)s[t]=new q}if(h[0].startsWith("#")){if("#datatype"===h[0])for(let t=1;t<l;t++)s[t].dataType=h[t];else if("#default"===h[0])for(let t=1;t<l;t++)s[t].defaultValue=h[t];else if("#group"===h[0])for(let t=1;t<l;t++)s[t].group="t"===h[t][0]}else{""===h[0]?(n=1,s=s.slice(1)):n=0;for(let t=n;t<l;t++)s[t-n].label=h[t];r=new A(s),i=!1}}else t.next(h.slice(n,l),r)}},complete(){t.complete()},useCancellable(e){t.useCancellable&&t.useCancellable(e)}}}const Q="function"==typeof Symbol&&Symbol.observable||"@@observable";class X{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 tt(){}class et{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):tt,error:s?s.bind(t):tt,complete:r?r.bind(t):tt}}("object"!=typeof t||null===t?{next:t,error:e,complete:s}:t);return new X(this.decorator(r),this.executor)}[Q](){return this}}const st={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},rt=t=>t;class it{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 et(this.createExecutor(t),rt)}rows(t){return new et(this.createExecutor(t),t=>K({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)(K(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,dialect:st,type:s})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":r?"gzip":"identity"}},new Z(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=h,exports.DEFAULT_WriteOptions=l,exports.FluxTableColumn=q,exports.FluxTableMetaData=A,exports.HttpError=f,exports.IllegalArgumentError=u,exports.InfluxDB=class{constructor(t){if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new u("No url or configuration specified!");this._options=t}const e=this._options.url;if("string"!=typeof e)throw new u("No url specified!");e.endsWith("/")&&(this._options.url=e.substring(0,e.length-1)),this.transport=this._options.transport||new Y(this._options)}getWriteApi(t,e,s="ns"){return new k(this.transport,t,e,s,this._options.writeOptions)}getQueryApi(t){return new it(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]=x.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+=`${x.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+=`${x.tag(t)}=${x.tag(e)}`)}});let i=this.time;return t&&t.convertTime&&(i=t.convertTime(i)),`${x.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||!d.includes(t.code)))},exports.currentTime=$,exports.dateToProtocolTimestamp=B,exports.escape=x,exports.getRetryDelay=p,exports.isStatusCodeRetriable=c,exports.typeSerializers=P,exports.useProcessHrtime=S;
//# 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),h=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),l=["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 O=Date.now(),T=0;function S(){var t=Date.now();t!==O?(O=t,T=0):T++;var e=String(T);return String(t)+"000000000".substr(0,6-e.length)+e}function R(){return String(Date.now())+"000000000".substr(0,3)}function E(){return String(Date.now())}function C(){return String(Math.floor(Date.now()/1e3))}var _=Object.freeze(((d={})[String("s")]=C,d[String("ms")]=E,d[String("us")]=R,d[String("ns")]=S,d.seconds=C,d.millis=E,d.micros=R,d.nanos=S,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),P=function(t){return t},A={boolean:function(t){return"true"===t},unsignedLong:P,long:P,double:function(t){return+t},string:P,base64Binary:P,dateTime:P,duration:P},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]=(A[i.dataType]||P)(n)}return e},t}(),B=function(){function t(){}return t.from=function(e){var r=new t;return r.label=e.label,r.dataType=e.dataType,r.group=Boolean(e.group),r.defaultValue=e.defaultValue||"",r},t}(),L=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}(),k=Object.freeze({error:function(t,e){console.error("ERROR: "+t,e||"")},warn:function(t,e){console.warn("WARN: "+t,e||"")}}),z=function(t,e){k.error(t,e)},H=function(t,e){k.warn(t,e)},M=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 U=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);z("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}(),F=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}(),I=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=_[i],this.dateToProtocolTimestamp=D[i];var a;this.writeBuffer=new F(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 M(a)),this.retryBuffer=new U(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 h)||r.statusCode>=429)?(H("Write to influx DB failed (remaining attempts: "+(e-1)+").",r),n.retryBuffer.addLines(t,e-1,n.retryStrategy.nextDelay(r)),o(r)):(z("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&&z("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}(),N={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 q=function(){function t(t){this.connectionOptions=t,this.chunkCombiner=N,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.3.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 h(t.status,t.statusText,e,t.headers.get("retry-after")))})).catch((function(e){H("Unable to receive error body",e),u.error(new h(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(),H("Unable to read error body",c),[3,8];case 8:if(i>=300)throw new h(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}(),V=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}(),J=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 W(t){var e,r,n=(new J).withReuse(),i=!0,o=0;return{error:function(e){t.error(e)},next:function(s){if(""===s)i=!0,e=void 0;else{var u=n.splitLine(s),a=n.lastSplitLength;if(i){if(!e){e=new Array(a);for(var c=0;c<a;c++)e[c]=new B}if(u[0].startsWith("#")){if("#datatype"===u[0])for(c=1;c<a;c++)e[c].dataType=u[c];else if("#default"===u[0])for(c=1;c<a;c++)e[c].defaultValue=u[c];else if("#group"===u[0])for(c=1;c<a;c++)e[c].group="t"===u[c][0]}else{""===u[0]?(o=1,e=e.slice(1)):o=0;for(var c=o;c<a;c++)e[c-o].label=u[c];r=new 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 $="function"==typeof Symbol&&Symbol.observable||"@@observable",G=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 K(){}var Q=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):K,error:r?r.bind(t):K,complete:n?n.bind(t):K}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new G(this.decorator(n),this.executor)},t.prototype[$]=function(){return this},t}(),X={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},Y=function(t){return t},Z=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 Q(this.createExecutor(t),Y)},t.prototype.rows=function(t){return new Q(this.createExecutor(t),(function(t){return W({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)(W(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,dialect:X,type:i})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":o?"gzip":"identity"}},new V(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}(),tt=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}if(void 0===this._options.url)throw new f("No url specified!");this.transport=this._options.transport||new q(this._options)}return t.prototype.getWriteApi=function(t,e,r){return void 0===r&&(r="ns"),new I(this.transport,t,e,r,this._options.writeOptions)},t.prototype.getQueryApi=function(t){return new Z(this.transport,t)},t}();return t.AbortError=v,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=s,t.DEFAULT_WriteOptions=u,t.FluxTableColumn=B,t.FluxTableMetaData=j,t.HttpError=h,t.IllegalArgumentError=f,t.InfluxDB=tt,t.Point=L,t.RequestTimedOutError=g,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!l.includes(t.code)))},t.currentTime=_,t.dateToProtocolTimestamp=D,t.escape=x,t.getRetryDelay=p,t.isStatusCodeRetriable=c,t.typeSerializers=A,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),h=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),l=["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 O=Date.now(),T=0;function S(){var t=Date.now();t!==O?(O=t,T=0):T++;var e=String(T);return String(t)+"000000000".substr(0,6-e.length)+e}function R(){return String(Date.now())+"000000000".substr(0,3)}function E(){return String(Date.now())}function _(){return String(Math.floor(Date.now()/1e3))}var C=Object.freeze(((d={})[String("s")]=_,d[String("ms")]=E,d[String("us")]=R,d[String("ns")]=S,d.seconds=_,d.millis=E,d.micros=R,d.nanos=S,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),P=function(t){return t},A={boolean:function(t){return"true"===t},unsignedLong:P,long:P,double:function(t){return+t},string:P,base64Binary:P,dateTime:P,duration:P},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]=(A[i.dataType]||P)(n)}return e},t}(),B=function(){function t(){}return t.from=function(e){var r=new t;return r.label=e.label,r.dataType=e.dataType,r.group=Boolean(e.group),r.defaultValue=e.defaultValue||"",r},t}(),L=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}(),k=Object.freeze({error:function(t,e){console.error("ERROR: "+t,e||"")},warn:function(t,e){console.warn("WARN: "+t,e||"")}}),z=function(t,e){k.error(t,e)},H=function(t,e){k.warn(t,e)},M=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 U=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);z("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}(),F=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}(),I=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 F(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 M(a)),this.retryBuffer=new U(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 h)||r.statusCode>=429)?(H("Write to influx DB failed (remaining attempts: "+(e-1)+").",r),n.retryBuffer.addLines(t,e-1,n.retryStrategy.nextDelay(r)),o(r)):(z("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&&z("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}(),N={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 q=function(){function t(t){this.connectionOptions=t,this.chunkCombiner=N,this.defaultHeaders={"content-type":"application/json; charset=utf-8","User-Agent":"influxdb-client-js/1.3.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 h(t.status,t.statusText,e,t.headers.get("retry-after")))})).catch((function(e){H("Unable to receive error body",e),u.error(new h(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(),H("Unable to read error body",c),[3,8];case 8:if(i>=300)throw new h(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}(),V=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}(),J=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 W(t){var e,r,n=(new J).withReuse(),i=!0,o=0;return{error:function(e){t.error(e)},next:function(s){if(""===s)i=!0,e=void 0;else{var u=n.splitLine(s),a=n.lastSplitLength;if(i){if(!e){e=new Array(a);for(var c=0;c<a;c++)e[c]=new B}if(u[0].startsWith("#")){if("#datatype"===u[0])for(c=1;c<a;c++)e[c].dataType=u[c];else if("#default"===u[0])for(c=1;c<a;c++)e[c].defaultValue=u[c];else if("#group"===u[0])for(c=1;c<a;c++)e[c].group="t"===u[c][0]}else{""===u[0]?(o=1,e=e.slice(1)):o=0;for(var c=o;c<a;c++)e[c-o].label=u[c];r=new 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 $="function"==typeof Symbol&&Symbol.observable||"@@observable",G=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 K(){}var Q=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):K,error:r?r.bind(t):K,complete:n?n.bind(t):K}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new G(this.decorator(n),this.executor)},t.prototype[$]=function(){return this},t}(),X={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},Y=function(t){return t},Z=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 Q(this.createExecutor(t),Y)},t.prototype.rows=function(t){return new Q(this.createExecutor(t),(function(t){return W({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)(W(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,dialect:X,type:i})),{method:"POST",headers:{"content-type":"application/json; encoding=utf-8","accept-encoding":o?"gzip":"identity"}},new V(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}(),tt=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 q(this._options)}return t.prototype.getWriteApi=function(t,e,r){return void 0===r&&(r="ns"),new I(this.transport,t,e,r,this._options.writeOptions)},t.prototype.getQueryApi=function(t){return new Z(this.transport,t)},t}();return t.AbortError=v,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=s,t.DEFAULT_WriteOptions=u,t.FluxTableColumn=B,t.FluxTableMetaData=j,t.HttpError=h,t.IllegalArgumentError=f,t.InfluxDB=tt,t.Point=L,t.RequestTimedOutError=g,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!l.includes(t.code)))},t.currentTime=C,t.dateToProtocolTimestamp=D,t.escape=x,t.getRetryDelay=p,t.isStatusCodeRetriable=c,t.typeSerializers=A,t.useProcessHrtime=function(t){return!1},t}({});
//# sourceMappingURL=influxdb.min.js.map
{
"name": "@influxdata/influxdb-client",
"version": "1.3.0-nightly.7+494787e",
"version": "1.3.0-nightly.8+eef1c1a",
"description": "InfluxDB 2.0 client",

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

},
"gitHead": "494787ea2f3155ff1ed4a6884317f5241b8f1239"
"gitHead": "eef1c1ac074e64e6f3da515a3bcbcd852a1930f5"
}

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 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

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