@atmosx/event-product-parser 3.0.62 → 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 (179) 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 +10 -8
  5. package/dist/cjs/index.cjs +24482 -7207
  6. package/dist/esm/index.mjs +24275 -7003
  7. package/package.json +56 -47
  8. package/pnpm-workspace.yaml +4 -0
  9. package/src/bootstrap.ts +65 -48
  10. package/src/{@building → building}/CreateEvent.ts +22 -24
  11. package/src/{@building → building}/GetCleanedEvent.ts +2 -2
  12. package/src/{@building → building}/GetEventAttachments.ts +14 -12
  13. package/src/building/GetEventDirection.ts +28 -0
  14. package/src/{@building → building}/GetEventEnhancedName.ts +5 -8
  15. package/src/{@building → building}/GetEventGeometry.ts +19 -13
  16. package/src/{@building → building}/GetEventHeader.ts +13 -13
  17. package/src/{@building → building}/GetEventNodes.ts +22 -20
  18. package/src/{@building → building}/GetEventOffice.ts +13 -13
  19. package/src/building/GetEventPopulation.ts +58 -0
  20. package/src/building/GetEventProperties.ts +106 -0
  21. package/src/{@building → building}/GetEventSignature.ts +9 -9
  22. package/src/{@building → building}/GetEventTags.ts +3 -3
  23. package/src/building/GetEventTheme.ts +26 -0
  24. package/src/building/GetEventTracking.ts +64 -0
  25. package/src/components/audio/GenerateAudioMessage.ts +149 -0
  26. package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
  27. package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
  28. package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
  29. package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +13 -8
  30. package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
  31. package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +14 -8
  32. package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +17 -10
  33. package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +7 -7
  34. package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +13 -8
  35. package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
  36. package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +11 -6
  37. package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +12 -7
  38. package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +12 -7
  39. package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +22 -14
  40. package/src/{@modules/@utilities/SetWarning.ts → components/database/CreateQuery.ts} +18 -13
  41. package/src/{@modules/@database → components/database}/GetCachedEvents.ts +18 -15
  42. package/src/components/database/ImportBoundaries.ts +168 -0
  43. package/src/{@modules/@database → components/database}/ImportBroadcastify.ts +14 -24
  44. package/src/components/database/ImportCities.ts +87 -0
  45. package/src/{@modules/@database → components/database}/ImportShapefiles.ts +23 -26
  46. package/src/{@modules/@database → components/database}/ImportStanza.ts +15 -19
  47. package/src/components/database/InitializeDatabase.ts +71 -0
  48. package/src/components/images/GenerateGraphic.ts +242 -0
  49. package/src/components/images/components/CreateRectangle.ts +22 -0
  50. package/src/components/images/components/CreateText.ts +22 -0
  51. package/src/components/images/modules/CreateSVG.ts +37 -0
  52. package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
  53. package/src/components/images/modules/GetGeographicalCities.ts +58 -0
  54. package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
  55. package/src/components/images/modules/GetGeometryBounds.ts +82 -0
  56. package/src/components/images/modules/GetParsedBoundary.ts +58 -0
  57. package/src/components/images/modules/GetSVGPath.ts +53 -0
  58. package/src/components/images/modules/NormalizePolygon.ts +57 -0
  59. package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +16 -17
  60. package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +27 -15
  61. package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +26 -26
  62. package/src/{@parsers/@text → components/utilities}/GetEmbededText.ts +8 -6
  63. package/src/{@modules/@utilities → components/utilities}/GetFormattedTime.ts +2 -2
  64. package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
  65. package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
  66. package/src/{@modules/@utilities → components/utilities}/GetShapeNearestPoint.ts +24 -19
  67. package/src/{@parsers/@text → components/utilities}/GetStringText.ts +9 -9
  68. package/src/components/utilities/GetUnionPolygon.ts +36 -0
  69. package/src/components/utilities/QueueManager.ts +70 -0
  70. package/src/components/utilities/SetCronSchedule.ts +106 -0
  71. package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +12 -12
  72. package/src/components/utilities/SetEventEmit.ts +42 -0
  73. package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +7 -7
  74. package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +5 -5
  75. package/src/components/utilities/SetTimeoutAction.ts +64 -0
  76. package/src/components/utilities/SetWarning.ts +47 -0
  77. package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +20 -20
  78. package/src/{@core/CreateListener.ts → components/xmpp/ErrorXMPP.ts} +8 -5
  79. package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +13 -13
  80. package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +18 -18
  81. package/src/components/xmpp/ReconnectXMPP.ts +64 -0
  82. package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +25 -25
  83. package/src/{@core → core}/ClearEvents.ts +9 -9
  84. package/src/{@core → core}/GetEvents.ts +4 -4
  85. package/src/{@core → core}/GetNodes.ts +4 -4
  86. package/src/{@core → core}/GetRandomEvent.ts +4 -4
  87. package/src/{@core → core}/GetVersion.ts +4 -4
  88. package/src/{@core → core}/ManualEvent.ts +23 -24
  89. package/src/{@core → core}/QueryStanza.ts +12 -11
  90. package/src/core/SetNode.ts +87 -0
  91. package/src/{@core → core}/StartService.ts +21 -20
  92. package/src/{@core → core}/StopService.ts +10 -10
  93. package/src/{@enums → enums}/AWIPS.ts +2 -2
  94. package/src/{@enums → enums}/Actions.ts +2 -2
  95. package/src/{@enums → enums}/Cancellation.ts +2 -2
  96. package/src/{@enums → enums}/Causes.ts +2 -2
  97. package/src/{@enums → enums}/Correlations.ts +2 -2
  98. package/src/{@enums → enums}/Enhanced.ts +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 +38 -37
  119. package/src/index.ts +57 -37
  120. package/src/{@manager → manager}/MakeEvents.ts +38 -47
  121. package/src/manager/RemoveEvent.ts +74 -0
  122. package/src/{@manager → manager}/SetHash.ts +18 -13
  123. package/src/{@manager → manager}/UpdateEvents.ts +12 -12
  124. package/src/{@manager → manager}/UpdateNode.ts +14 -14
  125. package/src/{@manager → manager}/ValidateEvents.ts +55 -45
  126. package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +11 -11
  127. package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
  128. package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
  129. package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +12 -12
  130. package/src/parsers/ugc/GetCache.ts +24 -0
  131. package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
  132. package/src/{@parsers/@ugc/GetUGCHeader.ts → parsers/ugc/GetHeader.ts} +4 -4
  133. package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +10 -10
  134. package/src/parsers/ugc/GetZonePolygon.ts +73 -0
  135. package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +3 -3
  136. package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +13 -8
  137. package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +14 -14
  138. package/src/{@parsers/@pvtec → parsers/vtec}/GetExpiry.ts +2 -2
  139. package/src/parsers/vtec/VTECExtract.ts +49 -0
  140. package/src/{@types → static}/Attributes.ts +2 -3
  141. package/src/{@types → static}/Event.ts +8 -7
  142. package/src/{@types → static}/Properties.ts +17 -3
  143. package/src/{@types → static}/Stanza.ts +2 -2
  144. package/src/tasks/CreateTasks.ts +116 -0
  145. package/src/tasks/TaskGenerateJSON.ts +34 -0
  146. package/src/tasks/TaskGenerateText.ts +34 -0
  147. package/src/tasks/TaskSendNTFY.ts +95 -0
  148. package/src/tasks/TaskSendWebhook.ts +107 -0
  149. package/src/{@types → types}/Actions.ts +3 -3
  150. package/src/{@types → types}/HVTEC.ts +6 -6
  151. package/src/{@types → types}/Hash.ts +5 -5
  152. package/src/types/Nodes.ts +29 -0
  153. package/src/{@types → types}/Settings.ts +17 -8
  154. package/src/{@types → types}/StanzaCompiled.ts +15 -15
  155. package/src/{@types → types}/UGC.ts +5 -5
  156. package/src/{@modules/@utilities/GetSettings.ts → types/VTEC.ts} +12 -7
  157. package/tools/build.js +47 -0
  158. package/tsconfig.json +28 -1
  159. package/src/@building/GetEventProperties.ts +0 -96
  160. package/src/@building/GetEventTracking.ts +0 -68
  161. package/src/@core/SetNode.ts +0 -81
  162. package/src/@events/ParseAPI.ts +0 -117
  163. package/src/@manager/RemoveEvent.ts +0 -70
  164. package/src/@manager/Tasks.ts +0 -246
  165. package/src/@modules/@database/InitializeDatabase.ts +0 -59
  166. package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
  167. package/src/@modules/@utilities/SetCronSchedule.ts +0 -94
  168. package/src/@modules/@utilities/SetEventEmit.ts +0 -41
  169. package/src/@modules/@utilities/SetListener.ts +0 -30
  170. package/src/@modules/@utilities/SetTimeoutAction.ts +0 -64
  171. package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
  172. package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
  173. package/src/@parsers/@pvtec/VTECExtract.ts +0 -49
  174. package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
  175. package/src/@parsers/@text/GetXML.ts +0 -61
  176. package/src/@parsers/@ugc/GetCache.ts +0 -24
  177. package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
  178. package/src/@types/VTEC.ts +0 -30
  179. package/tsup.config.ts +0 -16
