@atmosx/event-product-parser 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.github/docs/docs-functions.md +2 -2
  2. package/.github/docs/docs-general-configurations.md +2 -12
  3. package/.github/docs/docs-integrations.md +4 -3
  4. package/.github/docs/docs-listeners.md +1 -1
  5. package/.github/docs/docs-source-configuration.md +1 -1
  6. package/.github/docs/docs-technical.md +1 -1
  7. package/{.github/README.md → README.md} +15 -9
  8. package/dist/cjs/index.cjs +24073 -7018
  9. package/dist/esm/index.mjs +24035 -6983
  10. package/package.json +56 -47
  11. package/pnpm-workspace.yaml +4 -0
  12. package/src/bootstrap.ts +64 -48
  13. package/src/{@building → building}/CreateEvent.ts +22 -24
  14. package/src/{@building → building}/GetCleanedEvent.ts +2 -2
  15. package/src/{@building → building}/GetEventAttachments.ts +14 -12
  16. package/src/building/GetEventDirection.ts +28 -0
  17. package/src/{@building → building}/GetEventEnhancedName.ts +5 -8
  18. package/src/{@building → building}/GetEventGeometry.ts +19 -13
  19. package/src/{@building → building}/GetEventHeader.ts +13 -13
  20. package/src/{@building → building}/GetEventNodes.ts +21 -19
  21. package/src/{@building → building}/GetEventOffice.ts +13 -13
  22. package/src/building/GetEventProperties.ts +105 -0
  23. package/src/{@building → building}/GetEventSignature.ts +9 -9
  24. package/src/{@building → building}/GetEventTags.ts +3 -3
  25. package/src/building/GetEventTheme.ts +26 -0
  26. package/src/building/GetEventTracking.ts +64 -0
  27. package/src/components/audio/GenerateAudioMessage.ts +149 -0
  28. package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
  29. package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
  30. package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
  31. package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +13 -8
  32. package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
  33. package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +14 -8
  34. package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +17 -10
  35. package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +7 -7
  36. package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +13 -8
  37. package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
  38. package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +11 -6
  39. package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +12 -7
  40. package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +12 -7
  41. package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +22 -14
  42. package/src/{@modules/@utilities/SetWarning.ts → components/database/CreateQuery.ts} +18 -13
  43. package/src/{@modules/@database → components/database}/GetCachedEvents.ts +18 -15
  44. package/src/components/database/ImportBoundaries.ts +168 -0
  45. package/src/{@modules/@database → components/database}/ImportBroadcastify.ts +14 -24
  46. package/src/components/database/ImportCities.ts +87 -0
  47. package/src/{@modules/@database → components/database}/ImportShapefiles.ts +23 -26
  48. package/src/{@modules/@database → components/database}/ImportStanza.ts +15 -19
  49. package/src/components/database/InitializeDatabase.ts +71 -0
  50. package/src/components/images/GenerateGraphic.ts +234 -0
  51. package/src/components/images/components/CreateRectangle.ts +22 -0
  52. package/src/components/images/components/CreateText.ts +22 -0
  53. package/src/components/images/modules/CreateSVG.ts +37 -0
  54. package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
  55. package/src/components/images/modules/GetGeographicalCities.ts +58 -0
  56. package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
  57. package/src/components/images/modules/GetGeometryBounds.ts +82 -0
  58. package/src/components/images/modules/GetParsedBoundary.ts +58 -0
  59. package/src/components/images/modules/GetSVGPath.ts +53 -0
  60. package/src/components/images/modules/NormalizePolygon.ts +57 -0
  61. package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +16 -17
  62. package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +27 -15
  63. package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +26 -26
  64. package/src/{@modules/@utilities → components/utilities}/GetFormattedTime.ts +2 -2
  65. package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
  66. package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
  67. package/src/{@modules/@utilities → components/utilities}/GetShapeNearestPoint.ts +24 -19
  68. package/src/components/utilities/GetUnionPolygon.ts +36 -0
  69. package/src/components/utilities/QueueManager.ts +70 -0
  70. package/src/{@modules/@utilities → components/utilities}/SetCronSchedule.ts +29 -25
  71. package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +12 -12
  72. package/src/components/utilities/SetEventEmit.ts +42 -0
  73. package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +7 -7
  74. package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +5 -5
  75. package/src/components/utilities/SetTimeoutAction.ts +64 -0
  76. package/src/components/utilities/SetWarning.ts +47 -0
  77. package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +20 -20
  78. package/src/{@core/CreateListener.ts → components/xmpp/ErrorXMPP.ts} +8 -5
  79. package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +13 -13
  80. package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +18 -18
  81. package/src/components/xmpp/ReconnectXMPP.ts +64 -0
  82. package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +25 -25
  83. package/src/{@core → core}/ClearEvents.ts +9 -9
  84. package/src/{@core → core}/GetEvents.ts +4 -4
  85. package/src/{@core → core}/GetNodes.ts +4 -4
  86. package/src/{@core → core}/GetRandomEvent.ts +4 -4
  87. package/src/{@core → core}/GetVersion.ts +4 -4
  88. package/src/{@core → core}/ManualEvent.ts +23 -24
  89. package/src/{@core → core}/QueryStanza.ts +12 -11
  90. package/src/core/SetNode.ts +87 -0
  91. package/src/{@core → core}/StartService.ts +21 -20
  92. package/src/{@core → core}/StopService.ts +10 -10
  93. package/src/{@enums → enums}/AWIPS.ts +2 -2
  94. package/src/{@enums → enums}/Actions.ts +2 -2
  95. package/src/{@enums → enums}/Cancellation.ts +2 -2
  96. package/src/{@enums → enums}/Causes.ts +2 -2
  97. package/src/{@enums → enums}/Correlations.ts +2 -2
  98. package/src/{@enums → enums}/Enhanced.ts +2 -2
  99. package/src/{@enums → enums}/Events.ts +2 -2
  100. package/src/{@enums → enums}/Expressions.ts +3 -3
  101. package/src/{@enums → enums}/GlobalFilter.ts +2 -2
  102. package/src/{@enums → enums}/Hail.ts +2 -2
  103. package/src/{@enums → enums}/ICAO.ts +2 -2
  104. package/src/{@enums → enums}/Matches.ts +8 -3
  105. package/src/{@enums → enums}/Products.ts +2 -2
  106. package/src/{@enums → enums}/Records.ts +2 -2
  107. package/src/{@enums → enums}/Severity.ts +2 -2
  108. package/src/{@enums → enums}/Shapefiles.ts +2 -2
  109. package/src/{@enums → enums}/States.ts +68 -4
  110. package/src/{@enums → enums}/Status.ts +2 -2
  111. package/src/{@enums → enums}/Strings.ts +2 -2
  112. package/src/{@enums → enums}/Tags.ts +9 -4
  113. package/src/{@enums → enums}/Testing.ts +2 -2
  114. package/src/enums/Themes.ts +70 -0
  115. package/src/events/ParseAPI.ts +129 -0
  116. package/src/{@events → events}/ParseText.ts +24 -22
  117. package/src/{@events → events}/ParseUGC.ts +27 -26
  118. package/src/{@events → events}/ParseVTEC.ts +38 -37
  119. package/src/index.ts +57 -37
  120. package/src/manager/MakeEvents.ts +110 -0
  121. package/src/manager/RemoveEvent.ts +74 -0
  122. package/src/{@manager → manager}/SetHash.ts +18 -13
  123. package/src/{@manager → manager}/UpdateEvents.ts +12 -12
  124. package/src/{@manager → manager}/UpdateNode.ts +14 -14
  125. package/src/{@building → manager}/ValidateEvents.ts +47 -57
  126. package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +11 -11
  127. package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
  128. package/src/{@parsers/@text → parsers/text}/GetEmbededText.ts +7 -6
  129. package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
  130. package/src/{@parsers/@text → parsers/text}/GetStringText.ts +9 -9
  131. package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +12 -12
  132. package/src/parsers/ugc/GetCache.ts +24 -0
  133. package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
  134. package/src/{@parsers/@ugc/GetUGCHeader.ts → parsers/ugc/GetHeader.ts} +4 -4
  135. package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +10 -10
  136. package/src/parsers/ugc/GetZonePolygon.ts +73 -0
  137. package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +3 -3
  138. package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +13 -8
  139. package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +14 -14
  140. package/src/{@parsers/@pvtec → parsers/vtec}/GetExpiry.ts +2 -2
  141. package/src/parsers/vtec/VTECExtract.ts +49 -0
  142. package/src/{@types → static}/Attributes.ts +2 -3
  143. package/src/{@types → static}/Event.ts +8 -7
  144. package/src/{@types → static}/Properties.ts +7 -3
  145. package/src/{@types → static}/Stanza.ts +2 -2
  146. package/src/tasks/CreateTasks.ts +123 -0
  147. package/src/tasks/TaskGenerateJSON.ts +34 -0
  148. package/src/tasks/TaskGenerateText.ts +34 -0
  149. package/src/tasks/TaskSendNTFY.ts +97 -0
  150. package/src/tasks/TaskSendWebhook.ts +107 -0
  151. package/src/{@types → types}/Actions.ts +3 -3
  152. package/src/{@types → types}/HVTEC.ts +6 -6
  153. package/src/{@types → types}/Hash.ts +5 -5
  154. package/src/types/Nodes.ts +29 -0
  155. package/src/{@types → types}/Settings.ts +16 -8
  156. package/src/{@types → types}/StanzaCompiled.ts +15 -15
  157. package/src/{@types → types}/UGC.ts +5 -5
  158. package/src/{@modules/@utilities/GetSettings.ts → types/VTEC.ts} +12 -7
  159. package/tools/build.js +47 -0
  160. package/tsconfig.json +28 -1
  161. package/src/@building/GetEventProperties.ts +0 -96
  162. package/src/@building/GetEventTracking.ts +0 -68
  163. package/src/@core/SetNode.ts +0 -81
  164. package/src/@events/ParseAPI.ts +0 -117
  165. package/src/@manager/CreateActions.ts +0 -213
  166. package/src/@manager/MakeEvent.ts +0 -99
  167. package/src/@manager/RemoveEvent.ts +0 -70
  168. package/src/@modules/@database/InitializeDatabase.ts +0 -59
  169. package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
  170. package/src/@modules/@utilities/SetEventEmit.ts +0 -41
  171. package/src/@modules/@utilities/SetListener.ts +0 -30
  172. package/src/@modules/@utilities/SetTimeoutAction.ts +0 -64
  173. package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
  174. package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
  175. package/src/@parsers/@pvtec/VTECExtract.ts +0 -49
  176. package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
  177. package/src/@parsers/@text/GetXML.ts +0 -61
  178. package/src/@parsers/@ugc/GetCache.ts +0 -24
  179. package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
  180. package/src/@types/VTEC.ts +0 -30
  181. package/tsup.config.ts +0 -16
