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,74 +1,74 @@
1
- export interface INanoDate extends Date {
2
- /**
3
- * Returns the unix nanoseconds timestamp as a string.
4
- */
5
- getNanoTime(): string;
6
- /**
7
- * Formats the date as an ISO RFC3339 timestamp with nanosecond precision.
8
- */
9
- toNanoISOString(): string;
10
- }
11
- export declare type TimePrecision = 'n' | 'u' | 'ms' | 's' | 'm' | 'h';
12
- /**
13
- * Precision is a map of available Influx time precisions.
14
- * @type {Object.<String, String>}
15
- * @example
16
- * console.log(Precision.Hours); // => 'h'
17
- * console.log(Precision.Minutes); // => 'm'
18
- * console.log(Precision.Seconds); // => 's'
19
- * console.log(Precision.Milliseconds); // => 'ms'
20
- * console.log(Precision.Microseconds); // => 'u'
21
- * console.log(Precision.Nanoseconds); // => 'ns'
22
- */
23
- export declare const Precision: {
24
- Hours: string;
25
- Microseconds: string;
26
- Milliseconds: string;
27
- Minutes: string;
28
- Nanoseconds: string;
29
- Seconds: string;
30
- };
31
- /**
32
- * Covers a nanoseconds unix timestamp to a INanoDate for node-influx. The
33
- * timestamp is provided as a string to prevent precision loss.
34
- *
35
- * Please see [A Moment for Times](https://node-influx.github.io/manual/
36
- * usage.html#a-moment-for-times) for a more complete and eloquent explanation
37
- * of time handling in this module.
38
- *
39
- * @param {String} timestamp
40
- * @returns {INanoDate}
41
- * @example
42
- * const date = toNanoDate('1475985480231035600')
43
- *
44
- * // You can use the returned Date as a normal date:
45
- * expect(date.getTime()).to.equal(1475985480231);
46
- *
47
- * // We decorate it with two additional methods to read
48
- * // nanosecond-precision results:
49
- * expect(date.getNanoTime()).to.equal('1475985480231035600');
50
- * expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035600Z');
51
- */
52
- export declare function toNanoDate(timestamp: string): INanoDate;
53
- /**
54
- * formatDate converts the Date instance to Influx's date query format.
55
- * @private
56
- */
57
- export declare function formatDate(date: Date): string;
58
- /**
59
- * Converts a Date instance to a timestamp with the specified time precision.
60
- * @private
61
- */
62
- export declare function dateToTime(date: Date | INanoDate, precision: TimePrecision): string;
63
- /**
64
- * Converts an ISO-formatted data or unix timestamp to a Date instance. If
65
- * the precision is finer than 'ms' the returned value will be a INanoDate.
66
- * @private
67
- */
68
- export declare function isoOrTimeToDate(stamp: string | number, precision?: TimePrecision): INanoDate;
69
- /**
70
- * Converts a timestamp to a string with the correct precision. Assumes
71
- * that raw number and string instances are already in the correct precision.
72
- * @private
73
- */
74
- export declare function castTimestamp(timestamp: string | number | Date, precision: TimePrecision): string;
1
+ export interface INanoDate extends Date {
2
+ /**
3
+ * Returns the unix nanoseconds timestamp as a string.
4
+ */
5
+ getNanoTime(): string;
6
+ /**
7
+ * Formats the date as an ISO RFC3339 timestamp with nanosecond precision.
8
+ */
9
+ toNanoISOString(): string;
10
+ }
11
+ export declare type TimePrecision = 'n' | 'u' | 'ms' | 's' | 'm' | 'h';
12
+ /**
13
+ * Precision is a map of available Influx time precisions.
14
+ * @type {Object.<String, String>}
15
+ * @example
16
+ * console.log(Precision.Hours); // => 'h'
17
+ * console.log(Precision.Minutes); // => 'm'
18
+ * console.log(Precision.Seconds); // => 's'
19
+ * console.log(Precision.Milliseconds); // => 'ms'
20
+ * console.log(Precision.Microseconds); // => 'u'
21
+ * console.log(Precision.Nanoseconds); // => 'ns'
22
+ */
23
+ export declare const Precision: Readonly<{
24
+ Hours: string;
25
+ Microseconds: string;
26
+ Milliseconds: string;
27
+ Minutes: string;
28
+ Nanoseconds: string;
29
+ Seconds: string;
30
+ }>;
31
+ /**
32
+ * Covers a nanoseconds unix timestamp to a INanoDate for node-influx. The
33
+ * timestamp is provided as a string to prevent precision loss.
34
+ *
35
+ * Please see [A Moment for Times](https://node-influx.github.io/manual/
36
+ * usage.html#a-moment-for-times) for a more complete and eloquent explanation
37
+ * of time handling in this module.
38
+ *
39
+ * @param {String} timestamp
40
+ * @returns {INanoDate}
41
+ * @example
42
+ * const date = toNanoDate('1475985480231035600')
43
+ *
44
+ * // You can use the returned Date as a normal date:
45
+ * expect(date.getTime()).to.equal(1475985480231);
46
+ *
47
+ * // We decorate it with two additional methods to read
48
+ * // nanosecond-precision results:
49
+ * expect(date.getNanoTime()).to.equal('1475985480231035600');
50
+ * expect(date.toNanoISOString()).to.equal('2016-10-09T03:58:00.231035600Z');
51
+ */
52
+ export declare function toNanoDate(timestamp: string): INanoDate;
53
+ /**
54
+ * formatDate converts the Date instance to Influx's date query format.
55
+ * @private
56
+ */
57
+ export declare function formatDate(date: Date): string;
58
+ /**
59
+ * Converts a Date instance to a timestamp with the specified time precision.
60
+ * @private
61
+ */
62
+ export declare function dateToTime(date: Date | INanoDate, precision: TimePrecision): string;
63
+ /**
64
+ * Converts an ISO-formatted data or unix timestamp to a Date instance. If
65
+ * the precision is finer than 'ms' the returned value will be a INanoDate.
66
+ * @private
67
+ */
68
+ export declare function isoOrTimeToDate(stamp: string | number, precision?: TimePrecision): INanoDate;
69
+ /**
70
+ * Converts a timestamp to a string with the correct precision. Assumes
71
+ * that raw number and string instances are already in the correct precision.
72
+ * @private
73
+ */
74
+ export declare function castTimestamp(timestamp: string | number | Date, precision: TimePrecision): string;