@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
|
@@ -0,0 +1,35 @@
|
|
|
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 { TypeAttributes } from "./types.attributes"
|
|
21
|
+
|
|
22
|
+
export type TypeStanzaCompiled = {
|
|
23
|
+
message?: string
|
|
24
|
+
attributes?: TypeAttributes
|
|
25
|
+
isCapEvent?: boolean
|
|
26
|
+
isVTEC?: boolean
|
|
27
|
+
isUGC?: boolean
|
|
28
|
+
isCapAreaDescription?: boolean
|
|
29
|
+
isIgnored?: boolean
|
|
30
|
+
isNWWS?: boolean
|
|
31
|
+
getType?: {
|
|
32
|
+
type: string
|
|
33
|
+
prefix: string
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -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
|
+
export type TypeHash = {
|
|
21
|
+
tracking: string
|
|
22
|
+
hashes: string[]
|
|
23
|
+
expires: string
|
|
24
|
+
}
|
|
@@ -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 type TypeHVTEC = {
|
|
21
|
+
hvtec: string
|
|
22
|
+
severity: string
|
|
23
|
+
cause: string
|
|
24
|
+
record: string
|
|
25
|
+
}
|
|
@@ -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 type TypePVTEC = {
|
|
21
|
+
vtec: string
|
|
22
|
+
product: string
|
|
23
|
+
tracking: string
|
|
24
|
+
event: string
|
|
25
|
+
status: string
|
|
26
|
+
organization: string
|
|
27
|
+
expires: string
|
|
28
|
+
prediction_center: boolean
|
|
29
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 type TypeSettings = {
|
|
21
|
+
Database: string
|
|
22
|
+
EnableWireService: boolean
|
|
23
|
+
EnableJournal: boolean
|
|
24
|
+
NOAAWeatherWireServiceSettings: {
|
|
25
|
+
ReconnectionSettings: {
|
|
26
|
+
Enabled: boolean
|
|
27
|
+
ReconnectionInterval: number
|
|
28
|
+
}
|
|
29
|
+
CredentialSettings: {
|
|
30
|
+
Username: string | void
|
|
31
|
+
Password: string | void
|
|
32
|
+
Nickname: string | void
|
|
33
|
+
}
|
|
34
|
+
CacheSettings: {
|
|
35
|
+
Enabled: boolean
|
|
36
|
+
MaxDatabaseHistory: number
|
|
37
|
+
MaxRetentionHistory: number
|
|
38
|
+
}
|
|
39
|
+
StanzaSettings: {
|
|
40
|
+
DisableUGC: boolean
|
|
41
|
+
DisableVTEC: boolean
|
|
42
|
+
DisableText: boolean
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
NationalWeatherServiceSettings: {
|
|
46
|
+
CallbackInterval: number
|
|
47
|
+
EventsEndpoint: string
|
|
48
|
+
}
|
|
49
|
+
GlobalSettings: {
|
|
50
|
+
BetterEventNames: boolean
|
|
51
|
+
DisableGeometryParsing: boolean
|
|
52
|
+
UseShapefileCoordinates: boolean
|
|
53
|
+
ShapefileSkipPoints: number
|
|
54
|
+
NodeTTL: number
|
|
55
|
+
NodeMinDistance: number
|
|
56
|
+
EventFiltering: {
|
|
57
|
+
ListeningEvents: string[]
|
|
58
|
+
ListeningICAO: string[]
|
|
59
|
+
IgnoredICAO: string[]
|
|
60
|
+
IgnoredEvents: string[]
|
|
61
|
+
ListeningUGC: string[]
|
|
62
|
+
ListeningStates: string[]
|
|
63
|
+
NodeLocationFiltering: boolean
|
|
64
|
+
IgnoreTestProducts: boolean
|
|
65
|
+
},
|
|
66
|
+
EASSettings: {
|
|
67
|
+
ArchiveDirectory: string | void,
|
|
68
|
+
IntroWavFile: string | void,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 type TypeStanza = {
|
|
21
|
+
getChild(arg0: string): unknown
|
|
22
|
+
is(arg0: string): unknown
|
|
23
|
+
name: string
|
|
24
|
+
parent: TypeStanza | null
|
|
25
|
+
children: any
|
|
26
|
+
attrs: {
|
|
27
|
+
xmlns: string
|
|
28
|
+
id: string
|
|
29
|
+
issue: string
|
|
30
|
+
ttaaii: string
|
|
31
|
+
cccc: string
|
|
32
|
+
awipsid: string
|
|
33
|
+
from: string
|
|
34
|
+
to: string
|
|
35
|
+
type: string
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -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
|
+
export type TypeUGC = {
|
|
21
|
+
zones: string[]
|
|
22
|
+
locations: string[]
|
|
23
|
+
expires: string
|
|
24
|
+
}
|
package/src/bootstrap.ts
CHANGED
|
@@ -1,183 +1,101 @@
|
|
|
1
1
|
/*
|
|
2
|
-
|
|
2
|
+
_ _ _ __ __
|
|
3
3
|
/\ | | | | (_) \ \ / /
|
|
4
4
|
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
5
|
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
6
|
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
7
|
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
-
| |
|
|
8
|
+
| |
|
|
9
9
|
|_|
|
|
10
|
-
|
|
11
|
-
Written by: k3yomi@GitHub
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import * as fs from 'fs';
|
|
15
|
-
import * as path from 'path';
|
|
16
|
-
import * as events from 'events';
|
|
17
|
-
import * as xmpp from '@xmpp/client';
|
|
18
|
-
import * as shapefile from 'shapefile';
|
|
19
|
-
import * as xml2js from 'xml2js';
|
|
20
|
-
import * as jobs from 'croner';
|
|
21
|
-
import * as polygonClipping from 'polygon-clipping';
|
|
22
|
-
import sqlite3 from 'better-sqlite3';
|
|
23
|
-
import axios from 'axios';
|
|
24
|
-
import crypto from 'crypto';
|
|
25
|
-
import os from 'os';
|
|
26
|
-
import say from 'say';
|
|
27
|
-
import child from 'child_process';
|
|
28
|
-
import jszip from 'jszip';
|
|
29
|
-
|
|
30
10
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
35
15
|
|
|
16
|
+
Internal Package: @atmosx/event-product-parser
|
|
36
17
|
|
|
18
|
+
*/
|
|
37
19
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
shapefile, xml2js, sqlite3, jobs, axios,
|
|
41
|
-
crypto, os, say, child, polygonClipping, jszip
|
|
42
|
-
};
|
|
20
|
+
import path from 'path'
|
|
21
|
+
import { EventEmitter } from 'node:events';
|
|
43
22
|
|
|
44
|
-
export const
|
|
23
|
+
export const bootstrap = {
|
|
45
24
|
isReady: true,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
totalLocationWarns: 0,
|
|
56
|
-
events: new events.EventEmitter(),
|
|
57
|
-
isProcessingAudioQueue: false,
|
|
58
|
-
audioQueue: [],
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const settings = {
|
|
62
|
-
database: path.join(process.cwd(), 'shapefiles.db'),
|
|
63
|
-
is_wire: true,
|
|
64
|
-
journal: true,
|
|
65
|
-
noaa_weather_wire_service_settings: {
|
|
66
|
-
reconnection_settings: {
|
|
67
|
-
enabled: true,
|
|
68
|
-
interval: 60,
|
|
69
|
-
},
|
|
70
|
-
credentials: {
|
|
71
|
-
username: null,
|
|
72
|
-
password: null,
|
|
73
|
-
nickname: "AtmosphericX Standalone Parser",
|
|
74
|
-
},
|
|
75
|
-
cache: {
|
|
76
|
-
enabled: true,
|
|
77
|
-
max_db_history: 5000,
|
|
78
|
-
max_db_cache_size: 1000,
|
|
79
|
-
},
|
|
80
|
-
preferences: {
|
|
81
|
-
disable_ugc: false,
|
|
82
|
-
disable_vtec: false,
|
|
83
|
-
disable_text: false,
|
|
84
|
-
cap_only: false,
|
|
85
|
-
}
|
|
25
|
+
ratelimits: {},
|
|
26
|
+
session_xmpp: null,
|
|
27
|
+
database: null,
|
|
28
|
+
cron: null,
|
|
29
|
+
listener: new EventEmitter(),
|
|
30
|
+
ansi_colors: {
|
|
31
|
+
RED: `\x1b[31m`, GREEN: `\x1b[32m`, YELLOW: `\x1b[33m`,
|
|
32
|
+
BLUE: `\x1b[34m`, MAGENTA: `\x1b[35m`, CYAN: `\x1b[36m`,
|
|
33
|
+
WHITE: `\x1b[37m`, RESET: `\x1b[0m`
|
|
86
34
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
35
|
+
cache: {
|
|
36
|
+
lastStanza: null,
|
|
37
|
+
lastConnect: null,
|
|
38
|
+
isConnected: false,
|
|
39
|
+
isReconnecting: false,
|
|
40
|
+
tReconnects: 0,
|
|
41
|
+
sigHault: false,
|
|
42
|
+
events: {type: "FeatureCollection", features: []},
|
|
43
|
+
nodes: {type: "FeatureCollection", features: []},
|
|
44
|
+
hashes: [],
|
|
90
45
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
46
|
+
settings: {
|
|
47
|
+
Database: path.join(process.cwd(), 'shapefiles.db'),
|
|
48
|
+
EnableWireService: true,
|
|
49
|
+
EnableJournal: true,
|
|
50
|
+
NOAAWeatherWireServiceSettings: {
|
|
51
|
+
ReconnectionSettings: {
|
|
52
|
+
Enabled: true,
|
|
53
|
+
ReconnectionInterval: 60,
|
|
54
|
+
},
|
|
55
|
+
CredentialSettings: {
|
|
56
|
+
Username: null,
|
|
57
|
+
Password: null,
|
|
58
|
+
Nickname: "@atmosx/event-product-parser/3.0",
|
|
59
|
+
},
|
|
60
|
+
CacheSettings: {
|
|
61
|
+
Enabled: true,
|
|
62
|
+
MaxDatabaseHistory: 5000,
|
|
63
|
+
MaxRetentionHistory: 1000,
|
|
64
|
+
},
|
|
65
|
+
StanzaSettings: {
|
|
66
|
+
DisableUGC: false,
|
|
67
|
+
DisableVTEC: false,
|
|
68
|
+
DisableText: false,
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
NationalWeatherServiceSettings: {
|
|
72
|
+
CallbackInterval: 15,
|
|
73
|
+
EventsEndpoint: `https://api.weather.gov/alerts/active`,
|
|
106
74
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
75
|
+
GlobalSettings: {
|
|
76
|
+
BetterEventNames: true,
|
|
77
|
+
DisableGeometryParsing: false,
|
|
78
|
+
UseShapefileCoordinates: false,
|
|
79
|
+
ShapefileSkipPoints: 15,
|
|
80
|
+
NodeTTL: 60,
|
|
81
|
+
NodeMinDistance: 120,
|
|
82
|
+
EventFiltering: {
|
|
83
|
+
ListeningEvents: [],
|
|
84
|
+
ListeningICAO: [],
|
|
85
|
+
IgnoredICAO: [],
|
|
86
|
+
IgnoredEvents: [`Xx`, `Test Message`],
|
|
87
|
+
ListeningUGC: [],
|
|
88
|
+
ListeningStates: [],
|
|
89
|
+
NodeLocationFiltering: false,
|
|
90
|
+
IgnoreTestProducts: true,
|
|
91
|
+
},
|
|
92
|
+
EASSettings: {
|
|
93
|
+
ArchiveDirectory: null,
|
|
94
|
+
IntroWavFile: null,
|
|
95
|
+
}
|
|
110
96
|
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
113
100
|
|
|
114
101
|
|
|
115
|
-
export const definitions = {
|
|
116
|
-
events: dictEvents.events,
|
|
117
|
-
actions: dictEvents.actions,
|
|
118
|
-
status: dictEvents.status,
|
|
119
|
-
productTypes: dictEvents.types,
|
|
120
|
-
correlations: dictEvents.status_correlations,
|
|
121
|
-
offshore: dictEvents.offshore,
|
|
122
|
-
awips: dictAwips.awips,
|
|
123
|
-
causes: dictEvents.causes,
|
|
124
|
-
records: dictEvents.records,
|
|
125
|
-
severity: dictEvents.severity,
|
|
126
|
-
cancelSignatures: dictSignatures.cancel_signatures,
|
|
127
|
-
messageSignatures: dictSignatures.message_signatures,
|
|
128
|
-
tags: dictSignatures.tags,
|
|
129
|
-
ICAO: dictICAOs.icaos,
|
|
130
|
-
enhancedEvents: [
|
|
131
|
-
{"Tornado Warning": {
|
|
132
|
-
"Tornado Emergency": { description: "tornado emergency", condition: (tornadoThreatTag: string) => tornadoThreatTag === 'OBSERVED'},
|
|
133
|
-
"PDS Tornado Warning": { description: "particularly dangerous situation", condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE'},
|
|
134
|
-
"Confirmed Tornado Warning": { condition: (tornadoThreatTag: string) => tornadoThreatTag === 'OBSERVED'},
|
|
135
|
-
"Radar Indicated Tornado Warning": {condition: (tornadoThreatTag: string) => tornadoThreatTag !== 'OBSERVED'},
|
|
136
|
-
}},
|
|
137
|
-
{"Special Marine Warning": {
|
|
138
|
-
"Tornadic Special Marine Warning": {condition: (tornadoThreatTag: string) => tornadoThreatTag === 'POSSIBLE'},
|
|
139
|
-
}},
|
|
140
|
-
{"Tornado Watch": {
|
|
141
|
-
"PDS Tornado Watch": { description: "particularly dangerous situation"}
|
|
142
|
-
}},
|
|
143
|
-
{"Flash Flood Warning": {
|
|
144
|
-
"Flash Flood Emergency": { description: "flash flood emergency", },
|
|
145
|
-
"Considerable Flash Flood Warning": { condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE' },
|
|
146
|
-
}},
|
|
147
|
-
{"Severe Thunderstorm Warning": {
|
|
148
|
-
"EDS Severe Thunderstorm Warning": {description: "extremely dangerous situation"},
|
|
149
|
-
"Destructive Severe Thunderstorm Warning": {condition: (damageThreatTag: string) => damageThreatTag === 'DESTRUCTIVE'},
|
|
150
|
-
"Considerable Severe Thunderstorm Warning": {condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE'},
|
|
151
|
-
}},
|
|
152
|
-
],
|
|
153
|
-
shapefiles_directory: [
|
|
154
|
-
{name: "us_counties", id: "C", link: "https://www.weather.gov/source/gis/Shapefiles/County/c_16ap26.zip"},
|
|
155
|
-
{name: "us_states_territories", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/County/s_16ap26.zip"},
|
|
156
|
-
{name: "fire_weather_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/fz16ap26.zip"},
|
|
157
|
-
{name: "costal_marine_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/mz16ap26.zip"},
|
|
158
|
-
{name: "offshore_marine_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/oz16ap26.zip"},
|
|
159
|
-
{name: "public_forecast_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/z_16ap26.zip"},
|
|
160
|
-
{name: "county_warning_areas", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/w_16ap26.zip"},
|
|
161
|
-
{name: "river_forecast_boundaries", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/Misc/rf05mr24.zip"},
|
|
162
|
-
{name: "high_seas_marine_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/hz17fe26.zip"}
|
|
163
|
-
],
|
|
164
|
-
regular_expressions: {
|
|
165
|
-
pvtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
|
|
166
|
-
hvtec: new RegExp(`[a-zA-Z0-9]{4}.[A-Z0-9].[A-Z]{2}.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[A-Z]{2}`, "imu"),
|
|
167
|
-
wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
|
|
168
|
-
ugc1: new RegExp(`(\\w{2}[CZ](\\d{3}((-|>)\\s?(\\n\\n)?))+)`, "imu"),
|
|
169
|
-
ugc2: new RegExp(`(\\d{6}(-|>)\\s?(\\n\\n)?)`, "imu"),
|
|
170
|
-
ugc3: new RegExp(`(\\d{6})(?=-|$)`, "imu"),
|
|
171
|
-
dateline: new RegExp(`\\d{3,4}\\s*(AM|PM)?\\s*[A-Z]{2,4}\\s+[A-Z]{3,}\\s+[A-Z]{3,}\\s+\\d{1,2}\\s+\\d{4}`, "gim"),
|
|
172
|
-
},
|
|
173
|
-
messages: {
|
|
174
|
-
shapefile_creation: `DO NOT EXIT UNTIL THE SHAPEFILES ARE DONE COMPLETING! IF YOU CLOSE YOUR PROJECT, THE SHAPEFILES WILL NOT BE CREATED AND YOU WILL NEED TO DELETE ${settings.database} AND RESTART TO CREATE THEM AGAIN!`,
|
|
175
|
-
shapefile_creation_finished: `Shapefiles have finished completing and you can now use the parser.`,
|
|
176
|
-
not_ready: `You can not create another instance without shutting down the current one first, please make sure to call the stop() method first!`,
|
|
177
|
-
invalid_nickname: `The nickname you provided is invalid, please provide a valid nickname to continue.`,
|
|
178
|
-
eas_no_directory: `You have not set a directory for EAS audio files to be saved to, please set the 'directory' setting in the global settings to enable EAS audio generation.`,
|
|
179
|
-
reconnect_too_fast: `The client is attempting to reconnect too fast. This may be due to network instability. Reconnection attempt has been halted for safety.`,
|
|
180
|
-
dump_cache: `Found {count} cached events and will begin dumping them shortly. This may take a while depending on the number of cached events.`,
|
|
181
|
-
dump_cache_complete: `Completed dumping all cached alert files.`,
|
|
182
|
-
}
|
|
183
|
-
};
|