@atmosx/event-product-parser 3.0.0 → 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 +299 -5
- package/dist/cjs/index.cjs +10188 -237
- package/dist/esm/index.mjs +10186 -237
- package/dist/index.d.mts +235 -0
- package/dist/index.d.ts +235 -0
- package/package.json +4 -3
- package/src/@building/building.clean.ts +1 -1
- package/src/@building/building.create.ts +1 -1
- package/src/@building/building.enhance.ts +1 -1
- package/src/@building/building.geometry.ts +7 -1
- package/src/@building/building.headers.ts +1 -1
- package/src/@building/building.office.ts +1 -1
- package/src/@building/building.polygon.ts +1 -1
- package/src/@building/building.properties.ts +1 -1
- package/src/@building/building.signature.ts +9 -26
- package/src/@building/building.tags.ts +1 -1
- package/src/@building/building.tracking.ts +1 -1
- package/src/@building/building.validate.ts +19 -4
- package/src/@core/core.getEvents.ts +1 -1
- package/src/@core/core.getNodes.ts +1 -1
- package/src/@core/{core.callback.ts → core.getRandomEvent.ts} +3 -17
- package/src/@core/core.getVersion.ts +25 -0
- package/src/@core/core.listener.ts +1 -1
- package/src/@core/core.setNode.ts +2 -2
- package/src/@core/core.start.ts +9 -4
- package/src/@core/core.stop.ts +1 -1
- package/src/@dictionaries/dictionaries.betterEventNames.ts +5 -1
- package/src/@dictionaries/dictionaries.eventActions.ts +1 -1
- package/src/@dictionaries/dictionaries.eventAwipAbreviations.ts +2 -2
- package/src/@dictionaries/dictionaries.eventCancelMessages.ts +2 -1
- package/src/@dictionaries/dictionaries.eventCauses.ts +1 -1
- package/src/@dictionaries/dictionaries.eventProducts.ts +1 -1
- package/src/@dictionaries/dictionaries.eventRecords.ts +1 -1
- package/src/@dictionaries/dictionaries.eventSeverity.ts +1 -1
- package/src/@dictionaries/dictionaries.eventStatus.ts +1 -1
- package/src/@dictionaries/dictionaries.eventTags.ts +1 -1
- package/src/@dictionaries/dictionaries.eventTypes.ts +1 -1
- package/src/@dictionaries/dictionaries.eventsOffshore.ts +1 -1
- package/src/@dictionaries/dictionaries.hailStrings.ts +3 -1
- package/src/@dictionaries/dictionaries.officeICAOs.ts +1 -1
- package/src/@dictionaries/dictionaries.regExp.ts +1 -1
- package/src/@dictionaries/dictionaries.shapefileLinks.ts +1 -1
- package/src/@dictionaries/dictionaries.statusCorrelationText.ts +1 -1
- package/src/@dictionaries/{dictionaries.test_signatures.ts → dictionaries.testSignatures.ts} +3 -2
- package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +1 -1
- package/src/@events/events.api.ts +1 -1
- package/src/@events/events.text.ts +1 -1
- package/src/@events/events.ugc.ts +1 -1
- package/src/@events/events.vtec.ts +5 -5
- package/src/@manager/manager.mkEvent.ts +54 -38
- package/src/@manager/manager.rmEvent.ts +3 -1
- package/src/@manager/manager.setHash.ts +2 -2
- package/src/@manager/manager.updateNodes.ts +10 -6
- package/src/@manager/manager.updateWebhooks.ts +50 -0
- package/src/@modules/@database/database.cache.ts +1 -1
- package/src/@modules/@database/database.init.ts +1 -1
- package/src/@modules/@database/database.shapefiles.ts +2 -3
- package/src/@modules/@database/database.stanza.ts +2 -1
- 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 +1 -1
- package/src/@modules/@stanza/stanza.validate.ts +1 -1
- package/src/@modules/@utilities/utilities.createHttp.ts +17 -7
- package/src/@modules/@utilities/utilities.createWebhook.ts +100 -0
- package/src/@modules/@utilities/utilities.getFormattedTime.ts +1 -1
- package/src/@modules/@utilities/utilities.getSettings.ts +1 -1
- package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +1 -1
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +31 -4
- package/src/@modules/@utilities/utilities.setEventEmit.ts +1 -1
- package/src/@modules/@utilities/utilities.setListener.ts +3 -3
- package/src/@modules/@utilities/utilities.setSettings.ts +1 -1
- package/src/@modules/@utilities/utilities.setSleep.ts +3 -3
- package/src/@modules/@utilities/utilities.setTimeoutAction.ts +4 -4
- package/src/@modules/@utilities/utilities.setWarning.ts +3 -3
- package/src/@modules/@xmpp/xmpp.xDeploy.ts +2 -2
- package/src/@modules/@xmpp/xmpp.xError.ts +1 -10
- package/src/@modules/@xmpp/xmpp.xOffline.ts +2 -2
- package/src/@modules/@xmpp/xmpp.xOnline.ts +3 -19
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +7 -2
- package/src/@modules/@xmpp/xmpp.xStanza.ts +3 -3
- package/src/@parsers/@hvtec/hvtec.extract.ts +1 -1
- package/src/@parsers/@pvtec/pvtec.expires.ts +1 -1
- package/src/@parsers/@pvtec/pvtec.extract.ts +3 -4
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +1 -1
- package/src/@parsers/@text/text.getPolygonFromProduct.ts +1 -1
- package/src/@parsers/@text/text.getTextFromProduct.ts +1 -1
- package/src/@parsers/@text/text.getXML.ts +1 -1
- package/src/@parsers/@ugc/ugc.coordinates.ts +1 -1
- package/src/@parsers/@ugc/ugc.expiry.ts +1 -1
- package/src/@parsers/@ugc/ugc.extract.ts +1 -1
- package/src/@parsers/@ugc/ugc.header.ts +1 -1
- package/src/@parsers/@ugc/ugc.locations.ts +1 -1
- package/src/@parsers/@ugc/ugc.zones.ts +1 -1
- package/src/@types/type.event.ts +12 -12
- package/src/@types/type.properties.ts +1 -1
- package/src/@types/types.attributes.ts +1 -1
- package/src/@types/types.compiled.ts +1 -1
- package/src/@types/types.hash.ts +1 -1
- package/src/@types/types.hvtec.ts +1 -1
- package/src/@types/types.pvtec.ts +2 -1
- package/src/@types/types.settings.ts +10 -5
- package/src/@types/types.stanza.ts +1 -1
- package/src/@types/types.ugc.ts +1 -1
- package/src/@types/types.webhook.ts +26 -0
- package/src/bootstrap.ts +7 -4
- package/src/index.ts +11 -12
- package/test.js +29 -18
- package/tsup.config.ts +1 -0
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,12 +9,307 @@
|
|
|
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
17
|
npm install @atmosx/event-product-parser
|
|
16
18
|
```
|
|
17
19
|
|
|
18
|
-
|
|
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,
|
|
33
|
+
},
|
|
34
|
+
CredentialSettings: {
|
|
35
|
+
Username: `username`,
|
|
36
|
+
Password: `password`,
|
|
37
|
+
Nickname: "nickname (@atmosx/event-product-parser/3.0)",
|
|
38
|
+
},
|
|
39
|
+
CacheSettings: {
|
|
40
|
+
Enabled: true,
|
|
41
|
+
MaxDatabaseHistory: 5000,
|
|
42
|
+
MaxRetentionHistory: 555,
|
|
43
|
+
},
|
|
44
|
+
StanzaSettings: {
|
|
45
|
+
DisableUGC: false,
|
|
46
|
+
DisableVTEC: false,
|
|
47
|
+
DisableText: false,
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
NationalWeatherServiceSettings: {
|
|
51
|
+
CallbackInterval: 30,
|
|
52
|
+
EventsEndpoint: `https://api.weather.gov/alerts/active`,
|
|
53
|
+
},
|
|
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,
|
|
99
|
+
},
|
|
100
|
+
EASSettings: {
|
|
101
|
+
ArchiveDirectory: null,
|
|
102
|
+
IntroWavFile: null,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
})
|
|
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
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## Events and Listeners
|
|
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
|
+
})
|
|
163
|
+
```
|
|
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) => {})
|
|
169
|
+
```
|
|
170
|
+
|
|
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) => {})
|
|
175
|
+
```
|
|
176
|
+
|
|
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) => {})
|
|
182
|
+
```
|
|
183
|
+
|
|
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) => {})
|
|
188
|
+
```
|
|
189
|
+
|
|
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) => {})
|
|
194
|
+
```
|
|
195
|
+
|
|
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
|
+
})
|
|
205
|
+
```
|
|
206
|
+
|
|
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) => {})
|
|
211
|
+
```
|
|
212
|
+
|
|
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
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
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
|
+
})
|
|
231
|
+
```
|
|
232
|
+
|
|
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
|
|
239
|
+
```
|
|
240
|
+
|
|
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.
|
|
246
|
+
```
|
|
247
|
+
|
|
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.
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
|
|
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.
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
### Function `startService`
|
|
266
|
+
Starts the event product parser service.
|
|
267
|
+
```ts
|
|
268
|
+
import { startService } from "@atmosx/event-product-parser"
|
|
269
|
+
startService()
|
|
270
|
+
```
|
|
271
|
+
|
|
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
|
+
})
|
|
282
|
+
```
|
|
283
|
+
|
|
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)
|
|
291
|
+
```
|
|
292
|
+
|
|
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)
|
|
300
|
+
```
|
|
301
|
+
|
|
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)
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Performance Recommendations
|
|
311
|
+
- Enable cache retention
|
|
312
|
+
- Disable geometry parsing if GeoJSON is unnecessary.
|
|
19
313
|
|
|
20
314
|
## References
|
|
21
315
|
[NOAA NWWS Information](https://www.weather.gov/nwws/) |
|
|
@@ -32,4 +326,4 @@ npm install @atmosx/event-product-parser
|
|
|
32
326
|
[Changelogs](/CHANGELOGS.md) |
|
|
33
327
|
|
|
34
328
|
## Acknowledgements
|
|
35
|
-
- [k3yomi](https://github.com/k3yomi)
|
|
329
|
+
- [k3yomi](https://github.com/k3yomi)
|