@atmosx/event-product-parser 3.0.6 → 3.0.7
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/.github/docs/docs-functions.md +2 -2
- package/.github/docs/docs-general-configurations.md +2 -12
- package/.github/docs/docs-integrations.md +4 -3
- package/.github/docs/docs-listeners.md +1 -1
- package/.github/docs/docs-source-configuration.md +1 -1
- package/.github/docs/docs-technical.md +1 -1
- package/{.github/README.md → README.md} +15 -9
- package/dist/cjs/index.cjs +24073 -7018
- package/dist/esm/index.mjs +24035 -6983
- package/package.json +56 -47
- package/pnpm-workspace.yaml +4 -0
- package/src/bootstrap.ts +64 -48
- package/src/{@building → building}/CreateEvent.ts +22 -24
- package/src/{@building → building}/GetCleanedEvent.ts +2 -2
- package/src/{@building → building}/GetEventAttachments.ts +14 -12
- package/src/building/GetEventDirection.ts +28 -0
- package/src/{@building → building}/GetEventEnhancedName.ts +5 -8
- package/src/{@building → building}/GetEventGeometry.ts +19 -13
- package/src/{@building → building}/GetEventHeader.ts +13 -13
- package/src/{@building → building}/GetEventNodes.ts +21 -19
- package/src/{@building → building}/GetEventOffice.ts +13 -13
- package/src/building/GetEventProperties.ts +105 -0
- package/src/{@building → building}/GetEventSignature.ts +9 -9
- package/src/{@building → building}/GetEventTags.ts +3 -3
- package/src/building/GetEventTheme.ts +26 -0
- package/src/building/GetEventTracking.ts +64 -0
- package/src/components/audio/GenerateAudioMessage.ts +149 -0
- package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +13 -8
- package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +14 -8
- package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +17 -10
- package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +7 -7
- package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +13 -8
- package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +11 -6
- package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +12 -7
- package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +12 -7
- package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +22 -14
- package/src/{@modules/@utilities/SetWarning.ts → components/database/CreateQuery.ts} +18 -13
- package/src/{@modules/@database → components/database}/GetCachedEvents.ts +18 -15
- package/src/components/database/ImportBoundaries.ts +168 -0
- package/src/{@modules/@database → components/database}/ImportBroadcastify.ts +14 -24
- package/src/components/database/ImportCities.ts +87 -0
- package/src/{@modules/@database → components/database}/ImportShapefiles.ts +23 -26
- package/src/{@modules/@database → components/database}/ImportStanza.ts +15 -19
- package/src/components/database/InitializeDatabase.ts +71 -0
- package/src/components/images/GenerateGraphic.ts +234 -0
- package/src/components/images/components/CreateRectangle.ts +22 -0
- package/src/components/images/components/CreateText.ts +22 -0
- package/src/components/images/modules/CreateSVG.ts +37 -0
- package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
- package/src/components/images/modules/GetGeographicalCities.ts +58 -0
- package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
- package/src/components/images/modules/GetGeometryBounds.ts +82 -0
- package/src/components/images/modules/GetParsedBoundary.ts +58 -0
- package/src/components/images/modules/GetSVGPath.ts +53 -0
- package/src/components/images/modules/NormalizePolygon.ts +57 -0
- package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +16 -17
- package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +27 -15
- package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +26 -26
- package/src/{@modules/@utilities → components/utilities}/GetFormattedTime.ts +2 -2
- package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
- package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
- package/src/{@modules/@utilities → components/utilities}/GetShapeNearestPoint.ts +24 -19
- package/src/components/utilities/GetUnionPolygon.ts +36 -0
- package/src/components/utilities/QueueManager.ts +70 -0
- package/src/{@modules/@utilities → components/utilities}/SetCronSchedule.ts +29 -25
- package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +12 -12
- package/src/components/utilities/SetEventEmit.ts +42 -0
- package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +7 -7
- package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +5 -5
- package/src/components/utilities/SetTimeoutAction.ts +64 -0
- package/src/components/utilities/SetWarning.ts +47 -0
- package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +20 -20
- package/src/{@core/CreateListener.ts → components/xmpp/ErrorXMPP.ts} +8 -5
- package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +13 -13
- package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +18 -18
- package/src/components/xmpp/ReconnectXMPP.ts +64 -0
- package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +25 -25
- package/src/{@core → core}/ClearEvents.ts +9 -9
- package/src/{@core → core}/GetEvents.ts +4 -4
- package/src/{@core → core}/GetNodes.ts +4 -4
- package/src/{@core → core}/GetRandomEvent.ts +4 -4
- package/src/{@core → core}/GetVersion.ts +4 -4
- package/src/{@core → core}/ManualEvent.ts +23 -24
- package/src/{@core → core}/QueryStanza.ts +12 -11
- package/src/core/SetNode.ts +87 -0
- package/src/{@core → core}/StartService.ts +21 -20
- package/src/{@core → core}/StopService.ts +10 -10
- package/src/{@enums → enums}/AWIPS.ts +2 -2
- package/src/{@enums → enums}/Actions.ts +2 -2
- package/src/{@enums → enums}/Cancellation.ts +2 -2
- package/src/{@enums → enums}/Causes.ts +2 -2
- package/src/{@enums → enums}/Correlations.ts +2 -2
- package/src/{@enums → enums}/Enhanced.ts +2 -2
- package/src/{@enums → enums}/Events.ts +2 -2
- package/src/{@enums → enums}/Expressions.ts +3 -3
- package/src/{@enums → enums}/GlobalFilter.ts +2 -2
- package/src/{@enums → enums}/Hail.ts +2 -2
- package/src/{@enums → enums}/ICAO.ts +2 -2
- package/src/{@enums → enums}/Matches.ts +8 -3
- package/src/{@enums → enums}/Products.ts +2 -2
- package/src/{@enums → enums}/Records.ts +2 -2
- package/src/{@enums → enums}/Severity.ts +2 -2
- package/src/{@enums → enums}/Shapefiles.ts +2 -2
- package/src/{@enums → enums}/States.ts +68 -4
- package/src/{@enums → enums}/Status.ts +2 -2
- package/src/{@enums → enums}/Strings.ts +2 -2
- package/src/{@enums → enums}/Tags.ts +9 -4
- package/src/{@enums → enums}/Testing.ts +2 -2
- package/src/enums/Themes.ts +70 -0
- package/src/events/ParseAPI.ts +129 -0
- package/src/{@events → events}/ParseText.ts +24 -22
- package/src/{@events → events}/ParseUGC.ts +27 -26
- package/src/{@events → events}/ParseVTEC.ts +38 -37
- package/src/index.ts +57 -37
- package/src/manager/MakeEvents.ts +110 -0
- package/src/manager/RemoveEvent.ts +74 -0
- package/src/{@manager → manager}/SetHash.ts +18 -13
- package/src/{@manager → manager}/UpdateEvents.ts +12 -12
- package/src/{@manager → manager}/UpdateNode.ts +14 -14
- package/src/{@building → manager}/ValidateEvents.ts +47 -57
- package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +11 -11
- package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
- package/src/{@parsers/@text → parsers/text}/GetEmbededText.ts +7 -6
- package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
- package/src/{@parsers/@text → parsers/text}/GetStringText.ts +9 -9
- package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +12 -12
- package/src/parsers/ugc/GetCache.ts +24 -0
- package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
- package/src/{@parsers/@ugc/GetUGCHeader.ts → parsers/ugc/GetHeader.ts} +4 -4
- package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +10 -10
- package/src/parsers/ugc/GetZonePolygon.ts +73 -0
- package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +3 -3
- package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +13 -8
- package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +14 -14
- package/src/{@parsers/@pvtec → parsers/vtec}/GetExpiry.ts +2 -2
- package/src/parsers/vtec/VTECExtract.ts +49 -0
- package/src/{@types → static}/Attributes.ts +2 -3
- package/src/{@types → static}/Event.ts +8 -7
- package/src/{@types → static}/Properties.ts +7 -3
- package/src/{@types → static}/Stanza.ts +2 -2
- package/src/tasks/CreateTasks.ts +123 -0
- package/src/tasks/TaskGenerateJSON.ts +34 -0
- package/src/tasks/TaskGenerateText.ts +34 -0
- package/src/tasks/TaskSendNTFY.ts +97 -0
- package/src/tasks/TaskSendWebhook.ts +107 -0
- package/src/{@types → types}/Actions.ts +3 -3
- package/src/{@types → types}/HVTEC.ts +6 -6
- package/src/{@types → types}/Hash.ts +5 -5
- package/src/types/Nodes.ts +29 -0
- package/src/{@types → types}/Settings.ts +16 -8
- package/src/{@types → types}/StanzaCompiled.ts +15 -15
- package/src/{@types → types}/UGC.ts +5 -5
- package/src/{@modules/@utilities/GetSettings.ts → types/VTEC.ts} +12 -7
- package/tools/build.js +47 -0
- package/tsconfig.json +28 -1
- package/src/@building/GetEventProperties.ts +0 -96
- package/src/@building/GetEventTracking.ts +0 -68
- package/src/@core/SetNode.ts +0 -81
- package/src/@events/ParseAPI.ts +0 -117
- package/src/@manager/CreateActions.ts +0 -213
- package/src/@manager/MakeEvent.ts +0 -99
- package/src/@manager/RemoveEvent.ts +0 -70
- package/src/@modules/@database/InitializeDatabase.ts +0 -59
- package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
- package/src/@modules/@utilities/SetEventEmit.ts +0 -41
- package/src/@modules/@utilities/SetListener.ts +0 -30
- package/src/@modules/@utilities/SetTimeoutAction.ts +0 -64
- package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
- package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
- package/src/@parsers/@pvtec/VTECExtract.ts +0 -49
- package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
- package/src/@parsers/@text/GetXML.ts +0 -61
- package/src/@parsers/@ugc/GetCache.ts +0 -24
- package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
- package/src/@types/VTEC.ts +0 -30
- package/tsup.config.ts +0 -16
|
@@ -11,31 +11,31 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "
|
|
21
|
-
import {
|
|
22
|
-
import { OnlineXMPP } from "
|
|
23
|
-
import { OfflineXMPP } from "
|
|
24
|
-
import { ErrorXMPP } from "
|
|
25
|
-
import { StanzaXMPP } from "
|
|
26
|
-
import { SetEventEmit } from
|
|
27
|
-
import { client } from
|
|
20
|
+
import { TypeSettings } from "Types/Settings"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { OnlineXMPP } from "@XMPP/OnlineXMPP"
|
|
23
|
+
import { OfflineXMPP } from "@XMPP/OfflineXMPP"
|
|
24
|
+
import { ErrorXMPP } from "@XMPP/ErrorXMPP"
|
|
25
|
+
import { StanzaXMPP } from "@XMPP/StanzaXMPP"
|
|
26
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
27
|
+
import { client } from "@XMPP/client"
|
|
28
28
|
|
|
29
29
|
export const DeployXMPP = async (): Promise<void> => {
|
|
30
30
|
let session;
|
|
31
|
-
const settings =
|
|
31
|
+
const settings = Bootstrap.Settings as TypeSettings
|
|
32
32
|
settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname
|
|
33
33
|
??= settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username;
|
|
34
|
-
session =
|
|
34
|
+
session = Bootstrap.Session = client({
|
|
35
35
|
service: 'xmpp://nwws-oi.weather.gov',
|
|
36
36
|
domain: 'nwws-oi.weather.gov',
|
|
37
|
-
username: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username,
|
|
38
|
-
password: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Password
|
|
37
|
+
username: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username as string,
|
|
38
|
+
password: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Password as string
|
|
39
39
|
})
|
|
40
40
|
try {
|
|
41
41
|
await OfflineXMPP();
|
|
@@ -45,12 +45,12 @@ export const DeployXMPP = async (): Promise<void> => {
|
|
|
45
45
|
await session.start()
|
|
46
46
|
} catch (error) {
|
|
47
47
|
SetEventEmit({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
Event: `onServiceStatus`,
|
|
49
|
+
Metadata: {
|
|
50
|
+
Message: `Error occured while starting XMPP Session: ${error}`,
|
|
51
|
+
Data: {},
|
|
52
|
+
Type: `error`,
|
|
53
|
+
Error: true
|
|
54
54
|
},
|
|
55
55
|
})
|
|
56
56
|
}
|
|
@@ -11,14 +11,17 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
21
|
|
|
22
|
-
export const
|
|
23
|
-
|
|
22
|
+
export const ErrorXMPP = () => {
|
|
23
|
+
Bootstrap.Session.on(`error`, async () => {
|
|
24
|
+
Bootstrap.Cache.Connected = false;
|
|
25
|
+
Bootstrap.Cache.Hault = true;
|
|
26
|
+
})
|
|
24
27
|
}
|
|
@@ -11,26 +11,26 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
import { SetEventEmit } from "
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
22
22
|
|
|
23
23
|
export const OfflineXMPP = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
Bootstrap.Session.on(`offline`, async () => {
|
|
25
|
+
Bootstrap.Cache.Connected = false;
|
|
26
|
+
Bootstrap.Cache.Hault = true;
|
|
27
27
|
SetEventEmit({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
Event: `onServiceStatus`,
|
|
29
|
+
Metadata: {
|
|
30
|
+
Message: `Client has gone offline`,
|
|
31
|
+
Data: {},
|
|
32
|
+
Type: `offline`,
|
|
33
|
+
Error: true
|
|
34
34
|
},
|
|
35
35
|
})
|
|
36
36
|
})
|
|
@@ -11,36 +11,36 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
import { SetEventEmit } from
|
|
22
|
-
import { xml } from
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
22
|
+
import { xml } from "@XMPP/client"
|
|
23
23
|
|
|
24
24
|
export const OnlineXMPP = () => {
|
|
25
|
-
const settings =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
const settings = Bootstrap.Settings;
|
|
26
|
+
Bootstrap.Session.on(`online`, async () => {
|
|
27
|
+
Bootstrap.Cache.Hault = false;
|
|
28
|
+
Bootstrap.Cache.Connected = true;
|
|
29
|
+
Bootstrap.Cache.TotalReconnects = 0;
|
|
30
30
|
const nickname = settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname;
|
|
31
|
-
|
|
31
|
+
Bootstrap.Session.send(xml('presence', {
|
|
32
32
|
to: `nwws@conference.nwws-oi.weather.gov/${nickname}`,
|
|
33
33
|
xmlns: 'http://jabber.org/protocol/muc',
|
|
34
34
|
}))
|
|
35
35
|
SetEventEmit({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
Event: `onServiceStatus`,
|
|
37
|
+
Metadata: {
|
|
38
|
+
Message: `Succesfully connected to NOAA Weather Wire Service as "${nickname}"`,
|
|
39
|
+
Data: {},
|
|
40
|
+
Type: `online`,
|
|
41
|
+
Error: false
|
|
42
42
|
},
|
|
43
|
-
|
|
43
|
+
Message: `Succesfully connected to NOAA Weather Wire Service as "${nickname}"`,
|
|
44
44
|
})
|
|
45
45
|
})
|
|
46
46
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
|
+
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
|
+
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
|
+
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { TypeSettings } from "Types/Settings"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
23
|
+
import { SetWarning } from "@Utilities/SetWarning"
|
|
24
|
+
|
|
25
|
+
export const ReconnectXMPP = async (interval: number): Promise<void> => {
|
|
26
|
+
const settings = Bootstrap.Settings as TypeSettings;
|
|
27
|
+
const last = Date.now() - Bootstrap.Cache.LastStanzaTime
|
|
28
|
+
if (interval < 15) {
|
|
29
|
+
SetWarning({ Message: `Reconnection interval of ${interval} seconds is too low, setting to 15 seconds` })
|
|
30
|
+
interval = 15;
|
|
31
|
+
Bootstrap.Settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval = 15;
|
|
32
|
+
}
|
|
33
|
+
const reconnectThreshold = interval * 1e3
|
|
34
|
+
if ((!Bootstrap.Cache.Connected && !Bootstrap.Cache.Hault) || !Bootstrap.Session) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (last > reconnectThreshold) {
|
|
38
|
+
if (!Bootstrap.Cache.Reconnecting) {
|
|
39
|
+
Bootstrap.Cache.Reconnecting = true;
|
|
40
|
+
Bootstrap.Cache.Connected = false;
|
|
41
|
+
Bootstrap.Cache.TotalReconnects += 1;
|
|
42
|
+
try {
|
|
43
|
+
SetEventEmit({
|
|
44
|
+
Event: `onServiceStatus`,
|
|
45
|
+
Metadata: {
|
|
46
|
+
Message: `Attempting to reconnect to XMPP Service (Reconnect Attempt ${Bootstrap.Cache.TotalReconnects})`,
|
|
47
|
+
Data: {
|
|
48
|
+
Last: last,
|
|
49
|
+
Nickname: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname
|
|
50
|
+
},
|
|
51
|
+
Type: `reconnect`,
|
|
52
|
+
Error: true
|
|
53
|
+
}, Message: `Attempting to reconnect to XMPP Service (Reconnect Attempt ${Bootstrap.Cache.TotalReconnects})`,
|
|
54
|
+
})
|
|
55
|
+
await Bootstrap.Session.stop().catch(() => {});
|
|
56
|
+
await Bootstrap.Session.start().catch(() => {});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
SetWarning({ Message: `XMPP Reconnect Failed - ${(error as Error).message}` })
|
|
59
|
+
} finally {
|
|
60
|
+
Bootstrap.Cache.Reconnecting = false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -11,37 +11,37 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanza } from "
|
|
21
|
-
import {
|
|
22
|
-
import { ValidateStanza } from "
|
|
23
|
-
import { CreateEvent } from "
|
|
24
|
-
import { ImportStanza } from "
|
|
25
|
-
import { SetEventEmit } from "
|
|
20
|
+
import { TypeStanza } from "StaticTypes/Stanza"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { ValidateStanza } from "@Stanza/ValidateStanza"
|
|
23
|
+
import { CreateEvent } from "@Building/CreateEvent"
|
|
24
|
+
import { ImportStanza } from "@Database/ImportStanza"
|
|
25
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
26
26
|
|
|
27
27
|
export const StanzaXMPP = () => {
|
|
28
|
-
|
|
28
|
+
Bootstrap.Session.on(`stanza`, async (stanza: TypeStanza) => {
|
|
29
29
|
const msgFrom = stanza?.attrs?.from ?? ``
|
|
30
30
|
const msgType = stanza?.attrs?.type ?? ``
|
|
31
31
|
SetEventEmit({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
Event: `onServiceStatus`,
|
|
33
|
+
Metadata: {
|
|
34
|
+
Message: stanza,
|
|
35
|
+
From: msgFrom,
|
|
36
|
+
Type: `stanza`
|
|
37
37
|
},
|
|
38
38
|
})
|
|
39
|
-
|
|
39
|
+
Bootstrap.Cache.LastStanzaTime = Date.now();
|
|
40
40
|
if (stanza.is(`message`)) {
|
|
41
|
-
const result = ValidateStanza({ stanza });
|
|
42
|
-
const isSkippable = result.
|
|
43
|
-
(result.
|
|
44
|
-
(result.
|
|
41
|
+
const result = ValidateStanza({ Stanza: stanza });
|
|
42
|
+
const isSkippable = result.Ignored ||
|
|
43
|
+
(result.CapEvent) ||
|
|
44
|
+
(result.CapEvent && !result.CapAreaDescription)
|
|
45
45
|
if (isSkippable) { return; }
|
|
46
46
|
await CreateEvent(result);
|
|
47
47
|
await ImportStanza(result);
|
|
@@ -50,12 +50,12 @@ export const StanzaXMPP = () => {
|
|
|
50
50
|
const getOccupant = msgFrom.split(`/`).slice(1).join(`/`)
|
|
51
51
|
const getAvailability = msgType === `unavailable`
|
|
52
52
|
SetEventEmit({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
Event: `onServiceStatus`,
|
|
54
|
+
Metadata: {
|
|
55
|
+
Message: `Occupant ${getOccupant} has ${getAvailability ? `left` : `joined`} the room`,
|
|
56
|
+
Data: {},
|
|
57
|
+
Type: `occupant`,
|
|
58
|
+
Error: false
|
|
59
59
|
},
|
|
60
60
|
})
|
|
61
61
|
}
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
import { SetEventEmit } from "
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
22
22
|
|
|
23
23
|
export const ClearEvents = (): void => {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Bootstrap.Cache.Events.features = [];
|
|
25
|
+
Bootstrap.Cache.Hashes = [];
|
|
26
26
|
SetEventEmit({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
Event: `onEventCache`,
|
|
28
|
+
Metadata: Bootstrap.Cache.Events,
|
|
29
|
+
Message: `Manually cleared event cache.`
|
|
30
30
|
})
|
|
31
31
|
}
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
21
|
|
|
22
22
|
export const GetEvents = (): any => {
|
|
23
|
-
return
|
|
23
|
+
return Bootstrap.Cache.Events
|
|
24
24
|
}
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
21
|
|
|
22
22
|
export const GetNodes = (): any => {
|
|
23
|
-
return
|
|
23
|
+
return Bootstrap.Cache.Nodes
|
|
24
24
|
}
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
21
|
|
|
22
22
|
export const GetRandomEvent = (): any => {
|
|
23
|
-
return
|
|
23
|
+
return Bootstrap.Cache.Events.features[Math.floor(Math.random() * Bootstrap.Cache.Events.features.length)]
|
|
24
24
|
}
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
21
|
|
|
22
22
|
export const GetVersion = (): any => {
|
|
23
|
-
return
|
|
23
|
+
return Bootstrap.Version
|
|
24
24
|
}
|
|
@@ -11,46 +11,45 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { CreateEvent } from "../@building/CreateEvent";
|
|
20
|
+
import { EnumExpressions } from "@Enums/Expressions"
|
|
21
|
+
import { GetAwipsType } from "@Stanza/GetAwipsType"
|
|
22
|
+
import { CreateEvent } from "@Building/CreateEvent"
|
|
24
23
|
|
|
25
24
|
interface CreateEventOptions {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
Message: string
|
|
26
|
+
Awipsid?: string
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
export const ManualEvent = async (
|
|
31
|
-
const isCapEvent =
|
|
32
|
-
const isCapAreaDescription =
|
|
33
|
-
const isVTEC =
|
|
34
|
-
const isUGC =
|
|
29
|
+
export const ManualEvent = async ({ Message, Awipsid }: CreateEventOptions): Promise<void> => {
|
|
30
|
+
const isCapEvent = Message.includes(`<?xml`);
|
|
31
|
+
const isCapAreaDescription = Message.includes(`<areaDesc>`)
|
|
32
|
+
const isVTEC = Message.match(EnumExpressions.vtec) != null;
|
|
33
|
+
const isUGC = Message.match(EnumExpressions.ugc1) != null;
|
|
35
34
|
const attributes = {
|
|
36
35
|
"xmlns": "@atmosx/event-product-parser",
|
|
37
36
|
"id": "manual_processor.0000",
|
|
38
37
|
"issue": new Date().toISOString(),
|
|
39
38
|
"ttaaii": "XXXXX",
|
|
40
39
|
"cccc": "XXX",
|
|
41
|
-
"awipsid":
|
|
40
|
+
"awipsid": Awipsid ?? "XXXXXX",
|
|
42
41
|
}
|
|
43
|
-
const getType = GetAwipsType({ attributes
|
|
42
|
+
const getType = GetAwipsType({ Attributes: attributes})
|
|
44
43
|
const result = {
|
|
45
|
-
|
|
46
|
-
attributes,
|
|
47
|
-
isCapEvent,
|
|
48
|
-
isVTEC,
|
|
49
|
-
isUGC,
|
|
50
|
-
isCapAreaDescription,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
getType
|
|
44
|
+
Message: Message,
|
|
45
|
+
Attributes: attributes,
|
|
46
|
+
CapEvent: isCapEvent,
|
|
47
|
+
VTEC: isVTEC,
|
|
48
|
+
UGC: isUGC,
|
|
49
|
+
CapAreaDescription: isCapAreaDescription,
|
|
50
|
+
Ignored: false,
|
|
51
|
+
NWWS: true,
|
|
52
|
+
Type: getType,
|
|
54
53
|
}
|
|
55
54
|
await CreateEvent(result);
|
|
56
55
|
}
|
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanza } from "
|
|
21
|
-
import {
|
|
20
|
+
import { TypeStanza } from "StaticTypes/Stanza"
|
|
21
|
+
import { CreateQuery } from "@Database/CreateQuery"
|
|
22
22
|
|
|
23
23
|
interface QueryStanzaOptions {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Search: string
|
|
25
|
+
Max?: number
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
type QueryStanza = {
|
|
@@ -30,10 +30,11 @@ type QueryStanza = {
|
|
|
30
30
|
stanza: string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const QueryStanza = async (
|
|
34
|
-
const
|
|
35
|
-
`SELECT * FROM stanzas WHERE stanza LIKE ? LIMIT
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
export const QueryStanza = async ({ Search, Max }: QueryStanzaOptions): Promise<TypeStanza[]> => {
|
|
34
|
+
const query = CreateQuery({
|
|
35
|
+
Query: `SELECT * FROM stanzas WHERE stanza LIKE ? LIMIT ?`,
|
|
36
|
+
Parameters: [`%${Search}%`, Max ?? 100]
|
|
37
|
+
}) as QueryStanza[];
|
|
38
|
+
const events = query.map((row) => JSON.parse(row.stanza));
|
|
38
39
|
return events as TypeStanza[];
|
|
39
40
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ _ _ __ __
|
|
3
|
+
/\ | | | | (_) \ \ / /
|
|
4
|
+
/ \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
|
|
5
|
+
/ /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
|
|
6
|
+
/ ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
|
|
7
|
+
/_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
|
|
8
|
+
| |
|
|
9
|
+
|_|
|
|
10
|
+
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
|
+
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
|
+
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
|
+
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { SetWarning } from "@Utilities/SetWarning"
|
|
22
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
23
|
+
|
|
24
|
+
interface GetNodeOptions {
|
|
25
|
+
Identifier: string
|
|
26
|
+
Delete?: boolean
|
|
27
|
+
Coordinates: { Longitude: number; Latitude: number }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const SetNode = ({ Identifier, Delete, Coordinates }: GetNodeOptions) => {
|
|
31
|
+
const nodes = Bootstrap.Cache.Nodes.features;
|
|
32
|
+
const exists = nodes.find((node) => node.properties.identifier === Identifier);
|
|
33
|
+
if (Delete) {
|
|
34
|
+
if (exists) {
|
|
35
|
+
const index = nodes.indexOf(exists);
|
|
36
|
+
nodes.splice(index, 1);
|
|
37
|
+
SetWarning({ Message: `Node with identifier '${Identifier}' deleted.` })
|
|
38
|
+
return SetEventEmit({
|
|
39
|
+
Event: `onNodeDelete`,
|
|
40
|
+
Metadata: {
|
|
41
|
+
Type: `node-delete`,
|
|
42
|
+
Node: exists
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
return SetWarning({ Message: `Node with identifier '${Identifier}' not found.` })
|
|
47
|
+
}
|
|
48
|
+
if (exists) {
|
|
49
|
+
const index = nodes.indexOf(exists);
|
|
50
|
+
if (exists.geometry.coordinates[0] === Coordinates.Longitude && exists.geometry.coordinates[1] === Coordinates.Latitude) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
nodes[index] = {
|
|
54
|
+
...exists,
|
|
55
|
+
geometry: {
|
|
56
|
+
type: "Point",
|
|
57
|
+
coordinates: [Coordinates.Longitude, Coordinates.Latitude]
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
SetWarning({ Message: `Node with identifier '${Identifier}' updated.` })
|
|
61
|
+
return SetEventEmit({
|
|
62
|
+
Event: `onNodeUpdate`,
|
|
63
|
+
Metadata: {
|
|
64
|
+
Type: `node-update`,
|
|
65
|
+
Node: nodes[index]
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
nodes.push({
|
|
70
|
+
type: "Feature",
|
|
71
|
+
geometry: {
|
|
72
|
+
type: "Point",
|
|
73
|
+
coordinates: [Coordinates.Longitude, Coordinates.Latitude]
|
|
74
|
+
},
|
|
75
|
+
properties: {
|
|
76
|
+
identifier: Identifier
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
SetWarning({ Message: `Node with identifier '${Identifier}' added.` })
|
|
80
|
+
return SetEventEmit({
|
|
81
|
+
Event: `onNodeAdd`,
|
|
82
|
+
Metadata: {
|
|
83
|
+
Type: `node-add`,
|
|
84
|
+
Node: nodes[nodes.length - 1]
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
}
|