@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.
Files changed (212) hide show
  1. package/{CONTRIBUTING.md → .github/CONTRIBUTING.md} +1 -1
  2. package/.github/SUPPORTED_EVENTS.md +370 -0
  3. package/.github/docs/docs-functions.md +30 -0
  4. package/.github/docs/docs-general-configurations.md +199 -0
  5. package/.github/docs/docs-integrations.md +38 -0
  6. package/.github/docs/docs-listeners.md +28 -0
  7. package/.github/docs/docs-source-configuration.md +218 -0
  8. package/.github/docs/docs-technical.md +50 -0
  9. package/.github/logo.png +0 -0
  10. package/.github/samples/SAMPLE_EAS_GENERATION.wav +0 -0
  11. package/.github/samples/SAMPLE_GEOJSON.json +204 -0
  12. package/.github/samples/SAMPLE_TEXT_PRODUCT.txt +119 -0
  13. package/README.md +157 -337
  14. package/dist/cjs/index.cjs +24125 -15815
  15. package/dist/esm/index.mjs +24144 -15839
  16. package/package.json +56 -53
  17. package/pnpm-workspace.yaml +4 -0
  18. package/src/bootstrap.ts +83 -43
  19. package/src/building/CreateEvent.ts +54 -0
  20. package/src/{@building/building.clean.ts → building/GetCleanedEvent.ts} +4 -4
  21. package/src/building/GetEventAttachments.ts +88 -0
  22. package/src/building/GetEventDirection.ts +28 -0
  23. package/src/{@building/building.enhance.ts → building/GetEventEnhancedName.ts} +13 -17
  24. package/src/{@building/building.geometry.ts → building/GetEventGeometry.ts} +19 -13
  25. package/src/{@building/building.headers.ts → building/GetEventHeader.ts} +13 -13
  26. package/src/{@building/building.polygon.ts → building/GetEventNodes.ts} +26 -22
  27. package/src/{@building/building.office.ts → building/GetEventOffice.ts} +14 -14
  28. package/src/building/GetEventProperties.ts +105 -0
  29. package/src/{@building/building.signature.ts → building/GetEventSignature.ts} +16 -17
  30. package/src/{@core/core.createListener.ts → building/GetEventTags.ts} +11 -6
  31. package/src/building/GetEventTheme.ts +26 -0
  32. package/src/building/GetEventTracking.ts +64 -0
  33. package/src/components/audio/GenerateAudioMessage.ts +149 -0
  34. package/src/components/audio/components/GetCleanDescription.ts +91 -0
  35. package/src/{@modules/@eas/eas.getFloatPCM16.ts → components/audio/components/GetFloatPCM16.ts} +3 -3
  36. package/src/{@modules/@eas/eas.getMergedPCM16.ts → components/audio/components/GetMergedPCM16.ts} +3 -3
  37. package/src/{@modules/@eas/eas.getPCM16.ts → components/audio/components/GetPCM16.ts} +13 -8
  38. package/src/{@modules/@eas/eas.getPCMToFloat.ts → components/audio/components/GetPCMToFloat.ts} +3 -3
  39. package/src/{@modules/@eas/eas.getSampledPCM16.ts → components/audio/components/GetSampledPCM16.ts} +14 -8
  40. package/src/components/audio/components/GetTTS.ts +61 -0
  41. package/src/{@modules/@eas/eas.getWavPCM16.ts → components/audio/components/GetWavPCM16.ts} +8 -8
  42. package/src/{@modules/@eas/eas.setAFSK.ts → components/audio/components/SetAFSK.ts} +12 -8
  43. package/src/{@modules/@eas/eas.setAsciiToBits.ts → components/audio/components/SetAsciiToBits.ts} +3 -4
  44. package/src/{@modules/@eas/eas.setAttentionTone.ts → components/audio/components/SetAttentionTone.ts} +11 -6
  45. package/src/{@modules/@eas/eas.setNoise.ts → components/audio/components/SetNoise.ts} +14 -8
  46. package/src/{@modules/@eas/eas.setRadioEffect.ts → components/audio/components/SetRadioEffect.ts} +14 -8
  47. package/src/{@modules/@eas/eas.setSameHeader.ts → components/audio/components/SetSameHeader.ts} +22 -15
  48. package/src/{@modules/@utilities/utilities.setWarning.ts → components/database/CreateQuery.ts} +18 -13
  49. package/src/{@modules/@database/database.cache.ts → components/database/GetCachedEvents.ts} +19 -14
  50. package/src/components/database/ImportBoundaries.ts +168 -0
  51. package/src/components/database/ImportBroadcastify.ts +60 -0
  52. package/src/components/database/ImportCities.ts +87 -0
  53. package/src/{@modules/@database/database.shapefiles.ts → components/database/ImportShapefiles.ts} +31 -37
  54. package/src/components/database/ImportStanza.ts +43 -0
  55. package/src/components/database/InitializeDatabase.ts +71 -0
  56. package/src/components/images/GenerateGraphic.ts +234 -0
  57. package/src/components/images/components/CreateRectangle.ts +22 -0
  58. package/src/components/images/components/CreateText.ts +22 -0
  59. package/src/components/images/modules/CreateSVG.ts +37 -0
  60. package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
  61. package/src/components/images/modules/GetGeographicalCities.ts +58 -0
  62. package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
  63. package/src/components/images/modules/GetGeometryBounds.ts +82 -0
  64. package/src/components/images/modules/GetParsedBoundary.ts +58 -0
  65. package/src/components/images/modules/GetSVGPath.ts +53 -0
  66. package/src/components/images/modules/NormalizePolygon.ts +57 -0
  67. package/src/{@modules/@stanza/stanza.getAwipsType.ts → components/stanza/GetAwipsType.ts} +19 -18
  68. package/src/components/stanza/ValidateStanza.ts +62 -0
  69. package/src/components/utilities/CreateHttp.ts +83 -0
  70. package/src/{@modules/@utilities/utilities.getFormattedTime.ts → components/utilities/GetFormattedTime.ts} +3 -3
  71. package/src/components/utilities/GetLatestIssuance.ts +32 -0
  72. package/src/components/utilities/GetMatched.ts +38 -0
  73. package/src/{@modules/@utilities/utilities.getShapeNearestPoint.ts → components/utilities/GetShapeNearestPoint.ts} +24 -19
  74. package/src/components/utilities/GetUnionPolygon.ts +36 -0
  75. package/src/components/utilities/QueueManager.ts +70 -0
  76. package/src/components/utilities/SetCronSchedule.ts +98 -0
  77. package/src/{@core/core.clearEvents.ts → components/utilities/SetDebug.ts} +17 -12
  78. package/src/components/utilities/SetEventEmit.ts +42 -0
  79. package/src/{@modules/@utilities/utilities.setSettings.ts → components/utilities/SetSettings.ts} +7 -7
  80. package/src/{@modules/@utilities/utilities.setSleep.ts → components/utilities/SetSleep.ts} +5 -5
  81. package/src/components/utilities/SetTimeoutAction.ts +64 -0
  82. package/src/components/utilities/SetWarning.ts +47 -0
  83. package/src/{@modules/@xmpp/xmpp.xDeploy.ts → components/xmpp/DeployXMPP.ts} +26 -27
  84. package/src/components/xmpp/ErrorXMPP.ts +27 -0
  85. package/src/{@modules/@xmpp/xmpp.xError.ts → components/xmpp/OfflineXMPP.ts} +17 -9
  86. package/src/{@modules/@xmpp/xmpp.xOnline.ts → components/xmpp/OnlineXMPP.ts} +21 -20
  87. package/src/components/xmpp/ReconnectXMPP.ts +64 -0
  88. package/src/components/xmpp/StanzaXMPP.ts +63 -0
  89. package/src/{@building/building.tags.ts → core/ClearEvents.ts} +12 -5
  90. package/src/{@core/core.getVersion.ts → core/GetEvents.ts} +5 -6
  91. package/src/core/GetNodes.ts +24 -0
  92. package/src/{@core/core.getNodes.ts → core/GetRandomEvent.ts} +5 -6
  93. package/src/core/GetVersion.ts +24 -0
  94. package/src/core/ManualEvent.ts +55 -0
  95. package/src/core/QueryStanza.ts +40 -0
  96. package/src/core/SetNode.ts +87 -0
  97. package/src/core/StartService.ts +62 -0
  98. package/src/core/StopService.ts +32 -0
  99. package/src/enums/AWIPS.ts +366 -0
  100. package/src/{@dictionaries/dictionaries.eventActions.ts → enums/Actions.ts} +3 -3
  101. package/src/{@dictionaries/dictionaries.eventCancelMessages.ts → enums/Cancellation.ts} +4 -3
  102. package/src/{@dictionaries/dictionaries.eventCauses.ts → enums/Causes.ts} +3 -3
  103. package/src/{@dictionaries/dictionaries.statusCorrelationText.ts → enums/Correlations.ts} +3 -3
  104. package/src/enums/Enhanced.ts +70 -0
  105. package/src/{@dictionaries/dictionaries.eventTypes.ts → enums/Events.ts} +3 -3
  106. package/src/{@dictionaries/dictionaries.regExp.ts → enums/Expressions.ts} +5 -4
  107. package/src/{@core/core.getEvents.ts → enums/GlobalFilter.ts} +7 -8
  108. package/src/{@dictionaries/dictionaries.hailStrings.ts → enums/Hail.ts} +9 -4
  109. package/src/{@dictionaries/dictionaries.officeICAOs.ts → enums/ICAO.ts} +5 -3
  110. package/src/enums/Matches.ts +60 -0
  111. package/src/{@dictionaries/dictionaries.eventProducts.ts → enums/Products.ts} +3 -3
  112. package/src/{@dictionaries/dictionaries.eventRecords.ts → enums/Records.ts} +3 -3
  113. package/src/{@dictionaries/dictionaries.eventSeverity.ts → enums/Severity.ts} +3 -3
  114. package/src/{@dictionaries/dictionaries.shapefileLinks.ts → enums/Shapefiles.ts} +3 -3
  115. package/src/enums/States.ts +136 -0
  116. package/src/{@dictionaries/dictionaries.eventStatus.ts → enums/Status.ts} +3 -3
  117. package/src/enums/Strings.ts +22 -0
  118. package/src/enums/Tags.ts +172 -0
  119. package/src/{@dictionaries/dictionaries.testSignatures.ts → enums/Testing.ts} +5 -4
  120. package/src/enums/Themes.ts +70 -0
  121. package/src/events/ParseAPI.ts +129 -0
  122. package/src/{@events/events.text.ts → events/ParseText.ts} +32 -23
  123. package/src/{@events/events.ugc.ts → events/ParseUGC.ts} +36 -26
  124. package/src/events/ParseVTEC.ts +88 -0
  125. package/src/index.ts +60 -38
  126. package/src/manager/MakeEvents.ts +110 -0
  127. package/src/manager/RemoveEvent.ts +74 -0
  128. package/src/{@manager/manager.setHash.ts → manager/SetHash.ts} +19 -15
  129. package/src/manager/UpdateEvents.ts +35 -0
  130. package/src/manager/UpdateNode.ts +62 -0
  131. package/src/manager/ValidateEvents.ts +144 -0
  132. package/src/{@parsers/@hvtec/hvtec.extract.ts → parsers/hvtec/HVExtract.ts} +13 -13
  133. package/src/parsers/text/GetDescriptionFromProduct.ts +59 -0
  134. package/src/parsers/text/GetEmbededText.ts +57 -0
  135. package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
  136. package/src/parsers/text/GetStringText.ts +58 -0
  137. package/src/{@parsers/@text/text.getTextFromProduct.ts → parsers/text/GetTextFromProduct.ts} +12 -12
  138. package/src/parsers/ugc/GetCache.ts +24 -0
  139. package/src/{@parsers/@ugc/ugc.expiry.ts → parsers/ugc/GetExpiry.ts} +3 -3
  140. package/src/{@parsers/@ugc/ugc.header.ts → parsers/ugc/GetHeader.ts} +6 -6
  141. package/src/parsers/ugc/GetLocations.ts +57 -0
  142. package/src/parsers/ugc/GetZonePolygon.ts +73 -0
  143. package/src/{@parsers/@ugc/ugc.zones.ts → parsers/ugc/GetZones.ts} +3 -3
  144. package/src/{@modules/@utilities/utilities.setListener.ts → parsers/ugc/SetCache.ts} +13 -10
  145. package/src/{@parsers/@ugc/ugc.extract.ts → parsers/ugc/UGCExtract.ts} +15 -15
  146. package/src/{@parsers/@pvtec/pvtec.expires.ts → parsers/vtec/GetExpiry.ts} +3 -3
  147. package/src/parsers/vtec/VTECExtract.ts +49 -0
  148. package/src/{@types/types.attributes.ts → static/Attributes.ts} +2 -3
  149. package/src/{@types/type.event.ts → static/Event.ts} +11 -8
  150. package/src/{@types/type.properties.ts → static/Properties.ts} +17 -10
  151. package/src/{@types/types.stanza.ts → static/Stanza.ts} +2 -2
  152. package/src/tasks/CreateTasks.ts +123 -0
  153. package/src/{@core/core.stop.ts → tasks/TaskGenerateJSON.ts} +14 -12
  154. package/src/tasks/TaskGenerateText.ts +34 -0
  155. package/src/tasks/TaskSendNTFY.ts +97 -0
  156. package/src/tasks/TaskSendWebhook.ts +107 -0
  157. package/src/types/Actions.ts +37 -0
  158. package/src/{@types/types.hvtec.ts → types/HVTEC.ts} +6 -6
  159. package/src/{@types/types.hash.ts → types/Hash.ts} +5 -5
  160. package/src/types/Nodes.ts +29 -0
  161. package/src/{@types/types.settings.ts → types/Settings.ts} +42 -10
  162. package/src/{@types/types.compiled.ts → types/StanzaCompiled.ts} +15 -14
  163. package/src/{@types/types.ugc.ts → types/UGC.ts} +5 -5
  164. package/src/{@modules/@utilities/utilities.getSettings.ts → types/VTEC.ts} +12 -7
  165. package/tools/build.js +47 -0
  166. package/tsconfig.json +28 -1
  167. package/dist/index.d.mts +0 -239
  168. package/dist/index.d.ts +0 -239
  169. package/src/@building/building.create.ts +0 -42
  170. package/src/@building/building.properties.ts +0 -89
  171. package/src/@building/building.tracking.ts +0 -68
  172. package/src/@building/building.validate.ts +0 -147
  173. package/src/@core/core.getRandomEvent.ts +0 -25
  174. package/src/@core/core.setNode.ts +0 -81
  175. package/src/@core/core.start.ts +0 -61
  176. package/src/@dictionaries/dictionaries.betterEventNames.ts +0 -99
  177. package/src/@dictionaries/dictionaries.eventAwipAbreviations.ts +0 -364
  178. package/src/@dictionaries/dictionaries.eventTags.ts +0 -93
  179. package/src/@dictionaries/dictionaries.eventsMatchText.ts +0 -36
  180. package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +0 -68
  181. package/src/@events/events.api.ts +0 -113
  182. package/src/@events/events.vtec.ts +0 -87
  183. package/src/@manager/manager.mkEvent.ts +0 -96
  184. package/src/@manager/manager.rmEvent.ts +0 -49
  185. package/src/@manager/manager.updateEvents.ts +0 -35
  186. package/src/@manager/manager.updateNodes.ts +0 -55
  187. package/src/@manager/manager.updateWebhooks.ts +0 -50
  188. package/src/@modules/@database/database.init.ts +0 -45
  189. package/src/@modules/@database/database.stanza.ts +0 -48
  190. package/src/@modules/@eas/eas.setEasTone.ts +0 -137
  191. package/src/@modules/@stanza/stanza.validate.ts +0 -50
  192. package/src/@modules/@utilities/utilities.createHttp.ts +0 -85
  193. package/src/@modules/@utilities/utilities.createWebhook.ts +0 -115
  194. package/src/@modules/@utilities/utilities.setCronSchedule.ts +0 -65
  195. package/src/@modules/@utilities/utilities.setEventEmit.ts +0 -41
  196. package/src/@modules/@utilities/utilities.setTimeoutAction.ts +0 -59
  197. package/src/@modules/@xmpp/xmpp.xOffline.ts +0 -38
  198. package/src/@modules/@xmpp/xmpp.xReconnect.ts +0 -64
  199. package/src/@modules/@xmpp/xmpp.xStanza.ts +0 -63
  200. package/src/@parsers/@pvtec/pvtec.extract.ts +0 -49
  201. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +0 -53
  202. package/src/@parsers/@text/text.getPolygonFromProduct.ts +0 -32
  203. package/src/@parsers/@text/text.getXML.ts +0 -61
  204. package/src/@parsers/@ugc/ugc.coordinates.ts +0 -110
  205. package/src/@parsers/@ugc/ugc.locations.ts +0 -29
  206. package/src/@types/types.pvtec.ts +0 -30
  207. package/src/@types/types.webhook.ts +0 -27
  208. package/test.js +0 -91
  209. package/tsup.config.ts +0 -16
  210. /package/{CODE_OF_CONDUCT.md → .github/CODE_OF_CONDUCT.md} +0 -0
  211. /package/{LICENSE → .github/LICENSE} +0 -0
  212. /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",
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": "tsup && cd ./test && node ./index.js",
15
- "heap-memory-errors": "node --heap-prof --heap-prof-name=heap-profile-%p.heapsnapshot ./test/index.js",
16
- "publish": "tsup && npm publish --access public",
17
- "publish-beta-branch": "tsup && 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
- "express-ws": "5.0.2",
37
- "express": "5.2.1",
38
- "@xmpp/client": "0.14.0",
39
- "better-sqlite3": "12.9.0",
40
- "croner": "10.0.1",
41
- "jszip": "3.10.1",
42
- "polygon-clipping": "0.15.7",
43
- "request": "2.88.2",
44
- "say": "0.16.0",
45
- "shapefile": "0.6.6",
46
- "typescript": "5.9.3",
47
- "xml2js": "0.6.2"
48
- },
49
- "devDependencies": {
50
- "@types/node": "25.2.0",
51
- "tsup": "8.5.1"
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
+ }
@@ -0,0 +1,4 @@
1
+ allowBuilds:
2
+ better-sqlite3: true
3
+ esbuild: true
4
+ minimumReleaseAge: 43830
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
  */