@@ -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
 
@@ -32,6 +32,6 @@ export type TypeActions = {
32
32
  Priority?: string | number
33
33
  }
34
34
  Uploads?: {
35
- TEXT?: boolean, EAS?: boolean, JSON?: boolean
35
+ TEXT?: boolean, AUDIO?: boolean, JSON?: boolean, IMAGE?: boolean
36
36
  }
37
37
  }
@@ -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
20
  export type TypeHVTEC = {
21
- hvtec: string
22
- severity: string
23
- cause: string
24
- record: string
21
+ HVTEC: string
22
+ Severity: string
23
+ Cause: string
24
+ Record: string
25
25
  }
@@ -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
20
  export type TypeHash = {
21
- tracking: string
22
- hashes: string[]
23
- expires: string
21
+ Tracking: string
22
+ Hashes: string[]
23
+ Expires: string
24
24
  }
@@ -0,0 +1,29 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Independent Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeNode = {
21
+ type: string
22
+ geometry: {
23
+ type: string
24
+ coordinates: number[]
25
+ }
26
+ properties: {
27
+ identifier: string
28
+ }
29
+ }
@@ -11,18 +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 { TypeActions } from "./Actions"
20
+ import { TypeActions } from "Types/Actions"
21
21
 
22
22
  type TypeTimezones = string | "CST" | "CDT" | "MDT" | "MST" | "EST" | "EDT" | "HST" | "HDT" | "PDT" | "UTC"
