@atmosx/event-product-parser 3.0.621 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/.github/CHANGELOGS.md +52 -0
  2. package/.github/CODE_OF_CONDUCT.md +24 -1
  3. package/.github/CONTRIBUTING.md +22 -3
  4. package/.github/FUNDING.yaml +3 -0
  5. package/.github/LICENSE +24 -1
  6. package/.github/SECURITY.md +25 -6
  7. package/.github/docs/chapters/general-configurations.md +109 -0
  8. package/.github/docs/chapters/sources-and-attributes.md +219 -0
  9. package/README.md +56 -146
  10. package/dist/index.cjs +25333 -0
  11. package/package.json +17 -11
  12. package/pnpm-workspace.yaml +4 -0
  13. package/src/bootstrap.ts +67 -52
  14. package/src/components/audio/GenerateAudioMessage.ts +149 -0
  15. package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
  16. package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
  17. package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
  18. package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +13 -8
  19. package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
  20. package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +14 -8
  21. package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +17 -10
  22. package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +7 -7
  23. package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +13 -8
  24. package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
  25. package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +11 -6
  26. package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +12 -7
  27. package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +12 -7
  28. package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +22 -14
  29. package/src/components/database/CreateQuery.ts +39 -0
  30. package/src/components/database/InitializeDatabase.ts +71 -0
  31. package/src/components/database/imports/Boundaires.ts +168 -0
  32. package/src/{@modules/@database/ImportBroadcastify.ts → components/database/imports/Broadcastify.ts} +15 -25
  33. package/src/components/database/imports/Census.ts +87 -0
  34. package/src/{@modules/@database/ImportShapefiles.ts → components/database/imports/Shapefiles.ts} +24 -27
  35. package/src/{@modules/@database/ImportStanza.ts → components/database/imports/Stanza.ts} +15 -19
  36. package/src/components/events/CreateEvents.ts +88 -0
  37. package/src/components/events/FilterEvents.ts +149 -0
  38. package/src/{@building/CreateEvent.ts → components/events/ProcessStanza.ts} +22 -24
  39. package/src/components/events/RemoveEvents.ts +74 -0
  40. package/src/{@building → components/events/components}/GetCleanedEvent.ts +2 -2
  41. package/src/{@building → components/events/components}/GetEventAttachments.ts +14 -12
  42. package/src/components/events/components/GetEventDirection.ts +28 -0
  43. package/src/{@building → components/events/components}/GetEventEnhancedName.ts +5 -8
  44. package/src/{@building → components/events/components}/GetEventGeometry.ts +19 -13
  45. package/src/{@building → components/events/components}/GetEventHeader.ts +13 -13
  46. package/src/components/events/components/GetEventMerged.ts +51 -0
  47. package/src/{@building → components/events/components}/GetEventNodes.ts +22 -20
  48. package/src/{@building → components/events/components}/GetEventOffice.ts +13 -13
  49. package/src/components/events/components/GetEventPopulation.ts +58 -0
  50. package/src/components/events/components/GetEventProperties.ts +106 -0
  51. package/src/{@building → components/events/components}/GetEventSignature.ts +9 -9
  52. package/src/{@building → components/events/components}/GetEventTags.ts +3 -3
  53. package/src/components/events/components/GetEventTheme.ts +26 -0
  54. package/src/components/events/components/GetEventTracking.ts +64 -0
  55. package/src/{@modules/@database → components/events/utilities}/GetCachedEvents.ts +18 -15
  56. package/src/{@manager → components/events/utilities}/SetHash.ts +18 -13
  57. package/src/{@manager → components/events/utilities}/UpdateEvents.ts +12 -12
  58. package/src/{@manager → components/events/utilities}/UpdateNode.ts +14 -14
  59. package/src/{@parsers/@text → components/formatting}/GetEmbededText.ts +14 -8
  60. package/src/{@parsers/@text → components/formatting}/GetStringText.ts +15 -11
  61. package/src/{@modules/@utilities → components/geometry}/GetShapeNearestPoint.ts +24 -19
  62. package/src/components/geometry/GetUnionPolygon.ts +36 -0
  63. package/src/components/images/GenerateGraphic.ts +242 -0
  64. package/src/components/images/components/CreateRectangle.ts +22 -0
  65. package/src/components/images/components/CreateText.ts +22 -0
  66. package/src/components/images/modules/CreateSVG.ts +37 -0
  67. package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
  68. package/src/components/images/modules/GetGeographicalCities.ts +58 -0
  69. package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
  70. package/src/components/images/modules/GetGeometryBounds.ts +82 -0
  71. package/src/components/images/modules/GetParsedBoundary.ts +58 -0
  72. package/src/components/images/modules/GetSVGPath.ts +53 -0
  73. package/src/components/images/modules/NormalizePolygon.ts +57 -0
  74. package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +16 -17
  75. package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +27 -15
  76. package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +26 -26
  77. package/src/components/utilities/EmitThread.ts +97 -0
  78. package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
  79. package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
  80. package/src/components/utilities/QueueManager.ts +70 -0
  81. package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +13 -13
  82. package/src/components/utilities/SetEventEmit.ts +42 -0
  83. package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +7 -7
  84. package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +5 -5
  85. package/src/components/utilities/SetTimeoutAction.ts +64 -0
  86. package/src/components/utilities/SetWarning.ts +47 -0
  87. package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +20 -20
  88. package/src/{@core/CreateListener.ts → components/xmpp/ErrorXMPP.ts} +8 -5
  89. package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +13 -13
  90. package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +18 -18
  91. package/src/components/xmpp/ReconnectXMPP.ts +64 -0
  92. package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +26 -26
  93. package/src/{@enums → enums}/AWIPS.ts +2 -2
  94. package/src/{@enums → enums}/Actions.ts +2 -2
  95. package/src/{@enums → enums}/Cancellation.ts +2 -2
  96. package/src/{@enums → enums}/Causes.ts +2 -2
  97. package/src/{@enums → enums}/Correlations.ts +2 -2
  98. package/src/{@enums → enums}/Enhanced.ts +4 -3
  99. package/src/{@enums → enums}/Events.ts +2 -2
  100. package/src/{@enums → enums}/Expressions.ts +3 -3
  101. package/src/{@enums → enums}/GlobalFilter.ts +2 -2
  102. package/src/{@enums → enums}/Hail.ts +2 -2
  103. package/src/{@enums → enums}/ICAO.ts +2 -2
  104. package/src/{@enums → enums}/Matches.ts +8 -3
  105. package/src/{@enums → enums}/Products.ts +2 -2
  106. package/src/{@enums → enums}/Records.ts +2 -2
  107. package/src/{@enums → enums}/Severity.ts +2 -2
  108. package/src/{@enums → enums}/Shapefiles.ts +2 -2
  109. package/src/{@enums → enums}/States.ts +68 -4
  110. package/src/{@enums → enums}/Status.ts +2 -2
  111. package/src/{@enums → enums}/Strings.ts +2 -2
  112. package/src/{@enums → enums}/Tags.ts +9 -4
  113. package/src/{@enums → enums}/Testing.ts +2 -2
  114. package/src/enums/Themes.ts +70 -0
  115. package/src/events/ParseAPI.ts +133 -0
  116. package/src/{@events → events}/ParseText.ts +24 -22
  117. package/src/{@events → events}/ParseUGC.ts +27 -26
  118. package/src/{@events → events}/ParseVTEC.ts +37 -36
  119. package/src/{@core → exports}/ClearEvents.ts +9 -9
  120. package/src/{@core → exports}/GetEvents.ts +4 -4
  121. package/src/exports/GetNearestCity.ts +45 -0
  122. package/src/{@core → exports}/GetNodes.ts +4 -4
  123. package/src/{@core → exports}/GetRandomEvent.ts +4 -4
  124. package/src/{@core → exports}/GetVersion.ts +4 -4
  125. package/src/exports/ManualEvent.ts +55 -0
  126. package/src/{@core → exports}/QueryStanza.ts +12 -11
  127. package/src/exports/SetNode.ts +100 -0
  128. package/src/{@core → exports}/StartService.ts +23 -22
  129. package/src/{@core → exports}/StopService.ts +10 -10
  130. package/src/index.ts +57 -37
  131. package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +7 -7
  132. package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
  133. package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
  134. package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +12 -12
  135. package/src/parsers/ugc/GetCache.ts +24 -0
  136. package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
  137. package/src/{@parsers/@ugc/GetUGCHeader.ts → parsers/ugc/GetHeader.ts} +4 -4
  138. package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +10 -10
  139. package/src/parsers/ugc/GetZonePolygon.ts +73 -0
  140. package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +3 -3
  141. package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +13 -8
  142. package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +14 -14
  143. package/src/{@parsers/@pvtec → parsers/vtec}/GetExpiry.ts +2 -2
  144. package/src/{@parsers/@pvtec → parsers/vtec}/VTECExtract.ts +17 -17
  145. package/src/tasks/CreateTasks.ts +116 -0
  146. package/src/tasks/TaskGenerateJSON.ts +34 -0
  147. package/src/tasks/TaskGenerateText.ts +34 -0
  148. package/src/tasks/TaskSendNTFY.ts +96 -0
  149. package/src/tasks/TaskSendWebhook.ts +107 -0
  150. package/src/{@types → types/event}/Attributes.ts +2 -3
  151. package/src/{@types → types/event}/Event.ts +8 -7
  152. package/src/{@types → types/event}/HVTEC.ts +2 -2
  153. package/src/{@types → types/event}/Properties.ts +17 -3
  154. package/src/{@types → types/event}/Stanza.ts +2 -2
  155. package/src/{@types → types/event}/VTEC.ts +8 -8
  156. package/src/{@types → types/standard}/Actions.ts +3 -3
  157. package/src/{@types → types/standard}/Hash.ts +5 -5
  158. package/src/{@modules/@utilities/GetSettings.ts → types/standard/Nodes.ts} +15 -7
  159. package/src/{@types → types/standard}/Settings.ts +19 -12
  160. package/src/{@types → types/standard}/StanzaCompiled.ts +15 -15
  161. package/src/{@types → types/standard}/UGC.ts +5 -5
  162. package/tools/build.js +32 -0
  163. package/tsconfig.json +32 -1
  164. package/.github/SUPPORTED_EVENTS.md +0 -370
  165. package/.github/docs/docs-functions.md +0 -30
  166. package/.github/docs/docs-general-configurations.md +0 -209
  167. package/.github/docs/docs-integrations.md +0 -37
  168. package/.github/docs/docs-listeners.md +0 -28
  169. package/.github/docs/docs-source-configuration.md +0 -218
  170. package/.github/docs/docs-technical.md +0 -50
  171. package/.github/logo.png +0 -0
  172. package/.github/samples/SAMPLE_EAS_GENERATION.wav +0 -0
  173. package/.github/samples/SAMPLE_GEOJSON.json +0 -204
  174. package/.github/samples/SAMPLE_TEXT_PRODUCT.txt +0 -119
  175. package/dist/cjs/index.cjs +0 -8005
  176. package/dist/esm/index.mjs +0 -7985
  177. package/src/@building/GetEventProperties.ts +0 -96
  178. package/src/@building/GetEventTracking.ts +0 -68
  179. package/src/@core/ManualEvent.ts +0 -56
  180. package/src/@core/SetNode.ts +0 -81
  181. package/src/@events/ParseAPI.ts +0 -117
  182. package/src/@manager/MakeEvents.ts +0 -106
  183. package/src/@manager/RemoveEvent.ts +0 -70
  184. package/src/@manager/Tasks.ts +0 -246
  185. package/src/@manager/ValidateEvents.ts +0 -142
  186. package/src/@modules/@database/InitializeDatabase.ts +0 -59
  187. package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
  188. package/src/@modules/@utilities/GetFormattedTime.ts +0 -43
  189. package/src/@modules/@utilities/SetCronSchedule.ts +0 -94
  190. package/src/@modules/@utilities/SetEventEmit.ts +0 -41
  191. package/src/@modules/@utilities/SetListener.ts +0 -30
  192. package/src/@modules/@utilities/SetTimeoutAction.ts +0 -64
  193. package/src/@modules/@utilities/SetWarning.ts +0 -34
  194. package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
  195. package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
  196. package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
  197. package/src/@parsers/@text/GetXML.ts +0 -61
  198. package/src/@parsers/@ugc/GetCache.ts +0 -24
  199. package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
  200. package/tsup.config.ts +0 -16
