@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
@@ -11,18 +11,18 @@
11
11
  Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
- Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
  */
19
19
 
20
- import { TypeEvent } from "types-lower/Event"
21
- import { EnumCorrelations } from "@enums/Correlations"
22
- import { EnumCancellation } from "@enums/Cancellation"
23
- import { EnumTesting} from "@enums/Testing"
24
- import { EnumProducts } from "@enums/Products"
25
- import { EnumHail } from "@enums/Hail"
20
+ import { TypeEvent } from "StaticTypes/Event"
21
+ import { EnumCorrelations } from "@Enums/Correlations"
22
+ import { EnumCancellation } from "@Enums/Cancellation"
23
+ import { EnumTesting} from "@Enums/Testing"
24
+ import { EnumProducts } from "@Enums/Products"
25
+ import { EnumHail } from "@Enums/Hail"
26
26
 
27
27
  export const GetEventSignature = (event: TypeEvent): TypeEvent => {
28
28
  const properties = event?.properties;
@@ -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 { EnumTags } from "@enums/Tags"
20
+ import { EnumTags } from "@Enums/Tags"
21
21
 
22
22
  export const GetEventTags = (message: string): string[] => {
23
23
  if (!message) return [];
@@ -11,14 +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 { SetListener } from "@utilities/SetListener"
20
+ import { Bootstrap } from "@Bootstrap";
21
+ import { EnumThemes } from "@Enums/Themes"
22
+ import { GetMatched } from "@Utilities/GetMatched";
21
23
 
22
- export const CreateListener = (event: string, callback: () => void) => {
23
- SetListener({Event: event, Callback: callback})
24
- }
24
+ export const GetEventTheme = (Event: string): string => {
25
+ return Bootstrap.Settings.GlobalSettings.Themes.find(theme => GetMatched({Strings: [theme.Event], String: Event}))?.RGB ?? EnumThemes.find(theme => theme.Event === `Default`)?.RGB ?? `rgb(56, 72, 88)`;
26
+ };
@@ -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 { TypeAttributes } from "types-lower/Attributes"
21
- import { TypeEventProperties } from "types-lower/Properties"
22
- import { TypeStanzaCompiled } from "types/StanzaCompiled"
23
- import { TypeVTEC } from "types/VTEC"
20
+ import { TypeAttributes } from "StaticTypes/Attributes"
21
+ import { TypeEventProperties } from "StaticTypes/Properties"
22
+ import { TypeStanzaCompiled } from "Types/StanzaCompiled"
23
+ import { TypeVTEC } from "Types/VTEC"
24
24
 
25
25
  interface GetTrackingOptions {
26
26
  Type: `RAW` | `VTEC` | `API`
@@ -11,48 +11,47 @@
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 { GetWavPCM16 } from "@eas/GetWavPCM16"
23
- import { GetSampledPCM16 } from "@eas/GetSampledPCM16"
24
- import { SetRadioEffect } from "@eas/SetRadioEffect"
25
- import { SetSameHeader } from "@eas/SetSameHeader"
26
- import { SetAttentionTone } from "@eas/SetAttentionTone"
27
- import { GetMergedPCM16 } from "@eas/GetMergedPCM16"
28
- import { SetNoise } from "@eas/SetNoise"
29
- import { GetPCM16 } from "@eas/GetPCM16"
30
- import { GetTTS } from "@eas/GetTTS"
31
- import { GetCleanDescription } from "@eas/GetCleanDescription"
32
- import { SetWarning } from "@utilities/SetWarning"
33
- import { SetDebug } from "@utilities/SetDebug"
20
+ import { TypeSettings } from "Types/Settings"
21
+ import { Bootstrap } from "@Bootstrap"
22
+ import { GetWavPCM16 } from "@AudioComponents/GetWavPCM16"
23
+ import { GetSampledPCM16 } from "@AudioComponents/GetSampledPCM16"
24
+ import { SetRadioEffect } from "@AudioComponents/SetRadioEffect"
25
+ import { SetSameHeader } from "@AudioComponents/SetSameHeader"
26
+ import { SetAttentionTone } from "@AudioComponents/SetAttentionTone"
27
+ import { GetMergedPCM16 } from "@AudioComponents/GetMergedPCM16"
28
+ import { SetNoise } from "@AudioComponents/SetNoise"
29
+ import { GetPCM16 } from "@AudioComponents/GetPCM16"
30
+ import { GetTTS } from "@AudioComponents/GetTTS"
31
+ import { GetCleanDescription } from "@AudioComponents/GetCleanDescription"
32
+ import { SetWarning } from "@Utilities/SetWarning"
33
+ import { SetDebug } from "@Utilities/SetDebug"
34
34
  import { join } from "path"
35
35
  import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "fs"
36
36
  import { execSync } from "child_process"
37
37
  import { platform } from "os"
38
38
 
39
-
40
- interface GenerateEASMessageOptions {
39
+ interface GenerateAudioMessageOptions {
41
40
  Message: string
42
41
  Header: string
42
+ Directory?: string
43
43
  Title: string
44
44
  }
45
45
 
46
- export const GenerateEASMessage = async ({ Message, Header, Title }: GenerateEASMessageOptions): Promise<string> => {
46
+ export const GenerateAudioMessage = async ({ Message, Directory, Header, Title }: GenerateAudioMessageOptions): Promise<string> => {
47
47
  const tick = performance.now()
48
48
  const settings = Bootstrap.Settings as TypeSettings;
49
- const directory = settings.GlobalSettings.ArchiveSettings.EasDirectory;
50
- const prefix = settings.GlobalSettings.ArchiveSettings.EasToneout;
49
+ const prefix = settings.GlobalSettings.ArchiveSettings.AudioToneout;
51
50
  let title = (Title ?? `${Math.random().toString(36).substring(2, 15)}-${Header.replace(/[^a-zA-Z0-9]/g, '')}`).replace(/[\\:*?"<>|]/g, "_").replace(/\s+/g, " ").trim();
52
51
  if (!Message || !Header) {
53
52
  SetWarning({
54
- Title: `EAS`,
55
- Message: `Message and header are required to generate an EAS tone.`
53
+ Title: `Audio`,
54
+ Message: `Message and header are required to generate an audio message.`
56
55
  })
57
56
  return null;
58
57
  }
@@ -60,25 +59,25 @@ export const GenerateEASMessage = async ({ Message, Header, Title }: GenerateEAS
60
59
  let buffRadio: any;
61
60
  let buffFull: any[] = [];
62
61
 
63
- if (!directory) {
62
+ if (!Directory) {
64
63
  SetWarning({
65
- Title: `EAS`,
66
- Message: `EAS directory is not set in the settings. Please set it to generate EAS tones.`
64
+ Title: `Audio`,
65
+ Message: `Audio directory is not set in the settings. Please set it to generate audio messages.`
67
66
  });
68
67
  return null;
69
68
  }
70
69
 
71
- if (!existsSync(directory)) {
72
- mkdirSync(directory, { recursive: true });
70
+ if (!existsSync(Directory)) {
71
+ mkdirSync(Directory, { recursive: true });
73
72
  }
74
- const tmpTTS = join(directory, `/${title}-tts.wav`)
75
- const outTTS = join(directory, `/${title}.wav`)
73
+ const tmpTTS = join(Directory, `/${title}-tts.wav`)
74
+ const outTTS = join(Directory, `/${title}.wav`)
76
75
  const vPlatform = platform();
77
76
 
78
77
  if (vPlatform === 'darwin') {
79
78
  SetWarning({
80
- Title: `EAS`,
81
- Message: `EAS tone generation is not supported on macOS.`
79
+ Title: `Audio`,
80
+ Message: `Audio tone generation is not supported on macOS.`
82
81
  });
83
82
  return null
84
83
  }
@@ -104,7 +103,7 @@ export const GenerateEASMessage = async ({ Message, Header, Title }: GenerateEAS
104
103
 
105
104
  if (tWav == null) {
106
105
  try {
107
- const converted = join(directory, `/${title}-tts-fixed.wav`)
106
+ const converted = join(Directory, `/${title}-tts-fixed.wav`)
108
107
  execSync(`ffmpeg -y -i "${prefix}" -ar 8000 -ac 1 -sample_fmt s16 "${converted}"`, { stdio: 'ignore' })
109
108
  if (existsSync(converted)) {
110
109
  tBuffer = readFileSync(converted)
@@ -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
  */
@@ -11,9 +11,9 @@
11
11
  Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
- Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
 
19
19
  */
@@ -11,17 +11,18 @@
11
11
  Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
- Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
14
+ Documentation: https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
- Internal Package: @atmosx/event-product-parser
16
+ Independent Package: @atmosx/event-product-parser
17
17
 
18
18
 
19
19
  */
20
20
 
21
21
  import { platform } from "os"
22
- import { writeFileSync } from "fs"
22
+ import { writeFileSync, unlinkSync} from "fs"
23
23
  import { execSync } from "child_process"
24
24
 
25
+
25
26
  interface GetTTSOptions {
26
27
  Text: string
27
28
  OutputPath: string
@@ -43,6 +44,7 @@ export const GetTTS = async ({ Text, OutputPath }: GetTTSOptions): Promise<void>
43
44
  `$speak.Dispose();`
44
45
  ].join(" ");
45
46
  execSync(`powershell -Command "${command}"`, { stdio: 'inherit' })
47
+ try{ unlinkSync(txtPath) } catch {}
46
48
  } catch(error) {
47
49
  console.error('Error occurred while generating TTS:', error);
48
50
  }
@@ -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,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
 
21
- import { GetPCMToFloat } from "@eas/GetPCMToFloat"
22
- import { GetFloatPCM16 } from "@eas/GetFloatPCM16"
21
+ import { GetPCMToFloat } from "@AudioComponents/GetPCMToFloat"
22
+ import { GetFloatPCM16 } from "@AudioComponents/GetFloatPCM16"
23
23
 
24
24
  interface SetNoiseOptions {
25
25
  Int16: Int16Array
@@ -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
 
21
- import { GetPCMToFloat } from "@eas/GetPCMToFloat"
22
- import { GetFloatPCM16 } from "@eas/GetFloatPCM16"
21
+ import { GetPCMToFloat } from "@AudioComponents/GetPCMToFloat"
22
+ import { GetFloatPCM16 } from "@AudioComponents/GetFloatPCM16"
23
23
 
24
24
  interface SetRadioEffectOptions {
25
25
  Int16: Int16Array
@@ -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
20
 
21
- import { SetAFSK } from "@eas/SetAFSK"
22
- import { SetAsciiToBits } from "@eas/SetAsciiToBits"
23
- import { GetMergedPCM16 } from "@eas/GetMergedPCM16"
21
+ import { SetAFSK } from "@AudioComponents/SetAFSK"
22
+ import { SetAsciiToBits } from "@AudioComponents/SetAsciiToBits"
23
+ import { GetMergedPCM16 } from "@AudioComponents/GetMergedPCM16"
24
24
 
25
25
  interface SetSameHeaderOptions {
26
26
  VTEC: string
@@ -11,24 +11,29 @@
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 { TypeSettings } from "types/Settings"
20
+ import { Bootstrap } from "@Bootstrap"
21
+ import { SetWarning } from "@Utilities/SetWarning"
22
22
 
23
- interface SetWarningOptions {
24
- Title?: string
25
- Message: string
23
+ interface CreateQueryOptions {
24
+ Query: string
25
+ Parameters?: unknown[]
26
26
  }
27
27
 
28
- export const SetWarning = ({ Title, Message }: SetWarningOptions): void => {
29
- const settings = Bootstrap.Settings as TypeSettings;
30
- Bootstrap.Listener.emit(`log`, `${Title ?? `[${Bootstrap.Colors.Yellow}@atmosx/product-parser${Bootstrap.Colors.Reset}]`} ${Message}`)
31
- if (settings.EnableJournal) {
32
- console.log(`${Title ?? `[${Bootstrap.Colors.Yellow}@atmosx/product-parser${Bootstrap.Colors.Reset}]`} ${Message}`)
28
+ export const CreateQuery = function({ Query, Parameters }: CreateQueryOptions): any {
29
+ try {
30
+ const parameters = Array.isArray(Parameters) ? Parameters : [];
31
+ const statement = Bootstrap.Database.prepare(Query);
32
+ return /^\s*select/i.test(Query)
33
+ ? statement.all(...parameters)
34
+ : statement.run(...parameters);
35
+ } catch (error) {
36
+ SetWarning({Message: `Database Query Error: ${error instanceof Error ? error.stack ?? error.message : String(error)}`})
37
+ throw error;
33
38
  }
34
- }
39
+ };
@@ -11,16 +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 { TypeSettings } from "types/Settings"
21
- import { Bootstrap } from "@bootstrap"
22
- import { SetWarning } from "@utilities/SetWarning"
23
- import { CreateEvent } from "@building/CreateEvent"
20
+ import { TypeSettings } from "Types/Settings"
21
+ import { Bootstrap } from "@Bootstrap"
22
+ import { SetWarning } from "@Utilities/SetWarning"
23
+ import { CreateEvent } from "@Building/CreateEvent"
24
+ import { CreateQuery } from "@Database/CreateQuery"
24
25
 
25
26
  export const GetCachedEvents = async (): Promise<void> => {
26
27
  try {
@@ -28,7 +29,10 @@ export const GetCachedEvents = async (): Promise<void> => {
28
29
  const tick = performance.now();
29
30
  if (settings.NOAAWeatherWireServiceSettings.CacheSettings.Enabled) {
30
31
  const max = settings.NOAAWeatherWireServiceSettings.CacheSettings.MaxRetentionHistory ?? 500;
31
- const get = await Bootstrap.Database.prepare(`SELECT * FROM stanzas ORDER BY rowid DESC LIMIT ?`).all(max) as { rowid: number; stanza: string }[];
32
+ const get = await CreateQuery({
33
+ Query: `SELECT * FROM stanzas ORDER BY rowid DESC LIMIT ?`,
34
+ Parameters: [max]
35
+ }) as { rowid: number; stanza: string }[];
32
36
  SetWarning({ Message: `Fetched ${get.length} cached stanzas from the database in ${Math.floor(performance.now() - tick)} ms` })
33
37
  let events = get.map((row) => JSON.parse(row.stanza))
34
38
  .filter(stanza => {
@@ -42,7 +46,8 @@ export const GetCachedEvents = async (): Promise<void> => {
42
46
  await Promise.all(events.map(event => CreateEvent(event)))
43
47
  SetWarning({ Message: `Processed ${events.length} cached stanzas in ${Math.floor(performance.now() - tick)} ms` })
44
48
  }
45
- } catch (error) {
46
- SetWarning({ Message: `An error occurred while fetching cached stanzas: ${error.message} -> ${error.stack}` })
49
+ } catch (error: unknown) {
50
+ const message = error instanceof Error ? error.message : String(error);
51
+ SetWarning({ Message: `An error occurred while fetching cached stanzas: ${message}` })
47
52
  }
48
53
  }