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,265 +1,265 @@
1
- export interface IBaseExpression<T> {
2
- /**
3
- * Inserts a tag name in the expression.
4
- */
5
- tag(name: string): T;
6
- /**
7
- * Inserts a field name in the expression.
8
- */
9
- field(name: string): T;
10
- /**
11
- * Chains on a value to the expression. An error will be thrown if the
12
- * value is a type we can't represent in InfluxQL, primarily `null` or
13
- * `undefined.`
14
- */
15
- value(value: any): T;
16
- }
17
- export interface IExpressionHead extends IBaseExpression<IBinaryOp> {
18
- }
19
- export interface IExpressionTail extends IBaseExpression<IExpressionHead> {
20
- }
21
- export interface IBinaryOp {
22
- /**
23
- * Adds an 'AND' operator
24
- */
25
- and: IExpressionTail;
26
- /**
27
- * Adds an 'OR' operator
28
- */
29
- or: IExpressionTail;
30
- /**
31
- * Adds a '+' addition symbol
32
- */
33
- plus: IExpressionTail;
34
- /**
35
- * Adds a '*' multiplication symbol
36
- */
37
- times: IExpressionTail;
38
- /**
39
- * Adds a '-' subtraction symbol
40
- */
41
- minus: IExpressionTail;
42
- /**
43
- * Adds a '/' division symbol
44
- */
45
- div: IExpressionTail;
46
- /**
47
- * Adds a '=' symbol
48
- */
49
- equals: IExpressionTail;
50
- /**
51
- * Adds a '=~' comparator to select entries matching a regex.
52
- */
53
- matches: IExpressionTail;
54
- /**
55
- * Adds a '!~' comparator to select entries not matching a regex.
56
- */
57
- doesntMatch: IExpressionTail;
58
- /**
59
- * Adds a '!=' comparator to select entries not equaling a certain value.
60
- */
61
- notEqual: IExpressionTail;
62
- /**
63
- * Adds a '>' symbol
64
- */
65
- gt: IExpressionTail;
66
- /**
67
- * Adds a '>=' symbol
68
- */
69
- gte: IExpressionTail;
70
- /**
71
- * Adds a '<' symbol
72
- */
73
- lt: IExpressionTail;
74
- /**
75
- * Adds a '<=' symbol
76
- */
77
- lte: IExpressionTail;
78
- }
79
- /**
80
- * Expression is used to build filtering expressions, like those used in WHERE
81
- * clauses. It can be used for fluent and safe building of queries using
82
- * untrusted input.
83
- *
84
- * @example
85
- * e => e
86
- * .field('host').equals.value('ares.peet.io')
87
- * .or
88
- * .field('host').matches(/example\.com$/)
89
- * .or
90
- * .expr(e => e
91
- * .field('country').equals.value('US')
92
- * .and
93
- * .field('state').equals.value('WA'));
94
- *
95
- * // Generates:
96
- * // "host" = 'ares.peet.io' OR "host" ~= /example\.com$/ OR \
97
- * // ("county" = 'US' AND "state" = 'WA')
98
- */
99
- export declare class Expression implements IExpressionHead, IExpressionTail, IBinaryOp {
100
- private query;
101
- /**
102
- * Inserts a tag reference into the expression; the name will be
103
- * automatically escaped.
104
- * @param {String} name
105
- * @return {Expression}
106
- */
107
- tag(name: string): this;
108
- /**
109
- * Inserts a field reference into the expression; the name will be
110
- * automatically escaped.
111
- * @param {String} name
112
- * @return {Expression}
113
- */
114
- field(name: string): this;
115
- /**
116
- * Inserts a subexpression; invokes the function with a new expression
117
- * that can be chained on.
118
- * @param {function(e: Expression): Expression} fn
119
- * @return {Expression}
120
- * @example
121
- * e.field('a').equals.value('b')
122
- * .or.expr(e =>
123
- * e.field('b').equals.value('b')
124
- * .and.field('a').equals.value('c'))
125
- * .toString()
126
- * // "a" = 'b' OR ("b" = 'b' AND "a" = 'c')
127
- */
128
- exp(fn: (e: Expression) => Expression): this;
129
- /**
130
- * Value chains on a value to the expression.
131
- *
132
- * - Numbers will be inserted verbatim
133
- * - Strings will be escaped and inserted
134
- * - Booleans will be inserted correctly
135
- * - Dates will be formatted and inserted correctly, including INanoDates.
136
- * - Regular expressions will be inserted correctly, however an error will
137
- * be thrown if they contain flags, as regex flags do not work in Influx
138
- * - Otherwise we'll try to call `.toString()` on the value, throwing
139
- * if we cannot do so.
140
- *
141
- * @param {*} value
142
- * @return {Expression}
143
- */
144
- value(value: any): this;
145
- /**
146
- * Chains on an AND clause to the expression.
147
- * @type {Expression}
148
- */
149
- readonly and: this;
150
- /**
151
- * Chains on an OR clause to the expression.
152
- * @type {Expression}
153
- */
154
- readonly or: this;
155
- /**
156
- * Chains on a `+` operator to the expression.
157
- * @type {Expression}
158
- */
159
- readonly plus: this;
160
- /**
161
- * Chains on a `*` operator to the expression.
162
- * @type {Expression}
163
- */
164
- readonly times: this;
165
- /**
166
- * Chains on a `-` operator to the expression.
167
- * @type {Expression}
168
- */
169
- readonly minus: this;
170
- /**
171
- * Chains on a `/` operator to the expression.
172
- * @type {Expression}
173
- */
174
- readonly div: this;
175
- /**
176
- * Chains on a `=` conditional to the expression.
177
- * @type {Expression}
178
- */
179
- readonly equals: this;
180
- /**
181
- * Chains on a `=~` conditional to the expression to match regexes.
182
- * @type {Expression}
183
- */
184
- readonly matches: this;
185
- /**
186
- * Chains on a `!`` conditional to the expression to match regexes.
187
- * @type {Expression}
188
- */
189
- readonly doesntMatch: this;
190
- /**
191
- * Chains on a `!=` conditional to the expression.
192
- * @type {Expression}
193
- */
194
- readonly notEqual: this;
195
- /**
196
- * Chains on a `>` conditional to the expression.
197
- * @type {Expression}
198
- */
199
- readonly gt: this;
200
- /**
201
- * Chains on a `>=` conditional to the expression.
202
- * @type {Expression}
203
- */
204
- readonly gte: this;
205
- /**
206
- * Chains on a `<` conditional to the expression.
207
- * @type {Expression}
208
- */
209
- readonly lt: this;
210
- /**
211
- * Chains on a `<=` conditional to the expression.
212
- * @type {Expression}
213
- */
214
- readonly lte: this;
215
- /**
216
- * Converts the expression into its InfluxQL representation.
217
- * @return {String}
218
- */
219
- toString(): string;
220
- }
221
- /**
222
- * Measurement creates a reference to a particular measurement. You can
223
- * reference it solely by its name, but you can also specify the retention
224
- * policy and database it lives under.
225
- *
226
- * @example
227
- * m.name('my_measurement') // "my_measurement"
228
- * m.name('my_measurement').policy('one_day') // "one_day"."my_measurement"
229
- * m.name('my_measurement').policy('one_day').db('mydb') // "mydb".one_day"."my_measurement"
230
- */
231
- export declare class Measurement {
232
- private parts;
233
- /**
234
- * Sets the measurement name.
235
- * @param {String} name
236
- * @return {Measurement}
237
- */
238
- name(name: string): this;
239
- /**
240
- * Sets the retention policy name.
241
- * @param {String} retentionPolicy
242
- * @return {Measurement}
243
- */
244
- policy(retentionPolicy: string): this;
245
- /**
246
- * Sets the database name.
247
- * @param {String} db
248
- * @return {Measurement}
249
- */
250
- db(db: string): this;
251
- /**
252
- * Converts the measurement into its InfluxQL representation.
253
- * @return {String}
254
- * @throws {Error} if a measurement name is not provided
255
- */
256
- toString(): string;
257
- }
258
- export declare type measurement = {
259
- measurement: string | ((m: Measurement) => Measurement);
260
- };
261
- export declare type where = {
262
- where: string | ((e: IExpressionHead) => Expression);
263
- };
264
- export declare function parseMeasurement(q: measurement): string;
265
- export declare function parseWhere(q: where): string;
1
+ export interface IBaseExpression<T> {
2
+ /**
3
+ * Inserts a tag name in the expression.
4
+ */
5
+ tag(name: string): T;
6
+ /**
7
+ * Inserts a field name in the expression.
8
+ */
9
+ field(name: string): T;
10
+ /**
11
+ * Chains on a value to the expression. An error will be thrown if the
12
+ * value is a type we can't represent in InfluxQL, primarily `null` or
13
+ * `undefined.`
14
+ */
15
+ value(value: any): T;
16
+ }
17
+ export interface IExpressionHead extends IBaseExpression<IBinaryOp> {
18
+ }
19
+ export interface IExpressionTail extends IBaseExpression<IExpressionHead> {
20
+ }
21
+ export interface IBinaryOp {
22
+ /**
23
+ * Adds an 'AND' operator
24
+ */
25
+ and: IExpressionTail;
26
+ /**
27
+ * Adds an 'OR' operator
28
+ */
29
+ or: IExpressionTail;
30
+ /**
31
+ * Adds a '+' addition symbol
32
+ */
33
+ plus: IExpressionTail;
34
+ /**
35
+ * Adds a '*' multiplication symbol
36
+ */
37
+ times: IExpressionTail;
38
+ /**
39
+ * Adds a '-' subtraction symbol
40
+ */
41
+ minus: IExpressionTail;
42
+ /**
43
+ * Adds a '/' division symbol
44
+ */
45
+ div: IExpressionTail;
46
+ /**
47
+ * Adds a '=' symbol
48
+ */
49
+ equals: IExpressionTail;
50
+ /**
51
+ * Adds a '=~' comparator to select entries matching a regex.
52
+ */
53
+ matches: IExpressionTail;
54
+ /**
55
+ * Adds a '!~' comparator to select entries not matching a regex.
56
+ */
57
+ doesntMatch: IExpressionTail;
58
+ /**
59
+ * Adds a '!=' comparator to select entries not equaling a certain value.
60
+ */
61
+ notEqual: IExpressionTail;
62
+ /**
63
+ * Adds a '>' symbol
64
+ */
65
+ gt: IExpressionTail;
66
+ /**
67
+ * Adds a '>=' symbol
68
+ */
69
+ gte: IExpressionTail;
70
+ /**
71
+ * Adds a '<' symbol
72
+ */
73
+ lt: IExpressionTail;
74
+ /**
75
+ * Adds a '<=' symbol
76
+ */
77
+ lte: IExpressionTail;
78
+ }
79
+ /**
80
+ * Expression is used to build filtering expressions, like those used in WHERE
81
+ * clauses. It can be used for fluent and safe building of queries using
82
+ * untrusted input.
83
+ *
84
+ * @example
85
+ * e => e
86
+ * .field('host').equals.value('ares.peet.io')
87
+ * .or
88
+ * .field('host').matches(/example\.com$/)
89
+ * .or
90
+ * .expr(e => e
91
+ * .field('country').equals.value('US')
92
+ * .and
93
+ * .field('state').equals.value('WA'));
94
+ *
95
+ * // Generates:
96
+ * // "host" = 'ares.peet.io' OR "host" ~= /example\.com$/ OR \
97
+ * // ("county" = 'US' AND "state" = 'WA')
98
+ */
99
+ export declare class Expression implements IExpressionHead, IExpressionTail, IBinaryOp {
100
+ private query;
101
+ /**
102
+ * Inserts a tag reference into the expression; the name will be
103
+ * automatically escaped.
104
+ * @param {String} name
105
+ * @return {Expression}
106
+ */
107
+ tag(name: string): this;
108
+ /**
109
+ * Inserts a field reference into the expression; the name will be
110
+ * automatically escaped.
111
+ * @param {String} name
112
+ * @return {Expression}
113
+ */
114
+ field(name: string): this;
115
+ /**
116
+ * Inserts a subexpression; invokes the function with a new expression
117
+ * that can be chained on.
118
+ * @param {function(e: Expression): Expression} fn
119
+ * @return {Expression}
120
+ * @example
121
+ * e.field('a').equals.value('b')
122
+ * .or.expr(e =>
123
+ * e.field('b').equals.value('b')
124
+ * .and.field('a').equals.value('c'))
125
+ * .toString()
126
+ * // "a" = 'b' OR ("b" = 'b' AND "a" = 'c')
127
+ */
128
+ exp(fn: (e: Expression) => Expression): this;
129
+ /**
130
+ * Value chains on a value to the expression.
131
+ *
132
+ * - Numbers will be inserted verbatim
133
+ * - Strings will be escaped and inserted
134
+ * - Booleans will be inserted correctly
135
+ * - Dates will be formatted and inserted correctly, including INanoDates.
136
+ * - Regular expressions will be inserted correctly, however an error will
137
+ * be thrown if they contain flags, as regex flags do not work in Influx
138
+ * - Otherwise we'll try to call `.toString()` on the value, throwing
139
+ * if we cannot do so.
140
+ *
141
+ * @param {*} value
142
+ * @return {Expression}
143
+ */
144
+ value(value: any): this;
145
+ /**
146
+ * Chains on an AND clause to the expression.
147
+ * @type {Expression}
148
+ */
149
+ readonly and: this;
150
+ /**
151
+ * Chains on an OR clause to the expression.
152
+ * @type {Expression}
153
+ */
154
+ readonly or: this;
155
+ /**
156
+ * Chains on a `+` operator to the expression.
157
+ * @type {Expression}
158
+ */
159
+ readonly plus: this;
160
+ /**
161
+ * Chains on a `*` operator to the expression.
162
+ * @type {Expression}
163
+ */
164
+ readonly times: this;
165
+ /**
166
+ * Chains on a `-` operator to the expression.
167
+ * @type {Expression}
168
+ */
169
+ readonly minus: this;
170
+ /**
171
+ * Chains on a `/` operator to the expression.
172
+ * @type {Expression}
173
+ */
174
+ readonly div: this;
175
+ /**
176
+ * Chains on a `=` conditional to the expression.
177
+ * @type {Expression}
178
+ */
179
+ readonly equals: this;
180
+ /**
181
+ * Chains on a `=~` conditional to the expression to match regexes.
182
+ * @type {Expression}
183
+ */
184
+ readonly matches: this;
185
+ /**
186
+ * Chains on a `!`` conditional to the expression to match regexes.
187
+ * @type {Expression}
188
+ */
189
+ readonly doesntMatch: this;
190
+ /**
191
+ * Chains on a `!=` conditional to the expression.
192
+ * @type {Expression}
193
+ */
194
+ readonly notEqual: this;
195
+ /**
196
+ * Chains on a `>` conditional to the expression.
197
+ * @type {Expression}
198
+ */
199
+ readonly gt: this;
200
+ /**
201
+ * Chains on a `>=` conditional to the expression.
202
+ * @type {Expression}
203
+ */
204
+ readonly gte: this;
205
+ /**
206
+ * Chains on a `<` conditional to the expression.
207
+ * @type {Expression}
208
+ */
209
+ readonly lt: this;
210
+ /**
211
+ * Chains on a `<=` conditional to the expression.
212
+ * @type {Expression}
213
+ */
214
+ readonly lte: this;
215
+ /**
216
+ * Converts the expression into its InfluxQL representation.
217
+ * @return {String}
218
+ */
219
+ toString(): string;
220
+ }
221
+ /**
222
+ * Measurement creates a reference to a particular measurement. You can
223
+ * reference it solely by its name, but you can also specify the retention
224
+ * policy and database it lives under.
225
+ *
226
+ * @example
227
+ * m.name('my_measurement') // "my_measurement"
228
+ * m.name('my_measurement').policy('one_day') // "one_day"."my_measurement"
229
+ * m.name('my_measurement').policy('one_day').db('mydb') // "mydb".one_day"."my_measurement"
230
+ */
231
+ export declare class Measurement {
232
+ private parts;
233
+ /**
234
+ * Sets the measurement name.
235
+ * @param {String} name
236
+ * @return {Measurement}
237
+ */
238
+ name(name: string): this;
239
+ /**
240
+ * Sets the retention policy name.
241
+ * @param {String} retentionPolicy
242
+ * @return {Measurement}
243
+ */
244
+ policy(retentionPolicy: string): this;
245
+ /**
246
+ * Sets the database name.
247
+ * @param {String} db
248
+ * @return {Measurement}
249
+ */
250
+ db(db: string): this;
251
+ /**
252
+ * Converts the measurement into its InfluxQL representation.
253
+ * @return {String}
254
+ * @throws {Error} if a measurement name is not provided
255
+ */
256
+ toString(): string;
257
+ }
258
+ export declare type measurement = {
259
+ measurement: string | ((m: Measurement) => Measurement);
260
+ };
261
+ export declare type where = {
262
+ where: string | ((e: IExpressionHead) => Expression);
263
+ };
264
+ export declare function parseMeasurement(q: measurement): string;
265
+ export declare function parseWhere(q: where): string;