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

@influxdata/influxdb3-client

Package Overview
Dependencies
Maintainers
11
Versions
399
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@influxdata/influxdb3-client - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0-nightly.1549

2

dist/index.js
"use strict";var ar=Object.create;var X=Object.defineProperty;var fr=Object.getOwnPropertyDescriptor;var cr=Object.getOwnPropertyNames;var lr=Object.getPrototypeOf,ur=Object.prototype.hasOwnProperty;var pr=(r,e)=>{for(var t in e)X(r,t,{get:e[t],enumerable:!0})},ot=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of cr(e))!ur.call(r,i)&&i!==t&&X(r,i,{get:()=>e[i],enumerable:!(n=fr(e,i))||n.enumerable});return r};var Z=(r,e,t)=>(t=r!=null?ar(lr(r)):{},ot(e||!r||!r.__esModule?X(t,"default",{value:r,enumerable:!0}):t,r)),mr=r=>ot(X({},"__esModule",{value:!0}),r);var Br={};pr(Br,{AbortError:()=>D,DEFAULT_ConnectionOptions:()=>ye,DEFAULT_WriteOptions:()=>we,HttpError:()=>R,IllegalArgumentError:()=>L,InfluxDBClient:()=>G,Log:()=>P,Point:()=>V,RequestTimedOutError:()=>B,collectAll:()=>yt,consoleLogger:()=>st,convertTime:()=>Ne,convertTimeToNanos:()=>ke,createTextDecoderCombiner:()=>hr,currentTime:()=>mt,dateToProtocolTimestamp:()=>ht,escape:()=>_,setLogger:()=>dr,useProcessHrtime:()=>pt,writableDataToLineProtocol:()=>Fe});module.exports=mr(Br);var L=class r extends Error{constructor(e){super(e),this.name="IllegalArgumentError",Object.setPrototypeOf(this,r.prototype)}},R=class r extends Error{constructor(t,n,i,o,s){super();this.statusCode=t;this.statusMessage=n;this.body=i;this.contentType=o;if(Object.setPrototypeOf(this,r.prototype),s)this.message=s;else if(i){if(o!=null&&o.startsWith("application/json"))try{this.json=JSON.parse(i),this.message=this.json.message,this.code=this.json.code}catch(a){}this.message||(this.message=`${t} ${n} : ${i}`)}else this.message=`${t} ${n}`;this.name="HttpError"}},B=class r extends Error{constructor(){super(),Object.setPrototypeOf(this,r.prototype),this.name="RequestTimedOutError",this.message="Request timed out"}},D=class r extends Error{constructor(){super(),this.name="AbortError",Object.setPrototypeOf(this,r.prototype),this.message="Response aborted"}};function hr(){let r=new TextDecoder("utf-8");return{concat(e,t){let n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n},copy(e,t,n){let i=new Uint8Array(n-t);return i.set(e.subarray(t,n)),i},toUtf8String(e,t,n){return r.decode(e.subarray(t,n))}}}var ye={timeout:1e4},we={precision:"ns",gzipThreshold:1e3};var st={error(r,e){console.error(`ERROR: ${r}`,e||"")},warn(r,e){console.warn(`WARN: ${r}`,e||"")}},H=st,P={error(r,e){H.error(r,e)},warn(r,e){H.warn(r,e)}};function dr(r){let e=H;return H=r,e}function xe(r,e){return function(t){let n="",i=0,o=0;for(;o<t.length;){let s=r.indexOf(t[o]);s>=0&&(n+=t.substring(i,o),n+=e[s],i=o+1),o++}return i==0?t:(i<t.length&&(n+=t.substring(i,t.length)),n)}}function gr(r,e){let t=xe(r,e);return n=>`"${t(n)}"`}var _={measurement:xe(`,
\r `,["\\,","\\ ","\\n","\\r","\\t"]),quoted:gr('"\\',['\\"',"\\\\"]),tag:xe(`, =
\r `,["\\,","\\ ","\\=","\\n","\\r","\\t"])};var Y="000000000",Oe=!1;function pt(r){return Oe=r&&process&&typeof process.hrtime=="function"}pt(!0);var at,z,ft=Date.now(),Te=0;function Ie(){if(Oe){let r=process.hrtime(),e=Date.now();z?(r[0]=r[0]-z[0],r[1]=r[1]-z[1],r[1]<0&&(r[0]-=1,r[1]+=1e9),e=at+r[0]*1e3+Math.floor(r[1]/1e6)):(z=r,at=e);let t=String(r[1]%1e6);return String(e)+Y.substr(0,6-t.length)+t}else{let r=Date.now();r!==ft?(ft=r,Te=0):Te++;let e=String(Te);return String(r)+Y.substr(0,6-e.length)+e}}function ct(){if(Oe){let r=process.hrtime(),e=String(Math.trunc(r[1]/1e3)%1e3);return String(Date.now())+Y.substr(0,3-e.length)+e}else return String(Date.now())+Y.substr(0,3)}function lt(){return String(Date.now())}function ut(){return String(Math.floor(Date.now()/1e3))}var mt={s:ut,ms:lt,us:ct,ns:Ie,seconds:ut,millis:lt,micros:ct,nanos:Ie},ht={s:r=>`${Math.floor(r.getTime()/1e3)}`,ms:r=>`${r.getTime()}`,us:r=>`${r.getTime()}000`,ns:r=>`${r.getTime()}000000`};function ke(r){return r===void 0?Ie():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?`${r.getTime()}000000`:String(typeof r=="number"?Math.floor(r):r)}var Ne=(r,e="ns")=>r===void 0?mt[e]():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?ht[e](r):String(typeof r=="number"?Math.floor(r):r);var V=class r{constructor(e){this._tags={};this.fields={};e&&(this._name=e)}measurement(e){return this._name=e,this}tag(e,t){return this._tags[e]=t,this}booleanField(e,t){return this.fields[e]=t?"T":"F",this}intField(e,t){let n;if(typeof t=="number"?n=t:n=parseInt(String(t)),isNaN(n)||n<=-9223372036854776e3||n>=9223372036854776e3)throw new Error(`invalid integer value for field '${e}': '${t}'!`);return this.fields[e]=`${Math.floor(n)}i`,this}uintField(e,t){if(typeof t=="number"){if(isNaN(t)||t<0||t>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${e}' out of range: ${t}`);this.fields[e]=`${Math.floor(t)}u`}else{let n=String(t);for(let i=0;i<n.length;i++){let o=n.charCodeAt(i);if(o<48||o>57)throw new Error(`uint value has an unsupported character at pos ${i}: ${t}`)}if(n.length>20||n.length===20&&n.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${e}' out of range: ${n}`);this.fields[e]=`${n}u`}return this}floatField(e,t){let n;if(typeof t=="number"?n=t:n=parseFloat(t),!isFinite(n))throw new Error(`invalid float value for field '${e}': '${t}'!`);return this.fields[e]=String(n),this}stringField(e,t){return t!=null&&(typeof t!="string"&&(t=String(t)),this.fields[e]=_.quoted(t)),this}timestamp(e){return this._time=e,this}toLineProtocol(e){if(!this._name)return;let t="";if(Object.keys(this.fields).sort().forEach(s=>{if(s){let a=this.fields[s];t.length>0&&(t+=","),t+=`${_.tag(s)}=${a}`}}),t.length===0)return;let n="",i=this._tags;Object.keys(i).sort().forEach(s=>{if(s){let a=i[s];a&&(n+=",",n+=`${_.tag(s)}=${_.tag(a)}`)}});let o=this._time;return e?typeof e=="string"?o=Ne(o,e):o=e(o):o=ke(o),`${_.measurement(this._name)}${n} ${t}${o!==void 0?` ${o}`:""}`}toString(){let e=this.toLineProtocol(void 0);return e||`invalid point: ${JSON.stringify(this,void 0)}`}static fromRecord(e){let{measurement:t,fields:n,tags:i,timestamp:o}=e;if(!t)throw new Error("measurement must be defined on the Point record!");if(!n)throw new Error("fields must be defined on the Point record!");let s=new r(t);o!==void 0&&s.timestamp(o);for(let[a,f]of Object.entries(n))if(typeof f=="number")s.floatField(a,f);else if(typeof f=="string")s.stringField(a,f);else throw new Error(`unsuported type of field ${a}: ${typeof f}`);if(i)for(let[a,f]of Object.entries(i))if(typeof f=="string")s.tag(a,f);else throw new Error(`tag has to be string ${a}: ${typeof f}`);return s}};var Ee=r=>{throw r},dt=r=>r!==void 0,gt=r=>r instanceof Array||r instanceof Object&&typeof r.length=="number"&&(r.length===0||Object.getOwnPropertyNames(r).some(e=>e==="0")),bt=r=>{let e=new Uint8Array(4);return e[0]=r>>0,e[1]=r>>8,e[2]=r>>16,e[3]=r>>24,e},yt=async r=>{let e=[];for await(let t of r)e.push(t);return e};var Fe=r=>{let e=gt(r)&&typeof r!="string"?Array.from(r):[r];if(e.length===0)return[];let t=typeof e[0]=="string",n=e[0]instanceof V;return t?e:(n?e:e.map(V.fromRecord)).map(i=>i.toLineProtocol()).filter(dt)};var Se=require("url"),xt=Z(require("http")),Tt=Z(require("https")),Q=require("buffer");var M=Z(require("zlib"));function Re(r={}){let e=0,t={next:n=>{if(e===0&&r.next&&n!==null&&n!==void 0)return r.next(n)},error:n=>{e===0&&(e=1,r.error&&r.error(n))},complete:()=>{e===0&&(e=2,r.complete&&r.complete())},responseStarted:(n,i)=>{r.responseStarted&&r.responseStarted(n,i)}};return r.useCancellable&&(t.useCancellable=r.useCancellable.bind(r)),r.useResume&&(t.useResume=r.useResume.bind(r)),t}var wt="0.2.0";var It=require("stream");var br={flush:M.default.constants.Z_SYNC_FLUSH,finishFlush:M.default.constants.Z_SYNC_FLUSH},yr=Q.Buffer.allocUnsafe(0),Ae=class{constructor(){this._cancelled=!1}cancel(){this._cancelled=!0,this.resume&&(this.resume(),this.resume=void 0)}isCancelled(){return this._cancelled}},De=class{constructor(e){var f,l,u,p,m,h,b;let{host:t,proxyUrl:n,token:i,transportOptions:o,...s}=e,a=(0,Se.parse)(n||t);if(this._token=i,this._defaultOptions={...ye,...s,...o,port:a.port,protocol:a.protocol,hostname:a.hostname},this._contextPath=n?t:(f=a.path)!=null?f:"",this._contextPath.endsWith("/")&&(this._contextPath=this._contextPath.substring(0,this._contextPath.length-1)),Object.keys(this._defaultOptions).forEach(E=>this._defaultOptions[E]===void 0&&delete this._defaultOptions[E]),this._contextPath.endsWith("/api/v2")&&(P.warn(`Please remove '/api/v2' context path from InfluxDB base url, using ${a.protocol}//${a.hostname}:${a.port} !`),this._contextPath=""),a.protocol==="http:")this._requestApi=(p=(u=(l=this._defaultOptions["follow-redirects"])==null?void 0:l.http)==null?void 0:u.request)!=null?p:xt.request;else if(a.protocol==="https:")this._requestApi=(b=(h=(m=this._defaultOptions["follow-redirects"])==null?void 0:m.https)==null?void 0:h.request)!=null?b:Tt.request;else throw new Error(`Unsupported protocol "${a.protocol} in URL: "${e.host}"`);this._headers={"User-Agent":`influxdb-client-js/${wt}`,...e.headers},n&&(this._headers.Host=(0,Se.parse)(t).host)}send(e,t,n,i){let o=new Ae;i&&i.useCancellable&&i.useCancellable(o),this._createRequestMessage(e,t,n,s=>{this._request(s,o,i)},s=>(i==null?void 0:i.error)&&i.error(s))}request(e,t,n,i){t?typeof t!="string"&&(t=JSON.stringify(t)):t="";let o=yr,s,a;return new Promise((f,l)=>{this.send(e,t,n,{responseStarted(u,p){i&&i(u,p),s=String(u["content-type"]),a=p},next:u=>{o=Q.Buffer.concat([o,u])},complete:()=>{var p,m;let u=(m=(p=n.headers)==null?void 0:p.accept)!=null?m:s;try{a===204&&f(void 0),u.includes("json")?o.length?f(JSON.parse(o.toString("utf8"))):f(void 0):u.includes("text")||u.startsWith("application/csv")?f(o.toString("utf8")):f(o)}catch(h){l(h)}},error:u=>{l(u)}})})}async*iterate(e,t,n){var u;let i,o;function s(p){i=p,o(p)}let a=await new Promise((p,m)=>{o=m,this._createRequestMessage(e,t,n,p,s)});(u=a.signal)!=null&&u.addEventListener&&a.signal.addEventListener("abort",()=>{s(new D)});let f=await new Promise((p,m)=>{o=m;let h=this._requestApi(a,p);h.on("timeout",()=>s(new B)),h.on("error",s),h.write(a.body),h.end()}),l=await new Promise((p,m)=>{o=m,this._prepareResponse(f,p,s)});for await(let p of l){if(i)throw i;yield p}}_createRequestMessage(e,t,n,i,o){let s=Q.Buffer.from(t,"utf-8"),a={"content-type":"application/json; charset=utf-8",...this._headers};this._token&&(a.authorization=`Token ${this._token}`);let f={...this._defaultOptions,path:this._contextPath+e,method:n.method,headers:{...a,...n.headers}};if(n.signal&&(f.signal=n.signal),n.gzipThreshold!==void 0&&n.gzipThreshold<s.length){M.default.gzip(s,(l,u)=>{if(l)return o(l);f.headers["content-encoding"]="gzip",f.body=u,i(f)});return}f.body=s,f.headers["content-length"]=f.body.length,i(f)}_prepareResponse(e,t,n){var a;e.on("aborted",()=>{n(new D)}),e.on("error",n);let i=(a=e.statusCode)!=null?a:600,o=e.headers["content-encoding"],s;if(o==="gzip"?(s=M.default.createGunzip(br),s=(0,It.pipeline)(e,s,f=>f&&n(f))):s=e,i>=300){let f="",l=String(e.headers["content-type"]).startsWith("application/json");s.on("data",u=>{f+=u.toString(),!l&&f.length>1e3&&(f=f.slice(0,1e3),e.resume())}),s.on("end",()=>{f===""&&e.headers["x-influxdb-error"]&&(f=e.headers["x-influxdb-error"].toString()),n(new R(i,e.statusMessage,f,e.headers["retry-after"],e.headers["content-type"]))})}else t(s)}_request(e,t,n){var s;let i=Re(n);if(t.isCancelled()){i.complete();return}(s=e.signal)!=null&&s.addEventListener&&e.signal.addEventListener("abort",()=>{i.error(new D)});let o=this._requestApi(e,a=>{if(t.isCancelled()){a.resume(),i.complete();return}i.responseStarted(a.headers,a.statusCode),this._prepareResponse(a,f=>{f.on("data",l=>{if(t.isCancelled())a.resume();else if(i.next(l)===!1){if(!i.useResume){i.error(new Error("Unable to pause, useResume is not configured!")),a.resume();return}a.pause();let u=()=>{a.resume()};t.resume=u,i.useResume(u)}}),f.on("end",i.complete)},i.error)});typeof o.setTimeout=="function"&&e.timeout&&o.setTimeout(e.timeout),o.on("timeout",()=>{i.error(new B)}),o.on("error",a=>{i.error(a)}),e.body&&o.write(e.body),o.end()}},Ot=De;var Ft=require("@protobuf-ts/grpc-transport");var kt="http://",Nt="https://",Et=r=>{r=r.replace(/\/$/,"");let e;return r.startsWith(kt)?(r=r.slice(kt.length),e=!1,r.includes(":")||(r=`${r}:80`)):r.startsWith(Nt)&&(r=r.slice(Nt.length),e=!0,r.includes(":")||(r=`${r}:443`)),{url:r,safe:e}};var Rt=Z(require("@grpc/grpc-js")),St=({host:r})=>{let{url:e,safe:t}=Et(r),n=Rt.credentials[t==null||t?"createSsl":"createInsecure"]();return new Ft.GrpcTransport({host:e,channelCredentials:n})};var wr={writeTransport:r=>new Ot(r),queryTransport:St},$=wr;var q=class{constructor(e){this._options=e;this._closed=!1;var t;this._transport=(t=this._options.transport)!=null?t:$.writeTransport(this._options),this.doWrite=this.doWrite.bind(this)}_createWritePath(e,t,n){let i=[`bucket=${encodeURIComponent(e)}`,`precision=${t.precision}`];n&&i.push(`org=${encodeURIComponent(n)}`);let o=t==null?void 0:t.consistency;return o&&i.push(`consistency=${encodeURIComponent(o)}`),`/api/v2/write?${i.join("&")}`}doWrite(e,t,n,i){if(this._closed)return Promise.reject(new Error("writeApi: already closed!"));if(e.length<=0||e.length===1&&e[0]==="")return Promise.resolve();let s,a,f=new Promise((h,b)=>{s=h,a=b}),l,u={responseStarted(h,b){l=b},error(h){if(h instanceof R&&h.json&&typeof h.json.error=="string"&&h.json.error.includes("hinted handoff queue not empty")){P.warn(`Write to InfluxDB returns: ${h.json.error}`),l=204,u.complete();return}P.error("Write to InfluxDB failed.",h),a(h)},complete(){if(l==204||l==null)s();else{let h=`204 HTTP response status code expected, but ${l} returned`,b=new R(l,h,void 0,"0");b.message=h,u.error(b)}}},p={...we,...i},m={method:"POST",headers:{"content-type":"text/plain; charset=utf-8",...i==null?void 0:i.headers},gzipThreshold:p.gzipThreshold};return this._transport.send(this._createWritePath(t,p,n),e.join(`
\r `,["\\,","\\ ","\\=","\\n","\\r","\\t"])};var Y="000000000",Oe=!1;function pt(r){return Oe=r&&process&&typeof process.hrtime=="function"}pt(!0);var at,z,ft=Date.now(),Te=0;function Ie(){if(Oe){let r=process.hrtime(),e=Date.now();z?(r[0]=r[0]-z[0],r[1]=r[1]-z[1],r[1]<0&&(r[0]-=1,r[1]+=1e9),e=at+r[0]*1e3+Math.floor(r[1]/1e6)):(z=r,at=e);let t=String(r[1]%1e6);return String(e)+Y.substr(0,6-t.length)+t}else{let r=Date.now();r!==ft?(ft=r,Te=0):Te++;let e=String(Te);return String(r)+Y.substr(0,6-e.length)+e}}function ct(){if(Oe){let r=process.hrtime(),e=String(Math.trunc(r[1]/1e3)%1e3);return String(Date.now())+Y.substr(0,3-e.length)+e}else return String(Date.now())+Y.substr(0,3)}function lt(){return String(Date.now())}function ut(){return String(Math.floor(Date.now()/1e3))}var mt={s:ut,ms:lt,us:ct,ns:Ie,seconds:ut,millis:lt,micros:ct,nanos:Ie},ht={s:r=>`${Math.floor(r.getTime()/1e3)}`,ms:r=>`${r.getTime()}`,us:r=>`${r.getTime()}000`,ns:r=>`${r.getTime()}000000`};function ke(r){return r===void 0?Ie():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?`${r.getTime()}000000`:String(typeof r=="number"?Math.floor(r):r)}var Ne=(r,e="ns")=>r===void 0?mt[e]():typeof r=="string"?r.length>0?r:void 0:r instanceof Date?ht[e](r):String(typeof r=="number"?Math.floor(r):r);var V=class r{constructor(e){this._tags={};this.fields={};e&&(this._name=e)}measurement(e){return this._name=e,this}tag(e,t){return this._tags[e]=t,this}booleanField(e,t){return this.fields[e]=t?"T":"F",this}intField(e,t){let n;if(typeof t=="number"?n=t:n=parseInt(String(t)),isNaN(n)||n<=-9223372036854776e3||n>=9223372036854776e3)throw new Error(`invalid integer value for field '${e}': '${t}'!`);return this.fields[e]=`${Math.floor(n)}i`,this}uintField(e,t){if(typeof t=="number"){if(isNaN(t)||t<0||t>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${e}' out of range: ${t}`);this.fields[e]=`${Math.floor(t)}u`}else{let n=String(t);for(let i=0;i<n.length;i++){let o=n.charCodeAt(i);if(o<48||o>57)throw new Error(`uint value has an unsupported character at pos ${i}: ${t}`)}if(n.length>20||n.length===20&&n.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${e}' out of range: ${n}`);this.fields[e]=`${n}u`}return this}floatField(e,t){let n;if(typeof t=="number"?n=t:n=parseFloat(t),!isFinite(n))throw new Error(`invalid float value for field '${e}': '${t}'!`);return this.fields[e]=String(n),this}stringField(e,t){return t!=null&&(typeof t!="string"&&(t=String(t)),this.fields[e]=_.quoted(t)),this}timestamp(e){return this._time=e,this}toLineProtocol(e){if(!this._name)return;let t="";if(Object.keys(this.fields).sort().forEach(s=>{if(s){let a=this.fields[s];t.length>0&&(t+=","),t+=`${_.tag(s)}=${a}`}}),t.length===0)return;let n="",i=this._tags;Object.keys(i).sort().forEach(s=>{if(s){let a=i[s];a&&(n+=",",n+=`${_.tag(s)}=${_.tag(a)}`)}});let o=this._time;return e?typeof e=="string"?o=Ne(o,e):o=e(o):o=ke(o),`${_.measurement(this._name)}${n} ${t}${o!==void 0?` ${o}`:""}`}toString(){let e=this.toLineProtocol(void 0);return e||`invalid point: ${JSON.stringify(this,void 0)}`}static fromRecord(e){let{measurement:t,fields:n,tags:i,timestamp:o}=e;if(!t)throw new Error("measurement must be defined on the Point record!");if(!n)throw new Error("fields must be defined on the Point record!");let s=new r(t);o!==void 0&&s.timestamp(o);for(let[a,f]of Object.entries(n))if(typeof f=="number")s.floatField(a,f);else if(typeof f=="string")s.stringField(a,f);else throw new Error(`unsuported type of field ${a}: ${typeof f}`);if(i)for(let[a,f]of Object.entries(i))if(typeof f=="string")s.tag(a,f);else throw new Error(`tag has to be string ${a}: ${typeof f}`);return s}};var Ee=r=>{throw r},dt=r=>r!==void 0,gt=r=>r instanceof Array||r instanceof Object&&typeof r.length=="number"&&(r.length===0||Object.getOwnPropertyNames(r).some(e=>e==="0")),bt=r=>{let e=new Uint8Array(4);return e[0]=r>>0,e[1]=r>>8,e[2]=r>>16,e[3]=r>>24,e},yt=async r=>{let e=[];for await(let t of r)e.push(t);return e};var Fe=r=>{let e=gt(r)&&typeof r!="string"?Array.from(r):[r];if(e.length===0)return[];let t=typeof e[0]=="string",n=e[0]instanceof V;return t?e:(n?e:e.map(V.fromRecord)).map(i=>i.toLineProtocol()).filter(dt)};var Se=require("url"),xt=Z(require("http")),Tt=Z(require("https")),Q=require("buffer");var M=Z(require("zlib"));function Re(r={}){let e=0,t={next:n=>{if(e===0&&r.next&&n!==null&&n!==void 0)return r.next(n)},error:n=>{e===0&&(e=1,r.error&&r.error(n))},complete:()=>{e===0&&(e=2,r.complete&&r.complete())},responseStarted:(n,i)=>{r.responseStarted&&r.responseStarted(n,i)}};return r.useCancellable&&(t.useCancellable=r.useCancellable.bind(r)),r.useResume&&(t.useResume=r.useResume.bind(r)),t}var wt="0.3.0.nightly";var It=require("stream");var br={flush:M.default.constants.Z_SYNC_FLUSH,finishFlush:M.default.constants.Z_SYNC_FLUSH},yr=Q.Buffer.allocUnsafe(0),Ae=class{constructor(){this._cancelled=!1}cancel(){this._cancelled=!0,this.resume&&(this.resume(),this.resume=void 0)}isCancelled(){return this._cancelled}},De=class{constructor(e){var f,l,u,p,m,h,b;let{host:t,proxyUrl:n,token:i,transportOptions:o,...s}=e,a=(0,Se.parse)(n||t);if(this._token=i,this._defaultOptions={...ye,...s,...o,port:a.port,protocol:a.protocol,hostname:a.hostname},this._contextPath=n?t:(f=a.path)!=null?f:"",this._contextPath.endsWith("/")&&(this._contextPath=this._contextPath.substring(0,this._contextPath.length-1)),Object.keys(this._defaultOptions).forEach(E=>this._defaultOptions[E]===void 0&&delete this._defaultOptions[E]),this._contextPath.endsWith("/api/v2")&&(P.warn(`Please remove '/api/v2' context path from InfluxDB base url, using ${a.protocol}//${a.hostname}:${a.port} !`),this._contextPath=""),a.protocol==="http:")this._requestApi=(p=(u=(l=this._defaultOptions["follow-redirects"])==null?void 0:l.http)==null?void 0:u.request)!=null?p:xt.request;else if(a.protocol==="https:")this._requestApi=(b=(h=(m=this._defaultOptions["follow-redirects"])==null?void 0:m.https)==null?void 0:h.request)!=null?b:Tt.request;else throw new Error(`Unsupported protocol "${a.protocol} in URL: "${e.host}"`);this._headers={"User-Agent":`influxdb-client-js/${wt}`,...e.headers},n&&(this._headers.Host=(0,Se.parse)(t).host)}send(e,t,n,i){let o=new Ae;i&&i.useCancellable&&i.useCancellable(o),this._createRequestMessage(e,t,n,s=>{this._request(s,o,i)},s=>(i==null?void 0:i.error)&&i.error(s))}request(e,t,n,i){t?typeof t!="string"&&(t=JSON.stringify(t)):t="";let o=yr,s,a;return new Promise((f,l)=>{this.send(e,t,n,{responseStarted(u,p){i&&i(u,p),s=String(u["content-type"]),a=p},next:u=>{o=Q.Buffer.concat([o,u])},complete:()=>{var p,m;let u=(m=(p=n.headers)==null?void 0:p.accept)!=null?m:s;try{a===204&&f(void 0),u.includes("json")?o.length?f(JSON.parse(o.toString("utf8"))):f(void 0):u.includes("text")||u.startsWith("application/csv")?f(o.toString("utf8")):f(o)}catch(h){l(h)}},error:u=>{l(u)}})})}async*iterate(e,t,n){var u;let i,o;function s(p){i=p,o(p)}let a=await new Promise((p,m)=>{o=m,this._createRequestMessage(e,t,n,p,s)});(u=a.signal)!=null&&u.addEventListener&&a.signal.addEventListener("abort",()=>{s(new D)});let f=await new Promise((p,m)=>{o=m;let h=this._requestApi(a,p);h.on("timeout",()=>s(new B)),h.on("error",s),h.write(a.body),h.end()}),l=await new Promise((p,m)=>{o=m,this._prepareResponse(f,p,s)});for await(let p of l){if(i)throw i;yield p}}_createRequestMessage(e,t,n,i,o){let s=Q.Buffer.from(t,"utf-8"),a={"content-type":"application/json; charset=utf-8",...this._headers};this._token&&(a.authorization=`Token ${this._token}`);let f={...this._defaultOptions,path:this._contextPath+e,method:n.method,headers:{...a,...n.headers}};if(n.signal&&(f.signal=n.signal),n.gzipThreshold!==void 0&&n.gzipThreshold<s.length){M.default.gzip(s,(l,u)=>{if(l)return o(l);f.headers["content-encoding"]="gzip",f.body=u,i(f)});return}f.body=s,f.headers["content-length"]=f.body.length,i(f)}_prepareResponse(e,t,n){var a;e.on("aborted",()=>{n(new D)}),e.on("error",n);let i=(a=e.statusCode)!=null?a:600,o=e.headers["content-encoding"],s;if(o==="gzip"?(s=M.default.createGunzip(br),s=(0,It.pipeline)(e,s,f=>f&&n(f))):s=e,i>=300){let f="",l=String(e.headers["content-type"]).startsWith("application/json");s.on("data",u=>{f+=u.toString(),!l&&f.length>1e3&&(f=f.slice(0,1e3),e.resume())}),s.on("end",()=>{f===""&&e.headers["x-influxdb-error"]&&(f=e.headers["x-influxdb-error"].toString()),n(new R(i,e.statusMessage,f,e.headers["retry-after"],e.headers["content-type"]))})}else t(s)}_request(e,t,n){var s;let i=Re(n);if(t.isCancelled()){i.complete();return}(s=e.signal)!=null&&s.addEventListener&&e.signal.addEventListener("abort",()=>{i.error(new D)});let o=this._requestApi(e,a=>{if(t.isCancelled()){a.resume(),i.complete();return}i.responseStarted(a.headers,a.statusCode),this._prepareResponse(a,f=>{f.on("data",l=>{if(t.isCancelled())a.resume();else if(i.next(l)===!1){if(!i.useResume){i.error(new Error("Unable to pause, useResume is not configured!")),a.resume();return}a.pause();let u=()=>{a.resume()};t.resume=u,i.useResume(u)}}),f.on("end",i.complete)},i.error)});typeof o.setTimeout=="function"&&e.timeout&&o.setTimeout(e.timeout),o.on("timeout",()=>{i.error(new B)}),o.on("error",a=>{i.error(a)}),e.body&&o.write(e.body),o.end()}},Ot=De;var Ft=require("@protobuf-ts/grpc-transport");var kt="http://",Nt="https://",Et=r=>{r=r.replace(/\/$/,"");let e;return r.startsWith(kt)?(r=r.slice(kt.length),e=!1,r.includes(":")||(r=`${r}:80`)):r.startsWith(Nt)&&(r=r.slice(Nt.length),e=!0,r.includes(":")||(r=`${r}:443`)),{url:r,safe:e}};var Rt=Z(require("@grpc/grpc-js")),St=({host:r})=>{let{url:e,safe:t}=Et(r),n=Rt.credentials[t==null||t?"createSsl":"createInsecure"]();return new Ft.GrpcTransport({host:e,channelCredentials:n})};var wr={writeTransport:r=>new Ot(r),queryTransport:St},$=wr;var q=class{constructor(e){this._options=e;this._closed=!1;var t;this._transport=(t=this._options.transport)!=null?t:$.writeTransport(this._options),this.doWrite=this.doWrite.bind(this)}_createWritePath(e,t,n){let i=[`bucket=${encodeURIComponent(e)}`,`precision=${t.precision}`];n&&i.push(`org=${encodeURIComponent(n)}`);let o=t==null?void 0:t.consistency;return o&&i.push(`consistency=${encodeURIComponent(o)}`),`/api/v2/write?${i.join("&")}`}doWrite(e,t,n,i){if(this._closed)return Promise.reject(new Error("writeApi: already closed!"));if(e.length<=0||e.length===1&&e[0]==="")return Promise.resolve();let s,a,f=new Promise((h,b)=>{s=h,a=b}),l,u={responseStarted(h,b){l=b},error(h){if(h instanceof R&&h.json&&typeof h.json.error=="string"&&h.json.error.includes("hinted handoff queue not empty")){P.warn(`Write to InfluxDB returns: ${h.json.error}`),l=204,u.complete();return}P.error("Write to InfluxDB failed.",h),a(h)},complete(){if(l==204||l==null)s();else{let h=`204 HTTP response status code expected, but ${l} returned`,b=new R(l,h,void 0,"0");b.message=h,u.error(b)}}},p={...we,...i},m={method:"POST",headers:{"content-type":"text/plain; charset=utf-8",...i==null?void 0:i.headers},gzipThreshold:p.gzipThreshold};return this._transport.send(this._createWritePath(t,p,n),e.join(`
`),m,u),f}async close(){this._closed=!0}};var nr=require("apache-arrow");var Qt=require("@protobuf-ts/runtime-rpc");function C(r){let e=typeof r;if(e=="object"){if(Array.isArray(r))return"array";if(r===null)return"null"}return e}function _e(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}var N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ee=[];for(let r=0;r<N.length;r++)ee[N[r].charCodeAt(0)]=r;ee["-".charCodeAt(0)]=N.indexOf("+");ee["_".charCodeAt(0)]=N.indexOf("/");function At(r){let e=r.length*3/4;r[r.length-2]=="="?e-=2:r[r.length-1]=="="&&(e-=1);let t=new Uint8Array(e),n=0,i=0,o,s=0;for(let a=0;a<r.length;a++){if(o=ee[r.charCodeAt(a)],o===void 0)switch(r[a]){case"=":i=0;case`

@@ -5,0 +5,0 @@ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:s=o,i=1;break;case 1:t[n++]=s<<2|(o&48)>>4,s=o,i=2;break;case 2:t[n++]=(s&15)<<4|(o&60)>>2,s=o,i=3;break;case 3:t[n++]=(s&3)<<6|o,i=0;break}}if(i==1)throw Error("invalid base64 string.");return t.subarray(0,n)}function Dt(r){let e="",t=0,n,i=0;for(let o=0;o<r.length;o++)switch(n=r[o],t){case 0:e+=N[n>>2],i=(n&3)<<4,t=1;break;case 1:e+=N[i|n>>4],i=(n&15)<<2,t=2;break;case 2:e+=N[i|n>>6],e+=N[n&63],t=0;break}return t&&(e+=N[i],e+="=",t==1&&(e+="=")),e}var v;(function(r){r.symbol=Symbol.for("protobuf-ts/unknown"),r.onRead=(t,n,i,o,s)=>{(e(n)?n[r.symbol]:n[r.symbol]=[]).push({no:i,wireType:o,data:s})},r.onWrite=(t,n,i)=>{for(let{no:o,wireType:s,data:a}of r.list(n))i.tag(o,s).raw(a)},r.list=(t,n)=>{if(e(t)){let i=t[r.symbol];return n?i.filter(o=>o.no==n):i}return[]},r.last=(t,n)=>r.list(t,n).slice(-1)[0];let e=t=>t&&Array.isArray(t[r.symbol])})(v||(v={}));var x;(function(r){r[r.Varint=0]="Varint",r[r.Bit64=1]="Bit64",r[r.LengthDelimited=2]="LengthDelimited",r[r.StartGroup=3]="StartGroup",r[r.EndGroup=4]="EndGroup",r[r.Bit32=5]="Bit32"})(x||(x={}));function _t(){let r=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(r|=(i&127)<<n,!(i&128))return this.assertBounds(),[r,e]}let t=this.buf[this.pos++];if(r|=(t&15)<<28,e=(t&112)>>4,!(t&128))return this.assertBounds(),[r,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,!(i&128))return this.assertBounds(),[r,e]}throw new Error("invalid varint")}function re(r,e,t){for(let o=0;o<28;o=o+7){let s=r>>>o,a=!(!(s>>>7)&&e==0),f=(a?s|128:s)&255;if(t.push(f),!a)return}let n=r>>>28&15|(e&7)<<4,i=!!(e>>3);if(t.push((i?n|128:n)&255),!!i){for(let o=3;o<31;o=o+7){let s=e>>>o,a=!!(s>>>7),f=(a?s|128:s)&255;if(t.push(f),!a)return}t.push(e>>>31&1)}}var te=65536*65536;function Ce(r){let e=r[0]=="-";e&&(r=r.slice(1));let t=1e6,n=0,i=0;function o(s,a){let f=Number(r.slice(s,a));i*=t,n=n*t+f,n>=te&&(i=i+(n/te|0),n=n%te)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),[e,n,i]}function ne(r,e){if(e<=2097151)return""+(te*e+(r>>>0));let t=r&16777215,n=(r>>>24|e<<8)>>>0&16777215,i=e>>16&65535,o=t+n*6777216+i*6710656,s=n+i*8147497,a=i*2,f=1e7;o>=f&&(s+=Math.floor(o/f),o%=f),s>=f&&(a+=Math.floor(s/f),s%=f);function l(u,p){let m=u?String(u):"";return p?"0000000".slice(m.length)+m:m}return l(a,0)+l(s,a)+l(o,1)}function Ue(r,e){if(r>=0){for(;r>127;)e.push(r&127|128),r=r>>>7;e.push(r)}else{for(let t=0;t<9;t++)e.push(r&127|128),r=r>>7;e.push(1)}}function Ct(){let r=this.buf[this.pos++],e=r&127;if(!(r&128))return this.assertBounds(),e;if(r=this.buf[this.pos++],e|=(r&127)<<7,!(r&128))return this.assertBounds(),e;if(r=this.buf[this.pos++],e|=(r&127)<<14,!(r&128))return this.assertBounds(),e;if(r=this.buf[this.pos++],e|=(r&127)<<21,!(r&128))return this.assertBounds(),e;r=this.buf[this.pos++],e|=(r&15)<<28;for(let t=5;r&128&&t<10;t++)r=this.buf[this.pos++];if(r&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function xr(){let r=new DataView(new ArrayBuffer(8));return globalThis.BigInt!==void 0&&typeof r.getBigInt64=="function"&&typeof r.getBigUint64=="function"&&typeof r.setBigInt64=="function"&&typeof r.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:r}:void 0}var y=xr();function Ut(r){if(!r)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}var Lt=/^-?[0-9]+$/,ie=65536*65536,oe=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*ie+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}},T=class r extends oe{static from(e){if(y)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=y.C(e);case"number":if(e===0)return this.ZERO;e=y.C(e);case"bigint":if(!e)return this.ZERO;if(e<y.UMIN)throw new Error("signed value for ulong");if(e>y.UMAX)throw new Error("ulong too large");return y.V.setBigUint64(0,e,!0),new r(y.V.getInt32(0,!0),y.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Lt.test(e))throw new Error("string is no integer");let[t,n,i]=Ce(e);if(t)throw new Error("signed value");return new r(n,i);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new r(e,e/ie)}throw new Error("unknown value "+typeof e)}toString(){return y?this.toBigInt().toString():ne(this.lo,this.hi)}toBigInt(){return Ut(y),y.V.setInt32(0,this.lo,!0),y.V.setInt32(4,this.hi,!0),y.V.getBigUint64(0,!0)}};T.ZERO=new T(0,0);var g=class r extends oe{static from(e){if(y)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=y.C(e);case"number":if(e===0)return this.ZERO;e=y.C(e);case"bigint":if(!e)return this.ZERO;if(e<y.MIN)throw new Error("ulong too small");if(e>y.MAX)throw new Error("ulong too large");return y.V.setBigInt64(0,e,!0),new r(y.V.getInt32(0,!0),y.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Lt.test(e))throw new Error("string is no integer");let[t,n,i]=Ce(e),o=new r(n,i);return t?o.negate():o;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new r(e,e/ie):new r(-e,-e/ie).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&2147483648)!==0}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new r(t,e)}toString(){if(y)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+ne(e.lo,e.hi)}return ne(this.lo,this.hi)}toBigInt(){return Ut(y),y.V.setInt32(0,this.lo,!0),y.V.setInt32(4,this.hi,!0),y.V.getBigInt64(0,!0)}};g.ZERO=new g(0,0);var Bt={readUnknownField:!0,readerFactory:r=>new Le(r)};function Pt(r){return r?Object.assign(Object.assign({},Bt),r):Bt}var Le=class{constructor(e,t){this.varint64=_t,this.uint32=Ct,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t!=null?t:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e){let t=this.pos;switch(e){case x.Varint:for(;this.buf[this.pos++]&128;);break;case x.Bit64:this.pos+=4;case x.Bit32:this.pos+=4;break;case x.LengthDelimited:let n=this.uint32();this.pos+=n;break;case x.StartGroup:let i;for(;(i=this.tag()[1])!==x.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(t,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new g(...this.varint64())}uint64(){return new T(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,new g(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new T(this.sfixed32(),this.sfixed32())}sfixed64(){return new g(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function d(r,e){if(!r)throw new Error(e)}var Tr=34028234663852886e22,Ir=-34028234663852886e22,Or=4294967295,kr=2147483647,Nr=-2147483648;function S(r){if(typeof r!="number")throw new Error("invalid int 32: "+typeof r);if(!Number.isInteger(r)||r>kr||r<Nr)throw new Error("invalid int 32: "+r)}function U(r){if(typeof r!="number")throw new Error("invalid uint 32: "+typeof r);if(!Number.isInteger(r)||r>Or||r<0)throw new Error("invalid uint 32: "+r)}function W(r){if(typeof r!="number")throw new Error("invalid float 32: "+typeof r);if(Number.isFinite(r)&&(r>Tr||r<Ir))throw new Error("invalid float 32: "+r)}var Vt={writeUnknownFields:!0,writerFactory:()=>new Be};function vt(r){return r?Object.assign(Object.assign({},Vt),r):Vt}var Be=class{constructor(e){this.stack=[],this.textEncoder=e!=null?e:new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let t=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(U(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return S(e),Ue(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){W(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){U(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){S(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return S(e),e=(e<<1^e>>31)>>>0,Ue(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=g.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=T.from(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=g.from(e);return re(t.lo,t.hi,this.buf),this}sint64(e){let t=g.from(e),n=t.hi>>31,i=t.lo<<1^n,o=(t.hi<<1|t.lo>>>31)^n;return re(i,o,this.buf),this}uint64(e){let t=T.from(e);return re(t.lo,t.hi,this.buf),this}};var Wt={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},Mt={ignoreUnknownFields:!1};function $t(r){return r?Object.assign(Object.assign({},Mt),r):Mt}function qt(r){return r?Object.assign(Object.assign({},Wt),r):Wt}var Jt=Symbol.for("protobuf-ts/message-type");function Pe(r){let e=!1,t=[];for(let n=0;n<r.length;n++){let i=r.charAt(n);i=="_"?e=!0:/\d/.test(i)?(t.push(i),e=!0):e?(t.push(i.toUpperCase()),e=!1):n==0?t.push(i.toLowerCase()):t.push(i)}return t.join("")}var c;(function(r){r[r.DOUBLE=1]="DOUBLE",r[r.FLOAT=2]="FLOAT",r[r.INT64=3]="INT64",r[r.UINT64=4]="UINT64",r[r.INT32=5]="INT32",r[r.FIXED64=6]="FIXED64",r[r.FIXED32=7]="FIXED32",r[r.BOOL=8]="BOOL",r[r.STRING=9]="STRING",r[r.BYTES=12]="BYTES",r[r.UINT32=13]="UINT32",r[r.SFIXED32=15]="SFIXED32",r[r.SFIXED64=16]="SFIXED64",r[r.SINT32=17]="SINT32",r[r.SINT64=18]="SINT64"})(c||(c={}));var I;(function(r){r[r.BIGINT=0]="BIGINT",r[r.STRING=1]="STRING",r[r.NUMBER=2]="NUMBER"})(I||(I={}));var J;(function(r){r[r.NO=0]="NO",r[r.PACKED=1]="PACKED",r[r.UNPACKED=2]="UNPACKED"})(J||(J={}));function jt(r){var e,t,n,i;return r.localName=(e=r.localName)!==null&&e!==void 0?e:Pe(r.name),r.jsonName=(t=r.jsonName)!==null&&t!==void 0?t:Pe(r.name),r.repeat=(n=r.repeat)!==null&&n!==void 0?n:J.NO,r.opt=(i=r.opt)!==null&&i!==void 0?i:r.repeat||r.oneof?!1:r.kind=="message",r}function Kt(r){if(typeof r!="object"||r===null||!r.hasOwnProperty("oneofKind"))return!1;switch(typeof r.oneofKind){case"string":return r[r.oneofKind]===void 0?!1:Object.keys(r).length==2;case"undefined":return Object.keys(r).length==1;default:return!1}}var se=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}prepare(){if(this.data)return;let e=[],t=[],n=[];for(let i of this.fields)if(i.oneof)n.includes(i.oneof)||(n.push(i.oneof),e.push(i.oneof),t.push(i.oneof));else switch(t.push(i.localName),i.kind){case"scalar":case"enum":(!i.opt||i.repeat)&&e.push(i.localName);break;case"message":i.repeat&&e.push(i.localName);break;case"map":e.push(i.localName);break}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,n=!1){if(t<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let i=Object.keys(e),o=this.data;if(i.length<o.req.length||o.req.some(s=>!i.includes(s))||!n&&i.some(s=>!o.known.includes(s)))return!1;if(t<1)return!0;for(let s of o.oneofs){let a=e[s];if(!Kt(a))return!1;if(a.oneofKind===void 0)continue;let f=this.fields.find(l=>l.localName===a.oneofKind);if(!f||!this.field(a[a.oneofKind],f,n,t))return!1}for(let s of this.fields)if(s.oneof===void 0&&!this.field(e[s.localName],s,n,t))return!1;return!0}field(e,t,n,i){let o=t.repeat;switch(t.kind){case"scalar":return e===void 0?t.opt:o?this.scalars(e,t.T,i,t.L):this.scalar(e,t.T,t.L);case"enum":return e===void 0?t.opt:o?this.scalars(e,c.INT32,i):this.scalar(e,c.INT32);case"message":return e===void 0?!0:o?this.messages(e,t.T(),n,i):this.message(e,t.T(),n,i);case"map":if(typeof e!="object"||e===null)return!1;if(i<2)return!0;if(!this.mapKeys(e,t.K,i))return!1;switch(t.V.kind){case"scalar":return this.scalars(Object.values(e),t.V.T,i,t.V.L);case"enum":return this.scalars(Object.values(e),c.INT32,i);case"message":return this.messages(Object.values(e),t.V.T(),n,i)}break}return!0}message(e,t,n,i){return n?t.isAssignable(e,i):t.is(e,i)}messages(e,t,n,i){if(!Array.isArray(e))return!1;if(i<2)return!0;if(n){for(let o=0;o<e.length&&o<i;o++)if(!t.isAssignable(e[o],i-1))return!1}else for(let o=0;o<e.length&&o<i;o++)if(!t.is(e[o],i-1))return!1;return!0}scalar(e,t,n){let i=typeof e;switch(t){case c.UINT64:case c.FIXED64:case c.INT64:case c.SFIXED64:case c.SINT64:switch(n){case I.BIGINT:return i=="bigint";case I.NUMBER:return i=="number"&&!isNaN(e);default:return i=="string"}case c.BOOL:return i=="boolean";case c.STRING:return i=="string";case c.BYTES:return e instanceof Uint8Array;case c.DOUBLE:case c.FLOAT:return i=="number"&&!isNaN(e);default:return i=="number"&&Number.isInteger(e)}}scalars(e,t,n,i){if(!Array.isArray(e))return!1;if(n<2)return!0;if(Array.isArray(e)){for(let o=0;o<e.length&&o<n;o++)if(!this.scalar(e[o],t,i))return!1}return!0}mapKeys(e,t,n){let i=Object.keys(e);switch(t){case c.INT32:case c.FIXED32:case c.SFIXED32:case c.SINT32:case c.UINT32:return this.scalars(i.slice(0,n).map(o=>parseInt(o)),t,n);case c.BOOL:return this.scalars(i.slice(0,n).map(o=>o=="true"?!0:o=="false"?!1:o),t,n);default:return this.scalars(i,t,n,I.STRING)}}};function O(r,e){switch(e){case I.BIGINT:return r.toBigInt();case I.NUMBER:return r.toNumber();default:return r.toString()}}var ae=class{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};let t=(e=this.info.fields)!==null&&e!==void 0?e:[];for(let n of t)this.fMap[n.name]=n,this.fMap[n.jsonName]=n,this.fMap[n.localName]=n}}assert(e,t,n){if(!e){let i=C(n);throw(i=="number"||i=="boolean")&&(i=n.toString()),new Error(`Cannot parse JSON ${i} for ${this.info.typeName}#${t}`)}}read(e,t,n){this.prepare();let i=[];for(let[o,s]of Object.entries(e)){let a=this.fMap[o];if(!a){if(!n.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}let f=a.localName,l;if(a.oneof){if(i.includes(a.oneof))throw new Error(`Multiple members of the oneof group "${a.oneof}" of ${this.info.typeName} are present in JSON.`);i.push(a.oneof),l=t[a.oneof]={oneofKind:f}}else l=t;if(a.kind=="map"){if(s===null)continue;this.assert(_e(s),a.name,s);let u=l[f];for(let[p,m]of Object.entries(s)){this.assert(m!==null,a.name+" map value",null);let h;switch(a.V.kind){case"message":h=a.V.T().internalJsonRead(m,n);break;case"enum":if(h=this.enum(a.V.T(),m,a.name,n.ignoreUnknownFields),h===!1)continue;break;case"scalar":h=this.scalar(m,a.V.T,a.V.L,a.name);break}this.assert(h!==void 0,a.name+" map value",m);let b=p;a.K==c.BOOL&&(b=b=="true"?!0:b=="false"?!1:b),b=this.scalar(b,a.K,I.STRING,a.name).toString(),u[b]=h}}else if(a.repeat){if(s===null)continue;this.assert(Array.isArray(s),a.name,s);let u=l[f];for(let p of s){this.assert(p!==null,a.name,null);let m;switch(a.kind){case"message":m=a.T().internalJsonRead(p,n);break;case"enum":if(m=this.enum(a.T(),p,a.name,n.ignoreUnknownFields),m===!1)continue;break;case"scalar":m=this.scalar(p,a.T,a.L,a.name);break}this.assert(m!==void 0,a.name,s),u.push(m)}}else switch(a.kind){case"message":if(s===null&&a.T().typeName!="google.protobuf.Value"){this.assert(a.oneof===void 0,a.name+" (oneof member)",null);continue}l[f]=a.T().internalJsonRead(s,n,l[f]);break;case"enum":let u=this.enum(a.T(),s,a.name,n.ignoreUnknownFields);if(u===!1)continue;l[f]=u;break;case"scalar":l[f]=this.scalar(s,a.T,a.L,a.name);break}}}enum(e,t,n,i){if(e[0]=="google.protobuf.NullValue"&&d(t===null,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case"number":return d(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case"string":let o=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(o=t.substring(e[2].length));let s=e[1][o];return typeof s=="undefined"&&i?!1:(d(typeof s=="number",`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),s)}d(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,n,i){let o;try{switch(t){case c.DOUBLE:case c.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){o="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){o="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let s=Number(e);if(Number.isNaN(s)){o="not a number";break}if(!Number.isFinite(s)){o="too large or small";break}return t==c.FLOAT&&W(s),s;case c.INT32:case c.FIXED32:case c.SFIXED32:case c.SINT32:case c.UINT32:if(e===null)return 0;let a;if(typeof e=="number"?a=e:e===""?o="empty string":typeof e=="string"&&(e.trim().length!==e.length?o="extra whitespace":a=Number(e)),a===void 0)break;return t==c.UINT32?U(a):S(a),a;case c.INT64:case c.SFIXED64:case c.SINT64:if(e===null)return O(g.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return O(g.from(e),n);case c.FIXED64:case c.UINT64:if(e===null)return O(T.ZERO,n);if(typeof e!="number"&&typeof e!="string")break;return O(T.from(e),n);case c.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case c.STRING:if(e===null)return"";if(typeof e!="string"){o="extra whitespace";break}try{encodeURIComponent(e)}catch(f){f="invalid UTF8";break}return e;case c.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return At(e)}}catch(s){o=s.message}this.assert(!1,i+(o?" - "+o:""),e)}};var fe=class{constructor(e){var t;this.fields=(t=e.fields)!==null&&t!==void 0?t:[]}write(e,t){let n={},i=e;for(let o of this.fields){if(!o.oneof){let l=this.field(o,i[o.localName],t);l!==void 0&&(n[t.useProtoFieldName?o.name:o.jsonName]=l);continue}let s=i[o.oneof];if(s.oneofKind!==o.localName)continue;let a=o.kind=="scalar"||o.kind=="enum"?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,f=this.field(o,s[o.localName],a);d(f!==void 0),n[t.useProtoFieldName?o.name:o.jsonName]=f}return n}field(e,t,n){let i;if(e.kind=="map"){d(typeof t=="object"&&t!==null);let o={};switch(e.V.kind){case"scalar":for(let[f,l]of Object.entries(t)){let u=this.scalar(e.V.T,l,e.name,!1,!0);d(u!==void 0),o[f.toString()]=u}break;case"message":let s=e.V.T();for(let[f,l]of Object.entries(t)){let u=this.message(s,l,e.name,n);d(u!==void 0),o[f.toString()]=u}break;case"enum":let a=e.V.T();for(let[f,l]of Object.entries(t)){d(l===void 0||typeof l=="number");let u=this.enum(a,l,e.name,!1,!0,n.enumAsInteger);d(u!==void 0),o[f.toString()]=u}break}(n.emitDefaultValues||Object.keys(o).length>0)&&(i=o)}else if(e.repeat){d(Array.isArray(t));let o=[];switch(e.kind){case"scalar":for(let f=0;f<t.length;f++){let l=this.scalar(e.T,t[f],e.name,e.opt,!0);d(l!==void 0),o.push(l)}break;case"enum":let s=e.T();for(let f=0;f<t.length;f++){d(t[f]===void 0||typeof t[f]=="number");let l=this.enum(s,t[f],e.name,e.opt,!0,n.enumAsInteger);d(l!==void 0),o.push(l)}break;case"message":let a=e.T();for(let f=0;f<t.length;f++){let l=this.message(a,t[f],e.name,n);d(l!==void 0),o.push(l)}break}(n.emitDefaultValues||o.length>0||n.emitDefaultValues)&&(i=o)}else switch(e.kind){case"scalar":i=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case"enum":i=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case"message":i=this.message(e.T(),t,e.name,n);break}return i}enum(e,t,n,i,o,s){if(e[0]=="google.protobuf.NullValue")return null;if(t===void 0){d(i);return}if(!(t===0&&!o&&!i))return d(typeof t=="number"),d(Number.isInteger(t)),s||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,i){return t===void 0?i.emitDefaultValues?null:void 0:e.internalJsonWrite(t,i)}scalar(e,t,n,i,o){if(t===void 0){d(i);return}let s=o||i;switch(e){case c.INT32:case c.SFIXED32:case c.SINT32:return t===0?s?0:void 0:(S(t),t);case c.FIXED32:case c.UINT32:return t===0?s?0:void 0:(U(t),t);case c.FLOAT:W(t);case c.DOUBLE:return t===0?s?0:void 0:(d(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t);case c.STRING:return t===""?s?"":void 0:(d(typeof t=="string"),t);case c.BOOL:return t===!1?s?!1:void 0:(d(typeof t=="boolean"),t);case c.UINT64:case c.FIXED64:d(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let a=T.from(t);return a.isZero()&&!s?void 0:a.toString();case c.INT64:case c.SFIXED64:case c.SINT64:d(typeof t=="number"||typeof t=="string"||typeof t=="bigint");let f=g.from(t);return f.isZero()&&!s?void 0:f.toString();case c.BYTES:return d(t instanceof Uint8Array),t.byteLength?Dt(t):s?"":void 0}}};function j(r,e=I.STRING){switch(r){case c.BOOL:return!1;case c.UINT64:case c.FIXED64:return O(T.ZERO,e);case c.INT64:case c.SFIXED64:case c.SINT64:return O(g.ZERO,e);case c.DOUBLE:case c.FLOAT:return 0;case c.BYTES:return new Uint8Array(0);case c.STRING:return"";default:return 0}}var ce=class{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){let t=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(t.map(n=>[n.no,n]))}}read(e,t,n,i){this.prepare();let o=i===void 0?e.len:e.pos+i;for(;e.pos<o;){let[s,a]=e.tag(),f=this.fieldNoToField.get(s);if(!f){let m=n.readUnknownField;if(m=="throw")throw new Error(`Unknown field ${s} (wire type ${a}) for ${this.info.typeName}`);let h=e.skip(a);m!==!1&&(m===!0?v.onRead:m)(this.info.typeName,t,s,a,h);continue}let l=t,u=f.repeat,p=f.localName;switch(f.oneof&&(l=l[f.oneof],l.oneofKind!==p&&(l=t[f.oneof]={oneofKind:p})),f.kind){case"scalar":case"enum":let m=f.kind=="enum"?c.INT32:f.T,h=f.kind=="scalar"?f.L:void 0;if(u){let A=l[p];if(a==x.LengthDelimited&&m!=c.STRING&&m!=c.BYTES){let F=e.uint32()+e.pos;for(;e.pos<F;)A.push(this.scalar(e,m,h))}else A.push(this.scalar(e,m,h))}else l[p]=this.scalar(e,m,h);break;case"message":if(u){let A=l[p],F=f.T().internalBinaryRead(e,e.uint32(),n);A.push(F)}else l[p]=f.T().internalBinaryRead(e,e.uint32(),n,l[p]);break;case"map":let[b,E]=this.mapEntry(f,e,n);l[p][b]=E;break}}}mapEntry(e,t,n){let i=t.uint32(),o=t.pos+i,s,a;for(;t.pos<o;){let[f,l]=t.tag();switch(f){case 1:e.K==c.BOOL?s=t.bool().toString():s=this.scalar(t,e.K,I.STRING);break;case 2:switch(e.V.kind){case"scalar":a=this.scalar(t,e.V.T,e.V.L);break;case"enum":a=t.int32();break;case"message":a=e.V.T().internalBinaryRead(t,t.uint32(),n);break}break;default:throw new Error(`Unknown field ${f} (wire type ${l}) in map entry for ${this.info.typeName}#${e.name}`)}}if(s===void 0){let f=j(e.K);s=e.K==c.BOOL?f.toString():f}if(a===void 0)switch(e.V.kind){case"scalar":a=j(e.V.T,e.V.L);break;case"enum":a=0;break;case"message":a=e.V.T().create();break}return[s,a]}scalar(e,t,n){switch(t){case c.INT32:return e.int32();case c.STRING:return e.string();case c.BOOL:return e.bool();case c.DOUBLE:return e.double();case c.FLOAT:return e.float();case c.INT64:return O(e.int64(),n);case c.UINT64:return O(e.uint64(),n);case c.FIXED64:return O(e.fixed64(),n);case c.FIXED32:return e.fixed32();case c.BYTES:return e.bytes();case c.UINT32:return e.uint32();case c.SFIXED32:return e.sfixed32();case c.SFIXED64:return O(e.sfixed64(),n);case c.SINT32:return e.sint32();case c.SINT64:return O(e.sint64(),n)}}};var le=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((t,n)=>t.no-n.no)}}write(e,t,n){this.prepare();for(let o of this.fields){let s,a,f=o.repeat,l=o.localName;if(o.oneof){let u=e[o.oneof];if(u.oneofKind!==l)continue;s=u[l],a=!0}else s=e[l],a=!1;switch(o.kind){case"scalar":case"enum":let u=o.kind=="enum"?c.INT32:o.T;if(f)if(d(Array.isArray(s)),f==J.PACKED)this.packed(t,u,o.no,s);else for(let p of s)this.scalar(t,u,o.no,p,!0);else s===void 0?d(o.opt):this.scalar(t,u,o.no,s,a||o.opt);break;case"message":if(f){d(Array.isArray(s));for(let p of s)this.message(t,n,o.T(),o.no,p)}else this.message(t,n,o.T(),o.no,s);break;case"map":d(typeof s=="object"&&s!==null);for(let[p,m]of Object.entries(s))this.mapEntry(t,n,o,p,m);break}}let i=n.writeUnknownFields;i!==!1&&(i===!0?v.onWrite:i)(this.info.typeName,e,t)}mapEntry(e,t,n,i,o){e.tag(n.no,x.LengthDelimited),e.fork();let s=i;switch(n.K){case c.INT32:case c.FIXED32:case c.UINT32:case c.SFIXED32:case c.SINT32:s=Number.parseInt(i);break;case c.BOOL:d(i=="true"||i=="false"),s=i=="true";break}switch(this.scalar(e,n.K,1,s,!0),n.V.kind){case"scalar":this.scalar(e,n.V.T,2,o,!0);break;case"enum":this.scalar(e,c.INT32,2,o,!0);break;case"message":this.message(e,t,n.V.T(),2,o);break}e.join()}message(e,t,n,i,o){o!==void 0&&(n.internalBinaryWrite(o,e.tag(i,x.LengthDelimited).fork(),t),e.join())}scalar(e,t,n,i,o){let[s,a,f]=this.scalarInfo(t,i);(!f||o)&&(e.tag(n,s),e[a](i))}packed(e,t,n,i){if(!i.length)return;d(t!==c.BYTES&&t!==c.STRING),e.tag(n,x.LengthDelimited),e.fork();let[,o]=this.scalarInfo(t);for(let s=0;s<i.length;s++)e[o](i[s]);e.join()}scalarInfo(e,t){let n=x.Varint,i,o=t===void 0,s=t===0;switch(e){case c.INT32:i="int32";break;case c.STRING:s=o||!t.length,n=x.LengthDelimited,i="string";break;case c.BOOL:s=t===!1,i="bool";break;case c.UINT32:i="uint32";break;case c.DOUBLE:n=x.Bit64,i="double";break;case c.FLOAT:n=x.Bit32,i="float";break;case c.INT64:s=o||g.from(t).isZero(),i="int64";break;case c.UINT64:s=o||T.from(t).isZero(),i="uint64";break;case c.FIXED64:s=o||T.from(t).isZero(),n=x.Bit64,i="fixed64";break;case c.BYTES:s=o||!t.byteLength,n=x.LengthDelimited,i="bytes";break;case c.FIXED32:n=x.Bit32,i="fixed32";break;case c.SFIXED32:n=x.Bit32,i="sfixed32";break;case c.SFIXED64:s=o||g.from(t).isZero(),n=x.Bit64,i="sfixed64";break;case c.SINT32:i="sint32";break;case c.SINT64:s=o||g.from(t).isZero(),i="sint64";break}return[n,i,o||s]}};function Gt(r){let e={};Object.defineProperty(e,Jt,{enumerable:!1,value:r});for(let t of r.fields){let n=t.localName;if(!t.opt)if(t.oneof)e[t.oneof]={oneofKind:void 0};else if(t.repeat)e[n]=[];else switch(t.kind){case"scalar":e[n]=j(t.T,t.L);break;case"enum":e[n]=0;break;case"map":e[n]={};break}}return e}function ue(r,e,t){let n,i=t,o;for(let s of r.fields){let a=s.localName;if(s.oneof){let f=i[s.oneof];if((f==null?void 0:f.oneofKind)==null)continue;if(n=f[a],o=e[s.oneof],o.oneofKind=f.oneofKind,n==null){delete o[a];continue}}else if(n=i[a],o=e,n==null)continue;switch(s.repeat&&(o[a].length=n.length),s.kind){case"scalar":case"enum":if(s.repeat)for(let l=0;l<n.length;l++)o[a][l]=n[l];else o[a]=n;break;case"message":let f=s.T();if(s.repeat)for(let l=0;l<n.length;l++)o[a][l]=f.create(n[l]);else o[a]===void 0?o[a]=f.create(n):f.mergePartial(o[a],n);break;case"map":switch(s.V.kind){case"scalar":case"enum":Object.assign(o[a],n);break;case"message":let l=s.V.T();for(let u of Object.keys(n))o[a][u]=l.create(n[u]);break}break}}}function Ht(r,e,t){if(e===t)return!0;if(!e||!t)return!1;for(let n of r.fields){let i=n.localName,o=n.oneof?e[n.oneof][i]:e[i],s=n.oneof?t[n.oneof][i]:t[i];switch(n.kind){case"enum":case"scalar":let a=n.kind=="enum"?c.INT32:n.T;if(!(n.repeat?Xt(a,o,s):zt(a,o,s)))return!1;break;case"map":if(!(n.V.kind=="message"?Zt(n.V.T(),pe(o),pe(s)):Xt(n.V.kind=="enum"?c.INT32:n.V.T,pe(o),pe(s))))return!1;break;case"message":let f=n.T();if(!(n.repeat?Zt(f,o,s):f.equals(o,s)))return!1;break}}return!0}var pe=Object.values;function zt(r,e,t){if(e===t)return!0;if(r!==c.BYTES)return!1;let n=e,i=t;if(n.length!==i.length)return!1;for(let o=0;o<n.length;o++)if(n[o]!=i[o])return!1;return!0}function Xt(r,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!zt(r,e[n],t[n]))return!1;return!0}function Zt(r,e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r.equals(e[n],t[n]))return!1;return!0}var w=class{constructor(e,t,n){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(jt),this.options=n!=null?n:{},this.refTypeCheck=new se(this),this.refJsonReader=new ae(this),this.refJsonWriter=new fe(this),this.refBinReader=new ce(this),this.refBinWriter=new le(this)}create(e){let t=Gt(this);return e!==void 0&&ue(this,t,e),t}clone(e){let t=this.create();return ue(this,t,e),t}equals(e,t){return Ht(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){ue(this,e,t)}fromBinary(e,t){let n=Pt(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,$t(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,qt(t))}toJsonString(e,t){var n;let i=this.toJson(e,t);return JSON.stringify(i,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toBinary(e,t){let n=vt(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let i=n!=null?n:this.create();return this.refJsonReader.read(e,i,t),i}throw new Error(`Unable to parse message ${this.typeName} from JSON ${C(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,i){let o=i!=null?i:this.create();return this.refBinReader.read(e,o,n,t),o}};var Ve=class extends w{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){let e=this.create(),t=Date.now();return e.seconds=g.from(Math.floor(t/1e3)).toBigInt(),e.nanos=t%1e3*1e6,e}toDate(e){return new Date(g.from(e.seconds).toNumber()*1e3+Math.ceil(e.nanos/1e6))}fromDate(e){let t=this.create(),n=e.getTime();return t.seconds=g.from(Math.floor(n/1e3)).toBigInt(),t.nanos=n%1e3*1e6,t}internalJsonWrite(e,t){let n=g.from(e.seconds).toNumber()*1e3;if(n<Date.parse("0001-01-01T00:00:00Z")||n>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(e.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let i="Z";if(e.nanos>0){let o=(e.nanos+1e9).toString().substring(1);o.substring(3)==="000000"?i="."+o.substring(0,3)+"Z":o.substring(6)==="000"?i="."+o.substring(0,6)+"Z":i="."+o+"Z"}return new Date(n).toISOString().replace(".000Z",i)}internalJsonRead(e,t,n){if(typeof e!="string")throw new Error("Unable to parse Timestamp from JSON "+C(e)+".");let i=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let o=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(o))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(o<Date.parse("0001-01-01T00:00:00Z")||o>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return n||(n=this.create()),n.seconds=g.from(o/1e3).toBigInt(),n.nanos=0,i[7]&&(n.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),n}},Yt=new Ve;var er=(n=>(n[n.UNKNOWN=0]="UNKNOWN",n[n.PATH=1]="PATH",n[n.CMD=2]="CMD",n))(er||{}),tr=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.CANCELLED=1]="CANCELLED",i[i.CANCELLING=2]="CANCELLING",i[i.NOT_CANCELLABLE=3]="NOT_CANCELLABLE",i))(tr||{}),ve=class extends w{constructor(){super("arrow.flight.protocol.HandshakeRequest",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},Er=new ve,We=class extends w{constructor(){super("arrow.flight.protocol.HandshakeResponse",[{no:1,name:"protocol_version",kind:"scalar",T:4,L:0},{no:2,name:"payload",kind:"scalar",T:12}])}},Fr=new We,Me=class extends w{constructor(){super("arrow.flight.protocol.BasicAuth",[{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"password",kind:"scalar",T:9}])}},ro=new Me,$e=class extends w{constructor(){super("arrow.flight.protocol.Empty",[])}},Rr=new $e,qe=class extends w{constructor(){super("arrow.flight.protocol.ActionType",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9}])}},Sr=new qe,Je=class extends w{constructor(){super("arrow.flight.protocol.Criteria",[{no:1,name:"expression",kind:"scalar",T:12}])}},Ar=new Je,je=class extends w{constructor(){super("arrow.flight.protocol.Action",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"body",kind:"scalar",T:12}])}},Dr=new je,Ke=class extends w{constructor(){super("arrow.flight.protocol.CancelFlightInfoRequest",[{no:1,name:"info",kind:"message",T:()=>Qe}])}},no=new Ke,Ge=class extends w{constructor(){super("arrow.flight.protocol.RenewFlightEndpointRequest",[{no:1,name:"endpoint",kind:"message",T:()=>rr}])}},io=new Ge,Xe=class extends w{constructor(){super("arrow.flight.protocol.Result",[{no:1,name:"body",kind:"scalar",T:12}])}},_r=new Xe,Ze=class extends w{constructor(){super("arrow.flight.protocol.CancelFlightInfoResult",[{no:1,name:"status",kind:"enum",T:()=>["arrow.flight.protocol.CancelStatus",tr,"CANCEL_STATUS_"]}])}},oo=new Ze,He=class extends w{constructor(){super("arrow.flight.protocol.SchemaResult",[{no:1,name:"schema",kind:"scalar",T:12}])}},Cr=new He,ze=class extends w{constructor(){super("arrow.flight.protocol.FlightDescriptor",[{no:1,name:"type",kind:"enum",T:()=>["arrow.flight.protocol.FlightDescriptor.DescriptorType",er]},{no:2,name:"cmd",kind:"scalar",T:12},{no:3,name:"path",kind:"scalar",repeat:2,T:9}])}},he=new ze,Ye=class extends w{constructor(){super("arrow.flight.protocol.FlightInfo",[{no:1,name:"schema",kind:"scalar",T:12},{no:2,name:"flight_descriptor",kind:"message",T:()=>he},{no:3,name:"endpoint",kind:"message",repeat:1,T:()=>rr},{no:4,name:"total_records",kind:"scalar",T:3,L:0},{no:5,name:"total_bytes",kind:"scalar",T:3,L:0},{no:6,name:"ordered",kind:"scalar",T:8}])}},Qe=new Ye,et=class extends w{constructor(){super("arrow.flight.protocol.FlightEndpoint",[{no:1,name:"ticket",kind:"message",T:()=>de},{no:2,name:"location",kind:"message",repeat:1,T:()=>Ur},{no:3,name:"expiration_time",kind:"message",T:()=>Yt}])}},rr=new et,tt=class extends w{constructor(){super("arrow.flight.protocol.Location",[{no:1,name:"uri",kind:"scalar",T:9}])}},Ur=new tt,rt=class extends w{constructor(){super("arrow.flight.protocol.Ticket",[{no:1,name:"ticket",kind:"scalar",T:12}])}},de=new rt,nt=class extends w{constructor(){super("arrow.flight.protocol.FlightData",[{no:1,name:"flight_descriptor",kind:"message",T:()=>he},{no:2,name:"data_header",kind:"scalar",T:12},{no:3,name:"app_metadata",kind:"scalar",T:12},{no:1e3,name:"data_body",kind:"scalar",T:12}])}},me=new nt,it=class extends w{constructor(){super("arrow.flight.protocol.PutResult",[{no:1,name:"app_metadata",kind:"scalar",T:12}])}},Lr=new it,ge=new Qt.ServiceType("arrow.flight.protocol.FlightService",[{name:"Handshake",serverStreaming:!0,clientStreaming:!0,options:{},I:Er,O:Fr},{name:"ListFlights",serverStreaming:!0,options:{},I:Ar,O:Qe},{name:"GetFlightInfo",options:{},I:he,O:Qe},{name:"GetSchema",options:{},I:he,O:Cr},{name:"DoGet",serverStreaming:!0,options:{},I:de,O:me},{name:"DoPut",serverStreaming:!0,clientStreaming:!0,options:{},I:me,O:Lr},{name:"DoExchange",serverStreaming:!0,clientStreaming:!0,options:{},I:me,O:me},{name:"DoAction",serverStreaming:!0,options:{},I:Dr,O:_r},{name:"ListActions",serverStreaming:!0,options:{},I:Rr,O:Sr}]);var k=require("@protobuf-ts/runtime-rpc"),be=class{constructor(e){this._transport=e;this.typeName=ge.typeName;this.methods=ge.methods;this.options=ge.options}handshake(e){let t=this.methods[0],n=this._transport.mergeOptions(e);return(0,k.stackIntercept)("duplex",this._transport,t,n)}listFlights(e,t){let n=this.methods[1],i=this._transport.mergeOptions(t);return(0,k.stackIntercept)("serverStreaming",this._transport,n,i,e)}getFlightInfo(e,t){let n=this.methods[2],i=this._transport.mergeOptions(t);return(0,k.stackIntercept)("unary",this._transport,n,i,e)}getSchema(e,t){let n=this.methods[3],i=this._transport.mergeOptions(t);return(0,k.stackIntercept)("unary",this._transport,n,i,e)}doGet(e,t){let n=this.methods[4],i=this._transport.mergeOptions(t);return(0,k.stackIntercept)("serverStreaming",this._transport,n,i,e)}doPut(e){let t=this.methods[5],n=this._transport.mergeOptions(e);return(0,k.stackIntercept)("duplex",this._transport,t,n)}doExchange(e){let t=this.methods[6],n=this._transport.mergeOptions(e);return(0,k.stackIntercept)("duplex",this._transport,t,n)}doAction(e,t){let n=this.methods[7],i=this._transport.mergeOptions(t);return(0,k.stackIntercept)("serverStreaming",this._transport,n,i,e)}listActions(e,t){let n=this.methods[8],i=this._transport.mergeOptions(t);return(0,k.stackIntercept)("serverStreaming",this._transport,n,i,e)}};var K=class{constructor(e){this._options=e;this._closed=!1;this._transport=$.queryTransport(this._options),this._flightClient=new be(this._transport)}async*query(e,t,n){var h;if(this._closed)throw new Error("queryApi: already closed!");let i=this._flightClient,o={database:t,sql_query:e,query_type:n},s=de.create({ticket:new TextEncoder().encode(JSON.stringify(o))}),a={},f=this._options.token;f&&(a.authorization=`Bearer ${f}`);let l={meta:a},u=i.doGet(s,l),p=async function*(){for await(let b of u.responses)yield bt(b.dataHeader.length),yield b.dataHeader,yield b.dataBody}(),m=await nr.RecordBatchReader.from(p);for await(let b of m)for(let E=0;E<b.numRows;E++){let A={};for(let F=0;F<b.numCols;F++){let or=b.schema.fields[F].name,sr=(h=b.getChildAt(F))==null?void 0:h.get(E);A[or]=sr}yield A}}async close(){var e,t;this._closed=!0,(t=(e=this._transport).close)==null||t.call(e)}};var ir=`Please specify the 'database' as a method parameter or use default configuration at 'ClientOptions.database'

{
"name": "@influxdata/influxdb3-client",
"version": "0.2.0",
"version": "0.3.0-nightly.1549",
"description": "The Client that provides a simple and convenient way to interact with InfluxDB 3.",

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

},
"gitHead": "e46e563e9822b6ae133d5fb1d20135392f04269f"
"gitHead": "e3b99c3d1c320ec73095a3e5352029c5ca0608c4"
}

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

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