23
23
 
24
24
  export type TypeSettings = {
25
+ Timezone?: TypeTimezones
25
26
  Database: string
27
+ DebugDisableAllEvents: boolean
26
28
  EnableWireService: boolean
27
29
  EnableJournal: boolean
28
30
  EnableDebugging: boolean
@@ -56,14 +58,18 @@ export type TypeSettings = {
56
58
  BroadcastifyDatabase: string
57
59
  BroadcastifyTags: string[]
58
60
  },
61
+ BoundarySettings: {
62
+ BoundaryDatabase: string
63
+ CityDatabase: string
64
+ },
59
65
  NotifyServer: {
60
66
  Enabled: boolean
61
67
  Server: string
62
- Timezone?: TypeTimezones
63
68
  MediaStorage: {
64
69
  TEXT?: string
65
70
  JSON?: string
66
- EAS?: string
71
+ AUDIO?: string
72
+ IMAGE?: string
67
73
  }
68
74
  Credentials?: {
69
75
  Username: string | void
@@ -76,7 +82,7 @@ export type TypeSettings = {
76
82
  DisableGeometryParsing: boolean
77
83
  UseShapefileCoordinates: boolean
78
84
  SPCWatchesOnly: boolean
79
- ShapefileSkipPoints: number
85
+ CensusPopulationData: boolean
80
86
  NodeTTL: number
81
87
  NodeMaxDistance: number
82
88
  EventFiltering: {
@@ -89,12 +95,15 @@ export type TypeSettings = {
89
95
  NodeLocationFiltering: boolean
90
96
  IgnoreTestProducts: boolean
91
97
  },
98
+ Themes: { Event: string, RGB: string }[]
92
99
  ArchiveSettings: {
93
100
  TTL: number
101
+ ImageDirectory: string
94
102
  JSONDirectory: string
95
103
  TextDirectory: string
96
- EasDirectory: string
97
- EasToneout: string
104
+ AudioDirectory: string
105
+ Logo: string
106
+ AudioToneout: string
98
107
  }
99
108
  }
100
109
  }
@@ -11,26 +11,26 @@
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 "./Attributes"
20
+ import { TypeAttributes } from "StaticTypes/Attributes"
21
21
 
22
22
  export type TypeStanzaCompiled = {
23
- message?: string
24
- attributes?: TypeAttributes
25
- isCapEvent?: boolean
26
- isVTEC?: boolean
27
- isUGC?: boolean
28
- isCapAreaDescription?: boolean
29
- isIgnored?: boolean
30
- isNWWS?: boolean
31
- getType?: {
32
- type: string
33
- prefix: string
34
- discovered: boolean
23
+ Message?: string
24
+ Attributes?: TypeAttributes
25
+ CapEvent?: boolean
26
+ VTEC?: boolean
27
+ UGC?: boolean
28
+ CapAreaDescription?: boolean
29
+ Ignored?: boolean
30
+ NWWS?: boolean
31
+ Type?: {
32
+ Type: string
33
+ Prefix: string
34
+ Discovered: boolean
35
35
  }
36
36
  }
@@ -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
20
  export type TypeUGC = {
21
- zones: string[]
22
- locations: string[]
23
- expires: string
21
+ Zones: string[]
22
+ Locations: string[]
23
+ Expires: string
24
24
  }
@@ -11,15 +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
-
23
- export const GetSettings = (): TypeSettings => {
24
- return bootstrap.settings;
20
+ export type TypeVTEC = {
21
+ Raw: string
22
+ ProductType: string
23
+ Tracking: string
24
+ Event: string
25
+ Status: string
26
+ WMO: string
27
+ Expires: string
28
+ Watch: boolean
29
+ PredictionCenter: boolean
25
30
  }
package/tools/build.js ADDED
@@ -0,0 +1,47 @@
1
+ const { spawn } = require("child_process");
2
+ const watch = process.argv.includes("--watch");
3
+
4
+ const commands = [
5
+ {
6
+ name: "esm",
7
+ args: [
8
+ "--bundle",
9
+ "--platform=node",
10
+ "--target=node22",
11
+ "--format=esm",
12
+ "--external:better-sqlite3",
13
+ "--external:sharp",
14
+ "--out-extension:.js=.mjs",
15
+ "--outdir=dist/esm",
16
+ ...(watch ? ["--watch"] : []),
17
+ "./src/index.ts",
18
+ ],
19
+ },
20
+ {
21
+ name: "cjs",
22
+ args: [
23
+ "--bundle",
24
+ "--platform=node",
25
+ "--target=node22",
26
+ "--format=cjs",
27
+ "--external:better-sqlite3",
28
+ "--external:sharp",
29
+ "--out-extension:.js=.cjs",
30
+ "--outdir=dist/cjs",
31
+ ...(watch ? ["--watch"] : []),
32
+ "./src/index.ts",
33
+ ],
34
+ },
35
+ ];
36
+
37
+ function runBuild({ name, args }) {
38
+ return new Promise((resolve, reject) => {
39
+ const proc = spawn("esbuild", args, {
40
+ shell: true,
41
+ stdio: "inherit",
42
+ });
43
+ proc.on("error", reject);
44
+ });
45
+ }
46
+
47
+ Promise.all(commands.map(runBuild)).catch((err) => { console.error(err); process.exit(1); });
package/tsconfig.json CHANGED
@@ -8,7 +8,34 @@
8
8
  "declarationDir": "dist/types",
9
9
  "esModuleInterop": true,
10
10
  "allowSyntheticDefaultImports": true,
11
- "skipLibCheck": true
11
+ "skipLibCheck": true,
12
+ "strict": true,
13
+ "strictNullChecks": false, // Note: I use optional changing and heavily rely on `null` and `undefined` values in the codebase. Please do not set this to true unless you want the compiler to throw a fucking temper tantrum every time you try to access a property of an object that may or may not be null or undefined. I have better things to do than to deal with that nonsense.
14
+ "noImplicitAny": true,
15
+ "paths": {
16
+ "@ParsingHVTEC/*": ["./src/parsers/hvtec/*"],
17
+ "@ParsingVTEC/*": ["./src/parsers/vtec/*"],
18
+ "@ParsingUGC/*": ["./src/parsers/ugc/*"],
19
+ "@ParsingText/*": ["./src/parsers/text/*"],
20
+ "@Database/*": ["./src/components/database/*"],
21
+ "@Audio/*": ["./src/components/audio/*"],
22
+ "@AudioComponents/*": ["./src/components/audio/components/*"],
23
+ "@Image/*": ["./src/components/images/*"],
24
+ "@ImageModules/*": ["./src/components/images/modules/*"],
25
+ "@ImageComponents/*": ["./src/components/images/components/*"],
26
+ "@Stanza/*": ["./src/components/stanza/*"],
27
+ "@Utilities/*": ["./src/components/utilities/*"],
28
+ "@XMPP/*": ["./src/components/xmpp/*"],
29
+ "@Manager/*": ["./src/manager/*"],
30
+ "@Tasks/*": ["./src/tasks/*"],
31
+ "@Events/*": ["./src/events/*"],
32
+ "@Enums/*": ["./src/enums/*"],
33
+ "@Core/*": ["./src/core/*"],
34
+ "@Building/*": ["./src/building/*"],
35
+ "Types/*": ["./src/types/*"],
36
+ "StaticTypes/*": ["./src/static/*"],
37
+ "@Bootstrap": ["./src/bootstrap.ts"],
38
+ }
12
39
  },
13
40
  "include": ["src"]
14
41
  }
@@ -1,96 +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/Properties";
21
- import { TypeAttributes } from "../@types/Attributes";
22
- import { TypeUGC } from "../@types/UGC";
23
- import { TypePVTEC } from "../@types/VTEC";
24
- import { TypeHVTEC } from "../@types/HVTEC";
25
- import { EnumExpressions } from "../@enums/Expressions";
26
- import { GetDescriptionFromProduct } from "../@parsers/@text/GetDescriptionFromProduct";
27
- import { getPolygonFromProduct } from "../@parsers/@text/GetPolygonFromProduct";
28
- import { GetTextFromProduct } from "../@parsers/@text/GetTextFromProduct";
29
- import { GetEventOffice } from "./GetEventOffice";
30
- import { GetEventTags } from "./GetEventTags";
31
-
32
- interface GetEventPropertiesOptions {
33
- message: string
34
- attributes: TypeAttributes
35
- ugc?: TypeUGC
36
- pVtec?: TypePVTEC
37
- hVtec?: TypeHVTEC
38
- }
39
-
40
- export const GetEventProperties = (options: GetEventPropertiesOptions): TypeEventProperties => {
41
- const organization = options.message.match(EnumExpressions.wmo)?.[0] ?? null
42
- const polygons = getPolygonFromProduct(options.message)
43
- const properties = {
44
- locations: options?.ugc?.locations?.join(`; `) ?? null,
45
- locations_array: options?.ugc?.locations ?? [],
46
- description: GetDescriptionFromProduct({ message: options.message, handle: options?.pVtec?.vtec ?? null }),
47
- attributes: options.attributes,
48
- geocode: {
49
- office: GetEventOffice({ attributes: options.attributes, organization: organization, pVtec: options.pVtec }),
50
- organization: organization,
51
- ugc: options?.ugc?.zones ?? [],
52
- polygon: polygons.length > 0 ? Buffer.from(JSON.stringify([polygons])).toString('base64') : null,
53
- polygon_generated: polygons.length > 0 ? true : false
54
- },
55
- parameters: {
56
- tags: GetEventTags(options.message),
57
- instructions: GetTextFromProduct({ message: options.message, find: [`For your protection`, `do not`, `use extreme caution`], append: `...`, removal: [`.`]}) ?? null,
58
- source: GetTextFromProduct({ message: options.message, find: [`SOURCE...`], removal: [`.`]}) ?? null,
59
- hazards: GetTextFromProduct({ message: options.message, find: [`HAZARD...`], removal: [`.`]}) ?? null,
60
- impacts: GetTextFromProduct({ message: options.message, find: [`IMPACT...`], removal: [`.`]}) ?? null,
61
- estimated_hail_size: GetTextFromProduct({ message: options.message, find: [`MAX HAIL SIZE...`, `HAIL...`], removal: ['in']}) ?? null,
62
- estimated_wind_gusts: GetTextFromProduct({ message: options.message, find: [`MAX WIND GUST...`, `WIND...`]}) ?? null,
63
- damage_threat: GetTextFromProduct({ message: options.message, find: [`DAMAGE THREAT...`], removal: []}) ?? null,
64
- tornado_threat: GetTextFromProduct({ message: options.message, find: [`TORNADO...`, `WATERSPOUT...`] }) ?? null,
65
- flood_threat: GetTextFromProduct({ message: options.message, find: [`FLASH FLOOD...`]}) ?? null,
66
- wind_threat: GetTextFromProduct({ message: options.message, find: [`WIND THREAT...`]}) ?? null,
67
- hail_threat: GetTextFromProduct({ message: options.message, find: [`HAIL THREAT...`], removal: []}) ?? null,
68
- },
69
- discussion_parameters: {
70
- discussion_number: GetTextFromProduct({ message: options.message, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })?.toString()?.padStart(4, "0") ?? null,
71
- discussion_concerning: GetTextFromProduct({ message: options.message, find: [`Concerning...`] }) ?? null,
72
- discussion_max_tornado: GetTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] }) ?? null,
73
- discussion_max_hail: GetTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] }) ?? null,
74
- discussion_max_wind: GetTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] }) ?? null,
75
- discussion_watch_issuance: GetTextFromProduct({ message: options.message, find: [`Probability of Watch Issuance...`], removal: [`percent`]}) ?? null,
76
- },
77
- watch_parameters: {
78
- watch_number: options?.pVtec?.is_watch ? ( GetTextFromProduct({ message: options.message, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })?.replace(/(WT|WS|)/g, '')?.trim()?.toString()?.padStart(4, "0") ?? options?.pVtec?.tracking?.slice(-4)?.toString()?.padStart(4, "0") ?? null) : null,
79
- watch_type: options.message.includes(`TORNADO WATCH`) ? `Tornado` : options?.message.includes(`SEVERE`) ? `Severe` : null,
80
- additional_tornadoes_probability: GetTextFromProduct({ message: options.message, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] }) ?? null,
81
- strong_tornadoes_probability: GetTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] }) ?? null,
82
- severe_wind_probability: GetTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] }) ?? null,
83
- severe_hail_probability: GetTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] }) ?? null,
84
- hail_2in_probability: GetTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] }) ?? null,
85
- combined_hail_wind_probability: GetTextFromProduct({ message: options.message, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] }) ?? null,
86
- max_hail_in: GetTextFromProduct({ message: options.message, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] }) ?? null,
87
- max_wind_surface: GetTextFromProduct({ message: options.message, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] }) ?? null,
88
- max_tops_x100feet: GetTextFromProduct({ message: options.message, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] }) ?? null,
89
- pds_watch: (GetTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES` ? true : null)
90
- }
91
- }
92
- if (isNaN(Number(properties.watch_parameters.watch_number))) {
93
- properties.watch_parameters.watch_number = null
94
- }
95
- return properties;
96
- }
@@ -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/Attributes";
21
- import { TypeEventProperties } from "../@types/Properties";
22
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled";
23
- import { TypePVTEC } from "../@types/VTEC";
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 properties = 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 = properties.watch_parameters.watch_number ?? null
44
- if (getWatchNumber) {
45
- return `${properties.geocode.office.office}.${stanza.getType.prefix}.A.${getWatchNumber}`
46
- }
47
- return `${properties.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].vtec : options.vtec?.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] ?? '---';
61
- if (options.organization.featureId) {
62
- const idMatch = options.organization.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
63
- return `${station}.${idMatch?.[0]?.replace(/\./g, '') ?? '---'}`;
64
- }
65
- const id = wmoMatch?.[1] ?? '---';
66
- return `${station}.${id?.replace(/\./g, '') ?? '---'}`;
67
- }
68
- }
@@ -1,81 +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
- import { SetWarning } from "../@modules/@utilities/SetWarning"
22
- import { SetEventEmit } from "../@modules/@utilities/SetEventEmit";
23
-
24
- interface GetNodeOptions {
25
- identifier: string
26
- delete?: boolean
27
- coordinates: { longitude: number; latitude: number }
28
- }
29
-
30
- export const SetNode = (options: GetNodeOptions) => {
31
- const nodes = bootstrap.cache.nodes.features;
32
- const exists = nodes.find((node) => node.properties.identifier === options.identifier);
33
- if (options.delete) {
34
- if (exists) {
35
- const index = nodes.indexOf(exists);
36
- nodes.splice(index, 1);
37
- return SetEventEmit({
38
- event: `onNodeDelete`,
39
- metadata: {
40
- type: `node-delete`,
41
- node: exists
42
- }
43
- })
44
- }
45
- return SetWarning({ message: `Node with identifier '${options.identifier}' not found.` })
46
- }
47
- if (exists) {
48
- const index = nodes.indexOf(exists);
49
- nodes[index] = {
50
- ...exists,
51
- geometry: {
52
- type: "Point",
53
- coordinates: [options.coordinates.longitude, options.coordinates.latitude]
54
- }
55
- };
56
- return SetEventEmit({
57
- event: `onNodeUpdate`,
58
- metadata: {
59
- type: `node-update`,
60
- node: nodes[index]
61
- }
62
- })
63
- }
64
- nodes.push({
65
- type: "Feature",
66
- geometry: {
67
- type: "Point",
68
- coordinates: [options.coordinates.longitude, options.coordinates.latitude]
69
- },
70
- properties: {
71
- identifier: options.identifier
72
- }
73
- });
74
- return SetEventEmit({
75
- event: `onNodeAdd`,
76
- metadata: {
77
- type: `node-add`,
78
- node: nodes[nodes.length - 1]
79
- }
80
- })
81
- }