@atmosx/event-product-parser 3.0.63 → 3.0.75

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 (164) hide show
  1. package/.github/docs/docs-functions.md +1 -1
  2. package/.github/docs/docs-general-configurations.md +1 -11
  3. package/.github/docs/docs-integrations.md +3 -2
  4. package/README.md +4 -4
  5. package/dist/cjs/index.cjs +3590 -623
  6. package/dist/esm/index.mjs +3589 -624
  7. package/package.json +11 -4
  8. package/src/bootstrap.ts +50 -33
  9. package/src/{@building → building}/CreateEvent.ts +10 -10
  10. package/src/{@building → building}/GetCleanedEvent.ts +2 -2
  11. package/src/{@building → building}/GetEventAttachments.ts +12 -10
  12. package/src/building/GetEventDirection.ts +28 -0
  13. package/src/{@building → building}/GetEventEnhancedName.ts +5 -6
  14. package/src/{@building → building}/GetEventGeometry.ts +19 -13
  15. package/src/{@building → building}/GetEventHeader.ts +4 -4
  16. package/src/{@building → building}/GetEventNodes.ts +16 -14
  17. package/src/{@building → building}/GetEventOffice.ts +5 -5
  18. package/src/building/GetEventPopulation.ts +58 -0
  19. package/src/{@building → building}/GetEventProperties.ts +23 -18
  20. package/src/{@building → building}/GetEventSignature.ts +8 -8
  21. package/src/{@building → building}/GetEventTags.ts +3 -3
  22. package/src/{@core/CreateListener.ts → building/GetEventTheme.ts} +8 -6
  23. package/src/{@building → building}/GetEventTracking.ts +6 -6
  24. package/src/{@modules/@eas/GenerateEASMessage.ts → components/audio/GenerateAudioMessage.ts} +32 -33
  25. package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
  26. package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
  27. package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
  28. package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +2 -2
  29. package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
  30. package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +2 -2
  31. package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +5 -3
  32. package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +2 -2
  33. package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +2 -2
  34. package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
  35. package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +2 -2
  36. package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +4 -4
  37. package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +4 -4
  38. package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +5 -5
  39. package/src/{@modules/@utilities/SetWarning.ts → components/database/CreateQuery.ts} +18 -13
  40. package/src/{@modules/@database → components/database}/GetCachedEvents.ts +14 -9
  41. package/src/components/database/ImportBoundaries.ts +168 -0
  42. package/src/{@modules/@database → components/database}/ImportBroadcastify.ts +8 -17
  43. package/src/components/database/ImportCities.ts +87 -0
  44. package/src/{@modules/@database → components/database}/ImportShapefiles.ts +14 -16
  45. package/src/{@modules/@database → components/database}/ImportStanza.ts +13 -17
  46. package/src/components/database/InitializeDatabase.ts +71 -0
  47. package/src/components/images/GenerateGraphic.ts +242 -0
  48. package/src/components/images/components/CreateRectangle.ts +22 -0
  49. package/src/components/images/components/CreateText.ts +22 -0
  50. package/src/components/images/modules/CreateSVG.ts +37 -0
  51. package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
  52. package/src/components/images/modules/GetGeographicalCities.ts +58 -0
  53. package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
  54. package/src/components/images/modules/GetGeometryBounds.ts +82 -0
  55. package/src/components/images/modules/GetParsedBoundary.ts +58 -0
  56. package/src/components/images/modules/GetSVGPath.ts +53 -0
  57. package/src/components/images/modules/NormalizePolygon.ts +57 -0
  58. package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +4 -4
  59. package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +6 -6
  60. package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +2 -2
  61. package/src/{@parsers/@text → components/utilities}/GetEmbededText.ts +6 -4
  62. package/src/{@modules/@utilities → components/utilities}/GetFormattedTime.ts +2 -2
  63. package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
  64. package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +2 -2
  65. package/src/{@modules/@utilities → components/utilities}/GetShapeNearestPoint.ts +2 -2
  66. package/src/{@parsers/@text → components/utilities}/GetStringText.ts +7 -7
  67. package/src/components/utilities/GetUnionPolygon.ts +36 -0
  68. package/src/{@modules/@utilities → components/utilities}/QueueManager.ts +2 -2
  69. package/src/{@modules/@utilities → components/utilities}/SetCronSchedule.ts +37 -25
  70. package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +4 -4
  71. package/src/{@modules/@utilities → components/utilities}/SetEventEmit.ts +8 -7
  72. package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +4 -4
  73. package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +2 -2
  74. package/src/{@modules/@utilities → components/utilities}/SetTimeoutAction.ts +3 -3
  75. package/src/components/utilities/SetWarning.ts +47 -0
  76. package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +12 -12
  77. package/src/{@modules/@xmpp → components/xmpp}/ErrorXMPP.ts +3 -3
  78. package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +4 -4
  79. package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +5 -5
  80. package/src/{@modules/@xmpp → components/xmpp}/ReconnectXMPP.ts +6 -6
  81. package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +8 -8
  82. package/src/{@core → core}/ClearEvents.ts +4 -4
  83. package/src/{@core → core}/GetEvents.ts +3 -3
  84. package/src/{@core → core}/GetNodes.ts +3 -3
  85. package/src/{@core → core}/GetRandomEvent.ts +3 -3
  86. package/src/{@core → core}/GetVersion.ts +3 -3
  87. package/src/{@core → core}/ManualEvent.ts +6 -6
  88. package/src/{@core → core}/QueryStanza.ts +9 -8
  89. package/src/{@core → core}/SetNode.ts +5 -5
  90. package/src/{@core → core}/StartService.ts +13 -12
  91. package/src/{@core → core}/StopService.ts +3 -3
  92. package/src/{@enums → enums}/AWIPS.ts +2 -2
  93. package/src/{@enums → enums}/Actions.ts +2 -2
  94. package/src/{@enums → enums}/Cancellation.ts +2 -2
  95. package/src/{@enums → enums}/Causes.ts +2 -2
  96. package/src/{@enums → enums}/Correlations.ts +2 -2
  97. package/src/{@enums → enums}/Enhanced.ts +4 -3
  98. package/src/{@enums → enums}/Events.ts +2 -2
  99. package/src/{@enums → enums}/Expressions.ts +2 -2
  100. package/src/{@enums → enums}/GlobalFilter.ts +2 -2
  101. package/src/{@enums → enums}/Hail.ts +2 -2
  102. package/src/{@enums → enums}/ICAO.ts +2 -2
  103. package/src/{@enums → enums}/Matches.ts +8 -3
  104. package/src/{@enums → enums}/Products.ts +2 -2
  105. package/src/{@enums → enums}/Records.ts +2 -2
  106. package/src/{@enums → enums}/Severity.ts +2 -2
  107. package/src/{@enums → enums}/Shapefiles.ts +2 -2
  108. package/src/{@enums → enums}/States.ts +68 -4
  109. package/src/{@enums → enums}/Status.ts +2 -2
  110. package/src/{@enums → enums}/Strings.ts +2 -2
  111. package/src/{@enums → enums}/Tags.ts +8 -3
  112. package/src/{@enums → enums}/Testing.ts +2 -2
  113. package/src/enums/Themes.ts +70 -0
  114. package/src/{@events → events}/ParseAPI.ts +28 -17
  115. package/src/{@events → events}/ParseText.ts +13 -11
  116. package/src/{@events → events}/ParseUGC.ts +15 -14
  117. package/src/{@events → events}/ParseVTEC.ts +18 -16
  118. package/src/index.ts +49 -32
  119. package/src/{@manager → manager}/MakeEvents.ts +16 -28
  120. package/src/{@manager → manager}/RemoveEvent.ts +9 -9
  121. package/src/{@manager → manager}/SetHash.ts +5 -5
  122. package/src/{@manager → manager}/UpdateEvents.ts +6 -6
  123. package/src/{@manager → manager}/UpdateNode.ts +6 -6
  124. package/src/{@manager → manager}/ValidateEvents.ts +31 -20
  125. package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +7 -7
  126. package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +3 -3
  127. package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
  128. package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +2 -2
  129. package/src/{@parsers/@ugc → parsers/ugc}/GetCache.ts +4 -4
  130. package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
  131. package/src/{@parsers/@ugc → parsers/ugc}/GetHeader.ts +3 -3
  132. package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +9 -9
  133. package/src/parsers/ugc/GetZonePolygon.ts +73 -0
  134. package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +2 -2
  135. package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +4 -4
  136. package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +9 -9
  137. package/src/{@parsers/@vtec → parsers/vtec}/GetExpiry.ts +2 -2
  138. package/src/{@parsers/@vtec → parsers/vtec}/VTECExtract.ts +9 -9
  139. package/src/{@types-lower → static}/Attributes.ts +2 -3
  140. package/src/{@types-lower → static}/Event.ts +7 -6
  141. package/src/{@types-lower → static}/Properties.ts +17 -4
  142. package/src/{@types-lower → static}/Stanza.ts +3 -3
  143. package/src/{@tasks → tasks}/CreateTasks.ts +40 -34
  144. package/src/{@tasks → tasks}/TaskGenerateJSON.ts +2 -2
  145. package/src/{@tasks → tasks}/TaskGenerateText.ts +2 -2
  146. package/src/{@tasks → tasks}/TaskSendNTFY.ts +29 -25
  147. package/src/{@tasks → tasks}/TaskSendWebhook.ts +22 -15
  148. package/src/{@types → types}/Actions.ts +3 -3
  149. package/src/{@types → types}/HVTEC.ts +2 -2
  150. package/src/{@types → types}/Hash.ts +2 -2
  151. package/src/types/Nodes.ts +29 -0
  152. package/src/{@types → types}/Settings.ts +17 -8
  153. package/src/{@types → types}/StanzaCompiled.ts +3 -3
  154. package/src/{@types → types}/UGC.ts +2 -2
  155. package/src/{@types → types}/VTEC.ts +2 -2
  156. package/tools/build.js +2 -0
  157. package/tsconfig.json +25 -18
  158. package/src/@modules/@database/InitializeDatabase.ts +0 -59
  159. package/src/@modules/@utilities/GetSettings.ts +0 -25
  160. package/src/@modules/@utilities/SetListener.ts +0 -30
  161. package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
  162. package/src/@parsers/@text/GetXML.ts +0 -61
  163. package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
  164. package/src/@tasks/TaskGenerateAudio.ts +0 -34
