@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/dist/index.d.ts DELETED
@@ -1,239 +0,0 @@
1
- type TypeWebhook = {
2
- webhook: string;
3
- title: string;
4
- message: string;
5
- upload: boolean;
6
- rate: number;
7
- events: string[];
8
- };
9
-
10
- type TypeSettings = {
11
- Database: string;
12
- EnableWireService: boolean;
13
- EnableJournal: boolean;
14
- NOAAWeatherWireServiceSettings: {
15
- ReconnectionSettings: {
16
- Enabled: boolean;
17
- ReconnectionInterval: number;
18
- };
19
- CredentialSettings: {
20
- Username: string | void;
21
- Password: string | void;
22
- Nickname: string | void;
23
- };
24
- CacheSettings: {
25
- Enabled: boolean;
26
- MaxDatabaseHistory: number;
27
- MaxRetentionHistory: number;
28
- };
29
- StanzaSettings: {
30
- DisableUGC: boolean;
31
- DisableVTEC: boolean;
32
- DisableText: boolean;
33
- };
34
- };
35
- NationalWeatherServiceSettings: {
36
- CallbackInterval: number;
37
- EventsEndpoint: string;
38
- };
39
- GlobalSettings: {
40
- EventManagement: boolean;
41
- BetterEventNames: boolean;
42
- DisableGeometryParsing: boolean;
43
- UseShapefileCoordinates: boolean;
44
- SPCWatchesOnly: boolean;
45
- ShapefileSkipPoints: number;
46
- NodeTTL: number;
47
- NodeMinDistance: number;
48
- WebhookSettings?: TypeWebhook;
49
- EventFiltering: {
50
- ListeningEvents: string[];
51
- ListeningICAO: string[];
52
- ListeningUGC: string[];
53
- ListeningStates: string[];
54
- IgnoredICAO: string[];
55
- IgnoredEvents: string[];
56
- NodeLocationFiltering: boolean;
57
- IgnoreTestProducts: boolean;
58
- };
59
- EASSettings: {
60
- ArchiveDirectory: string;
61
- IntroWavFile: string;
62
- };
63
- };
64
- };
65
-
66
- declare const setSettings: (newSettings: TypeSettings) => TypeSettings;
67
-
68
- type TypeAttributes = {
69
- xmlns: string;
70
- id: string;
71
- issue: string;
72
- ttaaii: string;
73
- cccc: string;
74
- awipsid: string;
75
- };
76
-
77
- type TypeEventProperties = {
78
- locations: string;
79
- description: string;
80
- attributes: TypeAttributes;
81
- geocode: {
82
- office: {
83
- name: string;
84
- office: string;
85
- };
86
- organization: string;
87
- ugc: string[];
88
- polygon: string;
89
- polygon_generated: boolean;
90
- };
91
- parameters: {
92
- tags: string[];
93
- instructions: string;
94
- source: string;
95
- hazards: string;
96
- impacts: string;
97
- estimated_hail_size: string;
98
- estimated_wind_gusts: string;
99
- damage_threat: string;
100
- tornado_threat: string;
101
- flood_threat: string;
102
- wind_threat: string;
103
- hail_threat: string;
104
- max_hail_inches?: string;
105
- max_wind_gusts_surface_knots?: string;
106
- max_tops_x100feet?: string;
107
- mean_storm_motion_vector?: string;
108
- particularly_dangerous_situation?: string;
109
- };
110
- watch_parameters?: {
111
- watch_number: string;
112
- watch_type: string;
113
- additional_tornadoes_probability: string;
114
- strong_tornadoes_probability: string;
115
- severe_wind_probability: string;
116
- severe_hail_probability: string;
117
- hail_2in_probability: string;
118
- combined_hail_wind_probability: string;
119
- max_hail_in: string;
120
- max_wind_surface: string;
121
- max_tops_x100feet: string;
122
- pds_watch: boolean;
123
- };
124
- spc_parameters: {
125
- spc_max_tornado: string;
126
- spc_max_hail: string;
127
- spc_max_wind: string;
128
- spc_watch_issuance: string;
129
- };
130
- };
131
-
132
- type TypeHVTEC = {
133
- hvtec: string;
134
- severity: string;
135
- cause: string;
136
- record: string;
137
- };
138
-
139
- type TypePVTEC = {
140
- vtec: string;
141
- product: string;
142
- tracking: string;
143
- event: string;
144
- status: string;
145
- organization: string;
146
- expires: string;
147
- is_watch: boolean;
148
- prediction_center: boolean;
149
- };
150
-
151
- type TypeEvent = {
152
- type: string;
153
- geometry: {
154
- type: string;
155
- coordinates: number[][];
156
- };
157
- properties: {
158
- event: string;
159
- parent: string;
160
- status: string;
161
- issued: string;
162
- expires: string;
163
- status_metadata?: {
164
- is_issued?: boolean;
165
- is_updated?: boolean;
166
- is_expired?: boolean;
167
- is_test?: boolean;
168
- is_statement?: boolean;
169
- };
170
- metadata: {
171
- ms: number;
172
- source: string;
173
- tracking: string;
174
- hash?: string;
175
- header: string;
176
- vtec: TypePVTEC | null;
177
- hvtec: TypeHVTEC[];
178
- nodes?: {
179
- id?: string | number;
180
- coordinates: [number, number];
181
- nearest: [number, number];
182
- miles: number | null;
183
- kilometers: number | null;
184
- proximity: boolean;
185
- }[];
186
- filtered_proximity?: boolean;
187
- updated?: number;
188
- history: {
189
- description: string;
190
- issued: string;
191
- status: string;
192
- }[];
193
- };
194
- } & TypeEventProperties;
195
- };
196
-
197
- interface GetGeometryResponse {
198
- type: `Polygon` | `MultiPolygon`;
199
- coordinates: any[];
200
- }
201
- declare const getEventGeometry: (event: TypeEvent) => Promise<GetGeometryResponse>;
202
-
203
- declare const getCleanedEvent: <T extends Record<string, any>>(event: T) => T;
204
-
205
- declare const startService: (configurations: TypeSettings) => Promise<void>;
206
-
207
- declare const stopService: () => Promise<void>;
208
-
209
- interface GenerateEASOptions {
210
- message: string;
211
- header: string;
212
- }
213
- declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
214
-
215
- interface GetAddChaserOptions {
216
- identifier: string;
217
- delete?: boolean;
218
- coordinates: {
219
- longitude: number;
220
- latitude: number;
221
- };
222
- }
223
- declare const setNode: (options: GetAddChaserOptions) => void;
224
-
225
- declare const getEvents: () => any;
226
-
227
- declare const getNodes: () => any;
228
-
229
- declare const getRandomEvent: () => any;
230
-
231
- declare const clearEvents: () => void;
232
-
233
- declare class Manager {
234
- constructor(settings: TypeSettings);
235
- on(event: string, callback: () => void): void;
236
- trycatch(): void;
237
- }
238
-
239
- export { Manager, type TypeEvent, clearEvents, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, setEasTone, setNode, setSettings, startService, stopService };
@@ -1,42 +0,0 @@
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
-
16
- Internal Package: @atmosx/event-product-parser
17
-
18
- */
19
-
20
- import { TypeStanzaCompiled } from "../@types/types.compiled"
21
- import { TypeSettings } from "../@types/types.settings"
22
- import { bootstrap } from "../bootstrap"
23
- import { text } from "../@events/events.text"
24
- import { ugc } from "../@events/events.ugc"
25
- import { vtec } from "../@events/events.vtec"
26
- import { api } from "../@events/events.api"
27
-
28
- export const createEvent = async (stanza: TypeStanzaCompiled): Promise<void | string> => {
29
- const settings = bootstrap.settings as TypeSettings
30
- const StanzaSettings = settings.NOAAWeatherWireServiceSettings.StanzaSettings;
31
-
32
- const isVtecEvent = (stanza.isVTEC && stanza.isUGC)
33
- const isUgcEvent = (!stanza.isVTEC && stanza.isUGC)
34
- const isTextEvent = (!stanza.isVTEC && !stanza.isUGC)
35
- const isNWWS = (stanza.isNWWS)
36
-
37
- if (!isNWWS) return await api(stanza)
38
- if (!StanzaSettings.DisableVTEC && isVtecEvent) return await vtec(stanza)
39
- if (!StanzaSettings.DisableUGC && isUgcEvent) return await ugc(stanza);
40
- if (!StanzaSettings.DisableText && isTextEvent) return await text(stanza);
41
- return 'nothing picked';
42
- }
@@ -1,89 +0,0 @@
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
-
16
- Internal Package: @atmosx/event-product-parser
17
-
18
- */
19
-
20
- import { TypeEventProperties } from "../@types/type.properties";
21
- import { TypeAttributes } from "../@types/types.attributes";
22
- import { TypeUGC } from "../@types/types.ugc";
23
- import { TypePVTEC } from "../@types/types.pvtec";
24
- import { TypeHVTEC } from "../@types/types.hvtec";
25
- import { regExp } from "../@dictionaries/dictionaries.regExp";
26
- import { getDescriptionFromProduct } from "../@parsers/@text/text.getDescriptionFromProduct";
27
- import { getPolygonFromProduct } from "../@parsers/@text/text.getPolygonFromProduct";
28
- import { getTextFromProduct } from "../@parsers/@text/text.getTextFromProduct";
29
- import { getEventOffice } from "./building.office";
30
- import { getEventTags } from "./building.tags";
31
-
32
- interface GetPropertiesOptions {
33
- message: string
34
- attributes: TypeAttributes
35
- ugc?: TypeUGC
36
- pVtec?: TypePVTEC
37
- hVtec?: TypeHVTEC
38
- }
39
-
40
- export const properties = (options: GetPropertiesOptions): TypeEventProperties => {
41
- const organization = options.message.match(regExp.wmo)?.[0] ?? null
42
- const polygons = getPolygonFromProduct(options.message)
43
- return {
44
- locations: options?.ugc?.locations?.join(`; `) ?? null,
45
- description: getDescriptionFromProduct({ message: options.message, handle: options?.pVtec?.vtec ?? null }),
46
- attributes: options.attributes,
47
- geocode: {
48
- office: getEventOffice({ attributes: options.attributes, organization: organization, pVtec: options.pVtec }),
49
- organization: organization,
50
- ugc: options?.ugc?.zones ?? [],
51
- polygon: polygons.length > 0 ? Buffer.from(JSON.stringify([polygons])).toString('base64') : null,
52
- polygon_generated: polygons.length > 0 ? true : false
53
- },
54
- parameters: {
55
- tags: getEventTags(options.message),
56
- instructions: getTextFromProduct({ message: options.message, find: [`For your protection`, `do not`, `use extreme caution`], append: `...`, removal: [`.`]}) ?? null,
57
- source: getTextFromProduct({ message: options.message, find: [`SOURCE...`], removal: [`.`]}) ?? null,
58
- hazards: getTextFromProduct({ message: options.message, find: [`HAZARD...`], removal: [`.`]}) ?? null,
59
- impacts: getTextFromProduct({ message: options.message, find: [`IMPACT...`], removal: [`.`]}) ?? null,
60
- estimated_hail_size: getTextFromProduct({ message: options.message, find: [`MAX HAIL SIZE...`, `HAIL...`], removal: ['in']}) ?? null,
61
- estimated_wind_gusts: getTextFromProduct({ message: options.message, find: [`MAX WIND GUST...`, `WIND...`]}) ?? null,
62
- damage_threat: getTextFromProduct({ message: options.message, find: [`DAMAGE THREAT...`], removal: []}) ?? null,
63
- tornado_threat: getTextFromProduct({ message: options.message, find: [`TORNADO...`, `WATERSPOUT...`] }) ?? null,
64
- flood_threat: getTextFromProduct({ message: options.message, find: [`FLASH FLOOD...`]}) ?? null,
65
- wind_threat: getTextFromProduct({ message: options.message, find: [`WIND THREAT...`]}) ?? null,
66
- hail_threat: getTextFromProduct({ message: options.message, find: [`HAIL THREAT...`], removal: []}) ?? null,
67
- },
68
- spc_parameters: {
69
- spc_max_tornado: getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] }) ?? null,
70
- spc_max_hail: getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] }) ?? null,
71
- spc_max_wind: getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] }) ?? null,
72
- spc_watch_issuance: getTextFromProduct({ message: options.message, find: [`Probability of Watch Issuance...`], removal: [`percent`]}) ?? null,
73
- },
74
- watch_parameters: {
75
- watch_number: getTextFromProduct({ message: options.message, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })?.replace(/(WT|WS|)/g, '')?.trim() ?? null,
76
- watch_type: options.message.includes(`TORNADO WATCH`) ? `Tornado` : options?.message.includes(`SEVERE`) ? `Severe` : null,
77
- additional_tornadoes_probability: getTextFromProduct({ message: options.message, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] }) ?? null,
78
- strong_tornadoes_probability: getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] }) ?? null,
79
- severe_wind_probability: getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] }) ?? null,
80
- severe_hail_probability: getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] }) ?? null,
81
- hail_2in_probability: getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] }) ?? null,
82
- combined_hail_wind_probability: getTextFromProduct({ message: options.message, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] }) ?? null,
83
- max_hail_in: getTextFromProduct({ message: options.message, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] }) ?? null,
84
- max_wind_surface: getTextFromProduct({ message: options.message, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] }) ?? null,
85
- max_tops_x100feet: getTextFromProduct({ message: options.message, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] }) ?? null,
86
- pds_watch: (getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`)
87
- }
88
- }
89
- }
@@ -1,68 +0,0 @@
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
-
16
- Internal Package: @atmosx/event-product-parser
17
-
18
- */
19
-
20
- import { TypeAttributes } from "../@types/types.attributes";
21
- import { TypeEventProperties } from "../@types/type.properties";
22
- import { TypeStanzaCompiled } from "../@types/types.compiled";
23
- import { TypePVTEC } from "../@types/types.pvtec";
24
-
25
- interface GetTrackingOptions {
26
- type: `RAW` | `VTEC` | `API`
27
- stanza?: TypeStanzaCompiled
28
- attributes?: TypeAttributes
29
- properties?: TypeEventProperties
30
- organization?: {
31
- wmoidentifier: string
32
- featureId: string
33
- }
34
- vtec?: TypePVTEC
35
- }
36
-
37
- export const getEventTracking = (options: GetTrackingOptions): string => {
38
- const proprties = options.properties
39
- const attributes = options.attributes
40
- const stanza = options.stanza
41
- const vtec = options.vtec
42
- if (options.type === `RAW`) {
43
- const getWatchNumber = proprties.watch_parameters.watch_number ?? null
44
- if (getWatchNumber) {
45
- return `${proprties.geocode.office.office}-${stanza.getType.prefix}-A-${getWatchNumber}`
46
- }
47
- return `${proprties.geocode.office.office}-${attributes.ttaaii}-${attributes.id.slice(-4).replace(`.`, ``) ?? '0'}`
48
- }
49
- if (options.type === `VTEC`) {
50
- return vtec.tracking;
51
- }
52
- if (options.type === `API`) {
53
- if (options.vtec) {
54
- const vtecValue = Array.isArray(options.vtec)
55
- ? options.vtec[0] : options.vtec;
56
- const splitPVTEC = vtecValue.split('.');
57
- return `${splitPVTEC[2]}-${splitPVTEC[3]}-${splitPVTEC[4]}-${splitPVTEC[5]}`;
58
- }
59
- const wmoMatch = options.organization?.wmoidentifier?.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
60
- const station = wmoMatch?.[2] ?? 'N/A';
61
- if (options.organization.featureId) {
62
- const idMatch = options.organization.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
63
- return `${station}-${idMatch?.[1] ?? 'N/A'}`;
64
- }
65
- const id = wmoMatch?.[1] ?? 'N/A';
66
- return `${station}-${id}`;
67
- }
68
- }
@@ -1,147 +0,0 @@
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
-
16
- Internal Package: @atmosx/event-product-parser
17
-
18
- */
19
-
20
- import { createHash } from "crypto"
21
- import { TypeEvent } from "../@types/type.event";
22
- import { TypeSettings } from "../@types/types.settings";
23
- import { bootstrap } from "../bootstrap"
24
- import { getEventEnhancedName } from "./building.enhance";
25
- import { getEventSignature } from "./building.signature"
26
- import { mkEvent } from "../@manager/manager.mkEvent";
27
- import { rmEvent } from "../@manager/manager.rmEvent";
28
- import { getEventGeometry } from "./building.geometry";
29
- import { updateNode } from "../@manager/manager.updateNodes";
30
- import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
31
-
32
- export const validateEvents = async (events: TypeEvent[]): Promise<void> => {
33
- if (events.length === 0) return;
34
- const configurations = bootstrap.settings as TypeSettings
35
- const sets = {} as Record<string, Set<string>>;
36
- const bools = {} as Record<string, boolean>;
37
- const megered = {...configurations.GlobalSettings, ...configurations.GlobalSettings.EventFiltering}
38
- for (const key in megered) {
39
- const setting = megered[key];
40
- if (Array.isArray(setting)) { sets[key] = new Set(setting.map(item => item.toLowerCase())); }
41
- if (typeof setting === 'boolean') { bools[key] = setting; }
42
- }
43
- const filterd = events.filter((event: TypeEvent) => {
44
- const define = getEventSignature(event) as TypeEvent;
45
- const properties = define.properties;
46
- const zones = properties.geocode.ugc;
47
- const icao = properties.geocode.office.office
48
- const enhancedEventName = properties.event = getEventEnhancedName(event)
49
- const filteredProperties = JSON.parse(JSON.stringify(properties)) as typeof properties;
50
- if (filteredProperties?.metadata && 'ms' in filteredProperties.metadata) {
51
- delete filteredProperties.metadata.ms;
52
- }
53
- filteredProperties.metadata = filteredProperties.metadata ?? {} as any;
54
- filteredProperties.metadata.hash = createHash("sha256").update(JSON.stringify(filteredProperties)).digest("hex")
55
-
56
- setEventEmit({ event: `onProductType${enhancedEventName.replace(/\s+/g, '')}`, metadata: define });
57
-
58
- if (properties.status_metadata.is_test) {
59
- setEventEmit({ event: `onTestProduct`, metadata: define })
60
- if (bools?.IgnoreTestProducts) return false;
61
- }
62
-
63
- if (properties.status_metadata.is_expired) {
64
- setEventEmit({ event: `onExpiredProduct`, metadata: define })
65
- rmEvent(define)
66
- return false;
67
- }
68
-
69
- if (properties.metadata?.vtec?.is_watch) {
70
- const isSPC = properties.metadata?.vtec?.prediction_center;
71
- setEventEmit({ event: isSPC ? `onStormPredictionWatch` : `onNonStormPredictionWatch`, metadata: define })
72
- if (bools?.SPCWatchesOnly && !isSPC) {
73
- return false;
74
- }
75
- if ((!bools?.SPCWatchesOnly) && isSPC) {
76
- return false
77
- }
78
- }
79
-
80
-
81
- for (const key in sets) {
82
- const setting = sets[key]
83
- if (key === 'ListeningEvents' && setting.size > 0 && !setting.has(define.properties.event.toLowerCase())) {
84
- setEventEmit({
85
- event: `onFilteredEvent`,
86
- metadata: define
87
- });
88
- return false
89
- }
90
- if (key === 'IgnoredEvents' && setting.size > 0 && setting.has(define.properties.event.toLowerCase())) {
91
- setEventEmit({
92
- event: `onIgnoredEvent`,
93
- metadata: define
94
- });
95
- return false
96
- }
97
- if (key === 'ListeningICAO' && setting.size > 0 && icao != null && !setting.has(icao.toLowerCase())) {
98
- setEventEmit({
99
- event: `onFilteredICAO`,
100
- metadata: define
101
- });
102
- return false
103
- }
104
- if (key === 'IgnoredICAO' && setting.size > 0 && icao != null && setting.has(icao.toLowerCase())) {
105
- setEventEmit({
106
- event: `onIgnoredICAO`,
107
- metadata: define
108
- });
109
- return false
110
- }
111
- if (key === 'ListeningUGC' && setting.size > 0 && zones.length > 0 && !zones.some((ugc: string) => setting.has(ugc.toLowerCase()))) {
112
- setEventEmit({
113
- event: `onFilteredUGC`,
114
- metadata: define
115
- });
116
- return false
117
- }
118
- if (key === 'ListeningStates' && setting.size > 0 && zones.length > 0 && !zones.some((ugc: string) => setting.has(ugc.substring(0, 2).toLowerCase()))) {
119
- setEventEmit({
120
- event: `onFilteredState`,
121
- metadata: define
122
- });
123
- return false
124
- }
125
- }
126
- return true;
127
- })
128
-
129
-
130
- if (!configurations?.GlobalSettings?.DisableGeometryParsing) {
131
- for (const event of filterd) {
132
- event.geometry = await getEventGeometry(event)
133
- }
134
- }
135
-
136
- if (filterd.length > 0) {
137
- for (const event of filterd) {
138
- await mkEvent(event)
139
- }
140
- }
141
- await updateNode()
142
- setEventEmit({
143
- event: `onEventCache`,
144
- metadata: bootstrap.cache.events,
145
- limited: true
146
- })
147
- }
@@ -1,25 +0,0 @@
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: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
-
16
- Internal Package: @atmosx/event-product-parser
17
-
18
- */
19
-
20
- import { bootstrap } from "../bootstrap";
21
-
22
-
23
- export const getRandomEvent = (): any => {
24
- return bootstrap.cache.events.features[Math.floor(Math.random() * bootstrap.cache.events.features.length)]
25
- }