influx 5.0.3 → 5.0.7

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.
@@ -1,45 +1,45 @@
1
- /**
2
- * FieldType is an enumeration of InfluxDB field data types.
3
- * @typedef {Number} FieldType
4
- * @example
5
- * import { FieldType } from 'influx'; // or const FieldType = require('influx').FieldType
6
- *
7
- * const schema = {
8
- * measurement: 'my_measurement',
9
- * fields: {
10
- * my_int: FieldType.INTEGER,
11
- * my_float: FieldType.FLOAT,
12
- * my_string: FieldType.STRING,
13
- * my_boolean: FieldType.BOOLEAN,
14
- * }
15
- * }
16
- */
17
- export declare enum FieldType {
18
- FLOAT = 0,
19
- INTEGER = 1,
20
- STRING = 2,
21
- BOOLEAN = 3,
22
- }
23
- export declare function isNumeric(value: string): boolean;
24
- /**
25
- * You can provide Raw values to Influx methods to prevent it from escaping
26
- * your provided string.
27
- * @class
28
- * @example
29
- * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
30
- */
31
- export declare class Raw {
32
- private value;
33
- /**
34
- * Wraps a string so that it is not escaped in Influx queries.
35
- * @param {String} value
36
- * @example
37
- * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
38
- */
39
- constructor(value: string);
40
- /**
41
- * Returns the wrapped string.
42
- * @return {String}
43
- */
44
- getValue(): string;
45
- }
1
+ /**
2
+ * FieldType is an enumeration of InfluxDB field data types.
3
+ * @typedef {Number} FieldType
4
+ * @example
5
+ * import { FieldType } from 'influx'; // or const FieldType = require('influx').FieldType
6
+ *
7
+ * const schema = {
8
+ * measurement: 'my_measurement',
9
+ * fields: {
10
+ * my_int: FieldType.INTEGER,
11
+ * my_float: FieldType.FLOAT,
12
+ * my_string: FieldType.STRING,
13
+ * my_boolean: FieldType.BOOLEAN,
14
+ * }
15
+ * }
16
+ */
17
+ export declare enum FieldType {
18
+ FLOAT = 0,
19
+ INTEGER = 1,
20
+ STRING = 2,
21
+ BOOLEAN = 3,
22
+ }
23
+ export declare function isNumeric(value: string): boolean;
24
+ /**
25
+ * You can provide Raw values to Influx methods to prevent it from escaping
26
+ * your provided string.
27
+ * @class
28
+ * @example
29
+ * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
30
+ */
31
+ export declare class Raw {
32
+ private value;
33
+ /**
34
+ * Wraps a string so that it is not escaped in Influx queries.
35
+ * @param {String} value
36
+ * @example
37
+ * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
38
+ */
39
+ constructor(value: string);
40
+ /**
41
+ * Returns the wrapped string.
42
+ * @return {String}
43
+ */
44
+ getValue(): string;
45
+ }
@@ -1,55 +1,56 @@
1
- "use strict";
2
- /**
3
- * FieldType is an enumeration of InfluxDB field data types.
4
- * @typedef {Number} FieldType
5
- * @example
6
- * import { FieldType } from 'influx'; // or const FieldType = require('influx').FieldType
7
- *
8
- * const schema = {
9
- * measurement: 'my_measurement',
10
- * fields: {
11
- * my_int: FieldType.INTEGER,
12
- * my_float: FieldType.FLOAT,
13
- * my_string: FieldType.STRING,
14
- * my_boolean: FieldType.BOOLEAN,
15
- * }
16
- * }
17
- */
18
- (function (FieldType) {
19
- FieldType[FieldType["FLOAT"] = 0] = "FLOAT";
20
- FieldType[FieldType["INTEGER"] = 1] = "INTEGER";
21
- FieldType[FieldType["STRING"] = 2] = "STRING";
22
- FieldType[FieldType["BOOLEAN"] = 3] = "BOOLEAN";
23
- })(exports.FieldType || (exports.FieldType = {}));
24
- var FieldType = exports.FieldType;
25
- function isNumeric(value) {
26
- return !Number.isNaN(Number(value));
27
- }
28
- exports.isNumeric = isNumeric;
29
- /**
30
- * You can provide Raw values to Influx methods to prevent it from escaping
31
- * your provided string.
32
- * @class
33
- * @example
34
- * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
35
- */
36
- var Raw = (function () {
37
- /**
38
- * Wraps a string so that it is not escaped in Influx queries.
39
- * @param {String} value
40
- * @example
41
- * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
42
- */
43
- function Raw(value) {
44
- this.value = value;
45
- }
46
- /**
47
- * Returns the wrapped string.
48
- * @return {String}
49
- */
50
- Raw.prototype.getValue = function () {
51
- return this.value;
52
- };
53
- return Raw;
54
- }());
55
- exports.Raw = Raw;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * FieldType is an enumeration of InfluxDB field data types.
5
+ * @typedef {Number} FieldType
6
+ * @example
7
+ * import { FieldType } from 'influx'; // or const FieldType = require('influx').FieldType
8
+ *
9
+ * const schema = {
10
+ * measurement: 'my_measurement',
11
+ * fields: {
12
+ * my_int: FieldType.INTEGER,
13
+ * my_float: FieldType.FLOAT,
14
+ * my_string: FieldType.STRING,
15
+ * my_boolean: FieldType.BOOLEAN,
16
+ * }
17
+ * }
18
+ */
19
+ var FieldType;
20
+ (function (FieldType) {
21
+ FieldType[FieldType["FLOAT"] = 0] = "FLOAT";
22
+ FieldType[FieldType["INTEGER"] = 1] = "INTEGER";
23
+ FieldType[FieldType["STRING"] = 2] = "STRING";
24
+ FieldType[FieldType["BOOLEAN"] = 3] = "BOOLEAN";
25
+ })(FieldType = exports.FieldType || (exports.FieldType = {}));
26
+ function isNumeric(value) {
27
+ return !Number.isNaN(Number(value));
28
+ }
29
+ exports.isNumeric = isNumeric;
30
+ /**
31
+ * You can provide Raw values to Influx methods to prevent it from escaping
32
+ * your provided string.
33
+ * @class
34
+ * @example
35
+ * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
36
+ */
37
+ var Raw = (function () {
38
+ /**
39
+ * Wraps a string so that it is not escaped in Influx queries.
40
+ * @param {String} value
41
+ * @example
42
+ * influx.createDatabase(new Influx.Raw('This won\'t be escaped!'));
43
+ */
44
+ function Raw(value) {
45
+ this.value = value;
46
+ }
47
+ /**
48
+ * Returns the wrapped string.
49
+ * @return {String}
50
+ */
51
+ Raw.prototype.getValue = function () {
52
+ return this.value;
53
+ };
54
+ return Raw;
55
+ }());
56
+ exports.Raw = Raw;
@@ -1,25 +1,25 @@
1
- /**
2
- * tagEscaper escapes tag keys, tag values, and field keys.
3
- * @type {Object}
4
- * @property {function(s: string): string } quoted Escapes and wraps quoted
5
- * values, such as database names.
6
- * @property {function(s: string): string } stringLit Escapes and
7
- * wraps string literals.
8
- * @property {function(s: string): string } measurement Escapes measurement
9
- * names on the line protocol.
10
- * @property {function(s: string): string } tag Escapes tag keys, take values,
11
- * and field keys on the line protocol.
12
- *
13
- * @example
14
- * console.log(escape.quoted('my_"db')); // => "my_\"db"
15
- * console.log(escape.stringLit('hello\'world')); // => 'hello\'world'
16
- *
17
- * console.log(escape.measurement('my measurement')); // => my\ measurement
18
- * console.log(escape.tag('my tag=')); // => my\ tag\=
19
- */
20
- export declare const escape: {
21
- measurement: (val: string) => string;
22
- quoted: (val: string) => string;
23
- stringLit: (val: string) => string;
24
- tag: (val: string) => string;
25
- };
1
+ /**
2
+ * tagEscaper escapes tag keys, tag values, and field keys.
3
+ * @type {Object}
4
+ * @property {function(s: string): string } quoted Escapes and wraps quoted
5
+ * values, such as database names.
6
+ * @property {function(s: string): string } stringLit Escapes and
7
+ * wraps string literals.
8
+ * @property {function(s: string): string } measurement Escapes measurement
9
+ * names on the line protocol.
10
+ * @property {function(s: string): string } tag Escapes tag keys, take values,
11
+ * and field keys on the line protocol.
12
+ *
13
+ * @example
14
+ * console.log(escape.quoted('my_"db')); // => "my_\"db"
15
+ * console.log(escape.stringLit('hello\'world')); // => 'hello\'world'
16
+ *
17
+ * console.log(escape.measurement('my measurement')); // => my\ measurement
18
+ * console.log(escape.tag('my tag=')); // => my\ tag\=
19
+ */
20
+ export declare const escape: {
21
+ measurement: (val: string) => string;
22
+ quoted: (val: string) => string;
23
+ stringLit: (val: string) => string;
24
+ tag: (val: string) => string;
25
+ };
@@ -1,107 +1,108 @@
1
- "use strict";
2
- var ds_1 = require('./ds');
3
- var reEscape = /[-|\\{()[\]^$+*?.]/g;
4
- /**
5
- * The Escaper escapes the special characters in the provided list
6
- * with backslashes. Much of the code here is inspired by that in the
7
- * sqlstring packet found here: https://github.com/mysqljs/sqlstring
8
- *
9
- * Instances of the Escaper are derived from the documentation of escape
10
- * sequences found here: https://aka.ms/co1m4k
11
- *
12
- * sqlstring is made available under the following license:
13
- *
14
- * Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
15
- *
16
- * Permission is hereby granted, free of charge, to any person obtaining a copy
17
- * of this software and associated documentation files (the "Software"), to deal
18
- * in the Software without restriction, including without limitation the rights
19
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20
- * copies of the Software, and to permit persons to whom the Software is
21
- * furnished to do so, subject to the following conditions:
22
- *
23
- * The above copyright notice and this permission notice shall be included in
24
- * all copies or substantial portions of the Software.
25
- *
26
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32
- * THE SOFTWARE.
33
- *
34
- */
35
- var Escaper = (function () {
36
- function Escaper(chars, wrap, escaper) {
37
- if (wrap === void 0) { wrap = ''; }
38
- if (escaper === void 0) { escaper = '\\'; }
39
- this.wrap = wrap;
40
- this.escaper = escaper;
41
- var patterns = chars.join('').replace(reEscape, '\\$&');
42
- this.re = new RegExp('[' + patterns + '\\\\]', 'g');
43
- }
44
- /**
45
- * Escape replaces occurrences of special characters within the target
46
- * string with the necessary escape codes.
47
- */
48
- Escaper.prototype.escape = function (val) {
49
- if (val instanceof ds_1.Raw) {
50
- return val.getValue();
51
- }
52
- var chunkIndex = this.re.lastIndex = 0;
53
- var escapedVal = '';
54
- var match = this.re.exec(val);
55
- while (match) {
56
- escapedVal += val.slice(chunkIndex, match.index) + this.escaper + match[0];
57
- chunkIndex = this.re.lastIndex;
58
- match = this.re.exec(val);
59
- }
60
- if (chunkIndex === 0) {
61
- return this.wrap + val + this.wrap;
62
- }
63
- if (chunkIndex < val.length) {
64
- return this.wrap + escapedVal + val.slice(chunkIndex) + this.wrap;
65
- }
66
- return this.wrap + escapedVal + this.wrap;
67
- };
68
- return Escaper;
69
- }());
70
- var bindEsc = function (e) { return e.escape.bind(e); };
71
- /**
72
- * tagEscaper escapes tag keys, tag values, and field keys.
73
- * @type {Object}
74
- * @property {function(s: string): string } quoted Escapes and wraps quoted
75
- * values, such as database names.
76
- * @property {function(s: string): string } stringLit Escapes and
77
- * wraps string literals.
78
- * @property {function(s: string): string } measurement Escapes measurement
79
- * names on the line protocol.
80
- * @property {function(s: string): string } tag Escapes tag keys, take values,
81
- * and field keys on the line protocol.
82
- *
83
- * @example
84
- * console.log(escape.quoted('my_"db')); // => "my_\"db"
85
- * console.log(escape.stringLit('hello\'world')); // => 'hello\'world'
86
- *
87
- * console.log(escape.measurement('my measurement')); // => my\ measurement
88
- * console.log(escape.tag('my tag=')); // => my\ tag\=
89
- */
90
- exports.escape = {
91
- /**
92
- * measurement escapes measurement names.
93
- */
94
- measurement: bindEsc(new Escaper([',', ' '])),
95
- /**
96
- * quoted escapes quoted values, such as database names.
97
- */
98
- quoted: bindEsc(new Escaper(['"'], '"')),
99
- /**
100
- * stringLitEscaper escapes single quotes in string literals.
101
- */
102
- stringLit: bindEsc(new Escaper(['\''], '\'')),
103
- /**
104
- * tagEscaper escapes tag keys, tag values, and field keys.
105
- */
106
- tag: bindEsc(new Escaper([',', '=', ' '])),
107
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var ds_1 = require("./ds");
4
+ var reEscape = /[-|\\{()[\]^$+*?.]/g;
5
+ /**
6
+ * The Escaper escapes the special characters in the provided list
7
+ * with backslashes. Much of the code here is inspired by that in the
8
+ * sqlstring packet found here: https://github.com/mysqljs/sqlstring
9
+ *
10
+ * Instances of the Escaper are derived from the documentation of escape
11
+ * sequences found here: https://aka.ms/co1m4k
12
+ *
13
+ * sqlstring is made available under the following license:
14
+ *
15
+ * Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in
25
+ * all copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33
+ * THE SOFTWARE.
34
+ *
35
+ */
36
+ var Escaper = (function () {
37
+ function Escaper(chars, wrap, escaper) {
38
+ if (wrap === void 0) { wrap = ''; }
39
+ if (escaper === void 0) { escaper = '\\'; }
40
+ this.wrap = wrap;
41
+ this.escaper = escaper;
42
+ var patterns = chars.join('').replace(reEscape, '\\$&');
43
+ this.re = new RegExp('[' + patterns + '\\\\]', 'g');
44
+ }
45
+ /**
46
+ * Escape replaces occurrences of special characters within the target
47
+ * string with the necessary escape codes.
48
+ */
49
+ Escaper.prototype.escape = function (val) {
50
+ if (val instanceof ds_1.Raw) {
51
+ return val.getValue();
52
+ }
53
+ var chunkIndex = this.re.lastIndex = 0;
54
+ var escapedVal = '';
55
+ var match = this.re.exec(val);
56
+ while (match) {
57
+ escapedVal += val.slice(chunkIndex, match.index) + this.escaper + match[0];
58
+ chunkIndex = this.re.lastIndex;
59
+ match = this.re.exec(val);
60
+ }
61
+ if (chunkIndex === 0) {
62
+ return this.wrap + val + this.wrap;
63
+ }
64
+ if (chunkIndex < val.length) {
65
+ return this.wrap + escapedVal + val.slice(chunkIndex) + this.wrap;
66
+ }
67
+ return this.wrap + escapedVal + this.wrap;
68
+ };
69
+ return Escaper;
70
+ }());
71
+ var bindEsc = function (e) { return e.escape.bind(e); };
72
+ /**
73
+ * tagEscaper escapes tag keys, tag values, and field keys.
74
+ * @type {Object}
75
+ * @property {function(s: string): string } quoted Escapes and wraps quoted
76
+ * values, such as database names.
77
+ * @property {function(s: string): string } stringLit Escapes and
78
+ * wraps string literals.
79
+ * @property {function(s: string): string } measurement Escapes measurement
80
+ * names on the line protocol.
81
+ * @property {function(s: string): string } tag Escapes tag keys, take values,
82
+ * and field keys on the line protocol.
83
+ *
84
+ * @example
85
+ * console.log(escape.quoted('my_"db')); // => "my_\"db"
86
+ * console.log(escape.stringLit('hello\'world')); // => 'hello\'world'
87
+ *
88
+ * console.log(escape.measurement('my measurement')); // => my\ measurement
89
+ * console.log(escape.tag('my tag=')); // => my\ tag\=
90
+ */
91
+ exports.escape = {
92
+ /**
93
+ * measurement escapes measurement names.
94
+ */
95
+ measurement: bindEsc(new Escaper([',', ' '])),
96
+ /**
97
+ * quoted escapes quoted values, such as database names.
98
+ */
99
+ quoted: bindEsc(new Escaper(['"'], '"')),
100
+ /**
101
+ * stringLitEscaper escapes single quotes in string literals.
102
+ */
103
+ stringLit: bindEsc(new Escaper(['\''], '\'')),
104
+ /**
105
+ * tagEscaper escapes tag keys, tag values, and field keys.
106
+ */
107
+ tag: bindEsc(new Escaper([',', '=', ' '])),
108
+ };
@@ -1,3 +1,3 @@
1
- export * from './escape';
2
- export * from './ds';
3
- export * from './times';
1
+ export * from './escape';
2
+ export * from './ds';
3
+ export * from './times';
@@ -1,7 +1,8 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- __export(require('./escape'));
6
- __export(require('./ds'));
7
- __export(require('./times'));
1
+ "use strict";
2
+ function __export(m) {
3
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
+ }
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ __export(require("./escape"));
7
+ __export(require("./ds"));
8
+ __export(require("./times"));