@atmosx/event-product-parser 3.0.621 → 3.1.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/.github/CHANGELOGS.md +52 -0
- package/.github/CODE_OF_CONDUCT.md +24 -1
- package/.github/CONTRIBUTING.md +22 -3
- package/.github/FUNDING.yaml +3 -0
- package/.github/LICENSE +24 -1
- package/.github/SECURITY.md +25 -6
- package/.github/docs/chapters/general-configurations.md +109 -0
- package/.github/docs/chapters/sources-and-attributes.md +219 -0
- package/README.md +56 -146
- package/dist/index.cjs +25333 -0
- package/package.json +17 -11
- package/pnpm-workspace.yaml +4 -0
- package/src/bootstrap.ts +67 -52
- 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/components/database/CreateQuery.ts +39 -0
- package/src/components/database/InitializeDatabase.ts +71 -0
- package/src/components/database/imports/Boundaires.ts +168 -0
- package/src/{@modules/@database/ImportBroadcastify.ts → components/database/imports/Broadcastify.ts} +15 -25
- package/src/components/database/imports/Census.ts +87 -0
- package/src/{@modules/@database/ImportShapefiles.ts → components/database/imports/Shapefiles.ts} +24 -27
- package/src/{@modules/@database/ImportStanza.ts → components/database/imports/Stanza.ts} +15 -19
- package/src/components/events/CreateEvents.ts +88 -0
- package/src/components/events/FilterEvents.ts +149 -0
- package/src/{@building/CreateEvent.ts → components/events/ProcessStanza.ts} +22 -24
- package/src/components/events/RemoveEvents.ts +74 -0
- package/src/{@building → components/events/components}/GetCleanedEvent.ts +2 -2
- package/src/{@building → components/events/components}/GetEventAttachments.ts +14 -12
- package/src/components/events/components/GetEventDirection.ts +28 -0
- package/src/{@building → components/events/components}/GetEventEnhancedName.ts +5 -8
- package/src/{@building → components/events/components}/GetEventGeometry.ts +19 -13
- package/src/{@building → components/events/components}/GetEventHeader.ts +13 -13
- package/src/components/events/components/GetEventMerged.ts +51 -0
- package/src/{@building → components/events/components}/GetEventNodes.ts +22 -20
- package/src/{@building → components/events/components}/GetEventOffice.ts +13 -13
- package/src/components/events/components/GetEventPopulation.ts +58 -0
- package/src/components/events/components/GetEventProperties.ts +106 -0
- package/src/{@building → components/events/components}/GetEventSignature.ts +9 -9
- package/src/{@building → components/events/components}/GetEventTags.ts +3 -3
- package/src/components/events/components/GetEventTheme.ts +26 -0
- package/src/components/events/components/GetEventTracking.ts +64 -0
- package/src/{@modules/@database → components/events/utilities}/GetCachedEvents.ts +18 -15
- package/src/{@manager → components/events/utilities}/SetHash.ts +18 -13
- package/src/{@manager → components/events/utilities}/UpdateEvents.ts +12 -12
- package/src/{@manager → components/events/utilities}/UpdateNode.ts +14 -14
- package/src/{@parsers/@text → components/formatting}/GetEmbededText.ts +14 -8
- package/src/{@parsers/@text → components/formatting}/GetStringText.ts +15 -11
- package/src/{@modules/@utilities → components/geometry}/GetShapeNearestPoint.ts +24 -19
- package/src/components/geometry/GetUnionPolygon.ts +36 -0
- package/src/components/images/GenerateGraphic.ts +242 -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/components/utilities/EmitThread.ts +97 -0
- package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
- package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
- package/src/components/utilities/QueueManager.ts +70 -0
- package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +13 -13
- 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 +26 -26
- 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 +4 -3
- 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 +133 -0
- package/src/{@events → events}/ParseText.ts +24 -22
- package/src/{@events → events}/ParseUGC.ts +27 -26
- package/src/{@events → events}/ParseVTEC.ts +37 -36
- package/src/{@core → exports}/ClearEvents.ts +9 -9
- package/src/{@core → exports}/GetEvents.ts +4 -4
- package/src/exports/GetNearestCity.ts +45 -0
- package/src/{@core → exports}/GetNodes.ts +4 -4
- package/src/{@core → exports}/GetRandomEvent.ts +4 -4
- package/src/{@core → exports}/GetVersion.ts +4 -4
- package/src/exports/ManualEvent.ts +55 -0
- package/src/{@core → exports}/QueryStanza.ts +12 -11
- package/src/exports/SetNode.ts +100 -0
- package/src/{@core → exports}/StartService.ts +23 -22
- package/src/{@core → exports}/StopService.ts +10 -10
- package/src/index.ts +57 -37
- package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +7 -7
- package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
- package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
- 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/@pvtec → parsers/vtec}/VTECExtract.ts +17 -17
- package/src/tasks/CreateTasks.ts +116 -0
- package/src/tasks/TaskGenerateJSON.ts +34 -0
- package/src/tasks/TaskGenerateText.ts +34 -0
- package/src/tasks/TaskSendNTFY.ts +96 -0
- package/src/tasks/TaskSendWebhook.ts +107 -0
- package/src/{@types → types/event}/Attributes.ts +2 -3
- package/src/{@types → types/event}/Event.ts +8 -7
- package/src/{@types → types/event}/HVTEC.ts +2 -2
- package/src/{@types → types/event}/Properties.ts +17 -3
- package/src/{@types → types/event}/Stanza.ts +2 -2
- package/src/{@types → types/event}/VTEC.ts +8 -8
- package/src/{@types → types/standard}/Actions.ts +3 -3
- package/src/{@types → types/standard}/Hash.ts +5 -5
- package/src/{@modules/@utilities/GetSettings.ts → types/standard/Nodes.ts} +15 -7
- package/src/{@types → types/standard}/Settings.ts +19 -12
- package/src/{@types → types/standard}/StanzaCompiled.ts +15 -15
- package/src/{@types → types/standard}/UGC.ts +5 -5
- package/tools/build.js +32 -0
- package/tsconfig.json +32 -1
- package/.github/SUPPORTED_EVENTS.md +0 -370
- package/.github/docs/docs-functions.md +0 -30
- package/.github/docs/docs-general-configurations.md +0 -209
- package/.github/docs/docs-integrations.md +0 -37
- package/.github/docs/docs-listeners.md +0 -28
- package/.github/docs/docs-source-configuration.md +0 -218
- package/.github/docs/docs-technical.md +0 -50
- package/.github/logo.png +0 -0
- package/.github/samples/SAMPLE_EAS_GENERATION.wav +0 -0
- package/.github/samples/SAMPLE_GEOJSON.json +0 -204
- package/.github/samples/SAMPLE_TEXT_PRODUCT.txt +0 -119
- package/dist/cjs/index.cjs +0 -8005
- package/dist/esm/index.mjs +0 -7985
- package/src/@building/GetEventProperties.ts +0 -96
- package/src/@building/GetEventTracking.ts +0 -68
- package/src/@core/ManualEvent.ts +0 -56
- package/src/@core/SetNode.ts +0 -81
- package/src/@events/ParseAPI.ts +0 -117
- package/src/@manager/MakeEvents.ts +0 -106
- package/src/@manager/RemoveEvent.ts +0 -70
- package/src/@manager/Tasks.ts +0 -246
- package/src/@manager/ValidateEvents.ts +0 -142
- package/src/@modules/@database/InitializeDatabase.ts +0 -59
- package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
- package/src/@modules/@utilities/GetFormattedTime.ts +0 -43
- package/src/@modules/@utilities/SetCronSchedule.ts +0 -94
- 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/@utilities/SetWarning.ts +0 -34
- package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
- package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
- 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/tsup.config.ts +0 -16
|
@@ -11,76 +11,77 @@
|
|
|
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 { TypeAttributes } from "
|
|
21
|
-
import { TypeStanzaCompiled } from "
|
|
22
|
-
import {
|
|
23
|
-
import { TypeHVTEC } from "
|
|
24
|
-
import {
|
|
25
|
-
import { VTECExtract } from "
|
|
26
|
-
import { HVExtract } from "
|
|
27
|
-
import {
|
|
28
|
-
import { GetEventProperties } from "
|
|
29
|
-
import { GetEventHeader } from "
|
|
30
|
-
import { GetEventTracking } from "
|
|
31
|
-
import {
|
|
20
|
+
import { TypeAttributes } from "TypesEvent/Attributes"
|
|
21
|
+
import { TypeStanzaCompiled } from "TypesStandard/StanzaCompiled"
|
|
22
|
+
import { TypeVTEC } from "TypesEvent/VTEC"
|
|
23
|
+
import { TypeHVTEC } from "TypesEvent/HVTEC"
|
|
24
|
+
import { Bootstrap } from "@Bootstrap"
|
|
25
|
+
import { VTECExtract } from "@ParsingVTEC/VTECExtract"
|
|
26
|
+
import { HVExtract } from "@ParsingHVTEC/HVExtract"
|
|
27
|
+
import { UGCExtract } from "@ParsingUGC/UGCExtract"
|
|
28
|
+
import { GetEventProperties } from "@BuilderComponents/GetEventProperties"
|
|
29
|
+
import { GetEventHeader } from "@BuilderComponents/GetEventHeader"
|
|
30
|
+
import { GetEventTracking } from "@BuilderComponents/GetEventTracking"
|
|
31
|
+
import { GetEventTheme } from "@BuilderComponents/GetEventTheme"
|
|
32
|
+
import { SetDebug } from "@Utilities/SetDebug"
|
|
32
33
|
|
|
33
|
-
export const ParseVTEC = async (
|
|
34
|
-
const getMessages =
|
|
34
|
+
export const ParseVTEC = async (Stanza: TypeStanzaCompiled): Promise<void> => {
|
|
35
|
+
const getMessages = Stanza?.Message
|
|
35
36
|
?.split(/(?=\$\$)/g)
|
|
36
37
|
?.map(message => message.trim())
|
|
37
38
|
?.filter(message => message && message !== "$$");
|
|
38
39
|
if (!getMessages || getMessages?.length == 0 ) return;
|
|
39
40
|
for (const message of getMessages) {
|
|
40
41
|
const tick = performance.now();
|
|
41
|
-
const attributes =
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const ugc = await
|
|
45
|
-
if (
|
|
46
|
-
for (const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const header = GetEventHeader({properties: props, getType: stanza.getType, vtec: vtec})
|
|
42
|
+
const attributes = Stanza?.Attributes as TypeAttributes
|
|
43
|
+
const VTEC = VTECExtract(message) as TypeVTEC[];
|
|
44
|
+
const hVTEC = HVExtract(message) as TypeHVTEC[];
|
|
45
|
+
const ugc = await UGCExtract(message)
|
|
46
|
+
if (VTEC != null && ugc != null ) {
|
|
47
|
+
for (const vtec of VTEC) {
|
|
48
|
+
const props = GetEventProperties({ Message: message, Attributes: attributes, UGC: ugc, VTEC: vtec })
|
|
49
|
+
const header = GetEventHeader({ Properties: props, VTEC: vtec, Type: Stanza.Type })
|
|
50
50
|
const issued = new Date(attributes.issue)?? new Date()
|
|
51
51
|
const expires = new Date(vtec.expires)
|
|
52
|
-
|
|
52
|
+
Bootstrap.Cache.Parsed.push({
|
|
53
53
|
type: `Feature`,
|
|
54
54
|
geometry: {
|
|
55
|
-
type: `
|
|
55
|
+
type: `Polygon`,
|
|
56
56
|
coordinates: []
|
|
57
57
|
},
|
|
58
58
|
properties: {
|
|
59
|
-
event:
|
|
60
|
-
parent:
|
|
61
|
-
status:
|
|
59
|
+
event: vtec.event,
|
|
60
|
+
parent: vtec.event,
|
|
61
|
+
status: vtec.status,
|
|
62
62
|
issued: (!isNaN(issued.getTime())) ? issued.toISOString() : new Date().toISOString(),
|
|
63
|
-
expires: (!isNaN(expires.getTime())) ? expires.toISOString() : ugc.
|
|
63
|
+
expires: (!isNaN(expires.getTime())) ? expires.toISOString() : ugc.Expires ?? new Date(issued.getTime() + 60 * 60 * 1000).toISOString(),
|
|
64
|
+
theme: GetEventTheme(vtec.event),
|
|
64
65
|
...props,
|
|
65
66
|
metadata: {
|
|
66
67
|
ms: performance.now() - tick,
|
|
67
68
|
source: `events.vtec`,
|
|
68
|
-
tracking: GetEventTracking({
|
|
69
|
+
tracking: GetEventTracking({ Type: `VTEC`, Stanza, Attributes: attributes, Properties: props, VTEC: vtec }),
|
|
69
70
|
header: header,
|
|
70
|
-
vtec:
|
|
71
|
-
hvtec:
|
|
71
|
+
vtec: vtec,
|
|
72
|
+
hvtec: hVTEC,
|
|
72
73
|
raw: message,
|
|
73
74
|
history: [
|
|
74
75
|
{
|
|
75
76
|
description: props.description,
|
|
76
77
|
issued: (!isNaN(issued.getTime())) ? issued.toISOString() : new Date().toISOString(),
|
|
77
|
-
status:
|
|
78
|
+
status: vtec.status
|
|
78
79
|
}
|
|
79
80
|
]
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
})
|
|
83
|
-
SetDebug({
|
|
84
|
+
SetDebug({ Title: `ParseVTEC`, Message: `${Math.round(performance.now() - tick)}ms` })
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { CreateQuery } from "@Database/CreateQuery"
|
|
21
|
+
|
|
22
|
+
interface GetNearestCityOptions {
|
|
23
|
+
Radius?: number
|
|
24
|
+
Coordinates: {
|
|
25
|
+
Latitude: number
|
|
26
|
+
Longitude: number
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const GetNearestCity = ({ Radius = 15, Coordinates }: GetNearestCityOptions): any => {
|
|
31
|
+
const A = CreateQuery({
|
|
32
|
+
Query: `SELECT * FROM cities WHERE lat BETWEEN ? AND ? AND lon BETWEEN ? AND ? AND population > 0 ORDER BY ((lat - ?) * (lat - ?) + (lon - ?) * (lon - ?)) ASC LIMIT 1`,
|
|
33
|
+
Parameters: [
|
|
34
|
+
Coordinates.Latitude - (Radius / 69),
|
|
35
|
+
Coordinates.Latitude + (Radius / 69),
|
|
36
|
+
Coordinates.Longitude - (Radius / 69),
|
|
37
|
+
Coordinates.Longitude + (Radius / 69),
|
|
38
|
+
Coordinates.Latitude,
|
|
39
|
+
Coordinates.Latitude,
|
|
40
|
+
Coordinates.Longitude,
|
|
41
|
+
Coordinates.Longitude
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
|
+
return A?.[0] ?? null
|
|
45
|
+
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { EnumExpressions } from "@Enums/Expressions"
|
|
21
|
+
import { GetAwipsType } from "@Stanza/GetAwipsType"
|
|
22
|
+
import { ProcessStanza } from "@Builder/ProcessStanza"
|
|
23
|
+
|
|
24
|
+
interface CreateEventOptions {
|
|
25
|
+
Message: string
|
|
26
|
+
Awipsid?: string
|
|
27
|
+
}
|
|
28
|
+
|
|
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;
|
|
34
|
+
const attributes = {
|
|
35
|
+
"xmlns": "@atmosx/event-product-parser",
|
|
36
|
+
"id": "manual_processor.0000",
|
|
37
|
+
"issue": new Date().toISOString(),
|
|
38
|
+
"ttaaii": "XXXXX",
|
|
39
|
+
"cccc": "XXX",
|
|
40
|
+
"awipsid": Awipsid ?? "XXXXXX",
|
|
41
|
+
}
|
|
42
|
+
const getType = GetAwipsType({ Attributes: attributes})
|
|
43
|
+
const result = {
|
|
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,
|
|
53
|
+
}
|
|
54
|
+
await ProcessStanza(result);
|
|
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 "TypesEvent/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,100 @@
|
|
|
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
|
+
import { GetNearestCity } from "@Exports/GetNearestCity"
|
|
24
|
+
|
|
25
|
+
interface GetNodeOptions {
|
|
26
|
+
Identifier: string
|
|
27
|
+
Delete?: boolean
|
|
28
|
+
Coordinates: { Longitude: number; Latitude: number }
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const SetNode = ({ Identifier, Delete, Coordinates }: GetNodeOptions) => {
|
|
32
|
+
const nodes = Bootstrap.Cache.Nodes.features;
|
|
33
|
+
const exists = nodes.find((node) => node.properties.identifier === Identifier);
|
|
34
|
+
const nearest = GetNearestCity({ Coordinates, Radius: 25 });
|
|
35
|
+
if (Delete) {
|
|
36
|
+
if (exists) {
|
|
37
|
+
const index = nodes.indexOf(exists);
|
|
38
|
+
nodes.splice(index, 1);
|
|
39
|
+
SetWarning({ Message: `Node with identifier '${Identifier}' deleted.` })
|
|
40
|
+
return SetEventEmit({
|
|
41
|
+
Event: `onNodeDelete`,
|
|
42
|
+
Metadata: {
|
|
43
|
+
Type: `node-delete`,
|
|
44
|
+
Node: exists
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
return SetWarning({ Message: `Node with identifier '${Identifier}' not found.` })
|
|
49
|
+
}
|
|
50
|
+
if (exists) {
|
|
51
|
+
const index = nodes.indexOf(exists);
|
|
52
|
+
if (exists.geometry.coordinates[0] === Coordinates.Longitude && exists.geometry.coordinates[1] === Coordinates.Latitude) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
nodes[index] = {
|
|
56
|
+
...exists,
|
|
57
|
+
geometry: {
|
|
58
|
+
type: "Point",
|
|
59
|
+
coordinates: [Coordinates.Longitude, Coordinates.Latitude]
|
|
60
|
+
},
|
|
61
|
+
properties: {
|
|
62
|
+
...exists.properties,
|
|
63
|
+
city: nearest?.name ?? null,
|
|
64
|
+
county: nearest?.county ?? null,
|
|
65
|
+
state: nearest?.state ?? null,
|
|
66
|
+
population: nearest?.population ?? null
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
SetWarning({ Message: `Node with identifier '${Identifier}' updated. (${nearest?.name ?? "---"}, ${nearest?.county ?? "---"}, ${nearest?.state ?? "---"})` })
|
|
70
|
+
return SetEventEmit({
|
|
71
|
+
Event: `onNodeUpdate`,
|
|
72
|
+
Metadata: {
|
|
73
|
+
Type: `node-update`,
|
|
74
|
+
Node: nodes[index]
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
nodes.push({
|
|
79
|
+
type: "Feature",
|
|
80
|
+
geometry: {
|
|
81
|
+
type: "Point",
|
|
82
|
+
coordinates: [Coordinates.Longitude, Coordinates.Latitude]
|
|
83
|
+
},
|
|
84
|
+
properties: {
|
|
85
|
+
identifier: Identifier,
|
|
86
|
+
city: nearest?.name ?? null,
|
|
87
|
+
county: nearest?.county ?? null,
|
|
88
|
+
state: nearest?.state ?? null,
|
|
89
|
+
population: nearest?.population ?? null
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
SetWarning({ Message: `Node with identifier '${Identifier}' added. (${nearest?.name ?? "---"}, ${nearest?.county ?? "---"}, ${nearest?.state ?? "---"})` })
|
|
93
|
+
return SetEventEmit({
|
|
94
|
+
Event: `onNodeAdd`,
|
|
95
|
+
Metadata: {
|
|
96
|
+
Type: `node-add`,
|
|
97
|
+
Node: nodes[nodes.length - 1]
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
@@ -11,50 +11,51 @@
|
|
|
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 { SetWarning } from "
|
|
23
|
-
import { SetSettings } from "
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { UpdateNode } from "
|
|
29
|
-
import { UpdateEvents } from "
|
|
30
|
-
import { Cron } from "croner"
|
|
20
|
+
import { TypeSettings } from "TypesStandard/Settings"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { SetWarning } from "@Utilities/SetWarning"
|
|
23
|
+
import { SetSettings } from "@Utilities/SetSettings"
|
|
24
|
+
import { EmitThread } from "@Utilities/EmitThread"
|
|
25
|
+
import { DeployXMPP } from "@XMPP/DeployXMPP"
|
|
26
|
+
import { InitializeDatabase } from "@Database/InitializeDatabase"
|
|
27
|
+
import { GetCachedEvents } from "@BuilderUtilities/GetCachedEvents"
|
|
28
|
+
import { UpdateNode } from "@BuilderUtilities/UpdateNode"
|
|
29
|
+
import { UpdateEvents } from "@BuilderUtilities/UpdateEvents"
|
|
30
|
+
import { Cron } from "croner"
|
|
31
31
|
|
|
32
32
|
export const StartService = async (configurations: TypeSettings): Promise<void> => {
|
|
33
|
-
if (!
|
|
33
|
+
if (!Bootstrap.Ready) {
|
|
34
34
|
return SetWarning({
|
|
35
|
-
|
|
35
|
+
Message: `You can not create another instance without shutting down the current one first, please make sure to call the stop() method first!`
|
|
36
36
|
})
|
|
37
37
|
}
|
|
38
38
|
const settings = SetSettings(configurations);
|
|
39
|
-
|
|
39
|
+
Bootstrap.Ready = true;
|
|
40
40
|
await InitializeDatabase();
|
|
41
|
+
if (settings.DeveloperDisableEvents) { return SetWarning({ Message: `DeveloperDisableEvents is enabled, no events will be processed!` }) }
|
|
41
42
|
if (settings.EnableWireService) {
|
|
42
43
|
(async () => {
|
|
43
44
|
await GetCachedEvents();
|
|
44
45
|
await DeployXMPP()
|
|
45
46
|
})();
|
|
46
47
|
}
|
|
47
|
-
await
|
|
48
|
+
await EmitThread()
|
|
48
49
|
let scheduleInterval = !settings.EnableWireService ? settings.NationalWeatherServiceSettings.CallbackInterval : 1;
|
|
49
50
|
if (!settings.EnableWireService && scheduleInterval < 15) {
|
|
50
|
-
SetWarning({
|
|
51
|
-
|
|
51
|
+
SetWarning({ Message: `Schedule interval of ${scheduleInterval} seconds is too low, setting to 15 seconds` })
|
|
52
|
+
Bootstrap.Settings.NationalWeatherServiceSettings.CallbackInterval = 15;
|
|
52
53
|
scheduleInterval = 15;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
await
|
|
55
|
+
Bootstrap.Job = new Cron(`*/${scheduleInterval} * * * * *`, async () => {
|
|
56
|
+
await EmitThread();
|
|
56
57
|
})
|
|
57
|
-
|
|
58
|
+
Bootstrap.Job = new Cron(`* * * * * *`, async () => {
|
|
58
59
|
await UpdateNode();
|
|
59
60
|
await UpdateEvents();
|
|
60
61
|
})
|
|
@@ -11,22 +11,22 @@
|
|
|
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 StopService = async (): Promise<void> => {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
try { await
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
if (Bootstrap.Ready) {
|
|
24
|
+
Bootstrap.Ready = false;
|
|
25
|
+
if (Bootstrap.Session) {
|
|
26
|
+
try { await Bootstrap.Session.stop(); } catch {}
|
|
27
|
+
Bootstrap.Cache.Connected = false;
|
|
28
|
+
Bootstrap.Cache.Hault = true;
|
|
29
|
+
Bootstrap.Session = null;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|