package/package.json CHANGED
@@ -1,47 +1,56 @@
1
- {
2
- "name": "@atmosx/event-product-parser",
3
- "version": "3.0.6",
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": "tsup && cd ./test && node ./index.js",
15
- "publish": "tsup && npm publish --access public",
16
- "publish-beta-branch": "tsup && npm publish --tag v3-beta-branch --access public"
17
- },
18
- "keywords": [
19
- "NWWS",
20
- "NOAA Weather Wire Service",
21
- "TypeScript",
22
- "XMPP",
23
- "Parser",
24
- "JavaScript",
25
- "CommonJS",
26
- "ESM"
27
- ],
28
- "author": "k3yomi, StarflightWx",
29
- "license": "MIT",
30
- "bugs": {
31
- "url": "https://github.com/AtmosphericX/event-product-parser/issues"
32
- },
33
- "homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
34
- "dependencies": {
35
- "@xmpp/client": "0.14.0",
36
- "better-sqlite3": "12.9.0",
37
- "croner": "10.0.1",
38
- "jszip": "3.10.1",
39
- "polygon-clipping": "0.15.7",
40
- "shapefile": "0.6.6",
41
- "typescript": "5.9.3"
42
- },
43
- "devDependencies": {
44
- "@types/node": "25.2.0",
45
- "tsup": "8.5.1"
46
- }
47
- }
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,53 +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.6`,
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: [],
45
- processed: [],
46
- ugc: new Map<string, string[]>()
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[]>()
47
54
  },
48
- settings: {
49
- Database: path.join(process.cwd(), 'shapefiles.db'),
55
+ Settings: {
56
+ Timezone: "UTC",
57
+ Database: join(process.cwd(), 'shapefiles.db'),
58
+ DebugDisableAllEvents: false,
50
59
  EnableWireService: false,
51
60
  EnableDebugging: false,
52
61
  EnableJournal: true,
62
+ EnhancedEventJournaling: false,
53
63
  NOAAWeatherWireServiceSettings: {
54
64
  ReconnectionSettings: {
55
65
  Enabled: true,
56
66
  ReconnectionInterval: 60,
57
67
  },
58
68
  CredentialSettings: {
59
- Username: null,
60
- Password: null,
69
+ Username: null as string,
70
+ Password: null as string,
61
71
  Nickname: "@atmosx/event-product-parser/3.0",
62
72
  },
63
73
  CacheSettings: {
@@ -80,45 +90,51 @@ export const bootstrap = {
80
90
  BroadcastifyDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/broadcastify.json`,
