atmosx-nwws-parser 1.0.1917 → 1.0.1919
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/README.md +1 -1
- package/dist/events.d.mts +97 -0
- package/dist/events.d.ts +97 -0
- package/dist/events.js +971 -0
- package/dist/events.mjs +936 -0
- package/dist/helper.d.mts +88 -0
- package/dist/helper.d.ts +88 -0
- package/dist/helper.js +1360 -0
- package/dist/helper.mjs +1325 -0
- package/dist/stanza.d.mts +63 -0
- package/dist/stanza.d.ts +63 -0
- package/dist/stanza.js +1067 -0
- package/dist/stanza.mjs +1032 -0
- package/dist/text-parser.d.mts +35 -0
- package/dist/text-parser.d.ts +35 -0
- package/dist/text-parser.js +128 -0
- package/dist/text-parser.mjs +104 -0
- package/dist/ugc.d.mts +44 -0
- package/dist/ugc.d.ts +44 -0
- package/dist/ugc.js +300 -0
- package/dist/ugc.mjs +265 -0
- package/dist/vtec.d.mts +40 -0
- package/dist/vtec.d.ts +40 -0
- package/dist/vtec.js +240 -0
- package/dist/vtec.mjs +204 -0
- package/package.json +7 -6
- package/src/helper.ts +1 -1
- package/src/text-parser.ts +2 -0
- package/test.js +1 -1
- package/tsconfig.json +12 -5
- package/tsup.config.ts +10 -0
- package/dist/bootstrap.js +0 -166
- package/dist/src/events.js +0 -689
- package/dist/src/helper.js +0 -471
- package/dist/src/stanza.js +0 -150
- package/dist/src/text-parser.js +0 -119
- package/dist/src/ugc.js +0 -227
- package/dist/src/vtec.js +0 -125
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm install atmosx-nwws-parser
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
```js
|
|
15
|
-
const AtmosXWireParser = require(`atmosx-nwws-parser`); // CJS
|
|
15
|
+
const {AtmosXWireParser} = require(`atmosx-nwws-parser`); // CJS
|
|
16
16
|
import * as AtmosXWireParser from `atmosx-nwws-parser`; // ESM
|
|
17
17
|
```
|
|
18
18
|
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
declare class mEvents {
|
|
2
|
+
/**
|
|
3
|
+
* @function onEnhanced
|
|
4
|
+
* @description Enhances the event name and tags of an alert object based on its description and parameters.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} event - The alert object to be enhanced.
|
|
7
|
+
* @return {Object} - The enhanced alert object with updated event name and tags.
|
|
8
|
+
* @example
|
|
9
|
+
* Severe Thunderstorm Warning with "Considerable" damage threat becomes "Considerable Severe Thunderstorm Warning"
|
|
10
|
+
*/
|
|
11
|
+
static onEnhanced(event: any): {
|
|
12
|
+
eventName: string;
|
|
13
|
+
tags: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @function onFinished
|
|
17
|
+
* @description Processes and filters alert objects before emitting the 'onAlert' event. Based on settings, it can enhance event names, filter alerts, and check for expiry.
|
|
18
|
+
*
|
|
19
|
+
* @param {Array} alerts - An array of alert objects to be processed.
|
|
20
|
+
*
|
|
21
|
+
* @emits onAlert - Emitted when alerts are processed and ready.
|
|
22
|
+
*/
|
|
23
|
+
static onFinished(alerts: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* @function newCapAlerts
|
|
26
|
+
* @description Emits the 'onAlert' event with parsed CAP alert objects. (XML Format)
|
|
27
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
28
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
29
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} stanza - The XMPP stanza containing the CAP alert message.
|
|
32
|
+
*
|
|
33
|
+
* @emits onAlert - Emitted when a new CAP alert is received and parsed.
|
|
34
|
+
*/
|
|
35
|
+
static newCapAlerts(stanza: any): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* @function newRawAlerts
|
|
38
|
+
* @description Emits the 'onAlert' event with parsed raw alert objects.
|
|
39
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
40
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
41
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} stanza - The XMPP stanza containing the raw alert message.
|
|
44
|
+
*
|
|
45
|
+
* @emits onAlert - Emitted when a new raw alert is received and parsed.
|
|
46
|
+
*/
|
|
47
|
+
static newRawAlerts(stanza: any): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* @function newUnknownAlert
|
|
50
|
+
* @description Emits the 'onAlert' event with parsed unknown alert objects. (Non-CAP, Non-VTEC)
|
|
51
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
52
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
53
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} stanza - The XMPP stanza containing the raw alert message.
|
|
56
|
+
*
|
|
57
|
+
* @emits onAlert - Emitted when a new raw alert is received and parsed.
|
|
58
|
+
*/
|
|
59
|
+
static newUnknownAlert(stanza: any): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* @function newSpecialWeatherStatement
|
|
62
|
+
* @description Emits the 'onAlert' event with parsed special weather statement alert objects.
|
|
63
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
64
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
65
|
+
*
|
|
66
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
67
|
+
*
|
|
68
|
+
* @param {Object} stanza - The XMPP stanza containing the special weather statement message.
|
|
69
|
+
*
|
|
70
|
+
* @emits onAlert - Emitted when a new special weather statement is received and parsed.
|
|
71
|
+
*/
|
|
72
|
+
static newSpecialWeatherStatement(stanza: any): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* @function newMesoscaleDiscussion
|
|
75
|
+
* @description Emits the 'onMesoscaleDiscussion' event with a parsed mesoscale discussion alert object.
|
|
76
|
+
* The alert object contains various properties such as id, tracking, action, area description, expiration time,
|
|
77
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
78
|
+
* tornado intensity probability, peak wind gust, and peak hail size.
|
|
79
|
+
*
|
|
80
|
+
* @param {Object} stanza - The XMPP stanza containing the mesoscale discussion message.
|
|
81
|
+
*
|
|
82
|
+
* @emits onMesoscaleDiscussion - Emitted when a new mesoscale discussion is received and parsed.
|
|
83
|
+
*/
|
|
84
|
+
static newMesoscaleDiscussion(stanza: any): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* @function newLocalStormReport
|
|
87
|
+
* @description Emits the 'onLocalStormReport' event with the cleaned description of a local storm report. No other additional parsing is
|
|
88
|
+
* done at this time at least.
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} stanza - The XMPP stanza containing the local storm report message.
|
|
91
|
+
*
|
|
92
|
+
* @emits onLocalStormReport - Emitted when a new local storm report is received and parsed.
|
|
93
|
+
*/
|
|
94
|
+
static newLocalStormReport(stanza: any): Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { mEvents as default, mEvents };
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
declare class mEvents {
|
|
2
|
+
/**
|
|
3
|
+
* @function onEnhanced
|
|
4
|
+
* @description Enhances the event name and tags of an alert object based on its description and parameters.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} event - The alert object to be enhanced.
|
|
7
|
+
* @return {Object} - The enhanced alert object with updated event name and tags.
|
|
8
|
+
* @example
|
|
9
|
+
* Severe Thunderstorm Warning with "Considerable" damage threat becomes "Considerable Severe Thunderstorm Warning"
|
|
10
|
+
*/
|
|
11
|
+
static onEnhanced(event: any): {
|
|
12
|
+
eventName: string;
|
|
13
|
+
tags: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @function onFinished
|
|
17
|
+
* @description Processes and filters alert objects before emitting the 'onAlert' event. Based on settings, it can enhance event names, filter alerts, and check for expiry.
|
|
18
|
+
*
|
|
19
|
+
* @param {Array} alerts - An array of alert objects to be processed.
|
|
20
|
+
*
|
|
21
|
+
* @emits onAlert - Emitted when alerts are processed and ready.
|
|
22
|
+
*/
|
|
23
|
+
static onFinished(alerts: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* @function newCapAlerts
|
|
26
|
+
* @description Emits the 'onAlert' event with parsed CAP alert objects. (XML Format)
|
|
27
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
28
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
29
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} stanza - The XMPP stanza containing the CAP alert message.
|
|
32
|
+
*
|
|
33
|
+
* @emits onAlert - Emitted when a new CAP alert is received and parsed.
|
|
34
|
+
*/
|
|
35
|
+
static newCapAlerts(stanza: any): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* @function newRawAlerts
|
|
38
|
+
* @description Emits the 'onAlert' event with parsed raw alert objects.
|
|
39
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
40
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
41
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} stanza - The XMPP stanza containing the raw alert message.
|
|
44
|
+
*
|
|
45
|
+
* @emits onAlert - Emitted when a new raw alert is received and parsed.
|
|
46
|
+
*/
|
|
47
|
+
static newRawAlerts(stanza: any): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* @function newUnknownAlert
|
|
50
|
+
* @description Emits the 'onAlert' event with parsed unknown alert objects. (Non-CAP, Non-VTEC)
|
|
51
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
52
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
53
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
54
|
+
*
|
|
55
|
+
* @param {Object} stanza - The XMPP stanza containing the raw alert message.
|
|
56
|
+
*
|
|
57
|
+
* @emits onAlert - Emitted when a new raw alert is received and parsed.
|
|
58
|
+
*/
|
|
59
|
+
static newUnknownAlert(stanza: any): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* @function newSpecialWeatherStatement
|
|
62
|
+
* @description Emits the 'onAlert' event with parsed special weather statement alert objects.
|
|
63
|
+
* The alert objects contain various properties such as id, tracking, action, area description, expiration time,
|
|
64
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
65
|
+
*
|
|
66
|
+
* tornado detection, max hail size, max wind gust, and thunderstorm damage threat.
|
|
67
|
+
*
|
|
68
|
+
* @param {Object} stanza - The XMPP stanza containing the special weather statement message.
|
|
69
|
+
*
|
|
70
|
+
* @emits onAlert - Emitted when a new special weather statement is received and parsed.
|
|
71
|
+
*/
|
|
72
|
+
static newSpecialWeatherStatement(stanza: any): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* @function newMesoscaleDiscussion
|
|
75
|
+
* @description Emits the 'onMesoscaleDiscussion' event with a parsed mesoscale discussion alert object.
|
|
76
|
+
* The alert object contains various properties such as id, tracking, action, area description, expiration time,
|
|
77
|
+
* issue time, event type, sender information, description, geocode, and parameters like WMO identifier,
|
|
78
|
+
* tornado intensity probability, peak wind gust, and peak hail size.
|
|
79
|
+
*
|
|
80
|
+
* @param {Object} stanza - The XMPP stanza containing the mesoscale discussion message.
|
|
81
|
+
*
|
|
82
|
+
* @emits onMesoscaleDiscussion - Emitted when a new mesoscale discussion is received and parsed.
|
|
83
|
+
*/
|
|
84
|
+
static newMesoscaleDiscussion(stanza: any): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* @function newLocalStormReport
|
|
87
|
+
* @description Emits the 'onLocalStormReport' event with the cleaned description of a local storm report. No other additional parsing is
|
|
88
|
+
* done at this time at least.
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} stanza - The XMPP stanza containing the local storm report message.
|
|
91
|
+
*
|
|
92
|
+
* @emits onLocalStormReport - Emitted when a new local storm report is received and parsed.
|
|
93
|
+
*/
|
|
94
|
+
static newLocalStormReport(stanza: any): Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export { mEvents as default, mEvents };
|