@influxdata/influxdb-client 1.20.0 → 1.21.0-nightly.1592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/all.d.ts CHANGED
@@ -722,16 +722,17 @@ declare const dateToProtocolTimestamp: {
722
722
  declare function convertTimeToNanos(value: string | number | Date | undefined): string | undefined;
723
723
 
724
724
  /**
725
- * Logger that logs to console.out
726
- */
727
- declare const consoleLogger: Logger;/**
728
725
  * Logging interface.
729
726
  */
730
727
  interface Logger {
731
728
  error(message: string, err?: any): void;
732
729
  warn(message: string, err?: any): void;
733
730
  }
734
- declare const Logger: Logger;
731
+ /**
732
+ * Logger that logs to console.out
733
+ */
734
+ declare const consoleLogger: Logger;
735
+ declare const Log: Logger;
735
736
  /**
736
737
  * Sets custom logger.
737
738
  * @param logger - logger to use
@@ -1000,4 +1001,4 @@ declare class InfluxDB {
1000
1001
  getQueryApi(org: string | QueryOptions): QueryApi;
1001
1002
  }
1002
1003
 
1003
- export { AbortError, Cancellable, ChunkCombiner, ClientOptions, ColumnType, CommunicationObserver, ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_RetryDelayStrategyOptions, DEFAULT_WriteOptions, FLUX_VALUE, FluxParameterLike, FluxResultObserver, FluxTableColumn, FluxTableMetaData, Headers, HttpError, IllegalArgumentError, InfluxDB, LineSplitter, Logger, Observable, Observer, ObserverComplete, ObserverError, ObserverNext, ParameterizedQuery, Point, PointSettings, QueryApi, QueryOptions, RequestTimedOutError, ResponseStartedFn, RetriableDecision, RetryDelayStrategy, RetryDelayStrategyOptions, Row, SendOptions, Subscribable, Subscription, Transport, WriteApi, WriteOptions, WritePrecisionType, WriteRetryOptions, canRetryHttpCall, chunksToLines, consoleLogger, convertTimeToNanos, createFluxTableColumn, createFluxTableMetaData, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, flux, fluxBool, fluxDateTime, fluxDuration, fluxExpression, fluxFloat, fluxInteger, fluxRegExp, fluxString, getRetryDelay, isStatusCodeRetriable, linesToTables, newFluxTableColumn, sanitizeFloat, serializeDateTimeAsDate, serializeDateTimeAsNumber, serializeDateTimeAsString, setLogger, stringToLines, symbolObservable, toFluxValue, typeSerializers, useProcessHrtime };
1004
+ export { AbortError, Cancellable, ChunkCombiner, ClientOptions, ColumnType, CommunicationObserver, ConnectionOptions, DEFAULT_ConnectionOptions, DEFAULT_RetryDelayStrategyOptions, DEFAULT_WriteOptions, FLUX_VALUE, FluxParameterLike, FluxResultObserver, FluxTableColumn, FluxTableMetaData, Headers, HttpError, IllegalArgumentError, InfluxDB, LineSplitter, Log, Logger, Observable, Observer, ObserverComplete, ObserverError, ObserverNext, ParameterizedQuery, Point, PointSettings, QueryApi, QueryOptions, RequestTimedOutError, ResponseStartedFn, RetriableDecision, RetryDelayStrategy, RetryDelayStrategyOptions, Row, SendOptions, Subscribable, Subscription, Transport, WriteApi, WriteOptions, WritePrecisionType, WriteRetryOptions, canRetryHttpCall, chunksToLines, consoleLogger, convertTimeToNanos, createFluxTableColumn, createFluxTableMetaData, createTextDecoderCombiner, currentTime, dateToProtocolTimestamp, escape, flux, fluxBool, fluxDateTime, fluxDuration, fluxExpression, fluxFloat, fluxInteger, fluxRegExp, fluxString, getRetryDelay, isStatusCodeRetriable, linesToTables, newFluxTableColumn, sanitizeFloat, serializeDateTimeAsDate, serializeDateTimeAsNumber, serializeDateTimeAsString, setLogger, stringToLines, symbolObservable, toFluxValue, typeSerializers, useProcessHrtime };
@@ -1 +1 @@
1
- {"version":3,"file":"NodeHttpTransport.d.ts","sourceRoot":"","sources":["../../src/impl/node/NodeHttpTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAA4B,MAAM,eAAe,CAAA;AAM1E,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAEL,aAAa,EACb,qBAAqB,EAErB,iBAAiB,EAClB,MAAM,eAAe,CAAA;AAuBtB;;GAEG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAcrC,OAAO,CAAC,iBAAiB;IAZrC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAoB;IAEzD,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,UAAU,CAGK;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B;;;OAGG;gBACiB,iBAAiB,EAAE,iBAAiB;IAuCxD;;;;;;;;OAQG;IACH,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,SAAS,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAC9C,IAAI;IAaP;;;;;;;;OAQG;IACH,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,EACT,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,GAAG,CAAC;IA2Cf;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,QAAQ;CA0FjB;AACD,eAAe,iBAAiB,CAAA"}
1
+ {"version":3,"file":"NodeHttpTransport.d.ts","sourceRoot":"","sources":["../../src/impl/node/NodeHttpTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAA4B,MAAM,eAAe,CAAA;AAM1E,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAEL,aAAa,EACb,qBAAqB,EAErB,iBAAiB,EAClB,MAAM,eAAe,CAAA;AAuBtB;;GAEG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAcrC,OAAO,CAAC,iBAAiB;IAZrC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAoB;IAEzD,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,UAAU,CAGK;IACvB,OAAO,CAAC,WAAW,CAAQ;IAC3B;;;OAGG;gBACiB,iBAAiB,EAAE,iBAAiB;IAuCxD;;;;;;;;OAQG;IACH,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,EACpB,SAAS,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAC9C,IAAI;IAaP;;;;;;;;OAQG;IACH,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,EACT,OAAO,EAAE,WAAW,EACpB,eAAe,CAAC,EAAE,iBAAiB,GAClC,OAAO,CAAC,GAAG,CAAC;IA2Cf;;;;;;;;OAQG;IACH,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,QAAQ;CA2FjB;AACD,eAAe,iBAAiB,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const CLIENT_LIB_VERSION = "1.20.0";
1
+ export declare const CLIENT_LIB_VERSION = "1.21.0.nightly";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/impl/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,WAAW,CAAA"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/impl/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,mBAAmB,CAAA"}
@@ -13,5 +13,5 @@
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]])}return r}(r,["method","headers"]),o=`${this.url}${t}`,l=Object.assign({method:s,body:"GET"===s||"HEAD"===s?void 0:"string"==typeof e?e:JSON.stringify(e),headers:Object.assign(Object.assign({},this.defaultHeaders),n),credentials:"omit"},i);return this.requestDecorator(l,r,o),fetch(o,l)}}function Y(t,e){return e.toObject(t)}class K{constructor(t,e){this.isClosed=!1;try{e({next:e=>{t.next(e)},error:e=>{this.isClosed=!0,t.error(e)},complete:()=>{this.isClosed=!0,t.complete()},useCancellable:t=>{this.cancellable=t}})}catch(e){this.isClosed=!0,t.error(e)}}get closed(){return this.isClosed}unsubscribe(){var t;null===(t=this.cancellable)||void 0===t||t.cancel(),this.isClosed=!0}}function Q(){}class Z{constructor(t,e){this.executor=t,this.decorator=e}subscribe(t,e,r){const s=function(t){const{next:e,error:r,complete:s}=t;return{next:e?e.bind(t):Q,error:r?r.bind(t):Q,complete:s?s.bind(t):Q}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new K(this.decorator(s),this.executor)}[q](){return this}}const tt={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},et=t=>t;class rt{constructor(t,e){this.transport=t,this.options="string"==typeof e?{org:e}:e}with(t){return new rt(this.transport,Object.assign(Object.assign({},this.options),t))}lines(t){return new Z(this.createExecutor(t),et)}rows(t){return new Z(this.createExecutor(t),t=>w({next(e,r){t.next({values:e,tableMeta:r})},error(e){t.error(e)},complete(){t.complete()}}))}queryLines(t,e){this.createExecutor(t)(e)}queryRows(t,e){this.createExecutor(t)(w(e))}collectRows(t,e=Y){const r=[];return new Promise((s,n)=>{this.queryRows(t,{next(t,s){const n=e.call(this,t,s);void 0!==n&&r.push(n)},error(t){n(t)},complete(){s(r)}})})}collectLines(t){const e=[];return new Promise((r,s)=>{this.queryLines(t,{next(t){e.push(t)},error(t){s(t)},complete(){r(e)}})})}queryRaw(t){const{org:e,type:r,gzip:s,headers:n}=this.options;return this.transport.request("/api/v2/query?org="+encodeURIComponent(e),JSON.stringify(this.decorateRequest({query:t.toString(),dialect:tt,type:r})),{method:"POST",headers:Object.assign({accept:"text/csv","accept-encoding":s?"gzip":"identity","content-type":"application/json; encoding=utf-8"},n)})}createExecutor(t){const{org:e,type:s,gzip:n,headers:i}=this.options;return o=>{this.transport.send("/api/v2/query?org="+encodeURIComponent(e),JSON.stringify(this.decorateRequest({query:t.toString(),dialect:tt,type:s})),{method:"POST",headers:Object.assign({"content-type":"application/json; encoding=utf-8","accept-encoding":n?"gzip":"identity"},i)},r(o,this.transport.chunkCombiner))}}decorateRequest(t){var e;return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=null!==(e=this.options.type)&&void 0!==e?e:"flux",t}}t.AbortError=d,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=x,t.DEFAULT_WriteOptions=b,t.FLUX_VALUE=F,t.HttpError=u,t.IllegalArgumentError=a,t.InfluxDB=class{constructor(t){var e;if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new a("No url or configuration specified!");this._options=t}const r=this._options.url;if("string"!=typeof r)throw new a("No url specified!");r.endsWith("/")&&(this._options.url=r.substring(0,r.length-1)),this.transport=null!==(e=this._options.transport)&&void 0!==e?e:new X(this._options)}getWriteApi(t,e,r="ns",s){return new J(this.transport,t,e,r,null!=s?s:this._options.writeOptions)}getQueryApi(t){return new rt(this.transport,t)}},t.LineSplitter=s,t.Logger=L,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){let r;if(r="number"==typeof e?e:parseInt(String(e)),isNaN(r)||r<=-0x8000000000000000||r>=0x8000000000000000)throw new Error(`invalid integer value for field '${t}': '${e}'!`);return this.fields[t]=Math.floor(r)+"i",this}uintField(t,e){if("number"==typeof e){if(isNaN(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${t}' out of range: ${e}`);this.fields[t]=Math.floor(e)+"u"}else{const r=String(e);for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);if(s<48||s>57)throw new Error(`uint value has an unsupported character at pos ${t}: ${e}`)}if(r.length>20||20===r.length&&r.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${t}' out of range: ${r}`);this.fields[t]=r+"u"}return this}floatField(t,e){let r;if(r="number"==typeof e?e:parseFloat(e),!isFinite(r))throw new Error(`invalid float value for field '${t}': ${e}`);return this.fields[t]=String(r),this}stringField(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=T.quoted(e)),this}timestamp(t){return this.time=t,this}toLineProtocol(t){if(!this.name)return;let e="";if(Object.keys(this.fields).sort().forEach(t=>{if(t){const r=this.fields[t];e.length>0&&(e+=","),e+=`${T.tag(t)}=${r}`}}),0===e.length)return;let r="";const s=t&&t.defaultTags?Object.assign(Object.assign({},t.defaultTags),this.tags):this.tags;Object.keys(s).sort().forEach(t=>{if(t){const e=s[t];e&&(r+=",",r+=`${T.tag(t)}=${T.tag(e)}`)}});let n=this.time;return n=t&&t.convertTime?t.convertTime(n):$(n),`${T.measurement(this.name)}${r} ${e}${void 0!==n?" "+n:""}`}toString(){const t=this.toLineProtocol(void 0);return t||"invalid point: "+JSON.stringify(this,void 0)}},t.RequestTimedOutError=f,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.chunksToLines=r,t.consoleLogger=_,t.convertTimeToNanos=$,t.createFluxTableColumn=function(t){var e,r;const s=new n;return s.label=String(t.label),s.dataType=t.dataType,s.group=Boolean(t.group),s.defaultValue=null!==(e=t.defaultValue)&&void 0!==e?e:"",s.index=null!==(r=t.index)&&void 0!==r?r:0,s},t.createFluxTableMetaData=m,t.createTextDecoderCombiner=e,t.currentTime=A,t.dateToProtocolTimestamp=j,t.escape=T,t.flux=function(t,...e){if(1==t.length&&0===e.length)return z(t[0]);const r=new Array(t.length+e.length);let s=0;for(let i=0;i<t.length;i++){const o=t[i];if(r[s++]=o,i<e.length){const l=e[i];let a;if(o.endsWith('"')&&i+1<t.length&&t[i+1].startsWith('"'))a=I(l);else if(a=U(l),""===a&&("object"!=typeof(n=l)||"function"!=typeof n[F]))throw new Error(`Unsupported parameter literal '${l}' at index: ${i}, type: ${typeof l}`);r[s++]=a}else if(i<t.length-1)throw new Error("Too few parameters supplied!")}var n;return z(r.join(""))},t.fluxBool=function(t){return new P("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new P(function(t){return`time(v: "${I(t)}")`}(t))},t.fluxDuration=function(t){return new P(`duration(v: "${I(t)}")`)},t.fluxExpression=z,t.fluxFloat=function(t){return new P(M(t))},t.fluxInteger=function(t){const e=M(t);for(const t of e)if("."===t)throw new Error("not a flux integer: "+e);return new P(e)},t.fluxRegExp=function(t){return new P(N(t))},t.fluxString=function(t){return new P(`"${I(t)}"`)},t.getRetryDelay=c,t.isStatusCodeRetriable=l,t.linesToTables=w,t.newFluxTableColumn=i,t.sanitizeFloat=M,t.serializeDateTimeAsDate=function(){g["dateTime:RFC3339"]=t=>""===t?null:new Date(Date.parse(t))},t.serializeDateTimeAsNumber=function(){g["dateTime:RFC3339"]=t=>""===t?null:Date.parse(t)},t.serializeDateTimeAsString=function(){g["dateTime:RFC3339"]=t=>""===t?null:t},t.setLogger=function(t){const e=B;return B=t,e},t.stringToLines=function(t,e){let r=!1,s=0,n=0;for(;n<t.length;){const i=t.charCodeAt(n);if(10===i){if(!r){const r=n>0&&13===t.charCodeAt(n-1)?n-1:n;e.next(t.substring(s,r)),s=n+1}}else 34===i&&(r=!r);n++}s<n&&e.next(t.substring(s,n)),e.complete()},t.symbolObservable=q,t.toFluxValue=U,t.typeSerializers=g,t.useProcessHrtime=function(t){return!1},Object.defineProperty(t,"__esModule",{value:!0})}));
16
+ function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]])}return r}(r,["method","headers"]),o=`${this.url}${t}`,l=Object.assign({method:s,body:"GET"===s||"HEAD"===s?void 0:"string"==typeof e?e:JSON.stringify(e),headers:Object.assign(Object.assign({},this.defaultHeaders),n),credentials:"omit"},i);return this.requestDecorator(l,r,o),fetch(o,l)}}function Y(t,e){return e.toObject(t)}class K{constructor(t,e){this.isClosed=!1;try{e({next:e=>{t.next(e)},error:e=>{this.isClosed=!0,t.error(e)},complete:()=>{this.isClosed=!0,t.complete()},useCancellable:t=>{this.cancellable=t}})}catch(e){this.isClosed=!0,t.error(e)}}get closed(){return this.isClosed}unsubscribe(){var t;null===(t=this.cancellable)||void 0===t||t.cancel(),this.isClosed=!0}}function Q(){}class Z{constructor(t,e){this.executor=t,this.decorator=e}subscribe(t,e,r){const s=function(t){const{next:e,error:r,complete:s}=t;return{next:e?e.bind(t):Q,error:r?r.bind(t):Q,complete:s?s.bind(t):Q}}("object"!=typeof t||null===t?{next:t,error:e,complete:r}:t);return new K(this.decorator(s),this.executor)}[q](){return this}}const tt={header:!0,delimiter:",",quoteChar:'"',commentPrefix:"#",annotations:["datatype","group","default"]},et=t=>t;class rt{constructor(t,e){this.transport=t,this.options="string"==typeof e?{org:e}:e}with(t){return new rt(this.transport,Object.assign(Object.assign({},this.options),t))}lines(t){return new Z(this.createExecutor(t),et)}rows(t){return new Z(this.createExecutor(t),t=>w({next(e,r){t.next({values:e,tableMeta:r})},error(e){t.error(e)},complete(){t.complete()}}))}queryLines(t,e){this.createExecutor(t)(e)}queryRows(t,e){this.createExecutor(t)(w(e))}collectRows(t,e=Y){const r=[];return new Promise((s,n)=>{this.queryRows(t,{next(t,s){const n=e.call(this,t,s);void 0!==n&&r.push(n)},error(t){n(t)},complete(){s(r)}})})}collectLines(t){const e=[];return new Promise((r,s)=>{this.queryLines(t,{next(t){e.push(t)},error(t){s(t)},complete(){r(e)}})})}queryRaw(t){const{org:e,type:r,gzip:s,headers:n}=this.options;return this.transport.request("/api/v2/query?org="+encodeURIComponent(e),JSON.stringify(this.decorateRequest({query:t.toString(),dialect:tt,type:r})),{method:"POST",headers:Object.assign({accept:"text/csv","accept-encoding":s?"gzip":"identity","content-type":"application/json; encoding=utf-8"},n)})}createExecutor(t){const{org:e,type:s,gzip:n,headers:i}=this.options;return o=>{this.transport.send("/api/v2/query?org="+encodeURIComponent(e),JSON.stringify(this.decorateRequest({query:t.toString(),dialect:tt,type:s})),{method:"POST",headers:Object.assign({"content-type":"application/json; encoding=utf-8","accept-encoding":n?"gzip":"identity"},i)},r(o,this.transport.chunkCombiner))}}decorateRequest(t){var e;return"function"==typeof this.options.now&&(t.now=this.options.now()),t.type=null!==(e=this.options.type)&&void 0!==e?e:"flux",t}}t.AbortError=d,t.DEFAULT_ConnectionOptions={timeout:1e4},t.DEFAULT_RetryDelayStrategyOptions=x,t.DEFAULT_WriteOptions=b,t.FLUX_VALUE=F,t.HttpError=u,t.IllegalArgumentError=a,t.InfluxDB=class{constructor(t){var e;if("string"==typeof t)this._options={url:t};else{if(null===t||"object"!=typeof t)throw new a("No url or configuration specified!");this._options=t}const r=this._options.url;if("string"!=typeof r)throw new a("No url specified!");r.endsWith("/")&&(this._options.url=r.substring(0,r.length-1)),this.transport=null!==(e=this._options.transport)&&void 0!==e?e:new X(this._options)}getWriteApi(t,e,r="ns",s){return new J(this.transport,t,e,r,null!=s?s:this._options.writeOptions)}getQueryApi(t){return new rt(this.transport,t)}},t.LineSplitter=s,t.Log=L,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){let r;if(r="number"==typeof e?e:parseInt(String(e)),isNaN(r)||r<=-0x8000000000000000||r>=0x8000000000000000)throw new Error(`invalid integer value for field '${t}': '${e}'!`);return this.fields[t]=Math.floor(r)+"i",this}uintField(t,e){if("number"==typeof e){if(isNaN(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new Error(`uint value for field '${t}' out of range: ${e}`);this.fields[t]=Math.floor(e)+"u"}else{const r=String(e);for(let t=0;t<r.length;t++){const s=r.charCodeAt(t);if(s<48||s>57)throw new Error(`uint value has an unsupported character at pos ${t}: ${e}`)}if(r.length>20||20===r.length&&r.localeCompare("18446744073709551615")>0)throw new Error(`uint value for field '${t}' out of range: ${r}`);this.fields[t]=r+"u"}return this}floatField(t,e){let r;if(r="number"==typeof e?e:parseFloat(e),!isFinite(r))throw new Error(`invalid float value for field '${t}': ${e}`);return this.fields[t]=String(r),this}stringField(t,e){return null!=e&&("string"!=typeof e&&(e=String(e)),this.fields[t]=T.quoted(e)),this}timestamp(t){return this.time=t,this}toLineProtocol(t){if(!this.name)return;let e="";if(Object.keys(this.fields).sort().forEach(t=>{if(t){const r=this.fields[t];e.length>0&&(e+=","),e+=`${T.tag(t)}=${r}`}}),0===e.length)return;let r="";const s=t&&t.defaultTags?Object.assign(Object.assign({},t.defaultTags),this.tags):this.tags;Object.keys(s).sort().forEach(t=>{if(t){const e=s[t];e&&(r+=",",r+=`${T.tag(t)}=${T.tag(e)}`)}});let n=this.time;return n=t&&t.convertTime?t.convertTime(n):$(n),`${T.measurement(this.name)}${r} ${e}${void 0!==n?" "+n:""}`}toString(){const t=this.toLineProtocol(void 0);return t||"invalid point: "+JSON.stringify(this,void 0)}},t.RequestTimedOutError=f,t.canRetryHttpCall=function(t){return!!t&&("function"==typeof t.canRetry?!!t.canRetry():!(!t.code||!h.includes(t.code)))},t.chunksToLines=r,t.consoleLogger=_,t.convertTimeToNanos=$,t.createFluxTableColumn=function(t){var e,r;const s=new n;return s.label=String(t.label),s.dataType=t.dataType,s.group=Boolean(t.group),s.defaultValue=null!==(e=t.defaultValue)&&void 0!==e?e:"",s.index=null!==(r=t.index)&&void 0!==r?r:0,s},t.createFluxTableMetaData=m,t.createTextDecoderCombiner=e,t.currentTime=A,t.dateToProtocolTimestamp=j,t.escape=T,t.flux=function(t,...e){if(1==t.length&&0===e.length)return z(t[0]);const r=new Array(t.length+e.length);let s=0;for(let i=0;i<t.length;i++){const o=t[i];if(r[s++]=o,i<e.length){const l=e[i];let a;if(o.endsWith('"')&&i+1<t.length&&t[i+1].startsWith('"'))a=I(l);else if(a=U(l),""===a&&("object"!=typeof(n=l)||"function"!=typeof n[F]))throw new Error(`Unsupported parameter literal '${l}' at index: ${i}, type: ${typeof l}`);r[s++]=a}else if(i<t.length-1)throw new Error("Too few parameters supplied!")}var n;return z(r.join(""))},t.fluxBool=function(t){return new P("true"===t||"false"===t?t:(!!t).toString())},t.fluxDateTime=function(t){return new P(function(t){return`time(v: "${I(t)}")`}(t))},t.fluxDuration=function(t){return new P(`duration(v: "${I(t)}")`)},t.fluxExpression=z,t.fluxFloat=function(t){return new P(M(t))},t.fluxInteger=function(t){const e=M(t);for(const t of e)if("."===t)throw new Error("not a flux integer: "+e);return new P(e)},t.fluxRegExp=function(t){return new P(N(t))},t.fluxString=function(t){return new P(`"${I(t)}"`)},t.getRetryDelay=c,t.isStatusCodeRetriable=l,t.linesToTables=w,t.newFluxTableColumn=i,t.sanitizeFloat=M,t.serializeDateTimeAsDate=function(){g["dateTime:RFC3339"]=t=>""===t?null:new Date(Date.parse(t))},t.serializeDateTimeAsNumber=function(){g["dateTime:RFC3339"]=t=>""===t?null:Date.parse(t)},t.serializeDateTimeAsString=function(){g["dateTime:RFC3339"]=t=>""===t?null:t},t.setLogger=function(t){const e=B;return B=t,e},t.stringToLines=function(t,e){let r=!1,s=0,n=0;for(;n<t.length;){const i=t.charCodeAt(n);if(10===i){if(!r){const r=n>0&&13===t.charCodeAt(n-1)?n-1:n;e.next(t.substring(s,r)),s=n+1}}else 34===i&&(r=!r);n++}s<n&&e.next(t.substring(s,n)),e.complete()},t.symbolObservable=q,t.toFluxValue=U,t.typeSerializers=g,t.useProcessHrtime=function(t){return!1},Object.defineProperty(t,"__esModule",{value:!0})}));
17
17
  //# sourceMappingURL=index.browser.js.map
Binary file