@atmosx/event-product-parser 3.0.4 → 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/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +1 -1
- package/.github/SUPPORTED_EVENTS.md +370 -0
- package/.github/docs/docs-functions.md +30 -0
- package/.github/docs/docs-general-configurations.md +199 -0
- package/.github/docs/docs-integrations.md +38 -0
- package/.github/docs/docs-listeners.md +28 -0
- package/.github/docs/docs-source-configuration.md +218 -0
- package/.github/docs/docs-technical.md +50 -0
- package/.github/logo.png +0 -0
- package/.github/samples/SAMPLE_EAS_GENERATION.wav +0 -0
- package/.github/samples/SAMPLE_GEOJSON.json +204 -0
- package/.github/samples/SAMPLE_TEXT_PRODUCT.txt +119 -0
- package/README.md +157 -337
- package/dist/cjs/index.cjs +24125 -15815
- package/dist/esm/index.mjs +24144 -15839
- package/package.json +56 -53
- package/pnpm-workspace.yaml +4 -0
- package/src/bootstrap.ts +83 -43
- package/src/building/CreateEvent.ts +54 -0
- package/src/{@building/building.clean.ts → building/GetCleanedEvent.ts} +4 -4
- package/src/building/GetEventAttachments.ts +88 -0
- package/src/building/GetEventDirection.ts +28 -0
- package/src/{@building/building.enhance.ts → building/GetEventEnhancedName.ts} +13 -17
- package/src/{@building/building.geometry.ts → building/GetEventGeometry.ts} +19 -13
- package/src/{@building/building.headers.ts → building/GetEventHeader.ts} +13 -13
- package/src/{@building/building.polygon.ts → building/GetEventNodes.ts} +26 -22
- package/src/{@building/building.office.ts → building/GetEventOffice.ts} +14 -14
- package/src/building/GetEventProperties.ts +105 -0
- package/src/{@building/building.signature.ts → building/GetEventSignature.ts} +16 -17
- package/src/{@core/core.createListener.ts → building/GetEventTags.ts} +11 -6
- package/src/building/GetEventTheme.ts +26 -0
- package/src/building/GetEventTracking.ts +64 -0
- package/src/components/audio/GenerateAudioMessage.ts +149 -0
- package/src/components/audio/components/GetCleanDescription.ts +91 -0
- package/src/{@modules/@eas/eas.getFloatPCM16.ts → components/audio/components/GetFloatPCM16.ts} +3 -3
- package/src/{@modules/@eas/eas.getMergedPCM16.ts → components/audio/components/GetMergedPCM16.ts} +3 -3
- package/src/{@modules/@eas/eas.getPCM16.ts → components/audio/components/GetPCM16.ts} +13 -8
- package/src/{@modules/@eas/eas.getPCMToFloat.ts → components/audio/components/GetPCMToFloat.ts} +3 -3
- package/src/{@modules/@eas/eas.getSampledPCM16.ts → components/audio/components/GetSampledPCM16.ts} +14 -8
- package/src/components/audio/components/GetTTS.ts +61 -0
- package/src/{@modules/@eas/eas.getWavPCM16.ts → components/audio/components/GetWavPCM16.ts} +8 -8
- package/src/{@modules/@eas/eas.setAFSK.ts → components/audio/components/SetAFSK.ts} +12 -8
- package/src/{@modules/@eas/eas.setAsciiToBits.ts → components/audio/components/SetAsciiToBits.ts} +3 -4
- package/src/{@modules/@eas/eas.setAttentionTone.ts → components/audio/components/SetAttentionTone.ts} +11 -6
- package/src/{@modules/@eas/eas.setNoise.ts → components/audio/components/SetNoise.ts} +14 -8
- package/src/{@modules/@eas/eas.setRadioEffect.ts → components/audio/components/SetRadioEffect.ts} +14 -8
- package/src/{@modules/@eas/eas.setSameHeader.ts → components/audio/components/SetSameHeader.ts} +22 -15
- package/src/{@modules/@utilities/utilities.setWarning.ts → components/database/CreateQuery.ts} +18 -13
- package/src/{@modules/@database/database.cache.ts → components/database/GetCachedEvents.ts} +19 -14
- package/src/components/database/ImportBoundaries.ts +168 -0
- package/src/components/database/ImportBroadcastify.ts +60 -0
- package/src/components/database/ImportCities.ts +87 -0
- package/src/{@modules/@database/database.shapefiles.ts → components/database/ImportShapefiles.ts} +31 -37
- package/src/components/database/ImportStanza.ts +43 -0
- 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/stanza.getAwipsType.ts → components/stanza/GetAwipsType.ts} +19 -18
- package/src/components/stanza/ValidateStanza.ts +62 -0
- package/src/components/utilities/CreateHttp.ts +83 -0
- package/src/{@modules/@utilities/utilities.getFormattedTime.ts → components/utilities/GetFormattedTime.ts} +3 -3
- package/src/components/utilities/GetLatestIssuance.ts +32 -0
- package/src/components/utilities/GetMatched.ts +38 -0
- package/src/{@modules/@utilities/utilities.getShapeNearestPoint.ts → components/utilities/GetShapeNearestPoint.ts} +24 -19
- package/src/components/utilities/GetUnionPolygon.ts +36 -0
- package/src/components/utilities/QueueManager.ts +70 -0
- package/src/components/utilities/SetCronSchedule.ts +98 -0
- package/src/{@core/core.clearEvents.ts → components/utilities/SetDebug.ts} +17 -12
- package/src/components/utilities/SetEventEmit.ts +42 -0
- package/src/{@modules/@utilities/utilities.setSettings.ts → components/utilities/SetSettings.ts} +7 -7
- package/src/{@modules/@utilities/utilities.setSleep.ts → 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/xmpp.xDeploy.ts → components/xmpp/DeployXMPP.ts} +26 -27
- package/src/components/xmpp/ErrorXMPP.ts +27 -0
- package/src/{@modules/@xmpp/xmpp.xError.ts → components/xmpp/OfflineXMPP.ts} +17 -9
- package/src/{@modules/@xmpp/xmpp.xOnline.ts → components/xmpp/OnlineXMPP.ts} +21 -20
- package/src/components/xmpp/ReconnectXMPP.ts +64 -0
- package/src/components/xmpp/StanzaXMPP.ts +63 -0
- package/src/{@building/building.tags.ts → core/ClearEvents.ts} +12 -5
- package/src/{@core/core.getVersion.ts → core/GetEvents.ts} +5 -6
- package/src/core/GetNodes.ts +24 -0
- package/src/{@core/core.getNodes.ts → core/GetRandomEvent.ts} +5 -6
- package/src/core/GetVersion.ts +24 -0
- package/src/core/ManualEvent.ts +55 -0
- package/src/core/QueryStanza.ts +40 -0
- package/src/core/SetNode.ts +87 -0
- package/src/core/StartService.ts +62 -0
- package/src/core/StopService.ts +32 -0
- package/src/enums/AWIPS.ts +366 -0
- package/src/{@dictionaries/dictionaries.eventActions.ts → enums/Actions.ts} +3 -3
- package/src/{@dictionaries/dictionaries.eventCancelMessages.ts → enums/Cancellation.ts} +4 -3
- package/src/{@dictionaries/dictionaries.eventCauses.ts → enums/Causes.ts} +3 -3
- package/src/{@dictionaries/dictionaries.statusCorrelationText.ts → enums/Correlations.ts} +3 -3
- package/src/enums/Enhanced.ts +70 -0
- package/src/{@dictionaries/dictionaries.eventTypes.ts → enums/Events.ts} +3 -3
- package/src/{@dictionaries/dictionaries.regExp.ts → enums/Expressions.ts} +5 -4
- package/src/{@core/core.getEvents.ts → enums/GlobalFilter.ts} +7 -8
- package/src/{@dictionaries/dictionaries.hailStrings.ts → enums/Hail.ts} +9 -4
- package/src/{@dictionaries/dictionaries.officeICAOs.ts → enums/ICAO.ts} +5 -3
- package/src/enums/Matches.ts +60 -0
- package/src/{@dictionaries/dictionaries.eventProducts.ts → enums/Products.ts} +3 -3
- package/src/{@dictionaries/dictionaries.eventRecords.ts → enums/Records.ts} +3 -3
- package/src/{@dictionaries/dictionaries.eventSeverity.ts → enums/Severity.ts} +3 -3
- package/src/{@dictionaries/dictionaries.shapefileLinks.ts → enums/Shapefiles.ts} +3 -3
- package/src/enums/States.ts +136 -0
- package/src/{@dictionaries/dictionaries.eventStatus.ts → enums/Status.ts} +3 -3
- package/src/enums/Strings.ts +22 -0
- package/src/enums/Tags.ts +172 -0
- package/src/{@dictionaries/dictionaries.testSignatures.ts → enums/Testing.ts} +5 -4
- package/src/enums/Themes.ts +70 -0
- package/src/events/ParseAPI.ts +129 -0
- package/src/{@events/events.text.ts → events/ParseText.ts} +32 -23
- package/src/{@events/events.ugc.ts → events/ParseUGC.ts} +36 -26
- package/src/events/ParseVTEC.ts +88 -0
- package/src/index.ts +60 -38
- package/src/manager/MakeEvents.ts +110 -0
- package/src/manager/RemoveEvent.ts +74 -0
- package/src/{@manager/manager.setHash.ts → manager/SetHash.ts} +19 -15
- package/src/manager/UpdateEvents.ts +35 -0
- package/src/manager/UpdateNode.ts +62 -0
- package/src/manager/ValidateEvents.ts +144 -0
- package/src/{@parsers/@hvtec/hvtec.extract.ts → parsers/hvtec/HVExtract.ts} +13 -13
- package/src/parsers/text/GetDescriptionFromProduct.ts +59 -0
- package/src/parsers/text/GetEmbededText.ts +57 -0
- package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
- package/src/parsers/text/GetStringText.ts +58 -0
- package/src/{@parsers/@text/text.getTextFromProduct.ts → parsers/text/GetTextFromProduct.ts} +12 -12
- package/src/parsers/ugc/GetCache.ts +24 -0
- package/src/{@parsers/@ugc/ugc.expiry.ts → parsers/ugc/GetExpiry.ts} +3 -3
- package/src/{@parsers/@ugc/ugc.header.ts → parsers/ugc/GetHeader.ts} +6 -6
- package/src/parsers/ugc/GetLocations.ts +57 -0
- package/src/parsers/ugc/GetZonePolygon.ts +73 -0
- package/src/{@parsers/@ugc/ugc.zones.ts → parsers/ugc/GetZones.ts} +3 -3
- package/src/{@modules/@utilities/utilities.setListener.ts → parsers/ugc/SetCache.ts} +13 -10
- package/src/{@parsers/@ugc/ugc.extract.ts → parsers/ugc/UGCExtract.ts} +15 -15
- package/src/{@parsers/@pvtec/pvtec.expires.ts → parsers/vtec/GetExpiry.ts} +3 -3
- package/src/parsers/vtec/VTECExtract.ts +49 -0
- package/src/{@types/types.attributes.ts → static/Attributes.ts} +2 -3
- package/src/{@types/type.event.ts → static/Event.ts} +11 -8
- package/src/{@types/type.properties.ts → static/Properties.ts} +17 -10
- package/src/{@types/types.stanza.ts → static/Stanza.ts} +2 -2
- package/src/tasks/CreateTasks.ts +123 -0
- package/src/{@core/core.stop.ts → tasks/TaskGenerateJSON.ts} +14 -12
- package/src/tasks/TaskGenerateText.ts +34 -0
- package/src/tasks/TaskSendNTFY.ts +97 -0
- package/src/tasks/TaskSendWebhook.ts +107 -0
- package/src/types/Actions.ts +37 -0
- package/src/{@types/types.hvtec.ts → types/HVTEC.ts} +6 -6
- package/src/{@types/types.hash.ts → types/Hash.ts} +5 -5
- package/src/types/Nodes.ts +29 -0
- package/src/{@types/types.settings.ts → types/Settings.ts} +42 -10
- package/src/{@types/types.compiled.ts → types/StanzaCompiled.ts} +15 -14
- package/src/{@types/types.ugc.ts → types/UGC.ts} +5 -5
- package/src/{@modules/@utilities/utilities.getSettings.ts → types/VTEC.ts} +12 -7
- package/tools/build.js +47 -0
- package/tsconfig.json +28 -1
- package/dist/index.d.mts +0 -239
- package/dist/index.d.ts +0 -239
- package/src/@building/building.create.ts +0 -42
- package/src/@building/building.properties.ts +0 -89
- package/src/@building/building.tracking.ts +0 -68
- package/src/@building/building.validate.ts +0 -147
- package/src/@core/core.getRandomEvent.ts +0 -25
- package/src/@core/core.setNode.ts +0 -81
- package/src/@core/core.start.ts +0 -61
- package/src/@dictionaries/dictionaries.betterEventNames.ts +0 -99
- package/src/@dictionaries/dictionaries.eventAwipAbreviations.ts +0 -364
- package/src/@dictionaries/dictionaries.eventTags.ts +0 -93
- package/src/@dictionaries/dictionaries.eventsMatchText.ts +0 -36
- package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +0 -68
- package/src/@events/events.api.ts +0 -113
- package/src/@events/events.vtec.ts +0 -87
- package/src/@manager/manager.mkEvent.ts +0 -96
- package/src/@manager/manager.rmEvent.ts +0 -49
- package/src/@manager/manager.updateEvents.ts +0 -35
- package/src/@manager/manager.updateNodes.ts +0 -55
- package/src/@manager/manager.updateWebhooks.ts +0 -50
- package/src/@modules/@database/database.init.ts +0 -45
- package/src/@modules/@database/database.stanza.ts +0 -48
- package/src/@modules/@eas/eas.setEasTone.ts +0 -137
- package/src/@modules/@stanza/stanza.validate.ts +0 -50
- package/src/@modules/@utilities/utilities.createHttp.ts +0 -85
- package/src/@modules/@utilities/utilities.createWebhook.ts +0 -115
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +0 -65
- package/src/@modules/@utilities/utilities.setEventEmit.ts +0 -41
- package/src/@modules/@utilities/utilities.setTimeoutAction.ts +0 -59
- package/src/@modules/@xmpp/xmpp.xOffline.ts +0 -38
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +0 -64
- package/src/@modules/@xmpp/xmpp.xStanza.ts +0 -63
- package/src/@parsers/@pvtec/pvtec.extract.ts +0 -49
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +0 -53
- package/src/@parsers/@text/text.getPolygonFromProduct.ts +0 -32
- package/src/@parsers/@text/text.getXML.ts +0 -61
- package/src/@parsers/@ugc/ugc.coordinates.ts +0 -110
- package/src/@parsers/@ugc/ugc.locations.ts +0 -29
- package/src/@types/types.pvtec.ts +0 -30
- package/src/@types/types.webhook.ts +0 -27
- package/test.js +0 -91
- package/tsup.config.ts +0 -16
- /package/{CODE_OF_CONDUCT.md → .github/CODE_OF_CONDUCT.md} +0 -0
- /package/{LICENSE → .github/LICENSE} +0 -0
- /package/{SECURITY.md → .github/SECURITY.md} +0 -0
package/package.json
CHANGED
|
@@ -1,53 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@atmosx/event-product-parser",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "NOAA Weather Wire & NWS API Parser - Built for standalone and Project AtmosphericX Integration.",
|
|
5
|
-
"main": "dist/cjs/index.cjs",
|
|
6
|
-
"module": "dist/esm/index.mjs",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/AtmosphericX/event-product-parser",
|
|
10
|
-
"branch": "beta"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"start": "cd ./test && node ./index.js",
|
|
14
|
-
"build": "
|
|
15
|
-
"
|
|
16
|
-
"publish": "
|
|
17
|
-
"publish-beta-branch": "
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"NWWS",
|
|
21
|
-
"NOAA Weather Wire Service",
|
|
22
|
-
"TypeScript",
|
|
23
|
-
"XMPP",
|
|
24
|
-
"Parser",
|
|
25
|
-
"JavaScript",
|
|
26
|
-
"CommonJS",
|
|
27
|
-
"ESM"
|
|
28
|
-
],
|
|
29
|
-
"author": "k3yomi, StarflightWx",
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"bugs": {
|
|
32
|
-
"url": "https://github.com/AtmosphericX/event-product-parser/issues"
|
|
33
|
-
},
|
|
34
|
-
"homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
|
|
35
|
-
"dependencies": {
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"jszip": "3.10.1",
|
|
42
|
-
"polygon-clipping": "0.15.7",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"typescript": "5.9.3"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"@types/
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@atmosx/event-product-parser",
|
|
3
|
+
"version": "3.0.7",
|
|
4
|
+
"description": "NOAA Weather Wire & NWS API Parser - Built for standalone and Project AtmosphericX Integration.",
|
|
5
|
+
"main": "dist/cjs/index.cjs",
|
|
6
|
+
"module": "dist/esm/index.mjs",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AtmosphericX/event-product-parser",
|
|
10
|
+
"branch": "v3-beta-branch"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"start": "cd ./test && node ./index.js",
|
|
14
|
+
"build": "node ./tools/build.js && cd ./test && node index.js",
|
|
15
|
+
"watch": "node ./tools/build.js --watch",
|
|
16
|
+
"publish": "node ./tools/build.js && npm publish --access public",
|
|
17
|
+
"publish-beta-branch": "node ./tools/build.js && npm publish --tag v3-beta-branch --access public"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"NWWS",
|
|
21
|
+
"NOAA Weather Wire Service",
|
|
22
|
+
"TypeScript",
|
|
23
|
+
"XMPP",
|
|
24
|
+
"Parser",
|
|
25
|
+
"JavaScript",
|
|
26
|
+
"CommonJS",
|
|
27
|
+
"ESM"
|
|
28
|
+
],
|
|
29
|
+
"author": "k3yomi, StarflightWx",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/AtmosphericX/event-product-parser/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@xmpp/client": "0.14.0",
|
|
37
|
+
"better-sqlite3": "12.9.0",
|
|
38
|
+
"croner": "10.0.1",
|
|
39
|
+
"d3-geo": "3.1.1",
|
|
40
|
+
"esbuild": "0.28.1",
|
|
41
|
+
"jszip": "3.10.1",
|
|
42
|
+
"polygon-clipping": "0.15.7",
|
|
43
|
+
"shapefile": "0.6.6",
|
|
44
|
+
"sharp": "0.35.3",
|
|
45
|
+
"topojson-client": "3.1.0",
|
|
46
|
+
"typescript": "5.9.3"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/better-sqlite3": "7.6.13",
|
|
50
|
+
"@types/d3-geo": "3.1.0",
|
|
51
|
+
"@types/node": "25.2.0",
|
|
52
|
+
"@types/shapefile": "0.6.4",
|
|
53
|
+
"@types/topojson-client": "3.1.5",
|
|
54
|
+
"@types/xmpp__client": "0.14.1"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/bootstrap.ts
CHANGED
|
@@ -11,50 +11,63 @@
|
|
|
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 {
|
|
20
|
+
import { TypeEvent } from "StaticTypes/Event"
|
|
21
|
+
import { TypeHash } from "Types/Hash"
|
|
22
|
+
import { TypeActions } from "Types/Actions"
|
|
23
|
+
import { TypeNode } from "Types/Nodes"
|
|
24
|
+
import { EnumThemes } from "@Enums/Themes"
|
|
25
|
+
import { EventEmitter } from "node:events"
|
|
26
|
+
import { client } from "@xmpp/client"
|
|
27
|
+
import { Database } from "better-sqlite3"
|
|
28
|
+
import { join } from "path"
|
|
22
29
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
export const Bootstrap = {
|
|
31
|
+
Version: `3.0.7`,
|
|
32
|
+
Ready: true,
|
|
33
|
+
Ratelimits: {} as Record<string, number[]>,
|
|
34
|
+
Session: null as ReturnType<typeof client>,
|
|
35
|
+
Database: null as Database,
|
|
36
|
+
Job: null as unknown,
|
|
37
|
+
Listener: new EventEmitter(),
|
|
38
|
+
Colors: {
|
|
39
|
+
Red: `\x1b[31m`, Green: `\x1b[32m`, Yellow: `\x1b[33m`,
|
|
40
|
+
Blue: `\x1b[34m`, Magenta: `\x1b[35m`, Cyan: `\x1b[36m`,
|
|
41
|
+
White: `\x1b[37m`, Reset: `\x1b[0m`
|
|
35
42
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
Cache: {
|
|
44
|
+
LastStanzaTime: null as number,
|
|
45
|
+
Connected: false,
|
|
46
|
+
Reconnecting: false,
|
|
47
|
+
TotalReconnects: 0,
|
|
48
|
+
Hault: false,
|
|
49
|
+
Events: {type: "FeatureCollection", features: [] as TypeEvent[]},
|
|
50
|
+
Nodes: {type: "FeatureCollection", features: [] as TypeNode[]},
|
|
51
|
+
Hashes: [] as TypeHash[],
|
|
52
|
+
Parsed: [] as TypeEvent[],
|
|
53
|
+
UGC: new Map<string, string[]>()
|
|
45
54
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
Settings: {
|
|
56
|
+
Timezone: "UTC",
|
|
57
|
+
Database: join(process.cwd(), 'shapefiles.db'),
|
|
58
|
+
DebugDisableAllEvents: false,
|
|
59
|
+
EnableWireService: false,
|
|
60
|
+
EnableDebugging: false,
|
|
49
61
|
EnableJournal: true,
|
|
62
|
+
EnhancedEventJournaling: false,
|
|
50
63
|
NOAAWeatherWireServiceSettings: {
|
|
51
64
|
ReconnectionSettings: {
|
|
52
65
|
Enabled: true,
|
|
53
66
|
ReconnectionInterval: 60,
|
|
54
67
|
},
|
|
55
68
|
CredentialSettings: {
|
|
56
|
-
Username: null,
|
|
57
|
-
Password: null,
|
|
69
|
+
Username: null as string,
|
|
70
|
+
Password: null as string,
|
|
58
71
|
Nickname: "@atmosx/event-product-parser/3.0",
|
|
59
72
|
},
|
|
60
73
|
CacheSettings: {
|
|
@@ -72,29 +85,56 @@ export const bootstrap = {
|
|
|
72
85
|
CallbackInterval: 15,
|
|
73
86
|
EventsEndpoint: `https://api.weather.gov/alerts/active`,
|
|
74
87
|
},
|
|
75
|
-
|
|
88
|
+
BroadcastifySettings: {
|
|
89
|
+
BroadcastifyAttachments: true,
|
|
90
|
+
BroadcastifyDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/broadcastify.json`,
|
|
91
|
+
BroadcastifyTags: [`Ham`, `Air`, `Fire`, `Public Safety`, `Weather`, `EMS`, `Police`, `Rail`]
|
|
92
|
+
},
|
|
93
|
+
BoundarySettings: {
|
|
94
|
+
BoundaryDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/counties-10m.json`,
|
|
95
|
+
CityDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/cities500.json`
|
|
96
|
+
},
|
|
97
|
+
NotifyServer: {
|
|
98
|
+
Enabled: false,
|
|
99
|
+
Server: `https://ntfy.sh`,
|
|
100
|
+
MediaStorage: {
|
|
101
|
+
AUDIO: null as string,
|
|
102
|
+
TEXT: null as string,
|
|
103
|
+
JSON: null as string,
|
|
104
|
+
IMAGE: null as string
|
|
105
|
+
},
|
|
106
|
+
Credentials: {
|
|
107
|
+
Username: null as string,
|
|
108
|
+
Password: null as string
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
ActionSettings: [] as TypeActions[],
|
|
76
112
|
GlobalSettings: {
|
|
77
113
|
EventManagement: true,
|
|
78
|
-
BetterEventNames: true,
|
|
79
114
|
DisableGeometryParsing: false,
|
|
80
|
-
UseShapefileCoordinates:
|
|
115
|
+
UseShapefileCoordinates: true,
|
|
81
116
|
SPCWatchesOnly: true,
|
|
82
|
-
ShapefileSkipPoints: 15,
|
|
83
117
|
NodeTTL: 60,
|
|
84
|
-
|
|
118
|
+
NodeMaxDistance: 120,
|
|
85
119
|
EventFiltering: {
|
|
86
|
-
ListeningEvents: [],
|
|
87
|
-
ListeningICAO: [],
|
|
88
|
-
ListeningUGC: [],
|
|
89
|
-
ListeningStates: [],
|
|
90
|
-
IgnoredICAO: [],
|
|
120
|
+
ListeningEvents: [] as string[],
|
|
121
|
+
ListeningICAO: [] as string[],
|
|
122
|
+
ListeningUGC: [] as string[],
|
|
123
|
+
ListeningStates: [] as string[],
|
|
124
|
+
IgnoredICAO: [] as string[],
|
|
91
125
|
IgnoredEvents: [`Test Message`],
|
|
92
126
|
NodeLocationFiltering: false,
|
|
93
127
|
IgnoreTestProducts: true,
|
|
94
128
|
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
Themes: EnumThemes,
|
|
130
|
+
ArchiveSettings: {
|
|
131
|
+
TTL: 60,
|
|
132
|
+
ImageDirectory: `Archive/Images` as string,
|
|
133
|
+
JSONDirectory: `Archive/Products` as string,
|
|
134
|
+
TextDirectory: `Archive/Text` as string,
|
|
135
|
+
AudioDirectory: `Archive/Audio` as string,
|
|
136
|
+
Logo: null as string,
|
|
137
|
+
AudioToneout: null as string
|
|
98
138
|
}
|
|
99
139
|
}
|
|
100
140
|
},
|
|
@@ -0,0 +1,54 @@
|
|
|
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 { TypeStanzaCompiled } from "Types/StanzaCompiled"
|
|
21
|
+
import { TypeSettings } from "Types/Settings"
|
|
22
|
+
import { Bootstrap } from "@Bootstrap"
|
|
23
|
+
import { ParseText } from "@Events/ParseText"
|
|
24
|
+
import { ParseUGC } from "@Events/ParseUGC"
|
|
25
|
+
import { ParseVTEC } from "@Events/ParseVTEC"
|
|
26
|
+
import { ParseAPI } from "@Events/ParseAPI"
|
|
27
|
+
import { ValidateEvents } from "@Manager/ValidateEvents"
|
|
28
|
+
|
|
29
|
+
export const CreateEvent = async (Stanza: TypeStanzaCompiled): Promise<void | string> => {
|
|
30
|
+
const settings = Bootstrap.Settings as TypeSettings
|
|
31
|
+
const StanzaSettings = settings.NOAAWeatherWireServiceSettings.StanzaSettings;
|
|
32
|
+
|
|
33
|
+
const isVtecEvent = (Stanza.VTEC && Stanza.UGC)
|
|
34
|
+
const isUgcEvent = (!Stanza.VTEC && Stanza.UGC)
|
|
35
|
+
const isTextEvent = (!Stanza.VTEC && !Stanza.UGC)
|
|
36
|
+
|
|
37
|
+
const isNWWS = (Stanza.NWWS)
|
|
38
|
+
switch (true) {
|
|
39
|
+
case (!isNWWS):
|
|
40
|
+
await ParseAPI(Stanza)
|
|
41
|
+
break;
|
|
42
|
+
case (isNWWS && !StanzaSettings.DisableVTEC && isVtecEvent):
|
|
43
|
+
await ParseVTEC(Stanza)
|
|
44
|
+
break;
|
|
45
|
+
case (isNWWS && !StanzaSettings.DisableUGC && isUgcEvent):
|
|
46
|
+
await ParseUGC(Stanza)
|
|
47
|
+
break;
|
|
48
|
+
case (isNWWS && !StanzaSettings.DisableText && isTextEvent):
|
|
49
|
+
await ParseText(Stanza)
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
await ValidateEvents(Bootstrap.Cache.Parsed)
|
|
53
|
+
return 'nothing picked';
|
|
54
|
+
}
|
|
@@ -11,19 +11,19 @@
|
|
|
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
|
-
export const
|
|
20
|
+
export const GetCleanedEvent = <T extends Record<string, any>>(event: T): T => {
|
|
21
21
|
for (const key of Object.keys(event)) {
|
|
22
22
|
const value = event[key];
|
|
23
23
|
if (value === null || value === undefined) {
|
|
24
24
|
delete event[key];
|
|
25
25
|
} else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
26
|
-
(event as Record<string, any>)[key] =
|
|
26
|
+
(event as Record<string, any>)[key] = GetCleanedEvent(value as Record<string, any>) as any;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
return event;
|
|
@@ -0,0 +1,88 @@
|
|
|
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 { TypeEvent } from "StaticTypes/Event"
|
|
21
|
+
import { EnumStates } from "@Enums/States"
|
|
22
|
+
import { Bootstrap } from "@Bootstrap"
|
|
23
|
+
import { EnumExpressions } from "@Enums/Expressions"
|
|
24
|
+
import { GetLatestIssuance } from "@Utilities/GetLatestIssuance"
|
|
25
|
+
import { CreateQuery } from "@Database/CreateQuery"
|
|
26
|
+
|
|
27
|
+
interface GetEventAttachmentsResponse {
|
|
28
|
+
name: string
|
|
29
|
+
link: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type BroadcastifyResponse = {
|
|
33
|
+
state: string
|
|
34
|
+
county: string
|
|
35
|
+
feed: string
|
|
36
|
+
type: string
|
|
37
|
+
link: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const GetEventAttachments = (event: TypeEvent): GetEventAttachmentsResponse[] | null => {
|
|
41
|
+
let attachments = [];
|
|
42
|
+
const settings = Bootstrap.Settings;
|
|
43
|
+
const issuanceTime = GetLatestIssuance();
|
|
44
|
+
const spcNumber = event?.properties?.discussion_parameters?.discussion_number;
|
|
45
|
+
const watchNumber = event?.properties?.watch_parameters?.watch_number;
|
|
46
|
+
const locations = event?.properties?.locations_array;
|
|
47
|
+
const events = [
|
|
48
|
+
{ target: "Storm Prediction Center Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
|
|
49
|
+
{ target: "Storm Prediction Center Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
|
|
50
|
+
{ target: "Storm Prediction Center Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
|
|
51
|
+
{ target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
|
|
52
|
+
{ target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
53
|
+
{ target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
54
|
+
{ target: "Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
55
|
+
{ target: "PDS Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` }
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
if (events.find((e) => e.target === event.properties.event)) {
|
|
59
|
+
attachments.push({ name: `Image: Graphic`, link: events.find((e) => e.target.toLowerCase() === event.properties.event.toLowerCase()).attachment });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (settings.BroadcastifySettings.BroadcastifyAttachments) {
|
|
63
|
+
for (const location of locations) {
|
|
64
|
+
if (EnumExpressions.location.test(location)) {
|
|
65
|
+
const lines = [`Northern`, `Southern`, `Eastern`, `Western`, `Inland`, `Costal`, `County`]
|
|
66
|
+
const county = location?.split(',')[0]?.trim().replace(new RegExp(`^(${lines.join('|')}) `), '')
|
|
67
|
+
const state = EnumStates[location?.split(',')[1]?.trim()]
|
|
68
|
+
const feeds = CreateQuery({ Query: `SELECT * FROM broadcastify WHERE state = ? AND county = ?`, Parameters: [state, county] }) as BroadcastifyResponse[];
|
|
69
|
+
const so = feeds.sort((a: BroadcastifyResponse, b: BroadcastifyResponse) => {
|
|
70
|
+
const typeOrder = ['Other', 'Public Safety'];
|
|
71
|
+
const indexA = typeOrder.indexOf(a.type);
|
|
72
|
+
const indexB = typeOrder.indexOf(b.type);
|
|
73
|
+
return indexA - indexB;
|
|
74
|
+
});
|
|
75
|
+
const tags = Bootstrap.Settings.BroadcastifySettings.BroadcastifyTags;
|
|
76
|
+
const filtered = so.filter((feed: BroadcastifyResponse) => tags.includes(feed.type));
|
|
77
|
+
if (filtered.length > 0) {
|
|
78
|
+
filtered.map((filtered: BroadcastifyResponse) => {
|
|
79
|
+
if (!attachments.some((a) => a.link === filtered.link)) {
|
|
80
|
+
attachments.push({ name: `${filtered.type}: ${filtered.feed}`, link: filtered.link });
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return attachments;
|
|
88
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
export const GetEventDirection = (message: string): string | null => {
|
|
21
|
+
const direction = message
|
|
22
|
+
.replace(/\s+/g, ' ')
|
|
23
|
+
.match(/moving\s+(north|south|east|west|northeast|northwest|southeast|southwest)\s+at\s+(\d+)\s+mph/i);
|
|
24
|
+
if (direction) {
|
|
25
|
+
return direction[1].charAt(0).toUpperCase() + direction[1].slice(1).toLowerCase() + ` @ ${direction[2]} MPH`;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
@@ -11,29 +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 { TypeEvent } from "
|
|
21
|
-
import {
|
|
22
|
-
import { bootstrap } from "../bootstrap"
|
|
23
|
-
import { betterEventNames } from "../@dictionaries/dictionaries.betterEventNames"
|
|
20
|
+
import { TypeEvent } from "StaticTypes/Event"
|
|
21
|
+
import { EnumEnhanced } from "@Enums/Enhanced"
|
|
24
22
|
|
|
25
|
-
export const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return name
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const damage = event?.properties?.parameters?.damage_threat
|
|
34
|
-
const tornado = event?.properties?.parameters.tornado_threat;
|
|
23
|
+
export const GetEventEnhancedName = (event: TypeEvent): string => {
|
|
24
|
+
let name = event?.properties?.event;
|
|
25
|
+
const damage = event?.properties?.parameters?.damage_threat ?? event?.properties?.parameters?.flood_threat
|
|
26
|
+
const tornado = event?.properties?.parameters?.tornado_threat;
|
|
27
|
+
const pdswatch = event?.properties?.watch_parameters?.pds_watch;
|
|
35
28
|
const description = event?.properties?.description?.toLowerCase()
|
|
36
|
-
for (const [eventKey, eventConfig] of Object.entries(
|
|
29
|
+
for (const [eventKey, eventConfig] of Object.entries(EnumEnhanced)) {
|
|
37
30
|
if (eventKey !== name) continue;
|
|
38
31
|
for (const [paramKey, paramValue] of Object.entries(eventConfig)) {
|
|
39
32
|
let matches = true;
|
|
@@ -46,6 +39,9 @@ export const getEventEnhancedName = (event: TypeEvent): string => {
|
|
|
46
39
|
if (paramValue?.tornado) {
|
|
47
40
|
if (paramValue.tornado !== tornado) matches = false;
|
|
48
41
|
}
|
|
42
|
+
if (paramValue?.pdswatch) {
|
|
43
|
+
if (paramValue.pdswatch !== pdswatch) matches = false;
|
|
44
|
+
}
|
|
49
45
|
if (matches) {
|
|
50
46
|
name = paramKey;
|
|
51
47
|
break;
|
|
@@ -11,32 +11,38 @@
|
|
|
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 {
|
|
20
|
+
import { TypeSettings } from "Types/Settings"
|
|
21
|
+
import { TypeEvent } from "StaticTypes/Event"
|
|
22
|
+
import { Bootstrap } from "@Bootstrap"
|
|
23
|
+
import { GetZonePolygon } from "@ParsingUGC/GetZonePolygon"
|
|
24
24
|
|
|
25
|
-
interface
|
|
25
|
+
interface GetEventGeometryOptions {
|
|
26
|
+
Event: TypeEvent
|
|
27
|
+
Union?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface GetEventGeometryResponse {
|
|
26
31
|
type: `Polygon` | `MultiPolygon`
|
|
27
32
|
coordinates: any[]
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
export const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
+
export const GetEventGeometry = ({ Event, Union }: GetEventGeometryOptions): GetEventGeometryResponse => {
|
|
36
|
+
const { properties } = Event;
|
|
37
|
+
const settings = Bootstrap.Settings as TypeSettings
|
|
38
|
+
const generated = properties?.geocode?.polygon ?? null;
|
|
39
|
+
const ugc = properties?.geocode?.ugc ?? null;
|
|
40
|
+
let geo: GetEventGeometryResponse = {
|
|
35
41
|
type: `Polygon`,
|
|
36
42
|
coordinates: generated != null ? JSON.parse(Buffer.from(generated, 'base64').toString('utf-8')) : null
|
|
37
43
|
}
|
|
38
44
|
if (settings.GlobalSettings.UseShapefileCoordinates && generated == null && ugc != null) {
|
|
39
|
-
geo =
|
|
45
|
+
geo = GetZonePolygon({Zones: ugc, Union: Union ?? false});
|
|
40
46
|
if (geo == null) {
|
|
41
47
|
geo = {
|
|
42
48
|
type: `Polygon`,
|
|
@@ -11,27 +11,27 @@
|
|
|
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 { TypeEventProperties } from "
|
|
20
|
+
import { TypeVTEC } from "Types/VTEC"
|
|
21
|
+
import { TypeEventProperties } from "StaticTypes/Properties"
|
|
22
22
|
|
|
23
23
|
interface GetHeaderOptions {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
Properties: TypeEventProperties
|
|
25
|
+
VTEC?: TypeVTEC
|
|
26
|
+
Type: {
|
|
27
|
+
Type: string
|
|
28
|
+
Prefix: string
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export const
|
|
33
|
-
const properties =
|
|
34
|
-
const vtec =
|
|
32
|
+
export const GetEventHeader = ({ Properties, VTEC, Type }: GetHeaderOptions): string => {
|
|
33
|
+
const properties = Properties
|
|
34
|
+
const vtec = VTEC ?? null
|
|
35
35
|
const ugc = properties.geocode.ugc != null ? properties.geocode.ugc.join(`-`) : `0`;
|
|
36
|
-
return `ZCZC-ATMOSX-${
|
|
36
|
+
return `ZCZC-ATMOSX-${Type?.Prefix}-${ugc}-${vtec?.Status ?? `Issued`}-${new Date().toISOString().replace(/[-:]/g, '').split('.')[0]}-${properties.geocode.office.office ?? `KWNS`}`
|
|
37
37
|
}
|