@atmosx/event-product-parser 2.0.16 → 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 -3105
- package/dist/esm/index.mjs +2233 -3108
- package/package.json +3 -2
- 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 -163
- 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 -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
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { createHash } from "crypto"
|
|
21
|
+
import { TypeEvent } from "../@types/type.event";
|
|
22
|
+
import { TypeSettings } from "../@types/types.settings";
|
|
23
|
+
import { bootstrap } from "../bootstrap"
|
|
24
|
+
import { getEventEnhancedName } from "./building.enhance";
|
|
25
|
+
import { getEventSignature } from "./building.signature"
|
|
26
|
+
import { mkEvent } from "../@manager/manager.mkEvent";
|
|
27
|
+
import { rmEvent } from "../@manager/manager.rmEvent";
|
|
28
|
+
import { getEventGeometry } from "./building.geometry";
|
|
29
|
+
import { updateNodes } from "../@manager/manager.updateNodes";
|
|
30
|
+
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
31
|
+
|
|
32
|
+
export const validateEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
33
|
+
if (events.length === 0) return;
|
|
34
|
+
const configurations = bootstrap.settings as TypeSettings
|
|
35
|
+
const sets = {} as Record<string, Set<string>>;
|
|
36
|
+
const bools = {} as Record<string, boolean>;
|
|
37
|
+
const megered = {...configurations.GlobalSettings, ...configurations.GlobalSettings.EventFiltering}
|
|
38
|
+
for (const key in megered) {
|
|
39
|
+
const setting = megered[key];
|
|
40
|
+
if (Array.isArray(setting)) { sets[key] = new Set(setting.map(item => item.toLowerCase())); }
|
|
41
|
+
if (typeof setting === 'boolean') { bools[key] = setting; }
|
|
42
|
+
}
|
|
43
|
+
const filterd = events.filter((event: TypeEvent) => {
|
|
44
|
+
const define = getEventSignature(event) as TypeEvent;
|
|
45
|
+
const properties = define.properties;
|
|
46
|
+
const zones = properties.geocode.ugc;
|
|
47
|
+
const icao = properties.geocode.office.office
|
|
48
|
+
const enhancedEventName = properties.event = getEventEnhancedName(event)
|
|
49
|
+
const filteredProperties = JSON.parse(JSON.stringify(properties)) as typeof properties;
|
|
50
|
+
if (filteredProperties?.metadata && 'ms' in filteredProperties.metadata) {
|
|
51
|
+
delete filteredProperties.metadata.ms;
|
|
52
|
+
}
|
|
53
|
+
filteredProperties.metadata = filteredProperties.metadata ?? {} as any;
|
|
54
|
+
filteredProperties.metadata.hash = createHash("sha256").update(JSON.stringify(filteredProperties)).digest("hex")
|
|
55
|
+
|
|
56
|
+
if (properties.status_metadata.is_test) {
|
|
57
|
+
setEventEmit({ event: `onTestProduct`, metadata: define })
|
|
58
|
+
if (bools?.IgnoreTestProducts) return false;
|
|
59
|
+
}
|
|
60
|
+
if (properties.status_metadata.is_expired) {
|
|
61
|
+
setEventEmit({ event: `onExpiredProduct`, metadata: define })
|
|
62
|
+
rmEvent(define)
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
setEventEmit({ event: `onProductType${enhancedEventName.replace(/\s+/g, '')}`, metadata: define });
|
|
66
|
+
for (const key in sets) {
|
|
67
|
+
const setting = sets[key]
|
|
68
|
+
if (key === 'ListeningEvents' && setting.size > 0 && !setting.has(define.properties.event.toLowerCase())) {
|
|
69
|
+
setEventEmit({
|
|
70
|
+
event: `onFilteredEvent`,
|
|
71
|
+
metadata: define
|
|
72
|
+
});
|
|
73
|
+
return false
|
|
74
|
+
}
|
|
75
|
+
if (key === 'IgnoredEvents' && setting.size > 0 && setting.has(define.properties.event.toLowerCase())) {
|
|
76
|
+
setEventEmit({
|
|
77
|
+
event: `onIgnoredEvent`,
|
|
78
|
+
metadata: define
|
|
79
|
+
});
|
|
80
|
+
return false
|
|
81
|
+
}
|
|
82
|
+
if (key === 'ListeningICAO' && setting.size > 0 && icao != null && !setting.has(icao.toLowerCase())) {
|
|
83
|
+
setEventEmit({
|
|
84
|
+
event: `onFilteredICAO`,
|
|
85
|
+
metadata: define
|
|
86
|
+
});
|
|
87
|
+
return false
|
|
88
|
+
}
|
|
89
|
+
if (key === 'IgnoredICAO' && setting.size > 0 && icao != null && setting.has(icao.toLowerCase())) {
|
|
90
|
+
setEventEmit({
|
|
91
|
+
event: `onIgnoredICAO`,
|
|
92
|
+
metadata: define
|
|
93
|
+
});
|
|
94
|
+
return false
|
|
95
|
+
}
|
|
96
|
+
if (key === 'ListeningUGC' && setting.size > 0 && zones.length > 0 && !zones.some((ugc: string) => setting.has(ugc.toLowerCase()))) {
|
|
97
|
+
setEventEmit({
|
|
98
|
+
event: `onFilteredUGC`,
|
|
99
|
+
metadata: define
|
|
100
|
+
});
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
if (key === 'ListeningStates' && setting.size > 0 && zones.length > 0 && !zones.some((ugc: string) => setting.has(ugc.substring(0, 2).toLowerCase()))) {
|
|
104
|
+
setEventEmit({
|
|
105
|
+
event: `onFilteredState`,
|
|
106
|
+
metadata: define
|
|
107
|
+
});
|
|
108
|
+
return false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return true;
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
if (!configurations?.GlobalSettings?.DisableGeometryParsing) {
|
|
116
|
+
for (const event of filterd) {
|
|
117
|
+
event.geometry = await getEventGeometry(event)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (filterd.length > 0) {
|
|
122
|
+
for (const event of filterd) {
|
|
123
|
+
await mkEvent(event)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
await updateNodes()
|
|
127
|
+
setEventEmit({
|
|
128
|
+
event: `onEventCache`,
|
|
129
|
+
metadata: bootstrap.cache.events,
|
|
130
|
+
limited: true
|
|
131
|
+
})
|
|
132
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { createEvent } from "../@building/building.create";
|
|
21
|
+
import { createHttp } from "../@modules/@utilities/utilities.createHttp";
|
|
22
|
+
import { TypeSettings } from "../@types/types.settings";
|
|
23
|
+
import { bootstrap } from "../bootstrap";
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export const callback = async (): Promise<void> => {
|
|
27
|
+
const settings = bootstrap.settings as TypeSettings;
|
|
28
|
+
const response = await createHttp({
|
|
29
|
+
url: settings.NationalWeatherServiceSettings.EventsEndpoint,
|
|
30
|
+
headers: {
|
|
31
|
+
"User-Agent": "@atmosx/event-product-parser"
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
if (response.error) return;
|
|
35
|
+
createEvent({
|
|
36
|
+
message: response.message,
|
|
37
|
+
isNWWS: false
|
|
38
|
+
})
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { bootstrap } from "../bootstrap";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export const getEvents = (): any => {
|
|
24
|
+
return bootstrap.cache.events
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { bootstrap } from "../bootstrap";
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export const getNodes = (): any => {
|
|
24
|
+
return bootstrap.cache.nodes
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { setListener } from "../@modules/@utilities/utilities.setListener";
|
|
21
|
+
|
|
22
|
+
export const listener = (event: string, callback: () => void) => {
|
|
23
|
+
setListener({event, callback})
|
|
24
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { bootstrap } from "../bootstrap";
|
|
21
|
+
import { setWarning } from "../@modules/@utilities/utilities.setWarning"
|
|
22
|
+
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
23
|
+
|
|
24
|
+
interface GetAddChaserOptions {
|
|
25
|
+
identifier: string
|
|
26
|
+
delete?: boolean
|
|
27
|
+
coordinates: { longitude: number; latitude: number }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const setNode = (options: GetAddChaserOptions) => {
|
|
31
|
+
const nodes = bootstrap.cache.nodes.features;
|
|
32
|
+
const exists = nodes.find((node) => node.properties.identifier === options.identifier);
|
|
33
|
+
if (options.delete) {
|
|
34
|
+
if (exists) {
|
|
35
|
+
const index = nodes.indexOf(exists);
|
|
36
|
+
nodes.splice(index, 1);
|
|
37
|
+
return setEventEmit({
|
|
38
|
+
event: `onNodeDelete`,
|
|
39
|
+
metadata: {
|
|
40
|
+
type: `node-delete`,
|
|
41
|
+
node: exists
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
return setWarning({ message: `Node with identifier '${options.identifier}' not found.` })
|
|
46
|
+
}
|
|
47
|
+
if (exists) {
|
|
48
|
+
const index = nodes.indexOf(exists);
|
|
49
|
+
nodes[index] = {
|
|
50
|
+
...exists,
|
|
51
|
+
geometry: {
|
|
52
|
+
type: "Point",
|
|
53
|
+
coordinates: [options.coordinates.longitude, options.coordinates.latitude]
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return setEventEmit({
|
|
57
|
+
event: `onNodeUpdate`,
|
|
58
|
+
metadata: {
|
|
59
|
+
type: `node-update`,
|
|
60
|
+
node: nodes[index]
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
nodes.push({
|
|
65
|
+
type: "Feature",
|
|
66
|
+
geometry: {
|
|
67
|
+
type: "Point",
|
|
68
|
+
coordinates: [options.coordinates.longitude, options.coordinates.latitude]
|
|
69
|
+
},
|
|
70
|
+
properties: {
|
|
71
|
+
identifier: options.identifier
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return setEventEmit({
|
|
75
|
+
event: `onNodeUpdate`,
|
|
76
|
+
metadata: {
|
|
77
|
+
type: `node-add`,
|
|
78
|
+
node: nodes[nodes.length - 1]
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { TypeSettings } from "../@types/types.settings";
|
|
21
|
+
import { bootstrap } from "../bootstrap";
|
|
22
|
+
import { setWarning } from "../@modules/@utilities/utilities.setWarning"
|
|
23
|
+
import { setSettings } from "../@modules/@utilities/utilities.setSettings"
|
|
24
|
+
import { xDeploy } from "../@modules/@xmpp/xmpp.xDeploy"
|
|
25
|
+
import { initializeDatabase } from "../@modules/@database/database.init";
|
|
26
|
+
import { getCachedEvents } from "../@modules/@database/database.cache";
|
|
27
|
+
import { setCronSchedule } from "../@modules/@utilities/utilities.setCronSchedule";
|
|
28
|
+
import { Cron } from "croner";
|
|
29
|
+
import { updateNodes } from "../@manager/manager.updateNodes";
|
|
30
|
+
|
|
31
|
+
export const startService = async (settings: TypeSettings): Promise<void> => {
|
|
32
|
+
if (!bootstrap.isReady) {
|
|
33
|
+
return setWarning({
|
|
34
|
+
message: `You can not create another instance without shutting down the current one first, please make sure to call the stop() method first!`
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
setSettings(settings);
|
|
38
|
+
bootstrap.isReady = true;
|
|
39
|
+
await initializeDatabase();
|
|
40
|
+
if (settings.EnableWireService) {
|
|
41
|
+
(async () => {
|
|
42
|
+
await getCachedEvents();
|
|
43
|
+
await xDeploy()
|
|
44
|
+
})();
|
|
45
|
+
}
|
|
46
|
+
await setCronSchedule()
|
|
47
|
+
const scheduleInterval = !settings.EnableWireService ? settings.NationalWeatherServiceSettings.CallbackInterval : 5;
|
|
48
|
+
bootstrap.cron = new Cron(`*/${scheduleInterval} * * * * *`, async () => {
|
|
49
|
+
await setCronSchedule();
|
|
50
|
+
})
|
|
51
|
+
bootstrap.cron = new Cron(`*/1 * * * * *`, async () => {
|
|
52
|
+
await updateNodes();
|
|
53
|
+
})
|
|
54
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { bootstrap } from "../bootstrap";
|
|
21
|
+
|
|
22
|
+
export const stopService = async (): Promise<void> => {
|
|
23
|
+
if (bootstrap.isReady) {
|
|
24
|
+
bootstrap.isReady = false;
|
|
25
|
+
if (bootstrap.session_xmpp) {
|
|
26
|
+
try { await bootstrap.session_xmpp.stop(); } catch {}
|
|
27
|
+
bootstrap.cache.isConnected = false;
|
|
28
|
+
bootstrap.cache.sigHault = true;
|
|
29
|
+
bootstrap.session_xmpp = null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
type EnhancedEventType = {
|
|
21
|
+
description?: string
|
|
22
|
+
append?: boolean
|
|
23
|
+
tornado?: string
|
|
24
|
+
damage?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const betterEventNames: Record<string, Record<string, EnhancedEventType>> = {
|
|
28
|
+
"Tornado Warning": {
|
|
29
|
+
"Tornado Emergency": {
|
|
30
|
+
description: "tornado emergency"
|
|
31
|
+
},
|
|
32
|
+
"PDS Tornado Warning": {
|
|
33
|
+
description: "particularly dangerous situation",
|
|
34
|
+
damage: `CONSIDERABLE`
|
|
35
|
+
},
|
|
36
|
+
"Confirmed Tornado Warning": {
|
|
37
|
+
tornado: `OBSERVED`
|
|
38
|
+
},
|
|
39
|
+
"Radar Indicated Tornado Warning": { },
|
|
40
|
+
},
|
|
41
|
+
"Special Marine Warning": {
|
|
42
|
+
"Special Marine Warning (TPROB)": {
|
|
43
|
+
tornado: `POSSIBLE`
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
"Tornado Watch": {
|
|
47
|
+
"PDS Tornado Watch": {
|
|
48
|
+
description: "particularly dangerous situation"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"Flash Flood Warning": {
|
|
52
|
+
"Flash Flood Emergency": {
|
|
53
|
+
description: "flash flood emergency"
|
|
54
|
+
},
|
|
55
|
+
"Considerable Flash Flood Warning": {
|
|
56
|
+
damage: `CONSIDERABLE`
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
"Severe Thunderstorm Warning": {
|
|
60
|
+
"EDS Severe Thunderstorm Warning (TPROB)": {
|
|
61
|
+
description: "extremely dangerous situation",
|
|
62
|
+
tornado: "POSSIBLE"
|
|
63
|
+
},
|
|
64
|
+
"EDS Severe Thunderstorm Warning": {
|
|
65
|
+
description: "extremely dangerous situation"
|
|
66
|
+
},
|
|
67
|
+
"Destructive Severe Thunderstorm Warning (TPROB)": {
|
|
68
|
+
damage: `DESTRUCTIVE`,
|
|
69
|
+
tornado: `POSSIBLE`
|
|
70
|
+
},
|
|
71
|
+
"Destructive Severe Thunderstorm Warning": {
|
|
72
|
+
damage: `DESTRUCTIVE`
|
|
73
|
+
},
|
|
74
|
+
"Considerable Severe Thunderstorm Warning (TPROB)": {
|
|
75
|
+
damage: `CONSIDERABLE`,
|
|
76
|
+
tornado: `POSSIBLE`
|
|
77
|
+
},
|
|
78
|
+
"Considerable Severe Thunderstorm Warning": {
|
|
79
|
+
damage: `CONSIDERABLE`
|
|
80
|
+
},
|
|
81
|
+
"Severe Thunderstorm Warning (TPROB)": {
|
|
82
|
+
tornado: `POSSIBLE`
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const eventActions: Record<string, string> = {
|
|
21
|
+
"W": "Warning",
|
|
22
|
+
"F": "Forecast",
|
|
23
|
+
"A": "Watch",
|
|
24
|
+
"O": "Outlook",
|
|
25
|
+
"Y": "Advisory",
|
|
26
|
+
"N": "Synopsis",
|
|
27
|
+
"S": "Statement"
|
|
28
|
+
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
/*
|
|
2
|
-
|
|
2
|
+
_ _ _ __ __
|
|
3
3
|
/\ | | | | (_) \ \ / /
|
|
4
4
|
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
-
/ /\ \| __|
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
6
|
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
7
|
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
-
| |
|
|
8
|
+
| |
|
|
9
9
|
|_|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
12
18
|
*/
|
|
13
19
|
|
|
14
|
-
export const
|
|
20
|
+
export const eventAwipAbreviations: Record<string, string> = {
|
|
15
21
|
ABV: `rawinsonde-data-above-100-millibars`,
|
|
16
22
|
ADA: `alarm-alert-administrative-message`,
|
|
17
23
|
ADM: `alert-administrative-message`,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const eventCancelMessages: string[] = [
|
|
21
|
+
"subsided sufficiently for the advisory to be cancelled",
|
|
22
|
+
"has been cancelled",
|
|
23
|
+
"will be allowed to expire",
|
|
24
|
+
"has diminished",
|
|
25
|
+
"and no longer",
|
|
26
|
+
"has been replaced",
|
|
27
|
+
"The threat has ended",
|
|
28
|
+
"has weakened below severe"
|
|
29
|
+
]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const eventCauses : Record<string, string> = {
|
|
21
|
+
"SM": "Snow Melt",
|
|
22
|
+
"RS": "Rain/Snow Melt",
|
|
23
|
+
"ER": "Excessive Rain",
|
|
24
|
+
"DM": "Dam/Levee Failure",
|
|
25
|
+
"IJ": "Ice Jam",
|
|
26
|
+
"GO": "Glacier Lake Outburst",
|
|
27
|
+
"IC": "Ice",
|
|
28
|
+
"FS": "Flash Flood / Storm Surge",
|
|
29
|
+
"FT": "Tidal Effects",
|
|
30
|
+
"ET": "Elevated Upstream Flow",
|
|
31
|
+
"MC": "Other Multiple Causes",
|
|
32
|
+
"WT": "Wind and/or Tidal Effects",
|
|
33
|
+
"DR": "Reservoir Release",
|
|
34
|
+
"UU": "Unknown",
|
|
35
|
+
"OT": "Other Effects"
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
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
|
|
15
|
+
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
export const eventProducts: Record<string, string> = {
|
|
21
|
+
"O": "Operational Product",
|
|
22
|
+
"T": "Test Product",
|
|
23
|
+
"E": "Experimental Product",
|
|
24
|
+
"X": "Experimental Product (Non-Operational)",
|
|
25
|
+
}
|