@@ -0,0 +1,53 @@
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 { NormalizePolygon } from "@Image/modules/NormalizePolygon"
21
+
22
+ interface GenerateEventPolygonsOptions {
23
+ Polygons: GeoJSON.Polygon | GeoJSON.MultiPolygon | null
24
+ IPath: (feature: GeoJSON.Feature) => string | null
25
+ Map: boolean
26
+ Settings: {
27
+ BorderColor: string
28
+ BorderWidth: number
29
+ FillColor: string
30
+ FillOpacity: number
31
+ }
32
+ }
33
+
34
+ export const GetSVGPath = ({ Polygons, IPath, Settings, Map }: GenerateEventPolygonsOptions): string => {
35
+ if (!Polygons) return
36
+ const feature: GeoJSON.Feature = {
37
+ type: `Feature`,
38
+ properties: {},
39
+ geometry: !Map ? NormalizePolygon(Polygons) : Polygons,
40
+ };
41
+ const d = IPath(feature);
42
+ if (!d) return ``;
43
+ return `<path
44
+ d="${d}"
45
+ fill="${Settings.FillColor}"
46
+ fill-opacity="${Settings.FillOpacity}"
47
+ fill-rule="evenodd"
48
+ stroke="${Settings.BorderColor}"
49
+ stroke-width="${Settings.BorderWidth}"
50
+ stroke-linejoin="round"
51
+ stroke-linecap="round"
52
+ />`;
53
+ };
@@ -0,0 +1,57 @@
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 { geoArea } from "d3-geo";
21
+
22
+ export const NormalizeD3Polygon = (geometry: GeoJSON.Polygon | GeoJSON.MultiPolygon): GeoJSON.Polygon | GeoJSON.MultiPolygon => {
23
+ const area = geoArea(geometry);
24
+ if (area > 2 * Math.PI) {
25
+ if (geometry.type === `Polygon`) {
26
+ return {
27
+ type: `Polygon`,
28
+ coordinates: geometry.coordinates.map(ring => ring.slice().reverse())
29
+ };
30
+ }
31
+ return {
32
+ type: `MultiPolygon`,
33
+ coordinates: geometry.coordinates.map(polygon => polygon.map(ring => ring.slice().reverse()))
34
+ };
35
+ }
36
+ return geometry;
37
+ };
38
+
39
+ export const NormalizePolygon = (geometry: GeoJSON.Geometry): GeoJSON.Geometry => {
40
+ if (geometry.type !== `Polygon` && geometry.type !== `MultiPolygon`) {
41
+ return geometry;
42
+ }
43
+ const reverseRing = (ring: number[][]) => {
44
+ const reversed = ring.slice().reverse();
45
+ return reversed;
46
+ };
47
+ if (geometry.type === `Polygon`) {
48
+ return {
49
+ type: `Polygon`,
50
+ coordinates: geometry.coordinates.map((ring, index) => index === 0 ? reverseRing(ring) : ring.slice().reverse())
51
+ };
52
+ }
53
+ return {
54
+ type: `MultiPolygon`,
55
+ coordinates: geometry.coordinates.map(polygon => polygon.map((ring, index) => index === 0 ? reverseRing(ring) : ring.slice().reverse()))
56
+ };
57
+ }
@@ -11,14 +11,14 @@
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-lower/Attributes"
21
- import { EnumAWIPS } from "@enums/AWIPS"
20
+ import { TypeAttributes } from "StaticTypes/Attributes"
21
+ import { EnumAWIPS } from "@Enums/AWIPS"
22
22
 
