New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

influx

Package Overview
Dependencies
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

influx - npm Package Compare versions

Comparing version 5.0.4 to 5.0.5

1

lib/src/backoff/backoff.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -3,0 +4,0 @@ * @class

3

lib/src/builder.js
"use strict";
var grammar_1 = require('./grammar');
Object.defineProperty(exports, "__esModule", { value: true });
var grammar_1 = require("./grammar");
function regexHasFlags(re) {

@@ -4,0 +5,0 @@ if (typeof re.flags !== 'undefined') {

@@ -26,5 +26,7 @@ import { Tags } from './results';

* @property {String} [host='127.0.0.1'] Influx host to connect to.
* @property {Number} [port=8060] Influx port to connect to.
* @property {Number} [port=8086] Influx port to connect to.
* @property {String} [protocol='http'] Protocol to connect over, either
* 'http' or 'https'.
* @property {https.RequestOptions} [options={}] Option overrides to use in
* passing to http.request or https.request.
* @property {IPoolOptions} [pool] Options for the connection pool.

@@ -67,5 +69,7 @@ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.

* @property {String} [hosts.host='127.0.0.1'] Influx host to connect to.
* @property {Number} [hosts.port=8060] Influx port to connect to.
* @property {Number} [hosts.port=8086] Influx port to connect to.
* @property {String} [hosts.protocol='http'] Protocol to connect over, either
* 'http' or 'https'.
* @property {https.RequestOptions} [hosts.options={}] Option overrides to
* use in passing to http.request or https.request.
* @property {IPoolOptions} [pool] Options for the connection pool.

@@ -131,7 +135,8 @@ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.

/**
* IResults are returned from the .query method. It marshals the raw Influx
* IResults are returned from the {@link InfluxDB#query} method. It marshals the raw Influx
* results into a more palatable, JavaScript-y structure. All query results
* are marshalled into a single, flat arrays, and methods are provided to
* example grouped results as necessary. The `time` column, if included, is
* converted into a {@link INanoDate}.
* are marshalled into a single, flat array, and methods are provided to
* examine grouped results as necessary. The `time` column, if included, is
* converted into a {@link INanoDate}. If `.query()` was called on an array of strings,
* it will return an array of IResults, one result per query string.
*

@@ -150,3 +155,3 @@ * @interface

/**
* Group looks for and returns the first group in the results
* Looks for and returns the first group in the results
* that matches the provided tags.

@@ -219,4 +224,4 @@ *

* field values to insert.
* @property {Date|string|number} [fields] Timestamp tags this measurement with
* a date. This can be a Date object, in which case we'll adjust it to the
* @property {Date|string|number} [timestamp] Specifies a timestamp for this
* point. This can be a Date object, in which case we'll adjust it to the
* desired precision, or a numeric string or number, in which case

@@ -223,0 +228,0 @@ * it gets passed directly to Influx.

"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -31,5 +37,7 @@ * Pool options can be passed into the database to configure the behaviour

* @property {String} [host='127.0.0.1'] Influx host to connect to.
* @property {Number} [port=8060] Influx port to connect to.
* @property {Number} [port=8086] Influx port to connect to.
* @property {String} [protocol='http'] Protocol to connect over, either
* 'http' or 'https'.
* @property {https.RequestOptions} [options={}] Option overrides to use in
* passing to http.request or https.request.
* @property {IPoolOptions} [pool] Options for the connection pool.

@@ -72,5 +80,7 @@ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.

* @property {String} [hosts.host='127.0.0.1'] Influx host to connect to.
* @property {Number} [hosts.port=8060] Influx port to connect to.
* @property {Number} [hosts.port=8086] Influx port to connect to.
* @property {String} [hosts.protocol='http'] Protocol to connect over, either
* 'http' or 'https'.
* @property {https.RequestOptions} [hosts.options={}] Option overrides to
* use in passing to http.request or https.request.
* @property {IPoolOptions} [pool] Options for the connection pool.

@@ -136,7 +146,8 @@ * @property {ISchemaOptions[]} [schema] An optional list of data schema to use.

/**
* IResults are returned from the .query method. It marshals the raw Influx
* IResults are returned from the {@link InfluxDB#query} method. It marshals the raw Influx
* results into a more palatable, JavaScript-y structure. All query results
* are marshalled into a single, flat arrays, and methods are provided to
* example grouped results as necessary. The `time` column, if included, is
* converted into a {@link INanoDate}.
* are marshalled into a single, flat array, and methods are provided to
* examine grouped results as necessary. The `time` column, if included, is
* converted into a {@link INanoDate}. If `.query()` was called on an array of strings,
* it will return an array of IResults, one result per query string.
*

@@ -156,6 +167,6 @@ * @interface

function IResults() {
_super.apply(this, arguments);
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Group looks for and returns the first group in the results
* Looks for and returns the first group in the results
* that matches the provided tags.

@@ -226,4 +237,4 @@ *

* field values to insert.
* @property {Date|string|number} [fields] Timestamp tags this measurement with
* a date. This can be a Date object, in which case we'll adjust it to the
* @property {Date|string|number} [timestamp] Specifies a timestamp for this
* point. This can be a Date object, in which case we'll adjust it to the
* desired precision, or a numeric string or number, in which case

@@ -314,3 +325,3 @@ * it gets passed directly to Influx.

function INanoDate() {
_super.apply(this, arguments);
return _super !== null && _super.apply(this, arguments) || this;
}

@@ -317,0 +328,0 @@ /**

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -18,2 +19,3 @@ * FieldType is an enumeration of InfluxDB field data types.

*/
var FieldType;
(function (FieldType) {

@@ -24,4 +26,3 @@ FieldType[FieldType["FLOAT"] = 0] = "FLOAT";

FieldType[FieldType["BOOLEAN"] = 3] = "BOOLEAN";
})(exports.FieldType || (exports.FieldType = {}));
var FieldType = exports.FieldType;
})(FieldType = exports.FieldType || (exports.FieldType = {}));
function isNumeric(value) {

@@ -28,0 +29,0 @@ return !Number.isNaN(Number(value));

"use strict";
var ds_1 = require('./ds');
Object.defineProperty(exports, "__esModule", { value: true });
var ds_1 = require("./ds");
var reEscape = /[-|\\{()[\]^$+*?.]/g;

@@ -4,0 +5,0 @@ /**

@@ -5,4 +5,5 @@ "use strict";

}
__export(require('./escape'));
__export(require('./ds'));
__export(require('./times'));
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./escape"));
__export(require("./ds"));
__export(require("./times"));

@@ -23,3 +23,3 @@ export interface INanoDate extends Date {

*/
export declare const Precision: {
export declare const Precision: Readonly<{
Hours: string;

@@ -31,3 +31,3 @@ Microseconds: string;

Seconds: string;
};
}>;
/**

@@ -34,0 +34,0 @@ * Covers a nanoseconds unix timestamp to a INanoDate for node-influx. The

"use strict";
var ds_1 = require('./ds');
Object.defineProperty(exports, "__esModule", { value: true });
var ds_1 = require("./ds");
/**

@@ -132,5 +133,11 @@ * Just a quick overview of what's going on in this file. It's a bit of a mess.

var _a = iso.split('.'), secondsStr = _a[0], decimalStr = _a[1];
var seconds = Math.floor(new Date(secondsStr + 'Z').getTime() / 1000);
var decimal = rightPad(decimalStr.slice(0, -1), 9);
return "" + seconds + decimal;
if (decimalStr === undefined) {
decimalStr = '000000000';
}
else {
decimalStr = rightPad(decimalStr.slice(0, -1), 9);
secondsStr += 'Z';
}
var seconds = Math.floor(new Date(secondsStr).getTime() / 1000);
return "" + seconds + decimalStr;
}

@@ -137,0 +144,0 @@ var nanoDateMethods = {

/// <reference types="node" />
import { RequestOptions } from 'https';
import * as urlModule from 'url';
import { IBackoffStrategy } from './backoff/backoff';
import * as urlModule from 'url';
export declare class Host {
private backoff;
url: urlModule.Url;
readonly options: RequestOptions;
readonly url: urlModule.Url;
/**

@@ -12,3 +14,3 @@ * Creates a new Host instance.

*/
constructor(url: string, backoff: IBackoffStrategy);
constructor(url: string, backoff: IBackoffStrategy, options: RequestOptions);
/**

@@ -15,0 +17,0 @@ * Marks a failure on the host and returns the length of time it

"use strict";
var urlModule = require('url');
Object.defineProperty(exports, "__esModule", { value: true });
var urlModule = require("url");
var Host = (function () {

@@ -9,4 +10,5 @@ /**

*/
function Host(url, backoff) {
function Host(url, backoff, options) {
this.backoff = backoff;
this.options = options;
this.url = urlModule.parse(url);

@@ -13,0 +15,0 @@ }

@@ -0,8 +1,10 @@

/// <reference types="node" />
import { RequestOptions } from 'https';
import * as b from './builder';
import * as grammar from './grammar';
import { IPingStats, IPoolOptions } from './pool';
import { IResults } from './results';
import { ISchemaOptions } from './schema';
import * as b from './builder';
import * as grammar from './grammar';
export * from './builder';
export { FieldType, Precision, Raw, TimePrecision, escape, toNanoDate } from './grammar';
export { INanoDate, FieldType, Precision, Raw, TimePrecision, escape, toNanoDate } from './grammar';
export { ISchemaOptions } from './schema';

@@ -17,3 +19,3 @@ export { IPingStats, IPoolOptions } from './pool';

/**
* Influx port to connect to, defaults to 8060.
* Influx port to connect to, defaults to 8086.
*/

@@ -25,2 +27,6 @@ port?: number;

protocol?: 'http' | 'https';
/**
* Optional request option overrides.
*/
options?: RequestOptions;
}

@@ -341,3 +347,3 @@ export interface ISingleHostConfig extends IHostConfig {

* privileges on all databases.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -354,3 +360,3 @@ * influx.createUser('connor', 'pa55w0rd', true) // make 'connor' an admin

* @param {String} password
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -365,3 +371,3 @@ * influx.setPassword('connor', 'pa55w0rd')

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -376,3 +382,3 @@ * influx.grantPrivilege('connor', 'READ', 'my_db') // grants read access on my_db to connor

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -385,3 +391,3 @@ * influx.revokePrivilege('connor', 'READ', 'my_db') // removes read access on my_db from connor

* @param {String} username
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -394,3 +400,3 @@ * influx.grantAdminPrivilege('connor')

* @param {String} username
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -403,3 +409,3 @@ * influx.revokeAdminPrivilege('connor')

* @param {String} username
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -414,3 +420,3 @@ * influx.dropUser('connor')

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -426,3 +432,3 @@ * influx.createContinuousQuery('downsample_cpu_1h', `

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -439,3 +445,3 @@ * influx.showContinousQueries()

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -461,3 +467,3 @@ * influx.dropContinuousQuery('downsample_cpu_1h')

* be the default policy on the database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -484,3 +490,3 @@ * influx.createRetentionPolicy('7d', {

* be the default policy on the database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -502,3 +508,3 @@ * influx.alterRetentionPolicy('7d', {

* uses the default database if not provided.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -513,3 +519,3 @@ * influx.dropRetentionPolicy('7d')

* default database if not provided.
* @returns {Promise<Array<{
* @return {Promise<Array<{
* name: String,

@@ -576,6 +582,6 @@ * duration: String,

*
* Please see the IPoint and IWriteOptions type for a
* Please see the IPoint and IWriteOptions types for a
* full list of possible options.
*
* @param {Point[]} points
* @param {IPoint[]} points
* @param {IWriteOptions} [options]

@@ -615,3 +621,3 @@ * @return {Promise<void>}

* @param {String} measurement
* @param {Point[]} points
* @param {IPoint[]} points
* @param {IWriteOptions} [options]

@@ -643,3 +649,3 @@ * @return {Promise<void>}

*/
queryRaw<T>(query: string, options?: IQueryOptions): Promise<any>;
queryRaw<T>(query: string | string[], options?: IQueryOptions): Promise<any>;
/**

@@ -646,0 +652,0 @@ * Pings all available hosts, collecting online status and version info.

@@ -5,8 +5,9 @@ "use strict";

}
var pool_1 = require('./pool');
var results_1 = require('./results');
var schema_1 = require('./schema');
var b = require('./builder');
var grammar = require('./grammar');
var url = require('url');
Object.defineProperty(exports, "__esModule", { value: true });
var url = require("url");
var b = require("./builder");
var grammar = require("./grammar");
var pool_1 = require("./pool");
var results_1 = require("./results");
var schema_1 = require("./schema");
var defaultHost = Object.freeze({

@@ -24,4 +25,4 @@ host: '127.0.0.1',

});
__export(require('./builder'));
var grammar_1 = require('./grammar');
__export(require("./builder"));
var grammar_1 = require("./grammar");
exports.FieldType = grammar_1.FieldType;

@@ -32,3 +33,3 @@ exports.Precision = grammar_1.Precision;

exports.toNanoDate = grammar_1.toNanoDate;
var results_2 = require('./results');
var results_2 = require("./results");
exports.ResultError = results_2.ResultError;

@@ -217,3 +218,3 @@ /**

resolved.hosts.forEach(function (host) {
_this.pool.addHost(host.protocol + "://" + host.host + ":" + host.port);
_this.pool.addHost(host.protocol + "://" + host.host + ":" + host.port, host.options);
});

@@ -223,3 +224,3 @@ this.options.schema.forEach(function (schema) {

if (!db) {
throw new Error(("Schema " + schema.measurement + " doesn't have a database specified,") +
throw new Error("Schema " + schema.measurement + " doesn't have a database specified," +
'and no default database is provided!');

@@ -391,3 +392,3 @@ }

* privileges on all databases.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -402,3 +403,3 @@ * influx.createUser('connor', 'pa55w0rd', true) // make 'connor' an admin

return this.pool.json(this.getQueryOpts({
q: ("create user " + grammar.escape.quoted(username) + " with password ")
q: "create user " + grammar.escape.quoted(username) + " with password "
+ grammar.escape.stringLit(password)

@@ -412,3 +413,3 @@ + (admin ? ' with all privileges' : ''),

* @param {String} password
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -419,3 +420,3 @@ * influx.setPassword('connor', 'pa55w0rd')

return this.pool.json(this.getQueryOpts({
q: ("set password for " + grammar.escape.quoted(username) + " = ")
q: "set password for " + grammar.escape.quoted(username) + " = "
+ grammar.escape.stringLit(password),

@@ -429,3 +430,3 @@ }, 'POST')).then(results_1.assertNoErrors);

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -437,3 +438,3 @@ * influx.grantPrivilege('connor', 'READ', 'my_db') // grants read access on my_db to connor

return this.pool.json(this.getQueryOpts({
q: ("grant " + privilege + " on " + grammar.escape.quoted(database) + " ")
q: "grant " + privilege + " on " + grammar.escape.quoted(database) + " "
+ ("to " + grammar.escape.quoted(username)),

@@ -447,3 +448,3 @@ }, 'POST')).then(results_1.assertNoErrors);

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -455,3 +456,3 @@ * influx.revokePrivilege('connor', 'READ', 'my_db') // removes read access on my_db from connor

return this.pool.json(this.getQueryOpts({
q: ("revoke " + privilege + " from " + grammar.escape.quoted(username) + " on ")
q: "revoke " + privilege + " from " + grammar.escape.quoted(username) + " on "
+ grammar.escape.quoted(database),

@@ -463,3 +464,3 @@ }, 'POST')).then(results_1.assertNoErrors);

* @param {String} username
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -476,3 +477,3 @@ * influx.grantAdminPrivilege('connor')

* @param {String} username
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -489,3 +490,3 @@ * influx.revokeAdminPrivilege('connor')

* @param {String} username
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -504,3 +505,3 @@ * influx.dropUser('connor')

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -515,3 +516,3 @@ * influx.createContinuousQuery('downsample_cpu_1h', `

return this.pool.json(this.getQueryOpts({
q: ("create continuous query " + grammar.escape.quoted(name))
q: "create continuous query " + grammar.escape.quoted(name)
+ (" on " + grammar.escape.quoted(database) + " begin " + query + " end"),

@@ -523,3 +524,3 @@ }, 'POST')).then(results_1.assertNoErrors);

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -539,3 +540,3 @@ * influx.showContinousQueries()

* @param {String} [database] If not provided, uses the default database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -547,3 +548,3 @@ * influx.dropContinuousQuery('downsample_cpu_1h')

return this.pool.json(this.getQueryOpts({
q: ("drop continuous query " + grammar.escape.quoted(name))
q: "drop continuous query " + grammar.escape.quoted(name)
+ (" on " + grammar.escape.quoted(database)),

@@ -568,3 +569,3 @@ }, 'POST')).then(results_1.assertNoErrors);

* be the default policy on the database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -577,3 +578,3 @@ * influx.createRetentionPolicy('7d', {

InfluxDB.prototype.createRetentionPolicy = function (name, options) {
var q = ("create retention policy " + grammar.escape.quoted(name) + " on ")
var q = "create retention policy " + grammar.escape.quoted(name) + " on "
+ grammar.escape.quoted(options.database || this.defaultDB())

@@ -598,3 +599,3 @@ + (" duration " + options.duration + " replication " + options.replication)

* be the default policy on the database.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -608,3 +609,3 @@ * influx.alterRetentionPolicy('7d', {

InfluxDB.prototype.alterRetentionPolicy = function (name, options) {
var q = ("alter retention policy " + grammar.escape.quoted(name) + " on ")
var q = "alter retention policy " + grammar.escape.quoted(name) + " on "
+ grammar.escape.quoted(options.database || this.defaultDB())

@@ -623,3 +624,3 @@ + (" duration " + options.duration + " replication " + options.replication)

* uses the default database if not provided.
* @returns {Promise<void>}
* @return {Promise<void>}
* @example

@@ -631,3 +632,3 @@ * influx.dropRetentionPolicy('7d')

return this.pool.json(this.getQueryOpts({
q: ("drop retention policy " + grammar.escape.quoted(name) + " ")
q: "drop retention policy " + grammar.escape.quoted(name) + " "
+ ("on " + grammar.escape.quoted(database)),

@@ -641,3 +642,3 @@ }, 'POST')).then(results_1.assertNoErrors);

* default database if not provided.
* @returns {Promise<Array<{
* @return {Promise<Array<{
* name: String,

@@ -703,6 +704,6 @@ * duration: String,

*
* Please see the IPoint and IWriteOptions type for a
* Please see the IPoint and IWriteOptions types for a
* full list of possible options.
*
* @param {Point[]} points
* @param {IPoint[]} points
* @param {IWriteOptions} [options]

@@ -781,3 +782,3 @@ * @return {Promise<void>}

* @param {String} measurement
* @param {Point[]} points
* @param {IPoint[]} points
* @param {IWriteOptions} [options]

@@ -799,10 +800,9 @@ * @return {Promise<void>}

/**
* .query() run a query (or list of queries), runs them, and returns the
* results in a friendly format. If you run multiple queries, multiple
* sets of results will be returned, otherwise a single result will
* be returned.
* .query() runs a query (or list of queries), and returns the results in a
* friendly format, {@link IResults}. If you run multiple queries, an array of results
* will be returned, otherwise a single result (array of objects) will be returned.
*
* @param {String|String[]} query
* @param {IQueryOptions} [options]
* @return {Promise<IResults|Results[]>} query
* @return {Promise<IResults|Results[]>} result(s)
* @example

@@ -843,2 +843,5 @@ * influx.query('select * from perf').then(results => {

var _a = options.database, database = _a === void 0 ? this.defaultDB() : _a, retentionPolicy = options.retentionPolicy;
if (query instanceof Array) {
query = query.join(';');
}
return this.pool.json(this.getQueryOpts({

@@ -845,0 +848,0 @@ db: database,

@@ -5,2 +5,3 @@ /// <reference types="node" />

import * as http from 'http';
import * as https from 'https';
import * as urlModule from 'url';

@@ -102,3 +103,3 @@ export interface IPoolOptions {

*/
addHost(url: string): Host;
addHost(url: string, options?: https.RequestOptions): Host;
/**

@@ -105,0 +106,0 @@ * Returns true if there's any host available to by queried.

"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var exponential_1 = require('./backoff/exponential');
var host_1 = require('./host');
var http = require('http');
var https = require('https');
var querystring = require('querystring');
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var exponential_1 = require("./backoff/exponential");
var host_1 = require("./host");
var http = require("http");
var https = require("https");
var querystring = require("querystring");
/**

@@ -31,4 +37,6 @@ * Status codes that will cause a host to be marked as 'failed' if we get

function ServiceNotAvailableError(message) {
_super.call(this);
this.message = message;
var _this = _super.call(this) || this;
_this.message = message;
Object.setPrototypeOf(_this, ServiceNotAvailableError.prototype);
return _this;
}

@@ -45,6 +53,8 @@ return ServiceNotAvailableError;

function RequestError(req, res, body) {
_super.call(this);
this.req = req;
this.res = res;
this.message = "A " + res.statusCode + " " + res.statusMessage + " error occurred: " + body;
var _this = _super.call(this) || this;
_this.req = req;
_this.res = res;
_this.message = "A " + res.statusCode + " " + res.statusMessage + " error occurred: " + body;
Object.setPrototypeOf(_this, RequestError.prototype);
return _this;
}

@@ -134,4 +144,5 @@ RequestError.Create = function (req, res, callback) {

*/
Pool.prototype.addHost = function (url) {
var host = new host_1.Host(url, this.options.backoff.reset());
Pool.prototype.addHost = function (url, options) {
if (options === void 0) { options = {}; }
var host = new host_1.Host(url, this.options.backoff.reset(), options);
this.hostsAvailable.add(host);

@@ -201,3 +212,3 @@ return host;

return todo.push(new Promise(function (resolve) {
var req = request({
var req = request(Object.assign({
hostname: url.hostname,

@@ -209,3 +220,3 @@ method: 'GET',

timeout: timeout,
}, once(function (res) {
}, host.options), once(function (res) {
resolve({

@@ -256,3 +267,4 @@ url: url,

var host = this.getHost();
var req = request({
var req = request(Object.assign({
headers: { 'content-length': options.body ? options.body.length : 0 },
hostname: host.url.hostname,

@@ -264,3 +276,3 @@ method: options.method,

timeout: this.timeout,
}, once(function (res) {
}, host.options), once(function (res) {
if (res.statusCode >= 500) {

@@ -267,0 +279,0 @@ return _this.handleRequestError(new ServiceNotAvailableError(res.statusMessage), host, options, callback);

@@ -1,2 +0,1 @@

/// <reference types="node" />
import { TimePrecision } from './grammar';

@@ -3,0 +2,0 @@ /**

"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var grammar_1 = require('./grammar');
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var grammar_1 = require("./grammar");
/**

@@ -14,4 +20,5 @@ * A ResultError is thrown when a query generates errorful results from Influx.

function ResultError(message) {
_super.call(this);
this.message = "Error from InfluxDB: " + message;
var _this = _super.call(this) || this;
_this.message = "Error from InfluxDB: " + message;
return _this;
}

@@ -18,0 +25,0 @@ return ResultError;

"use strict";
var grammar_1 = require('./grammar');
Object.defineProperty(exports, "__esModule", { value: true });
var grammar_1 = require("./grammar");
/**

@@ -60,3 +61,3 @@ * The Schema provides information and utilities for an InfluxDB measurement.

default:
throw new Error(("Unknown field type " + _this.options.fields[field] + " for " + field + " in ") +
throw new Error("Unknown field type " + _this.options.fields[field] + " for " + field + " in " +
(_this.ref() + ". Please ensure that your configuration is correct."));

@@ -69,3 +70,3 @@ }

var extraneous = keys.filter(function (f) { return _this.fieldNames.indexOf(f) === -1; });
throw new Error("Extraneous fields detected for writing InfluxDB point in" +
throw new Error("Extraneous fields detected for writing InfluxDB point in " +
(this.ref() + ": `" + extraneous.join('`, `') + "`."));

@@ -84,3 +85,3 @@ }

if (extraneous.length > 0) {
throw new Error("Extraneous tags detected for writing InfluxDB point in" +
throw new Error("Extraneous tags detected for writing InfluxDB point in " +
(this.ref() + ": `" + extraneous.join('`, `') + "`."));

@@ -87,0 +88,0 @@ }

{
"name": "influx",
"version": "5.0.4",
"version": "5.0.5",
"description": "InfluxDB Client",

@@ -18,3 +18,3 @@ "main": "./lib/src/index.js",

"test:sauce": "SAUCE=1 karma start test/karma.conf.js",
"test:travis": "npm-run-all --parallel test:sauce test:integrate test:lint build:dist && istanbul cover _mocha --report lcovonly -- lib/test/unit/*.test.js",
"test:travis": "npm-run-all clean test:lint test:sauce test:integrate build:dist && istanbul cover _mocha --report lcovonly -- lib/test/unit/*.test.js",
"test:unit": "mocha --compilers ts:ts-node/register test/unit/*.test.ts",

@@ -47,3 +47,3 @@ "test:watch": "mocha -R min --watch --compilers ts:ts-node/register test/unit/*.test.ts"

"@types/sinon-chai": "^2.7.27",
"awesome-typescript-loader": "^2.2.4",
"awesome-typescript-loader": "^3.0.8",
"chai": "^3.5.0",

@@ -60,7 +60,7 @@ "coveralls": "^2.11.1",

"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^1.8.0",
"karma-webpack": "^2.0.2",
"lodash": "^4.16.2",
"mocha": "^3.1.0",
"node-fetch": "^1.6.3",
"npm-run-all": "^3.1.0",
"npm-run-all": "^4.0.2",
"opn-cli": "^3.1.0",

@@ -70,8 +70,8 @@ "sinon": "^2.0.0-pre.3",

"stream-http": "github:node-influx/stream-http",
"ts-node": "^1.3.0",
"tslint": "^3.11.0",
"tslint-microsoft-contrib": "^2.0.13",
"typescript": "^2.0.0",
"webpack": "^1.13.2"
"ts-node": "^2.1.0",
"tslint": "^4.5.1",
"tslint-microsoft-contrib": "^4.0.0",
"typescript": "^2.2.1",
"webpack": "^2.2.1"
}
}
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