@atmosx/event-product-parser 2.0.15 → 3.0.0
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 +4 -237
- package/dist/cjs/index.cjs +2233 -3100
- package/dist/esm/index.mjs +2233 -3103
- package/package.json +3 -3
- 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 +42 -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 +78 -0
- package/src/@building/building.tags.ts +24 -0
- package/src/@building/building.tracking.ts +68 -0
- package/src/@building/building.validate.ts +132 -0
- package/src/@core/core.callback.ts +39 -0
- package/src/@core/core.getEvents.ts +25 -0
- package/src/@core/core.getNodes.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 +54 -0
- package/src/@core/core.stop.ts +32 -0
- package/src/@dictionaries/dictionaries.betterEventNames.ts +85 -0
- package/src/@dictionaries/dictionaries.eventActions.ts +28 -0
- package/src/@dictionaries/{awips.ts → dictionaries.eventAwipAbreviations.ts} +12 -6
- package/src/@dictionaries/dictionaries.eventCancelMessages.ts +29 -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 +31 -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.test_signatures.ts +23 -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 +79 -0
- package/src/@manager/manager.rmEvent.ts +44 -0
- package/src/@manager/manager.setHash.ts +37 -0
- package/src/@manager/manager.updateNodes.ts +51 -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 +97 -0
- package/src/@modules/@database/database.stanza.ts +47 -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 +75 -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 +38 -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 +38 -0
- package/src/@modules/@xmpp/xmpp.xOffline.ts +38 -0
- package/src/@modules/@xmpp/xmpp.xOnline.ts +61 -0
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +59 -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 +50 -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 +29 -0
- package/src/@types/types.settings.ts +71 -0
- package/src/@types/types.stanza.ts +37 -0
- package/src/@types/types.ugc.ts +24 -0
- package/src/bootstrap.ts +82 -164
- package/src/index.ts +48 -216
- package/test.js +65 -49
- 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 -200
- package/src/@submodules/eas.ts +0 -490
- package/src/@submodules/utils.ts +0 -184
- package/src/@submodules/xmpp.ts +0 -142
- package/src/types.ts +0 -259
package/src/index.ts
CHANGED
|
@@ -1,240 +1,72 @@
|
|
|
1
1
|
/*
|
|
2
|
-
|
|
2
|
+
_ _ _ __ __
|
|
3
3
|
/\ | | | | (_) \ \ / /
|
|
4
4
|
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
-
/ /\ \| __|
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
6
|
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
7
|
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
-
| |
|
|
8
|
+
| |
|
|
9
9
|
|_|
|
|
10
|
-
|
|
11
|
-
Written by: KiyoWx (k3yomi)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import * as loader from './bootstrap';
|
|
15
|
-
import * as types from './types';
|
|
16
|
-
import Utils from './@submodules/utils';
|
|
17
|
-
import Xmpp from './@submodules/xmpp';
|
|
18
|
-
import EAS from './@submodules/eas';
|
|
19
|
-
import Database from './@submodules/database';
|
|
20
|
-
import StanzaParser from './@parsers/stanza';
|
|
21
|
-
import EventParser from './@parsers/events';
|
|
22
|
-
import TextParser from './@parsers/text';
|
|
23
|
-
import PVtecParser from './@parsers/pvtec';
|
|
24
|
-
import HVtecParser from './@parsers/hvtec';
|
|
25
|
-
import UGCParser from './@parsers/ugc';
|
|
26
10
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.sigCatch();
|
|
32
|
-
this.start(metadata)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @function setDisplayName
|
|
37
|
-
* @description
|
|
38
|
-
* Sets the display nickname for the NWWS XMPP session. Trims the provided
|
|
39
|
-
* name and validates it, emitting a warning if the name is empty or invalid.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} [name]
|
|
42
|
-
*/
|
|
43
|
-
public setDisplayName(name?: string) {
|
|
44
|
-
const settings = loader.settings as types.ClientSettingsTypes;
|
|
45
|
-
const trimmed = name?.trim();
|
|
46
|
-
if (!trimmed) {
|
|
47
|
-
Utils.warn(loader.definitions.messages.invalid_nickname);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
settings.noaa_weather_wire_service_settings.credentials.nickname = trimmed;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @function getEventPolygon
|
|
55
|
-
* @description
|
|
56
|
-
* Retrieves the geographical polygon for a given event based on its
|
|
57
|
-
* generated geocode and UGC zones.
|
|
58
|
-
*
|
|
59
|
-
* @async
|
|
60
|
-
* @param {types.EventCompiled} event
|
|
61
|
-
* @returns {Promise<types.geometry | null>}
|
|
62
|
-
*/
|
|
63
|
-
public async getEventPolygon(event: types.EventCompiled, isUnion: boolean = true): Promise<types.geometry | null> {
|
|
64
|
-
const hasGenerated = event.properties.geocode?.generated ?? null;
|
|
65
|
-
const getUgc = event.properties.geocode?.UGC ?? null;
|
|
66
|
-
return await EventParser.getEventGeometry(hasGenerated, {zones: getUgc}, isUnion);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @function createEasAudio
|
|
71
|
-
* @description
|
|
72
|
-
* Generates an EAS (Emergency Alert System) audio file using the provided
|
|
73
|
-
* description and header.
|
|
74
|
-
*
|
|
75
|
-
* @async
|
|
76
|
-
* @param {string} description
|
|
77
|
-
* @param {string} header
|
|
78
|
-
* @returns {Promise<string>}
|
|
79
|
-
*/
|
|
80
|
-
public async createEasAudio(description: string, header: string): Promise<string> {
|
|
81
|
-
return await EAS.generateEASAudio(description, header);
|
|
82
|
-
}
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
|
|
12
|
+
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
|
+
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
+
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
83
15
|
|
|
84
|
-
|
|
85
|
-
* @function getAllAlertTypes
|
|
86
|
-
* @description
|
|
87
|
-
* Generates a list of all possible alert types by combining defined
|
|
88
|
-
* event names with action names.
|
|
89
|
-
*
|
|
90
|
-
* @returns {string[]}
|
|
91
|
-
*/
|
|
92
|
-
public getAllAlertTypes(): string[] {
|
|
93
|
-
const events = new Set(Object.values(loader.definitions.events));
|
|
94
|
-
const actions = new Set(Object.values(loader.definitions.actions));
|
|
95
|
-
return Array.from(events).flatMap(event =>
|
|
96
|
-
Array.from(actions).map(action => `${event} ${action}`)
|
|
97
|
-
);
|
|
98
|
-
}
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
99
17
|
|
|
100
|
-
|
|
101
|
-
* @function searchStanzaDatabase
|
|
102
|
-
* @description
|
|
103
|
-
* Searches the stanza database for entries containing the specified query.
|
|
104
|
-
* Escapes SQL wildcard characters and returns results in descending order
|
|
105
|
-
* by ID, up to the specified limit.
|
|
106
|
-
*
|
|
107
|
-
* @async
|
|
108
|
-
* @param {string} query
|
|
109
|
-
* @param {number} [limit=250]
|
|
110
|
-
* @returns {Promise<string[]>}
|
|
111
|
-
*/
|
|
112
|
-
public async searchStanzaDatabase(query: string, limit: number = 250): Promise<string[]> {
|
|
113
|
-
const escapeLike = (s: string) => s.replace(/[%_]/g, '\\$&');
|
|
114
|
-
const rows = await loader.cache.db
|
|
115
|
-
.prepare(`SELECT * FROM stanzas WHERE stanza LIKE ? ESCAPE '\\' ORDER BY id DESC LIMIT ${limit}`)
|
|
116
|
-
.all(`%${escapeLike(query)}%`);
|
|
117
|
-
return rows;
|
|
118
|
-
}
|
|
18
|
+
*/
|
|
119
19
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
20
|
+
import { TypeSettings } from './@types/types.settings'
|
|
21
|
+
import { setSettings } from "./@modules/@utilities/utilities.setSettings"
|
|
22
|
+
import { getEventGeometry } from "./@building/building.geometry";
|
|
23
|
+
import { getCleanedEvent } from "./@building/building.clean"
|
|
24
|
+
import { setEventEmit } from './@modules/@utilities/utilities.setEventEmit';
|
|
25
|
+
import { setWarning } from './@modules/@utilities/utilities.setWarning';
|
|
26
|
+
import { listener } from "./@core/core.listener"
|
|
27
|
+
import { startService } from "./@core/core.start"
|
|
28
|
+
import { stopService } from "./@core/core.stop"
|
|
29
|
+
import { setNode } from "./@core/core.setNode"
|
|
30
|
+
import { getEvents } from "./@core/core.getEvents"
|
|
31
|
+
import { getNodes } from "./@core/core.getNodes"
|
|
133
32
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* @description
|
|
137
|
-
* Registers a callback for a specific event and returns a function
|
|
138
|
-
* to unregister the listener.
|
|
139
|
-
*
|
|
140
|
-
* @param {string} event
|
|
141
|
-
* @param {(...args: any[]) => void} callback
|
|
142
|
-
* @returns {() => void}
|
|
143
|
-
*/
|
|
144
|
-
public on(event: string, callback: (...args: any[]) => void): () => void {
|
|
145
|
-
loader.cache.events.on(event, callback);
|
|
146
|
-
return () => loader.cache.events.off(event, callback);
|
|
147
|
-
}
|
|
33
|
+
export class Manager {
|
|
34
|
+
constructor(settings: TypeSettings) { this.trycatch();startService(settings) }
|
|
148
35
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
* @description
|
|
152
|
-
* Initializes the client with the provided settings, starts the NWWS XMPP
|
|
153
|
-
* session if applicable, loads cached messages, and sets up scheduled
|
|
154
|
-
* tasks (cron jobs) for ongoing processing.
|
|
155
|
-
*
|
|
156
|
-
* @async
|
|
157
|
-
* @param {types.ClientSettingsTypes} metadata
|
|
158
|
-
* @returns {Promise<void>}
|
|
159
|
-
*/
|
|
160
|
-
public async start(metadata: types.ClientSettingsTypes): Promise<void> {
|
|
161
|
-
if (!loader.cache.isReady) {
|
|
162
|
-
Utils.warn(loader.definitions.messages.not_ready);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this.setSettings(metadata);
|
|
166
|
-
const settings = loader.settings as types.ClientSettingsTypes;
|
|
167
|
-
this.isNoaaWeatherWireService = settings.is_wire;
|
|
168
|
-
loader.cache.isReady = false;
|
|
169
|
-
await Database.loadDatabase();
|
|
170
|
-
if (this.isNoaaWeatherWireService) {
|
|
171
|
-
(async () => {
|
|
172
|
-
try {
|
|
173
|
-
await Xmpp.deploySession();
|
|
174
|
-
await Database.loadCollectionCache();
|
|
175
|
-
} catch (err: unknown) {
|
|
176
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
177
|
-
Utils.warn(`Failed to initialize NWWS services: ${msg}`);
|
|
178
|
-
}
|
|
179
|
-
})();
|
|
180
|
-
}
|
|
181
|
-
Utils.handleCronJob(this.isNoaaWeatherWireService);
|
|
182
|
-
if (this.job) {
|
|
183
|
-
try { this.job.stop(); } catch { Utils.warn(`Failed to stop existing cron job.`); }
|
|
184
|
-
this.job = null;
|
|
185
|
-
}
|
|
186
|
-
const interval = !this.isNoaaWeatherWireService ? settings.national_weather_service_settings.interval : 5;
|
|
187
|
-
this.job = new loader.packages.jobs.Cron(`*/${interval} * * * * *`, () => {
|
|
188
|
-
Utils.handleCronJob(this.isNoaaWeatherWireService);
|
|
189
|
-
});
|
|
36
|
+
on(event: string, callback: () => void) {
|
|
37
|
+
listener(event, callback)
|
|
190
38
|
}
|
|
191
39
|
|
|
192
|
-
|
|
193
|
-
* @function stop
|
|
194
|
-
* @description
|
|
195
|
-
* Stops active scheduled tasks (cron job) and, if connected, the NWWS
|
|
196
|
-
* XMPP session. Updates relevant cache flags to indicate the session
|
|
197
|
-
* is no longer active.
|
|
198
|
-
*
|
|
199
|
-
* @async
|
|
200
|
-
* @returns {Promise<void>}
|
|
201
|
-
*/
|
|
202
|
-
public async stop(): Promise<void> {
|
|
203
|
-
loader.cache.isReady = true;
|
|
204
|
-
if (this.job) {
|
|
205
|
-
try { this.job.stop(); } catch { Utils.warn(`Failed to stop cron job.`); }
|
|
206
|
-
this.job = null;
|
|
207
|
-
}
|
|
208
|
-
const session = loader.cache.session;
|
|
209
|
-
if (session && this.isNoaaWeatherWireService) {
|
|
210
|
-
try { await session.stop(); } catch { Utils.warn(`Failed to stop XMPP session.`); }
|
|
211
|
-
loader.cache.sigHalt = true;
|
|
212
|
-
loader.cache.isConnected = false;
|
|
213
|
-
loader.cache.session = null;
|
|
214
|
-
this.isNoaaWeatherWireService = false;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* @function sigCatch
|
|
220
|
-
* @description
|
|
221
|
-
* Sets up a global handler for uncaught exceptions, ignoring specific error codes
|
|
222
|
-
*
|
|
223
|
-
* @async
|
|
224
|
-
* @returns void
|
|
225
|
-
*/
|
|
226
|
-
private sigCatch() {
|
|
40
|
+
trycatch() {
|
|
227
41
|
process.on('uncaughtException', (err: any) => {
|
|
228
42
|
const ignored = ['ETIMEDOUT', 'ECONNRESET', 'EHOSTUNREACH', 'STARTTLS_FAILURE'];
|
|
229
43
|
if (ignored.includes(err?.code)) {
|
|
230
|
-
|
|
44
|
+
setEventEmit({
|
|
45
|
+
event: `onXMPPStatus`,
|
|
46
|
+
metadata: {
|
|
47
|
+
message: `XMPP Critical Error: ${err?.code ?? 'Unknown error code'}. This may indicate a connection issue. Attempting to continue...`,
|
|
48
|
+
data: {},
|
|
49
|
+
type: `error`,
|
|
50
|
+
error: true
|
|
51
|
+
}
|
|
52
|
+
})
|
|
231
53
|
return;
|
|
232
54
|
}
|
|
233
|
-
|
|
55
|
+
setWarning({message: `Uncaught Exception: ${err instanceof Error ? err.stack || err.message : String(err)}`})
|
|
234
56
|
})
|
|
235
57
|
}
|
|
236
58
|
}
|
|
237
59
|
|
|
238
60
|
export default Manager;
|
|
239
|
-
export
|
|
240
|
-
|
|
61
|
+
export {
|
|
62
|
+
setSettings,
|
|
63
|
+
getEventGeometry,
|
|
64
|
+
getCleanedEvent,
|
|
65
|
+
stopService,
|
|
66
|
+
startService,
|
|
67
|
+
setNode,
|
|
68
|
+
getEvents,
|
|
69
|
+
getNodes,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type { TypeSettings } from './@types/types.settings'
|
package/test.js
CHANGED
|
@@ -1,62 +1,78 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { Manager, setSettings, getSettings, getListener } = require(`../dist/cjs/index.cjs`)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const parser = new AlertManager({
|
|
3
|
+
const NOAAWeatherWireService = new Manager({
|
|
5
4
|
database: `shapefile-manager.db`,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
EnableWireService: true,
|
|
6
|
+
EnableJournal: false,
|
|
7
|
+
NOAAWeatherWireServiceSettings: {
|
|
8
|
+
ReconnectionSettings: {
|
|
9
|
+
Enabled: true,
|
|
10
|
+
ReconnectionInterval: 60,
|
|
12
11
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
CredentialSettings: {
|
|
13
|
+
Username: `username_here`,
|
|
14
|
+
Password: `password_here`,
|
|
15
|
+
Nickname: "nick_name_here (@atmosx/event-product-parser/3.0)",
|
|
17
16
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
CacheSettings: {
|
|
18
|
+
Enabled: true,
|
|
19
|
+
MaxDatabaseHistory: 15000,
|
|
20
|
+
MaxRetentionHistory: 500,
|
|
22
21
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
cap_only: false,
|
|
22
|
+
StanzaSettings: {
|
|
23
|
+
DisableUGC: false,
|
|
24
|
+
DisableVTEC: false,
|
|
25
|
+
DisableText: false,
|
|
28
26
|
}
|
|
29
27
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
NationalWeatherServiceSettings: {
|
|
29
|
+
CallbackInterval: 15,
|
|
30
|
+
EventsEndpoint: `https://api.weather.gov/alerts/active`,
|
|
33
31
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
GlobalSettings: {
|
|
33
|
+
BetterEventNames: true,
|
|
34
|
+
DisableGeometryParsing: false,
|
|
35
|
+
UseShapefileCoordinates: true,
|
|
36
|
+
EventFiltering: {
|
|
37
|
+
ListeningEvents: [
|
|
38
|
+
"Tornado Emergency", "PDS Tornado Warning", "Tornado Warning",
|
|
39
|
+
"Confirmed Tornado Warning", "Radar Indicated Tornado Warning",
|
|
40
|
+
"Special Marine Warning (TPROB)", "PDS Tornado Watch", "Tornado Watch",
|
|
41
|
+
"EDS Severe Thunderstorm Warning (TPROB)", "EDS Severe Thunderstorm Warning",
|
|
42
|
+
"Destructive Severe Thunderstorm Warning (TPROB)", "Destructive Severe Thunderstorm Warning",
|
|
43
|
+
"Considerable Severe Thunderstorm Warning (TPROB)", "Considerable Severe Thunderstorm Warning",
|
|
44
|
+
"Severe Thunderstorm Warning (TPROB)", "Severe Thunderstorm Warning",
|
|
45
|
+
"Severe Thunderstorm Watch",
|
|
46
|
+
"Flash Flood Emergency", "Flash Flood Warning",
|
|
47
|
+
"Flash Flood Watch",
|
|
48
|
+
"Tsunami Warning", "Tsunami Watch",
|
|
49
|
+
"Tsunami Advisory", "Special Marine Warning",
|
|
50
|
+
"Earthquake Warning",
|
|
51
|
+
"Hurricane Warning", "Hurricane Watch",
|
|
52
|
+
"Tropical Storm Warning",
|
|
53
|
+
"Winter Storm Warning", "Blizzard Warning",
|
|
54
|
+
"Ice Storm Warning", "Snow Squall Warning",
|
|
55
|
+
"Winter Weather Advisory", "Extreme Cold Watch"
|
|
56
|
+
],
|
|
57
|
+
ListeningICAO: [],
|
|
58
|
+
IgnoredICAO: [],
|
|
59
|
+
IgnoredEvents: [],
|
|
60
|
+
ListeningUGC: [],
|
|
61
|
+
ListeningStates: [],
|
|
62
|
+
IgnoreTestProducts: true,
|
|
48
63
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
EASSettings: {
|
|
65
|
+
ArchiveDirectory: null,
|
|
66
|
+
IntroWavFile: null,
|
|
52
67
|
}
|
|
53
68
|
}
|
|
54
69
|
})
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
71
|
+
|
|
72
|
+
NOAAWeatherWireService.on(`log`, (data) => {
|
|
73
|
+
console.log(data)
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
NOAAWeatherWireService.on(`onEventStatus`, (data) => {
|
|
77
|
+
console.log(`[${data.type}]: ${data.event.properties.event} (${data.event.properties.status}) (${data.event.properties.metadata.tracking})`)
|
|
78
|
+
})
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
_ _ __ __
|
|
3
|
-
/\ | | | | (_) \ \ / /
|
|
4
|
-
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
-
/ /\ \| __| "_ ` _ \ / _ \/ __| "_ \| "_ \ / _ \ "__| |/ __| > <
|
|
6
|
-
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
-
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
-
| |
|
|
9
|
-
|_|
|
|
10
|
-
|
|
11
|
-
Written by: KiyoWx (k3yomi)
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export const events: Record<string, string> = {
|
|
15
|
-
"AF": "Ashfall",
|
|
16
|
-
"AS": "Air Stagnation",
|
|
17
|
-
"BH": "Beach Hazard",
|
|
18
|
-
"BW": "Brisk Wind",
|
|
19
|
-
"BZ": "Blizzard",
|
|
20
|
-
"CF": "Coastal Flood",
|
|
21
|
-
"DF": "Debris Flow",
|
|
22
|
-
"DS": "Dust Storm",
|
|
23
|
-
"EC": "Extreme Cold",
|
|
24
|
-
"EH": "Excessive Heat",
|
|
25
|
-
"XH": "Extreme Heat",
|
|
26
|
-
"EW": "Extreme Wind",
|
|
27
|
-
"FA": "Areal Flood",
|
|
28
|
-
"FF": "Flash Flood",
|
|
29
|
-
"FG": "Dense Fog",
|
|
30
|
-
"FL": "Flood",
|
|
31
|
-
"FR": "Frost",
|
|
32
|
-
"FW": "Fire Weather",
|
|
33
|
-
"FZ": "Freeze",
|
|
34
|
-
"GL": "Gale",
|
|
35
|
-
"HF": "Hurricane Force Wind",
|
|
36
|
-
"HT": "Heat",
|
|
37
|
-
"HU": "Hurricane",
|
|
38
|
-
"HW": "High Wind",
|
|
39
|
-
"HY": "Hydrologic",
|
|
40
|
-
"HZ": "Hard Freeze",
|
|
41
|
-
"IS": "Ice Storm",
|
|
42
|
-
"LE": "Lake Effect Snow",
|
|
43
|
-
"LO": "Low Water",
|
|
44
|
-
"LS": "Lakeshore Flood",
|
|
45
|
-
"LW": "Lake Wind",
|
|
46
|
-
"MA": "Special Marine",
|
|
47
|
-
"EQ": "Earthquake",
|
|
48
|
-
"MF": "Dense Fog",
|
|
49
|
-
"MH": "Ashfall",
|
|
50
|
-
"MS": "Dense Smoke",
|
|
51
|
-
"RB": "Small Craft for Rough Bar",
|
|
52
|
-
"RP": "Rip Current Risk",
|
|
53
|
-
"SC": "Small Craft",
|
|
54
|
-
"SE": "Hazardous Seas",
|
|
55
|
-
"SI": "Small Craft for Winds",
|
|
56
|
-
"SM": "Dense Smoke",
|
|
57
|
-
"SQ": "Snow Squall",
|
|
58
|
-
"SR": "Storm",
|
|
59
|
-
"SS": "Storm Surge",
|
|
60
|
-
"SU": "High Surf",
|
|
61
|
-
"SV": "Severe Thunderstorm",
|
|
62
|
-
"SW": "Small Craft for Hazardous Seas",
|
|
63
|
-
"TO": "Tornado",
|
|
64
|
-
"TR": "Tropical Storm",
|
|
65
|
-
"TS": "Tsunami",
|
|
66
|
-
"TY": "Typhoon",
|
|
67
|
-
"SP": "Special Weather",
|
|
68
|
-
"UP": "Heavy Freezing Spray",
|
|
69
|
-
"WC": "Wind Chill",
|
|
70
|
-
"WI": "Wind",
|
|
71
|
-
"WS": "Winter Storm",
|
|
72
|
-
"WW": "Winter Weather",
|
|
73
|
-
"ZF": "Freezing Fog",
|
|
74
|
-
"ZR": "Freezing Rain",
|
|
75
|
-
"ZY": "Freezing Spray"
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const offshore: Record<string, string> = {
|
|
79
|
-
"Special Weather Statement": "Special Weather Statement",
|
|
80
|
-
"Hurricane Warning": "Hurricane Warning",
|
|
81
|
-
"Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
|
|
82
|
-
"Hurricane Watch": "Hurricane Watch",
|
|
83
|
-
"Tropical Storm Warning": "Tropical Storm Warning",
|
|
84
|
-
"Tropical Storm Watch": "Tropical Storm Watch",
|
|
85
|
-
"High Wind Warning": "High Wind Warning",
|
|
86
|
-
"Gale Warning": "Gale Warning",
|
|
87
|
-
"Small Craft Advisory": "Small Craft Advisory",
|
|
88
|
-
"Small Craft Warning": "Small Craft Warning",
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export const actions: Record<string, string> = {
|
|
92
|
-
"W": "Warning",
|
|
93
|
-
"F": "Forecast",
|
|
94
|
-
"A": "Watch",
|
|
95
|
-
"O": "Outlook",
|
|
96
|
-
"Y": "Advisory",
|
|
97
|
-
"N": "Synopsis",
|
|
98
|
-
"S": "Statement"
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export const status: Record<string, string> = {
|
|
103
|
-
"NEW": "Issued",
|
|
104
|
-
"CON": "Updated",
|
|
105
|
-
"EXT": "Extended",
|
|
106
|
-
"EXA": "Extended",
|
|
107
|
-
"EXB": "Extended",
|
|
108
|
-
"UPG": "Upgraded",
|
|
109
|
-
"COR": "Correction",
|
|
110
|
-
"ROU": "Routine",
|
|
111
|
-
"CAN": "Cancelled",
|
|
112
|
-
"EXP": "Expired"
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export const types: Record<string, string> = {
|
|
116
|
-
"O": "Operational Product",
|
|
117
|
-
"T": "Test Product",
|
|
118
|
-
"E": "Experimental Product",
|
|
119
|
-
"X": "Experimental Product (Non-Operational)",
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export const status_correlations: {type: string, forward: string, cancel: boolean, update: boolean, new: boolean}[] = [
|
|
123
|
-
{type: "Update", forward: "Updated", cancel: false, update: true, new: false},
|
|
124
|
-
{type: "Cancel", forward: "Cancelled", cancel: true, update: false, new: false},
|
|
125
|
-
{type: "Alert", forward: "Issued", cancel: false, update: false, new: true},
|
|
126
|
-
{type: "Updated", forward: "Updated", cancel: false, update: true, new: false},
|
|
127
|
-
{type: "Expired", forward: "Expired", cancel: true, update: false, new: false},
|
|
128
|
-
{type: "Issued", forward: "Issued", cancel: false, update: false, new: true},
|
|
129
|
-
{type: "Extended", forward: "Updated", cancel: false, update: true, new: false},
|
|
130
|
-
{type: "Correction", forward: "Updated", cancel: false, update: true, new: false},
|
|
131
|
-
{type: "Upgraded", forward: "Upgraded", cancel: false, update: true, new: false},
|
|
132
|
-
{type: "Cancelled", forward: "Cancelled", cancel: true, update: false, new: false},
|
|
133
|
-
{type: "Routine", forward: "Routine", cancel: false, update: true, new: false},
|
|
134
|
-
]
|
|
135
|
-
|
|
136
|
-
export const causes : Record<string, string> = {
|
|
137
|
-
"SM": "Snow Melt",
|
|
138
|
-
"RS": "Rain/Snow Melt",
|
|
139
|
-
"ER": "Excessive Rain",
|
|
140
|
-
"DM": "Dam/Levee Failure",
|
|
141
|
-
"IJ": "Ice Jam",
|
|
142
|
-
"GO": "Glacier Lake Outburst",
|
|
143
|
-
"IC": "Ice",
|
|
144
|
-
"FS": "Flash Flood / Storm Surge",
|
|
145
|
-
"FT": "Tidal Effects",
|
|
146
|
-
"ET": "Elevated Upstream Flow",
|
|
147
|
-
"MC": "Other Multiple Causes",
|
|
148
|
-
"WT": "Wind and/or Tidal Effects",
|
|
149
|
-
"DR": "Reservoir Release",
|
|
150
|
-
"UU": "Unknown",
|
|
151
|
-
"OT": "Other Effects"
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export const records: Record<string, string> = {
|
|
155
|
-
"NO": "No Record Expected",
|
|
156
|
-
"NR": "Near Record or possible record",
|
|
157
|
-
"UU": "Unknown history of records",
|
|
158
|
-
"OO": "Other",
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export const severity: Record<string, string> = {
|
|
162
|
-
N: "Not Expected",
|
|
163
|
-
0: "Areal Flood or FF Product",
|
|
164
|
-
1: "Minor",
|
|
165
|
-
2: "Moderate",
|
|
166
|
-
3: "Major",
|
|
167
|
-
U: "Unknown",
|
|
168
|
-
}
|