23
23
  interface GetAwipsTypeOptions {
24
24
  Attributes: TypeAttributes
@@ -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 { TypeStanza } from "types-lower/Stanza"
21
- import { TypeStanzaCompiled } from "types/StanzaCompiled"
22
- import { EnumExpressions } from "@enums/Expressions"
23
- import { GetAwipsType } from "@stanza/GetAwipsType"
20
+ import { TypeStanza } from "StaticTypes/Stanza"
21
+ import { TypeStanzaCompiled } from "Types/StanzaCompiled"
22
+ import { EnumExpressions } from "@Enums/Expressions"
23
+ import { GetAwipsType } from "@Stanza/GetAwipsType"
24
24
 
25
25
  interface ValidateStanzaOptions {
26
26
  Stanza: TypeStanza
@@ -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,15 +11,15 @@
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-lower/Event"
20
+ import { TypeEvent } from "StaticTypes/Event"
21
21
 
22
- export const GetEmebedText = (event: TypeEvent): string => {
22
+ export const GetEmbededText = (event: TypeEvent): string => {
23
23
  const line = (label: string, value: unknown, condition = true) => condition && value ? `${label} ${value}` : null;
24
24
  const isStatement = event.properties.status_metadata.is_statement;
25
25
  const isExpired = event.properties.status_metadata.is_expired;
@@ -32,6 +32,7 @@ export const GetEmebedText = (event: TypeEvent): string => {
32
32
  line(`**Tornado Threat:**`, event?.properties?.parameters?.tornado_threat, !isExpired),
33
33
  line(`**Wind Gusts:**`, `${event?.properties?.parameters?.estimated_wind_gusts} ${event?.properties?.parameters?.wind_threat ? ` (${event?.properties?.parameters?.wind_threat})` : ''}`, !isExpired && event?.properties?.parameters?.estimated_wind_gusts != null),
34
34
  line(`**Hail Size:**`, `${event?.properties?.parameters?.estimated_hail_size} ${event?.properties?.parameters?.hail_threat ? ` (${event?.properties?.parameters?.hail_threat})` : ''}`, !isExpired && event?.properties?.parameters?.estimated_hail_size != null),
35
+ line(`**Direction:**`, event?.properties?.parameters?.direction, !isExpired && event?.properties?.parameters?.direction != null),
35
36
  line(`**Discussion:**`, event?.properties?.discussion_parameters?.discussion_number, !isExpired),
36
37
  line(`**Concern:**`, event?.properties?.discussion_parameters?.discussion_concerning, !isExpired),
37
38
  line(`**SPC Max Tornado Threat:**`, event?.properties?.discussion_parameters?.discussion_max_tornado, !isExpired),
@@ -50,6 +51,7 @@ export const GetEmebedText = (event: TypeEvent): string => {
50
51
  line(`**Max Tops (x100 feet):**`, event?.properties?.watch_parameters?.max_tops_x100feet, !isExpired),
51
52
  line(`**Tags:**`, event?.properties?.parameters?.tags?.length > 0 ? event?.properties?.parameters?.tags.join(', ') : null, !isExpired),
52
53
  line(`**Sender:**`, event?.properties?.geocode?.office?.name ? `${event?.properties?.geocode?.office?.name} (${event?.properties?.geocode?.office?.office})` : event?.properties?.geocode?.office?.office),
54
+ line(`**Population:**`, event?.properties?.geocode?.census?.population, !isExpired),
53
55
  line(`**Tracking:**`, event?.properties?.metadata?.tracking),
54
56
  line(`**Logs:**`, event?.properties?.metadata?.history?.length > 0 ? event?.properties?.metadata?.history.length : null),
55
57
  ].filter(Boolean).join('\n');
@@ -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,19 +11,17 @@
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-lower/Event"
21
- import { TypeSettings } from "types/Settings"
22
- import { Bootstrap } from "@bootstrap"
20
+ import { TypeEvent } from "StaticTypes/Event"
21
+ import { Bootstrap } from "@Bootstrap"
23
22
 
24
23
  export const GetStringText = (event: TypeEvent): string => {
25
- const settings = Bootstrap.Settings as TypeSettings;
26
- const timezone = settings.NotifyServer.Timezone ?? `UTC`;
24
+ const timezone = Bootstrap.Settings.Timezone ?? `UTC`;
27
25
  const line = (label: string, value: unknown, condition = true) => condition && value ? `${label} ${value}` : null;
28
26
  const isStatement = event.properties.status_metadata.is_statement;
29
27
  const isExpired = event.properties.status_metadata.is_expired;
@@ -36,6 +34,7 @@ export const GetStringText = (event: TypeEvent): string => {
36
34
  line(`Tornado Threat:`, event?.properties?.parameters?.tornado_threat, !isExpired),
37
35
  line(`Wind Gusts:`, `${event?.properties?.parameters?.estimated_wind_gusts} ${event?.properties?.parameters?.wind_threat ? ` (${event?.properties?.parameters?.wind_threat})` : ''}`, !isExpired && event?.properties?.parameters?.estimated_wind_gusts != null),
38
36
  line(`Hail Size:`, `${event?.properties?.parameters?.estimated_hail_size} ${event?.properties?.parameters?.hail_threat ? ` (${event?.properties?.parameters?.hail_threat})` : ''}`, !isExpired && event?.properties?.parameters?.estimated_hail_size != null),
37
+ line(`Direction:`, event?.properties?.parameters?.direction, !isExpired && event?.properties?.parameters?.direction != null),
39
38
  line(`Discussion:`, event?.properties?.discussion_parameters?.discussion_number, !isExpired),
40
39
  line(`Concern:`, event?.properties?.discussion_parameters?.discussion_concerning, !isExpired),
41
40
  line(`SPC Max Tornado Threat:`, event?.properties?.discussion_parameters?.discussion_max_tornado, !isExpired),
@@ -53,6 +52,7 @@ export const GetStringText = (event: TypeEvent): string => {
53
52
  line(`Max Surface Wind:`, event?.properties?.watch_parameters?.max_wind_surface, !isExpired),
54
53
  line(`Max Tops (x100 feet):`, event?.properties?.watch_parameters?.max_tops_x100feet, !isExpired),
55
54
  line(`Sender:`, event?.properties?.geocode?.office?.name ? `${event?.properties?.geocode?.office?.name} (${event?.properties?.geocode?.office?.office})` : event?.properties?.geocode?.office?.office),
55
+ line(`Population:`, event?.properties?.geocode?.census?.population, !isExpired),
56
56
  line(`Tracking:`, event?.properties?.metadata?.tracking),
57
57
  ].filter(Boolean).join('\n');
58
58
  }
@@ -0,0 +1,36 @@
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 { union } from "polygon-clipping";
21
+
22
+ interface GetUnionPolygonOptions {
23
+ Polygons: number[][][][] | null;
24
+ }
25
+
26
+ export const GetUnionPolygon = ({ Polygons }: GetUnionPolygonOptions): GeoJSON.MultiPolygon | null => {
27
+ if (!Polygons || Polygons.length === 0) {
28
+ return null;
29
+ }
30
+ const unionFn = union as unknown as (...polygons: number[][][][]) => number[][][][];
31
+ const unioned = unionFn(...Polygons)
32
+ return {
33
+ type: `MultiPolygon`,
34
+ coordinates: unioned
35
+ }
36
+ };
@@ -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
  export type QueueTask = () => Promise<void>;
@@ -11,20 +11,20 @@
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
20
 
21
- import { TypeSettings } from "types/Settings"
22
- import { ReconnectXMPP } from "@xmpp/ReconnectXMPP"
23
- import { Bootstrap } from "@bootstrap"
24
- import { CreateHttp } from "@utilities/CreateHttp"
25
- import { SetEventEmit } from "@utilities/SetEventEmit"
26
- import { CreateEvent } from "@building/CreateEvent"
27
- import { readdirSync, unlinkSync, statSync, existsSync } from "fs"
21
+ import { TypeSettings } from "Types/Settings"
22
+ import { ReconnectXMPP } from "@XMPP/ReconnectXMPP"
23
+ import { Bootstrap } from "@Bootstrap"
24
+ import { CreateHttp } from "@Utilities/CreateHttp"
25
+ import { SetEventEmit } from "@Utilities/SetEventEmit"
26
+ import { CreateEvent } from "@Building/CreateEvent"
27
+ import { readdirSync, unlinkSync, statSync, rmdirSync, existsSync } from "fs"
28
28
  import { join } from "path"
29
29
 
30
30
  export const SetCronSchedule = async (): Promise<void> => {
@@ -33,26 +33,38 @@ export const SetCronSchedule = async (): Promise<void> => {
33
33
  const TTL = settings.GlobalSettings.ArchiveSettings.TTL
34
34
  const TTLCUT = Date.now() - TTL * 1000;
35
35
 
36
- const walk = (dir: string): void => {
37
- if (existsSync(dir)) {
38
- const entries = readdirSync(dir, { withFileTypes: true });
39
- for (const entry of entries) {
40
- const fullPath = join(dir, entry.name);
41
- if (entry.isDirectory()) { walk(fullPath); continue; }
42
- const stats = statSync(fullPath);
43
- if (stats.mtime.getTime() < TTLCUT) {
44
- try {
45
- unlinkSync(fullPath);
46
- } catch (err) {
47
- console.error(`Failed to delete ${fullPath}:`, err);
48
- }
36
+ const walk = (dir: string, deleteFolder = false): void => {
37
+ if (!existsSync(dir)) return;
38
+ const entries = readdirSync(dir, { withFileTypes: true });
39
+ for (const entry of entries) {
40
+ const fullPath = join(dir, entry.name);
41
+ if (entry.isDirectory()) {
42
+ walk(fullPath, deleteFolder);
43
+ continue;
44
+ }
45
+ const stats = statSync(fullPath);
46
+ if (stats.mtime.getTime() < TTLCUT) {
47
+ try {
48
+ unlinkSync(fullPath);
49
+ } catch (err) {
50
+ console.error(`Failed to delete ${fullPath}:`, err);
51
+ }
52
+ }
53
+ }
54
+ if (deleteFolder) {
55
+ try {
56
+ if (readdirSync(dir).length === 0 && statSync(dir).mtime.getTime() < TTLCUT) {
57
+ rmdirSync(dir);
49
58
  }
59
+ } catch (err) {
60
+ console.error(`Failed to delete directory ${dir}:`, err);
50
61
  }
51
62
  }
52
63
  };
53
- walk(settings.GlobalSettings.ArchiveSettings.TextDirectory)
54
- walk(settings.GlobalSettings.ArchiveSettings.EasDirectory)
55
- walk(settings.GlobalSettings.ArchiveSettings.JSONDirectory)
64
+ walk(settings.GlobalSettings.ArchiveSettings.TextDirectory, true)
65
+ walk(settings.GlobalSettings.ArchiveSettings.AudioDirectory, true)
66
+ walk(settings.GlobalSettings.ArchiveSettings.JSONDirectory, true)
67
+ walk(settings.GlobalSettings.ArchiveSettings.ImageDirectory, true)
56
68
 
57
69
 
58
70
 
@@ -11,14 +11,14 @@
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 { Bootstrap } from "@bootstrap"
20
+ import { TypeSettings } from "Types/Settings"
21
+ import { Bootstrap } from "@Bootstrap"
22
22
 
23
23
  interface SetDebugOptions {
24
24
  Title?: string
@@ -11,24 +11,25 @@
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 { Bootstrap } from "@bootstrap"
21
- import { SetTimeoutAction } from "@utilities/SetTimeoutAction"
22
- import { SetWarning } from "@utilities/SetWarning"
20
+ import { Bootstrap } from "@Bootstrap"
21
+ import { SetTimeoutAction } from "@Utilities/SetTimeoutAction"
22
+ import { SetWarning } from "@Utilities/SetWarning"
23
23
 
24
24
  interface SetEventEmitOptions {
25
25
  Event: string
26
26
  Metadata: any
27
27
  Message?: string
28
28
  Limited?: boolean
29
+ Tree?: string[]
29
30
  }
30
31
 
31
- export const SetEventEmit = ({ Event, Metadata, Message, Limited }: SetEventEmitOptions): void => {
32
+ export const SetEventEmit = ({ Event, Metadata, Message, Limited, Tree }: SetEventEmitOptions): void => {
32
33
  if (Limited) {
33
34
  const isTimeout = SetTimeoutAction({ Identifier: `event.${Event}`, AddTime: true, Max: 1, Interval: 1 })
34
35
  if (isTimeout.Limited) return;
@@ -36,6 +37,6 @@ export const SetEventEmit = ({ Event, Metadata, Message, Limited }: SetEventEmit
36
37
  Bootstrap.Listener.emit(Event, Metadata)
37
38
  if (Event != `log`) { Bootstrap.Listener.emit(`*`, {event: Event, data: Metadata}) }
38
39
  if (Message) {
39
- SetWarning({ Message: Message })
40
+ SetWarning({ Message: Message, Tree: Tree })
40
41
  }
41
42
  }
@@ -11,14 +11,14 @@
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 { Bootstrap } from "@bootstrap"
20
+ import { TypeSettings } from "Types/Settings"
21
+ import { Bootstrap } from "@Bootstrap"
22
22
 
23
23
  export const SetSettings = (imported: TypeSettings): TypeSettings => {
24
24
  const settings = Bootstrap.Settings as Record<string, unknown>;
@@ -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,13 @@
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 { Bootstrap } from "@bootstrap"
20
+ import { Bootstrap } from "@Bootstrap"
21
21
 
22
22
  interface SetTimeoutActionOptions {
23
23
  Identifier: string
@@ -0,0 +1,47 @@
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 { Bootstrap } from "@Bootstrap"
21
+ import { TypeSettings } from "Types/Settings"
22
+
23
+ interface SetWarningOptions {
24
+ Title?: string
25
+ Message: string
26
+ Tree?: string[]
27
+ }
28
+
29
+ export const SetWarning = ({ Title, Message, Tree }: SetWarningOptions): void => {
30
+ const settings = Bootstrap.Settings as TypeSettings;
31
+ const title = Title ?? (`[${Bootstrap.Colors.Yellow}@atmosx/event-product-parser${Bootstrap.Colors.Reset}]`);
32
+ const log = (message: string): void => {
33
+ Bootstrap.Listener.emit(`log`, message);
34
+ if (settings.EnableJournal) { console.log(message); }
35
+ };
36
+ log(`${title} ${Message}`);
37
+
38
+ if (!Tree?.length) return;
39
+
40
+ const cleanTitle = title.replace(/\x1b\[[0-9;]*m/g, ``);
41
+ const padding = ` `.repeat(cleanTitle.length + 1);
42
+ const entries = Tree.filter((entry): entry is NonNullable<typeof entry> => entry !== undefined && entry !== null);
43
+ entries.forEach((entry, index) => {
44
+ const prefix = index === entries.length - 1 ? `└─` : `├─`;
45
+ log(`${padding}${prefix} ${entry}`);
46
+ });
47
+ };
@@ -11,20 +11,20 @@
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 { Bootstrap } from "@bootstrap"
22
- import { OnlineXMPP } from "@xmpp/OnlineXMPP"
23
- import { OfflineXMPP } from "@xmpp/OfflineXMPP"
24
- import { ErrorXMPP } from "@xmpp/ErrorXMPP"
25
- import { StanzaXMPP } from "@xmpp/StanzaXMPP"
26
- import { SetEventEmit } from "@utilities/SetEventEmit"
27
- import { client } from "@xmpp/client"
20
+ import { TypeSettings } from "Types/Settings"
21
+ import { Bootstrap } from "@Bootstrap"
22
+ import { OnlineXMPP } from "@XMPP/OnlineXMPP"
23
+ import { OfflineXMPP } from "@XMPP/OfflineXMPP"
24
+ import { ErrorXMPP } from "@XMPP/ErrorXMPP"
25
+ import { StanzaXMPP } from "@XMPP/StanzaXMPP"
26
+ import { SetEventEmit } from "@Utilities/SetEventEmit"
27
+ import { client } from "@XMPP/client"
28
28
 
29
29
  export const DeployXMPP = async (): Promise<void> => {
30
30
  let session;
@@ -34,8 +34,8 @@ export const DeployXMPP = async (): Promise<void> => {
34
34
  session = Bootstrap.Session = client({
35
35
  service: 'xmpp://nwws-oi.weather.gov',
36
36
  domain: 'nwws-oi.weather.gov',
37
- username: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username,
38
- password: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Password
37
+ username: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username as string,
38
+ password: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Password as string
39
39
  })
40
40
  try {
41
41
  await OfflineXMPP();