@atmosx/event-product-parser 3.0.621 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/.github/CHANGELOGS.md +52 -0
  2. package/.github/CODE_OF_CONDUCT.md +24 -1
  3. package/.github/CONTRIBUTING.md +22 -3
  4. package/.github/FUNDING.yaml +3 -0
  5. package/.github/LICENSE +24 -1
  6. package/.github/SECURITY.md +25 -6
  7. package/.github/docs/chapters/general-configurations.md +109 -0
  8. package/.github/docs/chapters/sources-and-attributes.md +219 -0
  9. package/README.md +56 -146
  10. package/dist/index.cjs +25333 -0
  11. package/package.json +17 -11
  12. package/pnpm-workspace.yaml +4 -0
  13. package/src/bootstrap.ts +67 -52
  14. package/src/components/audio/GenerateAudioMessage.ts +149 -0
  15. package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
  16. package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
  17. package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
  18. package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +13 -8
  19. package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
  20. package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +14 -8
  21. package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +17 -10
  22. package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +7 -7
  23. package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +13 -8
  24. package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
  25. package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +11 -6
  26. package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +12 -7
  27. package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +12 -7
  28. package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +22 -14
  29. package/src/components/database/CreateQuery.ts +39 -0
  30. package/src/components/database/InitializeDatabase.ts +71 -0
  31. package/src/components/database/imports/Boundaires.ts +168 -0
  32. package/src/{@modules/@database/ImportBroadcastify.ts → components/database/imports/Broadcastify.ts} +15 -25
  33. package/src/components/database/imports/Census.ts +87 -0
  34. package/src/{@modules/@database/ImportShapefiles.ts → components/database/imports/Shapefiles.ts} +24 -27
  35. package/src/{@modules/@database/ImportStanza.ts → components/database/imports/Stanza.ts} +15 -19
  36. package/src/components/events/CreateEvents.ts +88 -0
  37. package/src/components/events/FilterEvents.ts +149 -0
  38. package/src/{@building/CreateEvent.ts → components/events/ProcessStanza.ts} +22 -24
  39. package/src/components/events/RemoveEvents.ts +74 -0
  40. package/src/{@building → components/events/components}/GetCleanedEvent.ts +2 -2
  41. package/src/{@building → components/events/components}/GetEventAttachments.ts +14 -12
  42. package/src/components/events/components/GetEventDirection.ts +28 -0
  43. package/src/{@building → components/events/components}/GetEventEnhancedName.ts +5 -8
  44. package/src/{@building → components/events/components}/GetEventGeometry.ts +19 -13
  45. package/src/{@building → components/events/components}/GetEventHeader.ts +13 -13
  46. package/src/components/events/components/GetEventMerged.ts +51 -0
  47. package/src/{@building → components/events/components}/GetEventNodes.ts +22 -20
  48. package/src/{@building → components/events/components}/GetEventOffice.ts +13 -13
  49. package/src/components/events/components/GetEventPopulation.ts +58 -0
  50. package/src/components/events/components/GetEventProperties.ts +106 -0
  51. package/src/{@building → components/events/components}/GetEventSignature.ts +9 -9
  52. package/src/{@building → components/events/components}/GetEventTags.ts +3 -3
  53. package/src/components/events/components/GetEventTheme.ts +26 -0
  54. package/src/components/events/components/GetEventTracking.ts +64 -0
  55. package/src/{@modules/@database → components/events/utilities}/GetCachedEvents.ts +18 -15
  56. package/src/{@manager → components/events/utilities}/SetHash.ts +18 -13
  57. package/src/{@manager → components/events/utilities}/UpdateEvents.ts +12 -12
  58. package/src/{@manager → components/events/utilities}/UpdateNode.ts +14 -14
  59. package/src/{@parsers/@text → components/formatting}/GetEmbededText.ts +14 -8
  60. package/src/{@parsers/@text → components/formatting}/GetStringText.ts +15 -11
  61. package/src/{@modules/@utilities → components/geometry}/GetShapeNearestPoint.ts +24 -19
  62. package/src/components/geometry/GetUnionPolygon.ts +36 -0
  63. package/src/components/images/GenerateGraphic.ts +242 -0
  64. package/src/components/images/components/CreateRectangle.ts +22 -0
  65. package/src/components/images/components/CreateText.ts +22 -0
  66. package/src/components/images/modules/CreateSVG.ts +37 -0
  67. package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
  68. package/src/components/images/modules/GetGeographicalCities.ts +58 -0
  69. package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
  70. package/src/components/images/modules/GetGeometryBounds.ts +82 -0
  71. package/src/components/images/modules/GetParsedBoundary.ts +58 -0
  72. package/src/components/images/modules/GetSVGPath.ts +53 -0
  73. package/src/components/images/modules/NormalizePolygon.ts +57 -0
  74. package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +16 -17
  75. package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +27 -15
  76. package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +26 -26
  77. package/src/components/utilities/EmitThread.ts +97 -0
  78. package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
  79. package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
  80. package/src/components/utilities/QueueManager.ts +70 -0
  81. package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +13 -13
  82. package/src/components/utilities/SetEventEmit.ts +42 -0
  83. package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +7 -7
  84. package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +5 -5
  85. package/src/components/utilities/SetTimeoutAction.ts +64 -0
  86. package/src/components/utilities/SetWarning.ts +47 -0
  87. package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +20 -20
  88. package/src/{@core/CreateListener.ts → components/xmpp/ErrorXMPP.ts} +8 -5
  89. package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +13 -13
  90. package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +18 -18
  91. package/src/components/xmpp/ReconnectXMPP.ts +64 -0
  92. package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +26 -26
  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 +4 -3
  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 +133 -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 +37 -36
  119. package/src/{@core → exports}/ClearEvents.ts +9 -9
  120. package/src/{@core → exports}/GetEvents.ts +4 -4
  121. package/src/exports/GetNearestCity.ts +45 -0
  122. package/src/{@core → exports}/GetNodes.ts +4 -4
  123. package/src/{@core → exports}/GetRandomEvent.ts +4 -4
  124. package/src/{@core → exports}/GetVersion.ts +4 -4
  125. package/src/exports/ManualEvent.ts +55 -0
  126. package/src/{@core → exports}/QueryStanza.ts +12 -11
  127. package/src/exports/SetNode.ts +100 -0
  128. package/src/{@core → exports}/StartService.ts +23 -22
  129. package/src/{@core → exports}/StopService.ts +10 -10
  130. package/src/index.ts +57 -37
  131. package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +7 -7
  132. package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
  133. package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
  134. package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +12 -12
  135. package/src/parsers/ugc/GetCache.ts +24 -0
  136. package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
  137. package/src/{@parsers/@ugc/GetUGCHeader.ts → parsers/ugc/GetHeader.ts} +4 -4
  138. package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +10 -10
  139. package/src/parsers/ugc/GetZonePolygon.ts +73 -0
  140. package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +3 -3
  141. package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +13 -8
  142. package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +14 -14
  143. package/src/{@parsers/@pvtec → parsers/vtec}/GetExpiry.ts +2 -2
  144. package/src/{@parsers/@pvtec → parsers/vtec}/VTECExtract.ts +17 -17
  145. package/src/tasks/CreateTasks.ts +116 -0
  146. package/src/tasks/TaskGenerateJSON.ts +34 -0
  147. package/src/tasks/TaskGenerateText.ts +34 -0
  148. package/src/tasks/TaskSendNTFY.ts +96 -0
  149. package/src/tasks/TaskSendWebhook.ts +107 -0
  150. package/src/{@types → types/event}/Attributes.ts +2 -3
  151. package/src/{@types → types/event}/Event.ts +8 -7
  152. package/src/{@types → types/event}/HVTEC.ts +2 -2
  153. package/src/{@types → types/event}/Properties.ts +17 -3
  154. package/src/{@types → types/event}/Stanza.ts +2 -2
  155. package/src/{@types → types/event}/VTEC.ts +8 -8
  156. package/src/{@types → types/standard}/Actions.ts +3 -3
  157. package/src/{@types → types/standard}/Hash.ts +5 -5
  158. package/src/{@modules/@utilities/GetSettings.ts → types/standard/Nodes.ts} +15 -7
  159. package/src/{@types → types/standard}/Settings.ts +19 -12
  160. package/src/{@types → types/standard}/StanzaCompiled.ts +15 -15
  161. package/src/{@types → types/standard}/UGC.ts +5 -5
  162. package/tools/build.js +32 -0
  163. package/tsconfig.json +32 -1
  164. package/.github/SUPPORTED_EVENTS.md +0 -370
  165. package/.github/docs/docs-functions.md +0 -30
  166. package/.github/docs/docs-general-configurations.md +0 -209
  167. package/.github/docs/docs-integrations.md +0 -37
  168. package/.github/docs/docs-listeners.md +0 -28
  169. package/.github/docs/docs-source-configuration.md +0 -218
  170. package/.github/docs/docs-technical.md +0 -50
  171. package/.github/logo.png +0 -0
  172. package/.github/samples/SAMPLE_EAS_GENERATION.wav +0 -0
  173. package/.github/samples/SAMPLE_GEOJSON.json +0 -204
  174. package/.github/samples/SAMPLE_TEXT_PRODUCT.txt +0 -119
  175. package/dist/cjs/index.cjs +0 -8005
  176. package/dist/esm/index.mjs +0 -7985
  177. package/src/@building/GetEventProperties.ts +0 -96
  178. package/src/@building/GetEventTracking.ts +0 -68
  179. package/src/@core/ManualEvent.ts +0 -56
  180. package/src/@core/SetNode.ts +0 -81
  181. package/src/@events/ParseAPI.ts +0 -117
  182. package/src/@manager/MakeEvents.ts +0 -106
  183. package/src/@manager/RemoveEvent.ts +0 -70
  184. package/src/@manager/Tasks.ts +0 -246
  185. package/src/@manager/ValidateEvents.ts +0 -142
  186. package/src/@modules/@database/InitializeDatabase.ts +0 -59
  187. package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
  188. package/src/@modules/@utilities/GetFormattedTime.ts +0 -43
  189. package/src/@modules/@utilities/SetCronSchedule.ts +0 -94
  190. package/src/@modules/@utilities/SetEventEmit.ts +0 -41
  191. package/src/@modules/@utilities/SetListener.ts +0 -30
  192. package/src/@modules/@utilities/SetTimeoutAction.ts +0 -64
  193. package/src/@modules/@utilities/SetWarning.ts +0 -34
  194. package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
  195. package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
  196. package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
  197. package/src/@parsers/@text/GetXML.ts +0 -61
  198. package/src/@parsers/@ugc/GetCache.ts +0 -24
  199. package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
  200. package/tsup.config.ts +0 -16