81
91
  BroadcastifyTags: [`Ham`, `Air`, `Fire`, `Public Safety`, `Weather`, `EMS`, `Police`, `Rail`]
82
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
+ },
83
97
  NotifyServer: {
84
98
  Enabled: false,
85
99
  Server: `https://ntfy.sh`,
86
- Timezone: "UTC",
87
100
  MediaStorage: {
88
- EAS: null,
89
- TEXT: null,
90
- JSON: null,
101
+ AUDIO: null as string,
102
+ TEXT: null as string,
103
+ JSON: null as string,
104
+ IMAGE: null as string
91
105
  },
92
106
  Credentials: {
93
- Username: null,
94
- Password: null
107
+ Username: null as string,
108
+ Password: null as string
95
109
  }
96
110
  },
97
- ActionSettings: [],
111
+ ActionSettings: [] as TypeActions[],
98
112
  GlobalSettings: {
99
113
  EventManagement: true,
100
114
  DisableGeometryParsing: false,
101
115
  UseShapefileCoordinates: true,
102
116
  SPCWatchesOnly: true,
103
- ShapefileSkipPoints: 15,
104
117
  NodeTTL: 60,
105
118
  NodeMaxDistance: 120,
106
119
  EventFiltering: {
107
- ListeningEvents: [],
108
- ListeningICAO: [],
109
- ListeningUGC: [],
110
- ListeningStates: [],
111
- IgnoredICAO: [],
120
+ ListeningEvents: [] as string[],
121
+ ListeningICAO: [] as string[],
122
+ ListeningUGC: [] as string[],
123
+ ListeningStates: [] as string[],
124
+ IgnoredICAO: [] as string[],
112
125
  IgnoredEvents: [`Test Message`],
113
126
  NodeLocationFiltering: false,
114
127
  IgnoreTestProducts: true,
115
128
  },
129
+ Themes: EnumThemes,
116
130
  ArchiveSettings: {
117
131
  TTL: 60,
118
- JSONDirectory: null,
119
- TextDirectory: null,
120
- EasDirectory: null,
121
- EasToneout: null
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
122
138
  }
123
139
  }