19
19
 
20
- import path from 'path'
21
- import { EventEmitter } from 'node:events';
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 bootstrap = {
24
- version: `3.0.3`,
25
- isReady: true,
26
- ratelimits: {},
27
- session_xmpp: null,
28
- database: null,
29
- cron: null,
30
- listener: new EventEmitter(),
31
- ansi_colors: {
32
- RED: `\x1b[31m`, GREEN: `\x1b[32m`, YELLOW: `\x1b[33m`,
33
- BLUE: `\x1b[34m`, MAGENTA: `\x1b[35m`, CYAN: `\x1b[36m`,
34
- WHITE: `\x1b[37m`, RESET: `\x1b[0m`
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
- cache: {
37
- lastStanza: null,
38
- isConnected: false,
39
- isReconnecting: false,
40
- tReconnects: 0,
41
- sigHault: false,
42
- events: {type: "FeatureCollection", features: []},
43
- nodes: {type: "FeatureCollection", features: []},
44
- hashes: [],
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
- settings: {
47
- Database: path.join(process.cwd(), 'shapefiles.db'),
48
- EnableWireService: true,
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
- WebhookSettings: [],
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: false,
115
+ UseShapefileCoordinates: true,
81
116
  SPCWatchesOnly: true,
82
- ShapefileSkipPoints: 15,
83
117
  NodeTTL: 60,
84
- NodeMinDistance: 120,
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
- EASSettings: {
96
- ArchiveDirectory: null,
97
- IntroWavFile: null,
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
  */
19
19
 
20
- export const getCleanedEvent = <T extends Record<string, any>>(event: T): T => {
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] = getCleanedEvent(value as Record<string, any>) as any;
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
  */
19
19
 
20
- import { TypeEvent } from "../@types/type.event";
21
- import { TypeSettings } from "../@types/types.settings";
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 getEventEnhancedName = (event: TypeEvent): string => {
26
- const configurations = bootstrap.settings as TypeSettings
27
- let name = event?.properties?.event
28
-
29
- if (!configurations?.GlobalSettings?.BetterEventNames) {
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(betterEventNames)) {
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
  */
19
19
 
20
- import { getSettings } from "../@modules/@utilities/utilities.getSettings";
21
- import { TypeSettings } from "../@types/types.settings"
22
- import { TypeEvent } from "../@types/type.event"
23
- import { getZonePolygon } from "../@parsers/@ugc/ugc.coordinates";
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 GetGeometryResponse {
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 getEventGeometry = async (event: TypeEvent): Promise<GetGeometryResponse> => {
31
- const settings = getSettings() as TypeSettings
32
- const generated = event?.properties?.geocode?.polygon ?? null;
33
- const ugc = event?.properties?.geocode?.ugc ?? null;
34
- let geo: GetGeometryResponse = {
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 = await getZonePolygon({zones: ugc, isUnion: false})
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
  */
19
19
 
20
- import { TypePVTEC } from "../@types/types.pvtec";
21
- import { TypeEventProperties } from "../@types/type.properties";
20
+ import { TypeVTEC } from "Types/VTEC"
21
+ import { TypeEventProperties } from "StaticTypes/Properties"
22
22
 
23
23
  interface GetHeaderOptions {
24
- properties: TypeEventProperties
25
- vtec?: TypePVTEC
26
- getType: {
27
- type: string
28
- prefix: string
24
+ Properties: TypeEventProperties
25
+ VTEC?: TypeVTEC
26
+ Type: {
27
+ Type: string
28
+ Prefix: string
29
29
  }
30
30
  }
31
31
 
32
- export const getEventHeader = (options: GetHeaderOptions): string => {
33
- const properties = options.properties
34
- const vtec = options.vtec ?? null
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-${options.getType.prefix}-${ugc}-${vtec?.status ?? `Issued`}-${new Date().toISOString().replace(/[-:]/g, '').split('.')[0]}-${properties.geocode.office.office ?? `KWNS`}`
36
+ return `ZCZC-ATMOSX-${Type?.Prefix}-${ugc}-${vtec?.Status ?? `Issued`}-${new Date().toISOString().replace(/[-:]/g, '').split('.')[0]}-${properties.geocode.office.office ?? `KWNS`}`
37
37
  }