@@ -11,14 +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
+ type EnumMatchesType = {
21
+ match: RegExp;
22
+ label: string;
23
+ statement: boolean;
24
+ };
20
25
 
21
- export const EnumMatches = {
26
+ export const EnumMatches: Record<string, EnumMatchesType[]> = {
22
27
  SPS: [
23
28
  { match: /STRONG THUNDERSTORM/i, label: "Convective Special Weather Statement", statement: false },
24
29
  { match: /SPECIAL WEATHER STATEMENT/i, label: "Special Weather Statement", statement: false }
@@ -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,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,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,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,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
 
@@ -68,5 +68,69 @@ export const EnumStates: Record<string, string> = {
68
68
  "WV": "West Virginia",
69
69
  "WI": "Wisconsin",
70
70
  "WY": "Wyoming",
71
- "DC": "District of Columbia"
72
- };
71
+ "DC": "District of Columbia",
72
+ };
73
+
74
+ export const EnumZones: Record<string, string> = {
75
+ "LM": "Lake Michigan",
76
+ "GM": "Gulf of Mexico",
77
+ "LH": "Lake Huron",
78
+ "LE": "Lake Erie",
79
+ "LS": "Lake Superior",
80
+ "LO": "Lake Ontario",
81
+ "AM": "Atlantic Ocean",
82
+ }
83
+
84
+ export const EnumStateFIPS: Record<string, string> = {
85
+ "01": "AL",
86
+ "02": "AK",
87
+ "04": "AZ",
88
+ "05": "AR",
89
+ "06": "CA",
90
+ "08": "CO",
91
+ "09": "CT",
92
+ "10": "DE",
93
+ "11": "DC",
94
+ "12": "FL",
95
+ "13": "GA",
96
+ "15": "HI",
97
+ "16": "ID",
98
+ "17": "IL",
99
+ "18": "IN",
100
+ "19": "IA",
101
+ "20": "KS",
102
+ "21": "KY",
103
+ "22": "LA",
104
+ "23": "ME",
105
+ "24": "MD",
106
+ "25": "MA",
107
+ "26": "MI",
108
+ "27": "MN",
109
+ "28": "MS",
110
+ "29": "MO",
111
+ "30": "MT",
112
+ "31": "NE",
113
+ "32": "NV",
114
+ "33": "NH",
115
+ "34": "NJ",
116
+ "35": "NM",
117
+ "36": "NY",
118
+ "37": "NC",
119
+ "38": "ND",
120
+ "39": "OH",
121
+ "40": "OK",
122
+ "41": "OR",
123
+ "42": "PA",
124
+ "44": "RI",
125
+ "45": "SC",
126
+ "46": "SD",
127
+ "47": "TN",
128
+ "48": "TX",
129
+ "49": "UT",
130
+ "50": "VT",
131
+ "51": "VA",
132
+ "53": "WA",
133
+ "54": "WV",
134
+ "55": "WI",
135
+ "56": "WY"
136
+ }
@@ -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,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,13 +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
- export const EnumTags = {
20
+ type EnumTagsType = {
21
+ match: RegExp;
22
+ tag: string;
23
+ };
24
+
25
+ export const EnumTags: Record<string, EnumTagsType[]> = {
21
26
  SEVERE_WEATHER: [
22
27
  { match: /A Large And Extremely Dangerous Tornado/i, tag: "Large and Dangerous Tornado" },
23
28
  { match: /This Is A Particularly Dangerous Situation/i, tag: "Particularly Dangerous Situation" },
@@ -148,7 +153,7 @@ export const EnumTags = {
148
153
  { match: /Source\.\.\.Doppler Radar/i, tag: "Confirmed By Radar" },
149
154
  { match: /Source\.\.\.Automated Gauges/i, tag: "Confirmed By Automated Gauges" },
150
155
  { match: /Source\.\.\.Radar Confirmed/i, tag: "Confirmed By Radar" },
151
- { match: /Source\.\.\.Radar Indicated/i, tag: "Indicated By Radar" },
156
+ { match: /Source\.\.\.Radar Indicated/i, tag: "Radar Indicated" },
152
157
  { match: /Source\.\.\.Public/i, tag: "Confirmed By Public" },
153
158
  { match: /Source\.\.\.Amateur Radio/i, tag: "Confirmed By Amateur Radio" },
154
159
  { match: /Source\.\.\.Emergency Management/i, tag: "Confirmed By Emergency Management" },
@@ -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
 
@@ -0,0 +1,70 @@
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
+ type Themes = {
21
+ Event: string;
22
+ RGB: string;
23
+ }
24
+
25
+ export const EnumThemes: Themes[] = [
26
+ { Event: `Tornado Emergency`, RGB: `rgb(166, 0, 255)` },
27
+ { Event: `Flash Flood Emergency`, RGB: `rgb(21, 216, 37)` },
28
+ { Event: `*PDS Tornado Warning*`, RGB: `rgb(208, 0, 255)` },
29
+ { Event: `*Tornado Warning*`, RGB: `rgb(255, 0, 0)` },
30
+ { Event: `Confirmed Tornado Warning`, RGB: `rgb(220, 20, 20)` },
31
+ { Event: `Radar Indicated Tornado Warning`, RGB: `rgb(200, 30, 30)` },
32
+ { Event: `Tornado Warning`, RGB: `rgb(180, 40, 40)` },
33
+ { Event: `*EDS Severe Thunderstorm Warning*`, RGB: `rgb(255, 51, 0)` },
34
+ { Event: `*Destructive Severe Thunderstorm Warning*`, RGB: `rgb(255, 51, 0)` },
35
+ { Event: `Destructive Severe Thunderstorm Warning (TPROB)`, RGB: `rgb(240, 60, 0)` },
36
+ { Event: `EDS Severe Thunderstorm Warning (TPROB)`, RGB: `rgb(240, 60, 0)` },
37
+ { Event: `Considerable Severe Thunderstorm Warning (TPROB)`, RGB: `rgb(230, 100, 0)` },
38
+ { Event: `*Severe Thunderstorm Warning*`, RGB: `rgb(197, 159, 32)` },
39
+ { Event: `Severe Thunderstorm Warning (TPROB)`, RGB: `rgb(210, 140, 20)` },
40
+ { Event: `Considerable Severe Thunderstorm Warning`, RGB: `rgb(204, 160, 0)` },
41
+ { Event: `Severe Thunderstorm Warning`, RGB: `rgb(204, 132, 0)` },
42
+ { Event: `Flash Flood Warning`, RGB: `rgb(97, 204, 30)` },
43
+ { Event: `Flood Warning`, RGB: `rgb(0, 204, 0)` },
44
+ { Event: `Hurricane Warning`, RGB: `rgb(16, 125, 176)` },
45
+ { Event: `Tsunami Warning`, RGB: `rgb(93, 27, 158)` },
46
+ { Event: `Tsunami Watch`, RGB: `rgb(72, 16, 128)` },
47
+ { Event: `Tsunami Advisory`, RGB: `rgb(80, 48, 160)` },
48
+ { Event: `Tropical Storm Warning`, RGB: `rgb(101, 194, 238)` },
49
+ { Event: `Hurricane Watch`, RGB: `rgb(204, 84, 144)` },
50
+ { Event: `*PDS Blizzard Warning*`, RGB: `rgb(5, 115, 151)` },
51
+ { Event: `Blizzard Warning`, RGB: `rgb(0, 152, 204)` },
52
+ { Event: `Snow Squall Warning`, RGB: `rgb(56, 104, 144)` },
53
+ { Event: `*PDS Ice Storm Warning*`, RGB: `rgb(86, 67, 196)` },
54
+ { Event: `Ice Storm Warning`, RGB: `rgb(58, 49, 111)` },
55
+ { Event: `Lake Effect Snow Warning`, RGB: `rgb(0, 111, 111)` },
56
+ { Event: `Winter Storm Warning`, RGB: `rgb(24, 115, 204)` },
57
+ { Event: `Extreme Cold Warning`, RGB: `rgb(47, 47, 137)` },
58
+ { Event: `Tornadic Special Marine Warning`, RGB: `rgb(3, 134, 134)` },
59
+ { Event: `Special Marine Warning`, RGB: `rgb(0, 204, 204)` },
60
+ { Event: `Special Weather Statement`, RGB: `rgb(70, 130, 180)` },
61
+ { Event: `Mesoscale Discussion`, RGB: `rgb(255, 0, 0)` },
62
+ { Event: `*PDS Tornado Watch*`, RGB: `rgb(255, 0, 0)` },
63
+ { Event: `*Tornado Watch*`, RGB: `rgb(151, 23, 23)` },
64
+ { Event: `*PDS Severe Thunderstorm Watch*`, RGB: `rgb(255, 81, 0)` },
65
+ { Event: `*Severe Thunderstorm Watch*`, RGB: `rgb(255, 204, 0)` },
66
+ { Event: `*Excessive Heat Warning*`, RGB: `rgb(255, 255, 255)` },
67
+ { Event: `*Flood*`, RGB: `rgb(0, 255, 128)` },
68
+ { Event: `*Heat*`, RGB: `rgb(240, 197, 119)` },
69
+ { Event: `Default`, RGB: `rgb(86, 125, 165)` },
70
+ ];
@@ -0,0 +1,133 @@
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 "TypesStandard/StanzaCompiled"
21
+ import { TypeVTEC } from "TypesEvent/VTEC"
22
+ import { EnumICAO } from "@Enums/ICAO"
23
+ import { Bootstrap } from "@Bootstrap"
24
+ import { GetEventTracking } from "@BuilderComponents/GetEventTracking"
25
+ import { VTECExtract } from "@ParsingVTEC/VTECExtract"
26
+ import { GetEventTags } from "@BuilderComponents/GetEventTags"
27
+ import { GetEventTheme } from "@BuilderComponents/GetEventTheme"
28
+ import { GetEventDirection } from "@BuilderComponents/GetEventDirection"
29
+ import { GetTextFromProduct } from "@ParsingText/GetTextFromProduct"
30
+ import { SetDebug } from "@Utilities/SetDebug"
31
+
32
+ export const ParseAPI = async (Stanza: TypeStanzaCompiled): Promise<void> => {
33
+ const messages = Object.values(JSON.parse(Stanza.Message).features) as any;
34
+ for (const feature of messages) {
35
+ const tick = performance.now();
36
+ const VTEC = VTECExtract(feature?.properties?.parameters?.VTEC?.[0]) ?? null as TypeVTEC[]
37
+ Bootstrap.Cache.Parsed.push({
38
+ type: `Feature`,
39
+ geometry: {
40
+ type: `Polygon`,
41
+ coordinates: []
42
+ },
43
+ properties: {
44
+ event: feature?.properties?.event ?? null,
45
+ parent: feature?.properties?.event ?? null,
46
+ status: feature?.properties?.messageType ?? null,
47
+ issued: feature?.properties?.sent ? new Date(feature?.properties?.sent).toISOString() : null,
48
+ expires: feature?.properties?.expires ? new Date(feature?.properties?.expires).toISOString() : null,
49
+ locations: feature?.properties?.areaDesc ?? null,
50
+ locations_array: feature?.properties?.areaDesc ? feature?.properties?.areaDesc.split('; ') : [],
51
+ regions: [...new Set(
52
+ feature?.properties?.geocode?.UGC?.map((ugc: string) => ugc.match(/^([A-Z]{2})[CZ](\d{3})$/)?.[1])
53
+ .filter(Boolean) ?? []
54
+ )] as string[],
55
+ regions_string: (() => {
56
+ const abbrs = [...new Set(feature?.properties?.geocode?.UGC?.map((l: string) => l.match(/^([A-Z]{2})[CZ](\d{3})$/)?.[1]).filter(Boolean) ?? [])];
57
+ return abbrs.length ? abbrs.join(`-`) : null;
58
+ })(),
59
+ description: feature?.properties?.description ?? null,
60
+ attributes: feature?.properties?.attributes ?? {},
61
+ theme: GetEventTheme(feature?.properties?.event),
62
+ geocode: {
63
+ office: {
64
+ office: VTEC ? VTEC?.[0]?.tracking.split(`.`)[0] : null,
65
+ name: EnumICAO[VTEC ? VTEC?.[0]?.tracking.split(`.`)[0] : null] ?? null,
66
+ },
67
+ organization: feature?.properties?.parameters?.WMOidentifier?.[0],
68
+ ugc: feature?.properties?.geocode?.UGC ?? [],
69
+ census: {
70
+ population: null,
71
+ cities: []
72
+ },
73
+ polygon: feature?.geometry?.coordinates.length > 0 ? Buffer.from(JSON.stringify([feature?.geometry?.coordinates[0]])).toString('base64') : null,
74
+ polygon_generated: feature?.geometry?.coordinates.length > 0 ? true : false,
75
+ },
76
+ parameters: {
77
+ tags: GetEventTags(feature?.properties?.description),
78
+ instructions: feature?.properties?.instruction ?? null,
79
+ source: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`SOURCE...`], Removal: [`.`]}) ?? null,
80
+ hazards: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`HAZARD...`], Removal: [`.`]}) ?? null,
81
+ impacts: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`IMPACT...`], Removal: [`.`]}) ?? null,
82
+ estimated_hail_size: feature?.properties?.parameters?.maxHailSize?.[0] ?? null,
83
+ estimated_wind_gusts: feature?.properties?.parameters?.maxWindGust?.[0] ?? null,
84
+ direction: GetEventDirection(feature?.properties?.description) ?? null,
85
+ damage_threat: feature?.properties?.parameters?.thunderstormDamageThreat?.[0] ?? null,
86
+ tornado_threat: feature?.properties?.parameters?.tornadoDetection?.[0] ?? null,
87
+ flood_threat: feature?.properties?.parameters?.flashFloodDamageThreat?.[0] ?? null,
88
+ wind_threat: feature?.properties?.parameters?.windThreat?.[0] ?? null,
89
+ hail_threat: feature?.properties?.parameters?.hailThreat?.[0] ?? null,
90
+ },
91
+ discussion_parameters: {
92
+ discussion_number: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`Mesoscale Discussion `], Removal: [`Mesoscale Discussion`, `Number`, `...`] })?.toString()?.padStart(4, "0") ?? null,
93
+ discussion_concerning: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`Concerning...`] }) ?? null,
94
+ discussion_max_tornado: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] }) ?? null,
95
+ discussion_max_hail: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`MOST PROBABLE PEAK HAIL SIZE...`] }) ?? null,
96
+ discussion_max_wind: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`MOST PROBABLE PEAK WIND GUST...`] }) ?? null,
97
+ discussion_watch_issuance: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`Probability of Watch Issuance...`], Removal: [`percent`]}) ?? null,
98
+ },
99
+ watch_parameters: {
100
+ watch_number: (VTEC?.[0]?.watch) && (GetTextFromProduct({ Message: feature?.properties?.description, Find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], Removal: [`%`, `<`, `:`] })?.replace(/(WT|WS|)/g, '')?.trim()?.toString()?.padStart(4, "0") ?? VTEC?.[0]?.tracking?.slice(-4)?.toString()?.padStart(4, "0") ?? null),
101
+ watch_type: feature?.properties?.description.includes(`TORNADO WATCH`) ? `Tornado` : feature?.properties?.description.includes(`SEVERE`) ? `Severe` : null,
102
+ additional_tornadoes_probability: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PROB OF 2 OR MORE TORNADOES`], Removal: [`%`, `<`, `:`] }) ?? null,
103
+ strong_tornadoes_probability: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], Removal: [`%`, `<`, `:`] }) ?? null,
104
+ severe_wind_probability: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], Removal: [`%`, `<`, `:`] }) ?? null,
105
+ severe_hail_probability: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], Removal: [`%`, `<`, `:`] }) ?? null,
106
+ hail_2in_probability: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], Removal: [`%`, `<`, `:`] }) ?? null,
107
+ combined_hail_wind_probability: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], Removal: [`%`, `<`, `:`] }) ?? null,
108
+ max_hail_in: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`MAX HAIL /INCHES/`], Removal: [`%`, `<`, `:`] }) ?? null,
109
+ max_wind_surface: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`MAX WIND GUSTS SURFACE /KNOTS/`], Removal: [`%`, `<`, `:`] }) ?? null,
110
+ max_tops_x100feet: GetTextFromProduct({ Message: feature?.properties?.description, Find: [`MAX TOPS /X 100 FEET/`], Removal: [`%`, `<`, `:`] }) ?? null,
111
+ pds_watch: (GetTextFromProduct({ Message: feature?.properties?.description, Find: [`PARTICULARLY DANGEROUS SITUATION`], Removal: [`%`, `<`, `:`] }) === `YES`)
112
+ },
113
+ metadata: {
114
+ ms: performance.now() - tick,
115
+ source: `events.api`,
116
+ tracking: GetEventTracking({ Type: `API`, WMO: { Identifier: feature?.properties?.parameters?.WMOidentifier?.[0], ID: feature?.id}, VTEC: VTEC?.[0]}),
117
+ header: `ZCZC-ATMOSX-${feature?.properties?.parameters?.WMOidentifier}`,
118
+ vtec: VTEC?.[0],
119
+ hvtec: null,
120
+ raw: feature?.properties?.description,
121
+ history: [
122
+ {
123
+ description: feature?.properties?.description,
124
+ issued: feature?.properties?.sent ? new Date(feature?.properties?.sent).toISOString() : null,
125
+ status: feature?.properties?.messageType ?? null,
126
+ }
127
+ ]
128
+ }
129
+ }
130
+ })
131
+ SetDebug({ Title: `ParseAPI`, Message: `${Math.round(performance.now() - tick)}ms` })
132
+ }
133
+ }
@@ -11,51 +11,52 @@
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 { TypeAttributes } from "../@types/Attributes";
21
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled"
22
- import { EnumMatches } from "../@enums/Matches";
23
- import { bootstrap } from "../bootstrap";
24
- import { GetEventProperties } from "../@building/GetEventProperties";
25
- import { GetEventHeader } from "../@building/GetEventHeader";
26
- import { GetEventTracking } from "../@building/GetEventTracking";
27
- import { SetDebug } from "../@modules/@utilities/SetDebug";
20
+ import { TypeAttributes } from "TypesEvent/Attributes"
21
+ import { TypeStanzaCompiled } from "TypesStandard/StanzaCompiled"
22
+ import { EnumMatches } from "@Enums/Matches"
23
+ import { Bootstrap } from "@Bootstrap"
24
+ import { GetEventProperties } from "@BuilderComponents/GetEventProperties"
25
+ import { GetEventHeader } from "@BuilderComponents/GetEventHeader"
26
+ import { GetEventTracking } from "@BuilderComponents/GetEventTracking"
27
+ import { GetEventTheme } from "@BuilderComponents/GetEventTheme"
28
+ import { SetDebug } from "@Utilities/SetDebug"
28
29
 
29
- export const ParseText = async (stanza: TypeStanzaCompiled): Promise<void> => {
30
- const getMessages = stanza?.message
30
+ export const ParseText = async (Stanza: TypeStanzaCompiled): Promise<void> => {
31
+ const getMessages = Stanza?.Message
31
32
  ?.split(/(?=\$\$)/g)
32
33
  ?.map(message => message.trim())
33
34
  ?.filter(message => message && message !== "$$");
34
35
  if (!getMessages || getMessages?.length == 0 ) return;
35
36
  for (const message of getMessages) {
36
37
  const tick = performance.now();
37
- const attributes = stanza?.attributes as TypeAttributes
38
- const props = GetEventProperties({ message, attributes })
39
- const header = GetEventHeader({properties: props, getType: stanza.getType})
38
+ const attributes = Stanza?.Attributes as TypeAttributes
39
+ const props = GetEventProperties({ Message: message, Attributes: attributes })
40
+ const header = GetEventHeader({ Properties: props, VTEC: null, Type: Stanza.Type })
40
41
  const issued = new Date(attributes.issue)
41
42
  const expires = new Date(issued.getTime() + 12 * 60 * 60 * 1000)
42
- const matches = EnumMatches[stanza.getType.prefix]?.find(match => match.match.test(message.toUpperCase()));
43
+ const matches = EnumMatches[Stanza.Type.Prefix]?.find(match => match.match.test(message.toUpperCase()));
43
44
 
44
45
  let event = matches?.label;
45
46
  let isStatement = matches?.statement ?? false;
46
47
 
47
48
  if (!event) {
48
- event = stanza.getType.type;
49
- if (!stanza.getType.discovered) {
49
+ event = Stanza.Type.Type;
50
+ if (!Stanza.Type.Discovered) {
50
51
  event += ` (AWIPSID)`
51
52
  }
52
53
  isStatement = true;
53
54
  }
54
55
 
55
- bootstrap.cache.processed.push({
56
+ Bootstrap.Cache.Parsed.push({
56
57
  type: `Feature`,
57
58
  geometry: {
58
- type: `Point`,
59
+ type: `Polygon`,
59
60
  coordinates: []
60
61
  },
61
62
  properties: {
@@ -64,11 +65,12 @@ export const ParseText = async (stanza: TypeStanzaCompiled): Promise<void> => {
64
65
  status: isStatement ? `Statement` : `Issued`,
65
66
  issued: (!isNaN(issued.getTime())) ? issued.toISOString() : new Date().toISOString(),
66
67
  expires: isStatement ? new Date(issued.getTime() + 120 * 1000).toISOString() : (!isNaN(expires.getTime())) ? expires.toISOString() : new Date(Date.now() + 60 * 60 * 1000).toISOString(),
68
+ theme: GetEventTheme(event),
67
69
  ...props,
68
70
  metadata: {
69
71
  ms: performance.now() - tick,
70
72
  source: `events.text`,
71
- tracking: GetEventTracking({ type: `RAW`, stanza, attributes, properties: props }),
73
+ tracking: GetEventTracking({ Type: `RAW`, Stanza, Attributes: attributes, Properties: props }),
72
74
  header: header,
73
75
  vtec: null,
74
76
  hvtec: null,
@@ -83,6 +85,6 @@ export const ParseText = async (stanza: TypeStanzaCompiled): Promise<void> => {
83
85
  }
84
86
  }
85
87
  })
86
- SetDebug({ title: `ParseText`, message: `${Math.round(performance.now() - tick)}ms` })
88
+ SetDebug({ Title: `ParseText`, Message: `${Math.round(performance.now() - tick)}ms` })
87
89
  }
88
90
  }
@@ -11,56 +11,56 @@
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 { TypeAttributes } from "../@types/Attributes";
21
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled"
22
- import { EnumMatches } from "../@enums/Matches";
23
- import { bootstrap } from "../bootstrap";
24
- import { ugcExtract } from "../@parsers/@ugc/UGCExtract";
25
- import { GetEventProperties } from "../@building/GetEventProperties";
26
- import { GetEventHeader } from "../@building/GetEventHeader";
27
- import { GetEventTracking } from "../@building/GetEventTracking";
28
- import { SetDebug } from "../@modules/@utilities/SetDebug";
20
+ import { TypeAttributes } from "TypesEvent/Attributes"
21
+ import { TypeStanzaCompiled } from "TypesStandard/StanzaCompiled"
22
+ import { EnumMatches } from "@Enums/Matches"
23
+ import { Bootstrap } from "@Bootstrap"
24
+ import { UGCExtract } from "@ParsingUGC/UGCExtract"
25
+ import { GetEventProperties } from "@BuilderComponents/GetEventProperties"
26
+ import { GetEventHeader } from "@BuilderComponents/GetEventHeader"
27
+ import { GetEventTracking } from "@BuilderComponents/GetEventTracking"
28
+ import { GetEventTheme } from "@BuilderComponents/GetEventTheme"
29
+ import { SetDebug } from "@Utilities/SetDebug"
29
30
 
30
- export const ParseUGC = async (stanza: TypeStanzaCompiled): Promise<void> => {
31
- const getMessages = stanza?.message
31
+ export const ParseUGC = async (Stanza: TypeStanzaCompiled): Promise<void> => {
32
+ const getMessages = Stanza?.Message
32
33
  ?.split(/(?=\$\$)/g)
33
34
  ?.map(message => message.trim())
34
35
  ?.filter(message => message && message !== "$$");
35
36
  if (!getMessages || getMessages?.length == 0 ) return;
36
37
  for (const message of getMessages) {
37
38
  const tick = performance.now();
38
- const attributes = stanza?.attributes as TypeAttributes
39
- const ugc = await ugcExtract(message)
39
+ const attributes = Stanza?.Attributes as TypeAttributes
40
+ const ugc = await UGCExtract(message)
40
41
 
41
42
  if (ugc != null ) {
42
- const props = GetEventProperties({ message, attributes, ugc: ugc })
43
+ const props = GetEventProperties({ Message: message, Attributes: attributes, UGC: ugc })
43
44
  const issued = new Date(attributes.issue)
44
- const expires = new Date(ugc.expires)
45
- const header = GetEventHeader({properties: props, getType: stanza.getType })
46
- const matches = EnumMatches[stanza.getType.prefix]?.find(match => match.match.test(message.toUpperCase()));
45
+ const expires = new Date(ugc.Expires)
46
+ const header = GetEventHeader({ Properties: props, VTEC: null, Type: Stanza.Type })
47
+ const matches = EnumMatches[Stanza.Type.Prefix]?.find(match => match.match.test(message.toUpperCase()));
47
48
 
48
49
  let event = matches?.label;
49
50
  let isStatement = matches?.statement ?? false;
50
51
 
51
52
  if (!event) {
52
- event = stanza.getType.type;
53
- if (!stanza.getType.discovered) {
53
+ event = Stanza.Type.Type;
54
+ if (!Stanza.Type.Discovered) {
54
55
  event += ` (AWIPSID)`
55
56
  }
56
57
  isStatement = true;
57
-
58
58
  }
59
59
 
60
- bootstrap.cache.processed.push({
60
+ Bootstrap.Cache.Parsed.push({
61
61
  type: `Feature`,
62
62
  geometry: {
63
- type: `Point`,
63
+ type: `Polygon`,
64
64
  coordinates: []
65
65
  },
66
66
  properties: {
@@ -69,11 +69,12 @@ export const ParseUGC = async (stanza: TypeStanzaCompiled): Promise<void> => {
69
69
  status: isStatement ? `Statement` : `Issued`,
70
70
  issued: (!isNaN(issued.getTime())) ? issued.toISOString() : new Date().toISOString(),
71
71
  expires: isStatement ? new Date(issued.getTime() + 120 * 1000).toISOString() : (!isNaN(expires.getTime())) ? expires.toISOString() : new Date(Date.now() + 60 * 60 * 1000).toISOString(),
72
+ theme: GetEventTheme(event),
72
73
  ...props,
73
74
  metadata: {
74
75
  ms: performance.now() - tick,
75
76
  source: `events.ugc`,
76
- tracking: GetEventTracking({ type: `RAW`, stanza, attributes, properties: props }),
77
+ tracking: GetEventTracking({ Type: `RAW`, Stanza, Attributes: attributes, Properties: props }),
77
78
  header: header,
78
79
  vtec: null,
79
80
  hvtec: null,
@@ -88,7 +89,7 @@ export const ParseUGC = async (stanza: TypeStanzaCompiled): Promise<void> => {
88
89
  }
89
90
  }
90
91
  })
91
- SetDebug({ title: `ParseUGC`, message: `${Math.round(performance.now() - tick)}ms` })
92
+ SetDebug({ Title: `ParseUGC`, Message: `${Math.round(performance.now() - tick)}ms` })
92
93
  }
93
94
  }
94
95
  }