@@ -11,22 +11,22 @@
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
  interface SetSleepOptions {
22
- timeout: number
22
+ Timeout: number
23
23
  }
24
24
 
25
- export const SetSleep = async (options: SetSleepOptions): Promise<void> => {
25
+ export const SetSleep = async ({ Timeout }: SetSleepOptions): Promise<void> => {
26
26
  return new Promise((resolve) => {
27
27
  setTimeout(() => {
28
28
  resolve();
29
- }, options.timeout);
29
+ }, Timeout);
30
30
  });
31
31
  }
32
32
 
@@ -0,0 +1,64 @@
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
+
22
+ interface SetTimeoutActionOptions {
23
+ Identifier: string
24
+ AddTime?: boolean
25
+ Max?: number
26
+ Interval?: number
27
+ Expire?: boolean
28
+ }
29
+
30
+ type SetTimeoutActionResponse = {
31
+ Limited: boolean
32
+ Remaining?: number
33
+ Response?: string
34
+ }
35
+
36
+ export const SetTimeoutAction = ({ Identifier, AddTime, Max, Interval, Expire }: SetTimeoutActionOptions): SetTimeoutActionResponse => {
37
+ let target = Bootstrap?.Ratelimits?.[Identifier];
38
+ if (!target) {
39
+ Bootstrap.Ratelimits[Identifier] = [];
40
+ target = Bootstrap.Ratelimits[Identifier];
41
+ }
42
+ if (Expire) {
43
+ delete Bootstrap.Ratelimits[Identifier];
44
+ return { Limited: false };
45
+ }
46
+ if (target?.length > 0) {
47
+ Bootstrap.Ratelimits[Identifier] = target.filter((ts: number) => Date.now() - ts < Interval * 1000);
48
+ target = Bootstrap.Ratelimits[Identifier];
49
+ }
50
+
51
+ const oldestTimestamp = target?.[0];
52
+ const getWait = oldestTimestamp ? Math.ceil((Interval * 1000) - (Date.now() - oldestTimestamp)) : 0;
53
+ const max = Max ?? 1;
54
+
55
+ if (target?.length >= max && getWait > 0) {
56
+ return {
57
+ Limited: true,
58
+ Remaining: getWait,
59
+ Response: `You are being rate limited, please wait ${(getWait / 1e3).toFixed(1)} second(s) before performing this action again.`
60
+ }
61
+ }
62
+ Bootstrap.Ratelimits[Identifier].push(Date.now());
63
+ return { Limited: false };
64
+ }
@@ -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 "TypesStandard/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,31 +11,31 @@
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 "./OnlineXMPP";
23
- import { OfflineXMPP } from "./OfflineXMPP";
24
- import { ErrorXMPP } from "./ErrorXMPP";
25
- import { StanzaXMPP } from "./StanzaXMPP";
26
- import { SetEventEmit } from '../@utilities/SetEventEmit';
27
- import { client } from '@xmpp/client';
20
+ import { TypeSettings } from "TypesStandard/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;
31
- const settings = bootstrap.settings as TypeSettings
31
+ const settings = Bootstrap.Settings as TypeSettings
32
32
  settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname
33
33
  ??= settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username;
34
- session = bootstrap.session_xmpp = client({
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();
@@ -45,12 +45,12 @@ export const DeployXMPP = async (): Promise<void> => {
45
45
  await session.start()
46
46
  } catch (error) {
47
47
  SetEventEmit({
48
- event: `onServiceStatus`,
49
- metadata: {
50
- message: `Error occured while starting XMPP Session: ${error}`,
51
- data: {},
52
- type: `error`,
53
- error: true
48
+ Event: `onServiceStatus`,
49
+ Metadata: {
50
+ Message: `Error occured while starting XMPP Session: ${error}`,
51
+ Data: {},
52
+ Type: `error`,
53
+ Error: true
54
54
  },
55
55
  })
56
56
  }
@@ -11,14 +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 { SetListener } from "../@modules/@utilities/SetListener";
20
+ import { Bootstrap } from "@Bootstrap"
21
21
 
22
- export const CreateListener = (event: string, callback: () => void) => {
23
- SetListener({event, callback})
22
+ export const ErrorXMPP = () => {
23
+ Bootstrap.Session.on(`error`, async () => {
24
+ Bootstrap.Cache.Connected = false;
25
+ Bootstrap.Cache.Hault = true;
26
+ })
24
27
  }
@@ -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 { bootstrap } from "../../bootstrap";
21
- import { SetEventEmit } from "../@utilities/SetEventEmit";
20
+ import { Bootstrap } from "@Bootstrap"
21
+ import { SetEventEmit } from "@Utilities/SetEventEmit"
22
22
 
23
23
  export const OfflineXMPP = () => {
24
- bootstrap.session_xmpp.on(`offline`, async () => {
25
- bootstrap.cache.isConnected = false;
26
- bootstrap.cache.sigHault = true;
24
+ Bootstrap.Session.on(`offline`, async () => {
25
+ Bootstrap.Cache.Connected = false;
26
+ Bootstrap.Cache.Hault = true;
27
27
  SetEventEmit({
28
- event: `onServiceStatus`,
29
- metadata: {
30
- message: `Client has gone offline`,
31
- data: {},
32
- type: `offline`,
33
- error: true
28
+ Event: `onServiceStatus`,
29
+ Metadata: {
30
+ Message: `Client has gone offline`,
31
+ Data: {},
32
+ Type: `offline`,
33
+ Error: true
34
34
  },
35
35
  })
36
36
  })
@@ -11,36 +11,36 @@
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 { SetEventEmit } from '../@utilities/SetEventEmit';
22
- import { xml } from '@xmpp/client'
20
+ import { Bootstrap } from "@Bootstrap"
21
+ import { SetEventEmit } from "@Utilities/SetEventEmit"
22
+ import { xml } from "@XMPP/client"
23
23
 
24
24
  export const OnlineXMPP = () => {
25
- const settings = bootstrap.settings;
26
- bootstrap.session_xmpp.on(`online`, async (address: string) => {
27
- bootstrap.cache.sigHault = false;
28
- bootstrap.cache.isConnected = true;
29
- bootstrap.cache.tReconnects = 0;
25
+ const settings = Bootstrap.Settings;
26
+ Bootstrap.Session.on(`online`, async () => {
27
+ Bootstrap.Cache.Hault = false;
28
+ Bootstrap.Cache.Connected = true;
29
+ Bootstrap.Cache.TotalReconnects = 0;
30
30
  const nickname = settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname;
31
- bootstrap.session_xmpp.send(xml('presence', {
31
+ Bootstrap.Session.send(xml('presence', {
32
32
  to: `nwws@conference.nwws-oi.weather.gov/${nickname}`,
33
33
  xmlns: 'http://jabber.org/protocol/muc',
34
34
  }))
35
35
  SetEventEmit({
36
- event: `onServiceStatus`,
37
- metadata: {
38
- message: `Succesfully connected to NOAA Weather Wire Service as "${nickname}"`,
39
- data: {},
40
- type: `online`,
41
- error: false
36
+ Event: `onServiceStatus`,
37
+ Metadata: {
38
+ Message: `Succesfully connected to NOAA Weather Wire Service as "${nickname}"`,
39
+ Data: {},
40
+ Type: `online`,
41
+ Error: false
42
42
  },
43
- message: `Succesfully connected to NOAA Weather Wire Service as "${nickname}"`,
43
+ Message: `Succesfully connected to NOAA Weather Wire Service as "${nickname}"`,
44
44
  })
45
45
  })
46
46
  }
@@ -0,0 +1,64 @@
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 { TypeSettings } from "TypesStandard/Settings"
21
+ import { Bootstrap } from "@Bootstrap"
22
+ import { SetEventEmit } from "@Utilities/SetEventEmit"
23
+ import { SetWarning } from "@Utilities/SetWarning"
24
+
25
+ export const ReconnectXMPP = async (interval: number): Promise<void> => {
26
+ const settings = Bootstrap.Settings as TypeSettings;
27
+ const last = Date.now() - Bootstrap.Cache.LastStanzaTime
28
+ if (interval < 15) {
29
+ SetWarning({ Message: `Reconnection interval of ${interval} seconds is too low, setting to 15 seconds` })
30
+ interval = 15;
31
+ Bootstrap.Settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval = 15;
32
+ }
33
+ const reconnectThreshold = interval * 1e3
34
+ if ((!Bootstrap.Cache.Connected && !Bootstrap.Cache.Hault) || !Bootstrap.Session) {
35
+ return;
36
+ }
37
+ if (last > reconnectThreshold) {
38
+ if (!Bootstrap.Cache.Reconnecting) {
39
+ Bootstrap.Cache.Reconnecting = true;
40
+ Bootstrap.Cache.Connected = false;
41
+ Bootstrap.Cache.TotalReconnects += 1;
42
+ try {
43
+ SetEventEmit({
44
+ Event: `onServiceStatus`,
45
+ Metadata: {
46
+ Message: `Attempting to reconnect to XMPP Service (Reconnect Attempt ${Bootstrap.Cache.TotalReconnects})`,
47
+ Data: {
48
+ Last: last,
49
+ Nickname: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname
50
+ },
51
+ Type: `reconnect`,
52
+ Error: true
53
+ }, Message: `Attempting to reconnect to XMPP Service (Reconnect Attempt ${Bootstrap.Cache.TotalReconnects})`,
54
+ })
55
+ await Bootstrap.Session.stop().catch(() => {});
56
+ await Bootstrap.Session.start().catch(() => {});
57
+ } catch (error) {
58
+ SetWarning({ Message: `XMPP Reconnect Failed - ${(error as Error).message}` })
59
+ } finally {
60
+ Bootstrap.Cache.Reconnecting = false;
61
+ }
62
+ }
63
+ }
64
+ }
@@ -11,51 +11,51 @@
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/Stanza";
21
- import { bootstrap } from "../../bootstrap";
22
- import { ValidateStanza } from "../@stanza/ValidateStanza";
23
- import { CreateEvent } from "../../@building/CreateEvent";
24
- import { ImportStanza } from "../@database/ImportStanza";
25
- import { SetEventEmit } from "../@utilities/SetEventEmit";
20
+ import { TypeStanza } from "TypesEvent/Stanza"
21
+ import { Bootstrap } from "@Bootstrap"
22
+ import { ValidateStanza } from "@Stanza/ValidateStanza"
23
+ import { ProcessStanza } from "@Builder/ProcessStanza"
24
+ import { ImportStanza } from "@Database/imports/Stanza"
25
+ import { SetEventEmit } from "@Utilities/SetEventEmit"
26
26
 
27
27
  export const StanzaXMPP = () => {
28
- bootstrap.session_xmpp.on(`stanza`, async (stanza: TypeStanza) => {
28
+ Bootstrap.Session.on(`stanza`, async (stanza: TypeStanza) => {
29
29
  const msgFrom = stanza?.attrs?.from ?? ``
30
30
  const msgType = stanza?.attrs?.type ?? ``
31
31
  SetEventEmit({
32
- event: `onServiceStatus`,
33
- metadata: {
34
- message: stanza,
35
- from: msgFrom,
36
- type: `stanza`
32
+ Event: `onServiceStatus`,
33
+ Metadata: {
34
+ Message: stanza,
35
+ From: msgFrom,
36
+ Type: `stanza`
37
37
  },
38
38
  })
39
- bootstrap.cache.lastStanza = Date.now();
39
+ Bootstrap.Cache.LastStanzaTime = Date.now();
40
40
  if (stanza.is(`message`)) {
41
- const result = ValidateStanza({ stanza });
42
- const isSkippable = result.isIgnored ||
43
- (result.isCapEvent) ||
44
- (result.isCapEvent && !result.isCapAreaDescription)
41
+ const result = ValidateStanza({ Stanza: stanza });
42
+ const isSkippable = result.Ignored ||
43
+ (result.CapEvent) ||
44
+ (result.CapEvent && !result.CapAreaDescription)
45
45
  if (isSkippable) { return; }
46
- await CreateEvent(result);
46
+ await ProcessStanza(result);
47
47
  await ImportStanza(result);
48
48
  }
49
49
  if (stanza.is(`presence`) && msgFrom.startsWith('nwws@conference.nwws-oi.weather.gov/')) {
50
50
  const getOccupant = msgFrom.split(`/`).slice(1).join(`/`)
51
51
  const getAvailability = msgType === `unavailable`
52
52
  SetEventEmit({
53
- event: `onServiceStatus`,
54
- metadata: {
55
- message: `Occupant ${getOccupant} has ${getAvailability ? `left` : `joined`} the room`,
56
- data: {},
57
- type: `occupant`,
58
- error: false
53
+ Event: `onServiceStatus`,
54
+ Metadata: {
55
+ Message: `Occupant ${getOccupant} has ${getAvailability ? `left` : `joined`} the room`,
56
+ Data: {},
57
+ Type: `occupant`,
58
+ Error: false
59
59
  },
60
60
  })
61
61
  }
@@ -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
 
@@ -43,7 +43,8 @@ export const EnumEnhanced: Record<string, Record<string, EnhancedEventType>> = {
43
43
  "PDS Ice Storm Warning": { description: "particularly dangerous situation" },
44
44
  },
45
45
  "Special Marine Warning": {
46
- "Special Marine Warning (TPROB)": { tornado: `POSSIBLE` },
46
+ "Special Marine Warning (WPROB)": { tornado: `POSSIBLE` },
47
+ "Special Marine Warning (WCONF)": { tornado: `OBSERVED` },
47
48
  },
48
49
  "Tornado Watch": {
49
50
  "PDS Tornado Watch": { pdswatch: true }
@@ -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
  export const EnumExpressions: { [key: string]: RegExp } = {
21
21
  location: new RegExp(/^([A-Za-z.\-' ]+),\s*([A-Z]{2})$/),
22
- pvtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
22
+ vtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
23
23
  hvtec: new RegExp(`[a-zA-Z0-9]{4}.[A-Z0-9].[A-Z]{2}.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[A-Z]{2}`, "imu"),
24
24
  wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
25
25
  ugc1: new RegExp(`(\\w{2}[CZ](\\d{3}((-|>)\\s?(\\n\\n)?))+)`, "imu"),
@@ -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