@atmosx/event-product-parser 2.0.16 → 3.0.1
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 +248 -187
- package/dist/cjs/index.cjs +12218 -3139
- package/dist/esm/index.mjs +12401 -3327
- package/dist/index.d.mts +235 -0
- package/dist/index.d.ts +235 -0
- package/package.json +6 -4
- package/src/@building/building.clean.ts +30 -0
- package/src/@building/building.create.ts +42 -0
- package/src/@building/building.enhance.ts +56 -0
- package/src/@building/building.geometry.ts +48 -0
- package/src/@building/building.headers.ts +37 -0
- package/src/@building/building.office.ts +43 -0
- package/src/@building/building.polygon.ts +71 -0
- package/src/@building/building.properties.ts +89 -0
- package/src/@building/building.signature.ts +61 -0
- package/src/@building/building.tags.ts +24 -0
- package/src/@building/building.tracking.ts +68 -0
- package/src/@building/building.validate.ts +147 -0
- package/src/@core/core.getEvents.ts +25 -0
- package/src/@core/core.getNodes.ts +25 -0
- package/src/@core/core.getRandomEvent.ts +25 -0
- package/src/@core/core.getVersion.ts +25 -0
- package/src/@core/core.listener.ts +24 -0
- package/src/@core/core.setNode.ts +81 -0
- package/src/@core/core.start.ts +59 -0
- package/src/@core/core.stop.ts +32 -0
- package/src/@dictionaries/dictionaries.betterEventNames.ts +89 -0
- package/src/@dictionaries/dictionaries.eventActions.ts +28 -0
- package/src/@dictionaries/{awips.ts → dictionaries.eventAwipAbreviations.ts} +13 -7
- package/src/@dictionaries/dictionaries.eventCancelMessages.ts +30 -0
- package/src/@dictionaries/dictionaries.eventCauses.ts +36 -0
- package/src/@dictionaries/dictionaries.eventProducts.ts +25 -0
- package/src/@dictionaries/dictionaries.eventRecords.ts +25 -0
- package/src/@dictionaries/dictionaries.eventSeverity.ts +27 -0
- package/src/@dictionaries/dictionaries.eventStatus.ts +31 -0
- package/src/@dictionaries/{signatures.ts → dictionaries.eventTags.ts} +13 -68
- package/src/@dictionaries/dictionaries.eventTypes.ts +82 -0
- package/src/@dictionaries/dictionaries.eventsOffshore.ts +31 -0
- package/src/@dictionaries/dictionaries.hailStrings.ts +33 -0
- package/src/@dictionaries/{icao.ts → dictionaries.officeICAOs.ts} +13 -6
- package/src/@dictionaries/dictionaries.regExp.ts +28 -0
- package/src/@dictionaries/dictionaries.shapefileLinks.ts +36 -0
- package/src/@dictionaries/dictionaries.statusCorrelationText.ts +40 -0
- package/src/@dictionaries/dictionaries.testSignatures.ts +24 -0
- package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +68 -0
- package/src/@events/events.api.ts +113 -0
- package/src/@events/events.text.ts +79 -0
- package/src/@events/events.ugc.ts +83 -0
- package/src/@events/events.vtec.ts +87 -0
- package/src/@manager/manager.mkEvent.ts +95 -0
- package/src/@manager/manager.rmEvent.ts +46 -0
- package/src/@manager/manager.setHash.ts +37 -0
- package/src/@manager/manager.updateNodes.ts +55 -0
- package/src/@manager/manager.updateWebhooks.ts +50 -0
- package/src/@modules/@database/database.cache.ts +48 -0
- package/src/@modules/@database/database.init.ts +45 -0
- package/src/@modules/@database/database.shapefiles.ts +96 -0
- package/src/@modules/@database/database.stanza.ts +48 -0
- package/src/@modules/@eas/eas.getFloatPCM16.ts +29 -0
- package/src/@modules/@eas/eas.getMergedPCM16.ts +32 -0
- package/src/@modules/@eas/eas.getPCM16.ts +52 -0
- package/src/@modules/@eas/eas.getPCMToFloat.ts +26 -0
- package/src/@modules/@eas/eas.getSampledPCM16.ts +36 -0
- package/src/@modules/@eas/eas.getWavPCM16.ts +52 -0
- package/src/@modules/@eas/eas.setAFSK.ts +52 -0
- package/src/@modules/@eas/eas.setAsciiToBits.ts +32 -0
- package/src/@modules/@eas/eas.setAttentionTone.ts +40 -0
- package/src/@modules/@eas/eas.setEasTone.ts +137 -0
- package/src/@modules/@eas/eas.setNoise.ts +31 -0
- package/src/@modules/@eas/eas.setRadioEffect.ts +49 -0
- package/src/@modules/@eas/eas.setSameHeader.ts +45 -0
- package/src/@modules/@stanza/stanza.getAwipsType.ts +46 -0
- package/src/@modules/@stanza/stanza.validate.ts +50 -0
- package/src/@modules/@utilities/utilities.createHttp.ts +85 -0
- package/src/@modules/@utilities/utilities.createWebhook.ts +100 -0
- package/src/@modules/@utilities/utilities.getFormattedTime.ts +43 -0
- package/src/@modules/@utilities/utilities.getSettings.ts +25 -0
- package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +114 -0
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +65 -0
- package/src/@modules/@utilities/utilities.setEventEmit.ts +41 -0
- package/src/@modules/@utilities/utilities.setListener.ts +30 -0
- package/src/@modules/@utilities/utilities.setSettings.ts +42 -0
- package/src/@modules/@utilities/utilities.setSleep.ts +33 -0
- package/src/@modules/@utilities/utilities.setTimeoutAction.ts +59 -0
- package/src/@modules/@utilities/utilities.setWarning.ts +34 -0
- package/src/@modules/@xmpp/xmpp.xDeploy.ts +58 -0
- package/src/@modules/@xmpp/xmpp.xError.ts +29 -0
- package/src/@modules/@xmpp/xmpp.xOffline.ts +38 -0
- package/src/@modules/@xmpp/xmpp.xOnline.ts +45 -0
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +64 -0
- package/src/@modules/@xmpp/xmpp.xStanza.ts +63 -0
- package/src/@parsers/@hvtec/hvtec.extract.ts +40 -0
- package/src/@parsers/@pvtec/pvtec.expires.ts +26 -0
- package/src/@parsers/@pvtec/pvtec.extract.ts +49 -0
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +53 -0
- package/src/@parsers/@text/text.getPolygonFromProduct.ts +32 -0
- package/src/@parsers/@text/text.getTextFromProduct.ts +43 -0
- package/src/@parsers/@text/text.getXML.ts +61 -0
- package/src/@parsers/@ugc/ugc.coordinates.ts +110 -0
- package/src/@parsers/@ugc/ugc.expiry.ts +32 -0
- package/src/@parsers/@ugc/ugc.extract.ts +37 -0
- package/src/@parsers/@ugc/ugc.header.ts +30 -0
- package/src/@parsers/@ugc/ugc.locations.ts +29 -0
- package/src/@parsers/@ugc/ugc.zones.ts +52 -0
- package/src/@types/type.event.ts +67 -0
- package/src/@types/type.properties.ts +75 -0
- package/src/@types/types.attributes.ts +28 -0
- package/src/@types/types.compiled.ts +35 -0
- package/src/@types/types.hash.ts +24 -0
- package/src/@types/types.hvtec.ts +25 -0
- package/src/@types/types.pvtec.ts +30 -0
- package/src/@types/types.settings.ts +76 -0
- package/src/@types/types.stanza.ts +37 -0
- package/src/@types/types.ugc.ts +24 -0
- package/src/@types/types.webhook.ts +26 -0
- package/src/bootstrap.ts +85 -163
- package/src/index.ts +47 -216
- package/test.js +78 -51
- package/tsup.config.ts +1 -0
- package/src/@dictionaries/events.ts +0 -168
- package/src/@parsers/@events/api.ts +0 -146
- package/src/@parsers/@events/cap.ts +0 -123
- package/src/@parsers/@events/text.ts +0 -104
- package/src/@parsers/@events/ugc.ts +0 -107
- package/src/@parsers/@events/vtec.ts +0 -76
- package/src/@parsers/events.ts +0 -392
- package/src/@parsers/hvtec.ts +0 -46
- package/src/@parsers/pvtec.ts +0 -72
- package/src/@parsers/stanza.ts +0 -97
- package/src/@parsers/text.ts +0 -165
- package/src/@parsers/ugc.ts +0 -247
- package/src/@submodules/database.ts +0 -201
- package/src/@submodules/eas.ts +0 -490
- package/src/@submodules/utils.ts +0 -191
- package/src/@submodules/xmpp.ts +0 -142
- package/src/types.ts +0 -259
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# Project AtmosphericX - Event Product Parser (v3.0.0)
|
|
2
|
+
|
|
2
3
|
<div align="center">
|
|
3
|
-
<p align = "center">This repository contains the primary parser for AtmosphericX's NOAA Weather Wire Service (NWWS) and National Weather Service (NWS) API. It is designed to handle real time weather alerts and messages from the National Weather Service, using both XMPP (NWWS) and direct API access (Slower). This parser is intended for developers who want to integrate real time weather alerts, watches, warnings, and forecast data from the NWS seamlessly into their applications or services. It is not recommended for users without basic programming knowledge. If you wish to access NOAA weather data without programming, consider using our end-user project, which leverages this parser and provides an easy-to-use interface for tracking weather alerts.</small></p>
|
|
4
|
-
<p align = "center">Documentation written by @k3yomi</p>
|
|
5
4
|
<div align="center" style="border: none;">
|
|
6
5
|
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/AtmosphericX/event-product-parser">
|
|
7
6
|
<img alt="GitHub forks" src="https://img.shields.io/github/forks/AtmosphericX/event-product-parser">
|
|
@@ -10,243 +9,308 @@
|
|
|
10
9
|
</div>
|
|
11
10
|
</div>
|
|
12
11
|
|
|
12
|
+
## What is `@atmosx/event-product-parser`
|
|
13
|
+
This repository contains the primary function to obtain, parse, cache, and deliver products and events from the National Weather Service. There are two primary sources to obtain these products. By default, the repository uses the **National Weather Service API**. However, there is **FULL** support for **NOAA Weather Wire Service (Open Interface)**. This parser is intended for developers who want to integrate real-time weather alerts, watches, warnings, and forecast data from the NWS seamlessly into their applications or services without having to use external APIs from other sources / parsers. If you wish to access data without programming, consider using our end user project, which leverages this parser and provides an easy-to-use interface for tracking weather alerts. See [Documentation](https://atmosphericx.scriptkitty.cafe).
|
|
14
|
+
|
|
13
15
|
## Installation (NPM)
|
|
14
16
|
```bash
|
|
15
|
-
npm install @atmosx/event-product-parser
|
|
17
|
+
npm install @atmosx/event-product-parser
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
##
|
|
19
|
-
```
|
|
20
|
-
const {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
## Configurations & Usage
|
|
21
|
+
```ts
|
|
22
|
+
const { Manager } = require(`@atmosx/event-product-parser`) // CJS Importing
|
|
23
|
+
import { Manager } from '@atmosx/event-product-parser' // EJS Importing
|
|
24
|
+
|
|
25
|
+
const Client = new Manager({
|
|
26
|
+
Database: `shapefiles.db`,
|
|
27
|
+
EnableWireService: false,
|
|
28
|
+
EnableJournal: true,
|
|
29
|
+
NOAAWeatherWireServiceSettings: {
|
|
30
|
+
ReconnectionSettings: {
|
|
31
|
+
Enabled: true,
|
|
32
|
+
ReconnectionInterval: 60,
|
|
31
33
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
CredentialSettings: {
|
|
35
|
+
Username: `username`,
|
|
36
|
+
Password: `password`,
|
|
37
|
+
Nickname: "nickname (@atmosx/event-product-parser/3.0)",
|
|
36
38
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
CacheSettings: {
|
|
40
|
+
Enabled: true,
|
|
41
|
+
MaxDatabaseHistory: 5000,
|
|
42
|
+
MaxRetentionHistory: 555,
|
|
41
43
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
cap_only: false,
|
|
44
|
+
StanzaSettings: {
|
|
45
|
+
DisableUGC: false,
|
|
46
|
+
DisableVTEC: false,
|
|
47
|
+
DisableText: false,
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
NationalWeatherServiceSettings: {
|
|
51
|
+
CallbackInterval: 30,
|
|
52
|
+
EventsEndpoint: `https://api.weather.gov/alerts/active`,
|
|
52
53
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
WebhookSettings: [
|
|
55
|
+
{
|
|
56
|
+
webhook: "https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
|
57
|
+
title: "AtmosphericX - (@atmosx/event-product-parser)",
|
|
58
|
+
message: ``,
|
|
59
|
+
events: [`Severe Thunderstorm Warning`, `Radar Indicated Tornado Warning`, `*Warning`, `*Thunderstorm*`],
|
|
60
|
+
rate: 5,
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
GlobalSettings: {
|
|
64
|
+
EventManagement: true,
|
|
65
|
+
BetterEventNames: true,
|
|
66
|
+
DisableGeometryParsing: false,
|
|
67
|
+
UseShapefileCoordinates: true,
|
|
68
|
+
SPCWatchesOnly: true,
|
|
69
|
+
NodeTTL: 60,
|
|
70
|
+
NodeMinDistance: 120,
|
|
71
|
+
EventFiltering: {
|
|
72
|
+
ListeningEvents: [
|
|
73
|
+
"Tornado Emergency", "PDS Tornado Warning", "Tornado Warning",
|
|
74
|
+
"Confirmed Tornado Warning", "Radar Indicated Tornado Warning",
|
|
75
|
+
"Special Marine Warning (TPROB)", "PDS Tornado Watch", "Tornado Watch",
|
|
76
|
+
"EDS Severe Thunderstorm Warning (TPROB)", "EDS Severe Thunderstorm Warning",
|
|
77
|
+
"Destructive Severe Thunderstorm Warning (TPROB)", "Destructive Severe Thunderstorm Warning",
|
|
78
|
+
"Considerable Severe Thunderstorm Warning (TPROB)", "Considerable Severe Thunderstorm Warning",
|
|
79
|
+
"Severe Thunderstorm Warning (TPROB)", "Severe Thunderstorm Warning",
|
|
80
|
+
"Severe Thunderstorm Watch",
|
|
81
|
+
"Flash Flood Emergency", "Flash Flood Warning",
|
|
82
|
+
"Flash Flood Watch",
|
|
83
|
+
"Tsunami Warning", "Tsunami Watch",
|
|
84
|
+
"Tsunami Advisory", "Special Marine Warning",
|
|
85
|
+
"Earthquake Warning",
|
|
86
|
+
"Hurricane Warning", "Hurricane Watch",
|
|
87
|
+
"Tropical Storm Warning",
|
|
88
|
+
"Winter Storm Warning", "Blizzard Warning",
|
|
89
|
+
"Ice Storm Warning", "Snow Squall Warning",
|
|
90
|
+
"Winter Weather Advisory", "Extreme Cold Watch"
|
|
91
|
+
],
|
|
92
|
+
ListeningICAO: [],
|
|
93
|
+
IgnoredICAO: [],
|
|
94
|
+
IgnoredEvents: [],
|
|
95
|
+
ListeningUGC: [],
|
|
96
|
+
ListeningStates: [],
|
|
97
|
+
NodeLocationFiltering: false,
|
|
98
|
+
IgnoreTestProducts: true,
|
|
67
99
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
100
|
+
EASSettings: {
|
|
101
|
+
ArchiveDirectory: null,
|
|
102
|
+
IntroWavFile: null,
|
|
71
103
|
}
|
|
72
|
-
}
|
|
104
|
+
}
|
|
73
105
|
})
|
|
74
106
|
```
|
|
107
|
+
### General Settings
|
|
108
|
+
- **Database**: The database file name and location, please make sure to include the `.db` extension.
|
|
109
|
+
- **EnableWireService**: Whether to enable `NOAA Weather Wire Service` within the parser. This requires credentials from [NOAA Weather Wire Service](https://www.weather.gov/nwws/).
|
|
110
|
+
- **EnableJournal**: Whether to output logs without requiring event `listeners`.
|
|
111
|
+
|
|
112
|
+
### NOAAWeatherWireServiceSettings
|
|
113
|
+
- **ReconnectionSettings**: When the XMPP client gets disconnected or has an error, choose to reconnect to the service again. This contains a reconnection check interval.
|
|
114
|
+
- **CredentialSettings**: The username (nickname) and password that is required for using `NOAA Weather Wire Service`.
|
|
115
|
+
- **CacheSettings**: The ability to use the cache system so when you relaunch the parser, it will have a event retention history of all the stanzas collected.
|
|
116
|
+
- **StanzaSettings**: Modify what type of products metadata you'd like to receive. (UGC, VTEC, RawText)
|
|
117
|
+
|
|
118
|
+
### NationalWeatherServiceSettings
|
|
119
|
+
- **CallbackInterval**: The interval at which the parser will check for new alerts from the National Weather Service API.
|
|
120
|
+
- **EventsEndpoint**: The URL that directs to the API.
|
|
121
|
+
|
|
122
|
+
### WebhookSettings
|
|
123
|
+
- **webhook**: The URL of the webhook you want to send messages to.
|
|
124
|
+
- **title**: The title of the message you want to send.
|
|
125
|
+
- **message**: The message content you want to send. You can use placeholders like `<@&role_id>` to mention roles in Discord.
|
|
126
|
+
- **events**: An array of event types that will trigger the webhook when they are received by the parser. If this array is empty, the webhook will be triggered for all events.
|
|
127
|
+
- **rate**: The rate limit in seconds for how often the webhook can be triggered. This is to prevent spamming the webhook with too many messages in a short period of time.
|
|
128
|
+
|
|
129
|
+
### GlobalSettings
|
|
130
|
+
- **EventManagement**: Whether to enable the event management system which includes filtering, tracking nodes, and custom messages.
|
|
131
|
+
- **BetterEventNames**: Changes events to a more specific version depending on parameters, message types, etc. `(Ex. "Tornado Warning" -> "Observed Tornado Warning")`
|
|
132
|
+
- **DisableGeometryParsing**: Disable automatically appending GeoJSON geometry data to the events to save on memory consumption.
|
|
133
|
+
- **UseShapefileCoordinates**: Whether to use the shapefile database to obtain the coordinates for events with specified UGC zones.
|
|
134
|
+
- **SPCWatchesOnly**: Whether to only listen for SPC watches only (TOR/SVR) (If using the API, this is ignored).
|
|
135
|
+
- **NodeTTL**: How often nodes should be checked per event. (Tracking/Filtering)
|
|
136
|
+
- **NodeMinDistance**: The minimum distance to filter events from the node (Miles)
|
|
137
|
+
- **ListeningEvents**: Events you'd like to listen for. If this array is left empty, it will listen for **ALL** events and products.
|
|
138
|
+
- **ListeningICAO**: ICAO codes for the weather stations you'd like to listen for. Filtering all events that do not contain the codes. `(Ex. ["KLOT", "TORD"])`
|
|
139
|
+
- **IgnoredICAO**: Ignored ICAO codes `(Ex. ["KWNS"])`
|
|
140
|
+
- **IgnoredEvents**: Ignored events / products.
|
|
141
|
+
- **ListeningUGC**: Zones you'd like to listen to `(Ex. ["ILZ001"])`
|
|
142
|
+
- **ListeningStates**: States you'd like to listen to `(Ex. ["IL"])`
|
|
143
|
+
- **NodeLocationFiltering**: If you want tracking nodes to filter out events based on radius. (Miles)\
|
|
144
|
+
- **IgnoreTextProducts**: If you want to ignore test products and events.
|
|
145
|
+
- **ArchiveDirectory**: The directory you'd like to store generated EAS audio files.
|
|
146
|
+
- **IntroWavFile**: The PCM16 bit WAV audio file to append to the EAS message.
|
|
147
|
+
|
|
75
148
|
|
|
76
|
-
## NOAA Weather Wire Service (Getting Started)
|
|
77
|
-
To use the NOAA Weather Wire Service (NWWS). You would need to obtain credentials from the National Weather Service. Follow these steps:
|
|
78
|
-
1. Visit the [NOAA NWWS Registration Page](https://www.weather.gov/nwws/nwws_oi_request).
|
|
79
|
-
2. Fill out the registration form with the required information.
|
|
80
|
-
3. Submit the form and wait for approval. You will receive your NWWS credentials via email.
|
|
81
149
|
|
|
82
150
|
## Events and Listeners
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
151
|
+
|
|
152
|
+
### Event `onServiceStatus`
|
|
153
|
+
Triggers when an update to the XMPP / API service status occurs.
|
|
154
|
+
```ts
|
|
155
|
+
Client.on(`onServiceStatus`, (xmpp) => {
|
|
156
|
+
/*
|
|
157
|
+
message: string
|
|
158
|
+
data: object
|
|
159
|
+
type: string
|
|
160
|
+
error: boolean
|
|
161
|
+
*/
|
|
162
|
+
})
|
|
94
163
|
```
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
})
|
|
164
|
+
|
|
165
|
+
### Event `onTestProduct`
|
|
166
|
+
Triggers when a event is labeled as a **test message**. See [`types.event.ts`](./src/@types/type.event.ts) for properties.
|
|
167
|
+
```ts
|
|
168
|
+
Client.on(`onTestProduct`, (product: TypeEvent) => {})
|
|
100
169
|
```
|
|
101
170
|
|
|
102
|
-
### Event `
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
console.log(`Reconnection attempt #${data.reconnects}`);
|
|
107
|
-
});
|
|
171
|
+
### Event `onExpiredProduct`
|
|
172
|
+
Triggers when a event is cancelled, expired, or terminated. See [`types.event.ts`](./src/@types/type.event.ts) for properties.
|
|
173
|
+
```ts
|
|
174
|
+
Client.on(`onExpiredProduct`, (product: TypeEvent) => {})
|
|
108
175
|
```
|
|
109
176
|
|
|
110
|
-
### Event `
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
177
|
+
### Event `onProductType`
|
|
178
|
+
Supports all events and product, simply append the event name to the end like `onProductTypeRadarIndicatedTornadoWarning` and you will receive the event in the listener.
|
|
179
|
+
This listener returns [`types.event.ts`](./src/@types/type.event.ts).
|
|
180
|
+
```ts
|
|
181
|
+
Client.on(`onProductTypeRadarIndicatedTornadoWarning`, (product: TypeEvent) => {})
|
|
116
182
|
```
|
|
117
183
|
|
|
118
|
-
### Event `
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
console.log(`New occupant detected: ${data.occupant}`);
|
|
123
|
-
});
|
|
184
|
+
### Event `onFilteredEvent`, `onIgnoredEvent`, `onFilteredICAO`, `onIgnoredICAO`, `onFilteredUGC`, `onFilteredState`
|
|
185
|
+
These events all support [`types.event.ts`](./src/@types/type.event.ts) and are used to filter out events and products based on your settings.
|
|
186
|
+
```ts
|
|
187
|
+
Client.on(`onFilteredEvent`, (product: TypeEvent) => {})
|
|
124
188
|
```
|
|
125
189
|
|
|
126
|
-
### Event `
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
console.log(`Message received from ${data.from}: ${data.message}`);
|
|
131
|
-
});
|
|
190
|
+
### Event `onEventCache`
|
|
191
|
+
When all events in a batch have finished processing, a cache update will trigger allowing you to get a copy of all registered events in a listener. (**GeoJSON**)
|
|
192
|
+
```ts
|
|
193
|
+
Client.on(`onEventCache`, (cache) => {})
|
|
132
194
|
```
|
|
133
195
|
|
|
134
|
-
### Event `
|
|
135
|
-
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
196
|
+
### Event `onNodeAdd`, `onNodeUpdate`, `onNodeDelete`
|
|
197
|
+
Triggers when a tracking node gets added, updated, or deleted.
|
|
198
|
+
```ts
|
|
199
|
+
Client.on(`onNodeAdd`, (cache) => {
|
|
200
|
+
/*
|
|
201
|
+
type: string
|
|
202
|
+
node: object
|
|
203
|
+
*/
|
|
204
|
+
})
|
|
140
205
|
```
|
|
141
206
|
|
|
142
|
-
### Event `
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
console.log(`Alert expired for ${alert.properties.event} for locations of ${alert.properties.locations}`);
|
|
147
|
-
});
|
|
207
|
+
### Event `onStormPredictionWatch`, `onNonStormPredictionWatch`
|
|
208
|
+
Triggers when a SPC watch gets added, updated, or cancelled. This will also add a custom message if using jorunal or the `log` listener.
|
|
209
|
+
```ts
|
|
210
|
+
Client.on(`onProductTypeRadarIndicatedTornadoWarning`, (product: TypeEvent) => {})
|
|
148
211
|
```
|
|
149
212
|
|
|
150
|
-
### Event `
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
})
|
|
213
|
+
### Event `onEventStatus`
|
|
214
|
+
Triggers when a single event gets added, updated, or cancelled. This will also add a custom message if using jorunal or the `log` listener.
|
|
215
|
+
```ts
|
|
216
|
+
Client.on(`onEventStatus`, (cache) => {
|
|
217
|
+
/*
|
|
218
|
+
type: string
|
|
219
|
+
event: <TypeEvent>
|
|
220
|
+
*/
|
|
221
|
+
})
|
|
159
222
|
```
|
|
160
223
|
|
|
161
|
-
###
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
console.log(`Alert ignored for ${alert.properties.event}`);
|
|
169
|
-
});
|
|
224
|
+
### Function `setSettings`
|
|
225
|
+
Allows you to dynamically update parser settings without restarting the service.
|
|
226
|
+
```ts
|
|
227
|
+
import { setSettings } from "@atmosx/event-product-parser"
|
|
228
|
+
setSettings({
|
|
229
|
+
Database: `NewDatabaseFile.db`
|
|
230
|
+
})
|
|
170
231
|
```
|
|
171
232
|
|
|
172
|
-
###
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
233
|
+
### Function `getEventGeometry`
|
|
234
|
+
Fetches the `events` geometry (GeoJSON) coordinates table.
|
|
235
|
+
```ts
|
|
236
|
+
import { getEventGeometry } from "@atmosx/event-product-parser"
|
|
237
|
+
const event = {...}
|
|
238
|
+
const geometry = await getEventGeometry(event); // Returns GeoJSON
|
|
178
239
|
```
|
|
179
240
|
|
|
180
|
-
###
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
});
|
|
241
|
+
### Function `getRandomEvent`
|
|
242
|
+
Fetches a random event from the cache
|
|
243
|
+
```ts
|
|
244
|
+
import { getRandomEvent } from "@atmosx/event-product-parser"
|
|
245
|
+
const event = getRandomEvent(event); // Returns GeoJSON of an event.
|
|
186
246
|
```
|
|
187
247
|
|
|
188
|
-
###
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
});
|
|
248
|
+
### Function `getVersion`
|
|
249
|
+
Returns the current version of the parser.
|
|
250
|
+
```ts
|
|
251
|
+
import { getVersion } from "@atmosx/event-product-parser"
|
|
252
|
+
const version = getVersion(); // Returns the current version of the parser.
|
|
194
253
|
```
|
|
195
254
|
|
|
196
|
-
## Callbacks and Functions
|
|
197
255
|
|
|
198
|
-
### Function `
|
|
199
|
-
|
|
200
|
-
```
|
|
201
|
-
|
|
256
|
+
### Function `getCleanedEvent`
|
|
257
|
+
Removed any `NULL` values from the event itself. Therefore cleaning it up from any properties that are `NULL`.
|
|
258
|
+
```ts
|
|
259
|
+
import { getCleanedEvent } from "@atmosx/event-product-parser"
|
|
260
|
+
const event = {...}
|
|
261
|
+
const cleanedEvent = await getCleanedEvent(event); // Returns cleaned event object.
|
|
202
262
|
```
|
|
203
263
|
|
|
204
|
-
### Function `createEasAudio(description, header)`
|
|
205
|
-
Generates an EAS audio file based on the provided description and header. Audio file will be located based on settings provided in the global_settings.eas_settings object.
|
|
206
|
-
If you are running linux, festival is required to use this or it will error out.
|
|
207
|
-
```javascript
|
|
208
|
-
parser.createEasAudio(`This is a test alert`, `EAS Header Info`);
|
|
209
|
-
```
|
|
210
264
|
|
|
211
|
-
### Function `
|
|
212
|
-
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
|
|
265
|
+
### Function `startService`
|
|
266
|
+
Starts the event product parser service.
|
|
267
|
+
```ts
|
|
268
|
+
import { startService } from "@atmosx/event-product-parser"
|
|
269
|
+
startService()
|
|
216
270
|
```
|
|
217
271
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
272
|
+
|
|
273
|
+
### Function `setNode`
|
|
274
|
+
Sets up a tracking node using an identifier, longitude, and latitude values.
|
|
275
|
+
```ts
|
|
276
|
+
import { setNode } from "@atmosx/event-product-parser"
|
|
277
|
+
setNode({
|
|
278
|
+
identifier: `TestNode`,
|
|
279
|
+
coordinates: {longitude: -122.4194, latitude: 37.7749},
|
|
280
|
+
delete: false
|
|
281
|
+
})
|
|
223
282
|
```
|
|
224
283
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
284
|
+
|
|
285
|
+
### Function `getEvents`
|
|
286
|
+
Fetches the list of events from the parser.
|
|
287
|
+
```ts
|
|
288
|
+
import { getEvents } from "@atmosx/event-product-parser"
|
|
289
|
+
const events = getEvents() // Returns in GeoJSON (Similar to the onEventCache listener)
|
|
290
|
+
console.log(events)
|
|
230
291
|
```
|
|
231
292
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
});
|
|
293
|
+
|
|
294
|
+
### Function `getNodes`
|
|
295
|
+
Fetches the list of tracking nodes from the parser.
|
|
296
|
+
```ts
|
|
297
|
+
import { getNodes } from "@atmosx/event-product-parser"
|
|
298
|
+
const nodes = getNodes()
|
|
299
|
+
console.log(nodes)
|
|
242
300
|
```
|
|
243
301
|
|
|
244
|
-
### Function `
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
parser
|
|
302
|
+
### Function `setEasTone`
|
|
303
|
+
Fetches an EAS audio message for an event (Simulated)
|
|
304
|
+
```ts
|
|
305
|
+
import { setEasTone } from "@atmosx/event-product-parser"
|
|
306
|
+
const event = {...}
|
|
307
|
+
await setEasTone(event.properties.description, event.properties.metadata.header)
|
|
248
308
|
```
|
|
249
309
|
|
|
310
|
+
## Performance Recommendations
|
|
311
|
+
- Enable cache retention
|
|
312
|
+
- Disable geometry parsing if GeoJSON is unnecessary.
|
|
313
|
+
|
|
250
314
|
## References
|
|
251
315
|
[NOAA NWWS Information](https://www.weather.gov/nwws/) |
|
|
252
316
|
[NWS API Documentation](https://www.weather.gov/documentation/services-web-api) |
|
|
@@ -263,6 +327,3 @@ parser.stop();
|
|
|
263
327
|
|
|
264
328
|
## Acknowledgements
|
|
265
329
|
- [k3yomi](https://github.com/k3yomi)
|
|
266
|
-
- Lead developer @ AtmosphericX and maintainer of this module.
|
|
267
|
-
- [StarflightWx](https://x.com/starflightVR)
|
|
268
|
-
- For testing and providing feedback (Co-Developer and Spotter @ AtmosphericX)
|