124
140
  },
@@ -11,46 +11,44 @@
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 { 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 "./ValidateEvents"
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
28
 
29
- export const CreateEvent = async (stanza: TypeStanzaCompiled, ignorePushing?: boolean): Promise<void | string> => {
30
- const settings = bootstrap.settings as TypeSettings
29
+ export const CreateEvent = async (Stanza: TypeStanzaCompiled): Promise<void | string> => {
30
+ const settings = Bootstrap.Settings as TypeSettings
31
31
  const StanzaSettings = settings.NOAAWeatherWireServiceSettings.StanzaSettings;
32
32
 
33
- const isVtecEvent = (stanza.isVTEC && stanza.isUGC)
34
- const isUgcEvent = (!stanza.isVTEC && stanza.isUGC)
35
- const isTextEvent = (!stanza.isVTEC && !stanza.isUGC)
36
- const isNWWS = (stanza.isNWWS)
37
-
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
38
  switch (true) {
39
39
  case (!isNWWS):
40
- await ParseAPI(stanza)
40
+ await ParseAPI(Stanza)
41
41
  break;
42
42
  case (isNWWS && !StanzaSettings.DisableVTEC && isVtecEvent):
43
- await ParseVTEC(stanza)
43
+ await ParseVTEC(Stanza)
44
44
  break;
45
45
  case (isNWWS && !StanzaSettings.DisableUGC && isUgcEvent):
46
- await ParseUGC(stanza)
46
+ await ParseUGC(Stanza)
47
47
  break;
48
48
  case (isNWWS && !StanzaSettings.DisableText && isTextEvent):
49
- await ParseText(stanza)
49
+ await ParseText(Stanza)
50
50
  break;
51
51
  }
52
- if (!ignorePushing) {
53
- await ValidateEvents(bootstrap.cache.processed)
54
- }
52
+ await ValidateEvents(Bootstrap.Cache.Parsed)
55
53
  return 'nothing picked';
56
54
  }
@@ -11,9 +11,9 @@
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
 
@@ -11,17 +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: 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/Event"
21
- import { bootstrap } from "../bootstrap"
22
- import { EnumStates } from "../@enums/States"
23
- import { EnumExpressions } from "../@enums/Expressions"
24
- import { GetLatestIssuance } from "../@modules/@utilities/GetLatestIssuance";
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"
25
26
 
26
27
  interface GetEventAttachmentsResponse {
27
28
  name: string
@@ -38,7 +39,7 @@ type BroadcastifyResponse = {
38
39
 
39
40
  export const GetEventAttachments = (event: TypeEvent): GetEventAttachmentsResponse[] | null => {
40
41
  let attachments = [];
41
- const settings = bootstrap.settings;
42
+ const settings = Bootstrap.Settings;
42
43
  const issuanceTime = GetLatestIssuance();
43
44
  const spcNumber = event?.properties?.discussion_parameters?.discussion_number;
44
45
  const watchNumber = event?.properties?.watch_parameters?.watch_number;
@@ -64,14 +65,15 @@ export const GetEventAttachments = (event: TypeEvent): GetEventAttachmentsRespon
64
65
  const lines = [`Northern`, `Southern`, `Eastern`, `Western`, `Inland`, `Costal`, `County`]
65
66
  const county = location?.split(',')[0]?.trim().replace(new RegExp(`^(${lines.join('|')}) `), '')
66
67
  const state = EnumStates[location?.split(',')[1]?.trim()]
67
- const feeds = bootstrap.database.prepare(`SELECT * FROM broadcastify WHERE state = ? AND county = ?`).all(state, county).sort((a, b) => {
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) => {
68
70
  const typeOrder = ['Other', 'Public Safety'];
69
71
  const indexA = typeOrder.indexOf(a.type);
70
72
  const indexB = typeOrder.indexOf(b.type);
71
73
  return indexA - indexB;
72
- })
73
- const tags = bootstrap.settings.BroadcastifySettings.BroadcastifyTags;
74
- const filtered = feeds.filter((feed: BroadcastifyResponse) => tags.includes(feed.type));
74
+ });
75
+ const tags = Bootstrap.Settings.BroadcastifySettings.BroadcastifyTags;
76
+ const filtered = so.filter((feed: BroadcastifyResponse) => tags.includes(feed.type));
75
77
  if (filtered.length > 0) {
76
78
  filtered.map((filtered: BroadcastifyResponse) => {
77
79
  if (!attachments.some((a) => a.link === filtered.link)) {
@@ -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,21 +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: 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/Event";
21
- import { TypeSettings } from "../@types/Settings";
22
- import { EnumEnhanced } from "../@enums/Enhanced"
23
- import { bootstrap } from "../bootstrap"
20
+ import { TypeEvent } from "StaticTypes/Event"
21
+ import { EnumEnhanced } from "@Enums/Enhanced"
24
22
 
25
23
  export const GetEventEnhancedName = (event: TypeEvent): string => {
26
24
  let name = event?.properties?.event;
27
-
28
- const damage = event?.properties?.parameters?.damage_threat
25
+ const damage = event?.properties?.parameters?.damage_threat ?? event?.properties?.parameters?.flood_threat
29
26
  const tornado = event?.properties?.parameters?.tornado_threat;
30
27
  const pdswatch = event?.properties?.watch_parameters?.pds_watch;
31
28
  const description = event?.properties?.description?.toLowerCase()
@@ -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 { TypeSettings } from "../@types/Settings"
21
- import { TypeEvent } from "../@types/Event"
22
- import { GetSettings } from "../@modules/@utilities/GetSettings";
23
- import { getZonePolygon } from "../@parsers/@ugc/GetZonePolygon";
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 = (event: TypeEvent): 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 = 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/VTEC";
21
- import { TypeEventProperties } from "../@types/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
  }
@@ -11,16 +11,16 @@
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/Event"
21
- import { bootstrap } from "../bootstrap"
22
- import { GetEventGeometry } from "./GetEventGeometry"
23
- import { GetShapeNearestPoint } from "../@modules/@utilities/GetShapeNearestPoint"
20
+ import { TypeEvent } from "StaticTypes/Event"
21
+ import { Bootstrap } from "@Bootstrap"
22
+ import { GetEventGeometry } from "@Building/GetEventGeometry"
23
+ import { GetShapeNearestPoint } from "@Utilities/GetShapeNearestPoint"
24
24
 
25
25
  interface GetEventNodesResponse {
26
26
  nodes: {
@@ -36,34 +36,36 @@ interface GetEventNodesResponse {
36
36
  }
37
37
 
38
38
  export const GetEventNodes = async (event: TypeEvent): Promise<GetEventNodesResponse> => {
39
- const nodes = bootstrap.cache.nodes.features;
39
+ const nodes = Bootstrap.Cache.Nodes.features;
40
40
  if (!nodes || nodes.length === 0) {
41
41
  return { nodes: [], filtered: false, updated: Date.now() };
42
42
  }
43
- const metadata = { nodes: [], proximity: false, filtered: false };
44
- const geometry = await GetEventGeometry(event);
43
+ const metadata = { nodes: [] as GetEventNodesResponse['nodes'], proximity: false, filtered: false };
44
+ const geometry = await GetEventGeometry({ Event: event });;
45
45
  if (!geometry || !geometry.coordinates) {
46
46
  return { nodes: [], filtered: false, updated: Date.now() }
47
47
  }
48
48
  for (const node of nodes) {
49
- const [longitude, latitude] = node.geometry.coordinates;
50
- const getPoint = GetShapeNearestPoint(geometry.coordinates, [longitude, latitude])
51
- const miles = getPoint.distance ?? null;
52
- const kilometers = Number((miles * 1.609344).toFixed(3));
49
+ const [longitude, latitude] = (node?.geometry?.coordinates ?? []) as [number, number];
50
+
51
+ const getPoint = GetShapeNearestPoint({ Coordinates: geometry.coordinates, Point: [longitude, latitude] });
52
+ const miles = getPoint.Distance ?? null;
53
+ const kilometers = miles != null ? Number((miles * 1.609344).toFixed(3)) : null;
53
54
 
54
55
  const info = {
55
56
  id: node.properties?.identifier,
56
- coordinates: [longitude, latitude],
57
- nearest: getPoint.point,
57
+ coordinates: [longitude, latitude] as [number, number],
58
+ nearest: getPoint.Point as [number, number],
58
59
  miles,
59
60
  kilometers,
60
61
  proximity: false
61
- }
62
- metadata.nodes.push(info)
63
- if (miles != null && (bootstrap.settings.GlobalSettings.EventFiltering.NodeLocationFiltering) && (miles < bootstrap.settings.GlobalSettings.NodeMaxDistance)) {
64
- metadata.proximity = true;
62
+ };
63
+
64
+ if (miles != null && (miles < Bootstrap.Settings.GlobalSettings.NodeMaxDistance)) {
65
65
  info.proximity = true;
66
+ metadata.proximity = true;
66
67
  }
68
+ metadata.nodes.push(info);
67
69
  }
68
70
  return {
69
71
  nodes: metadata.nodes,