@atmosx/event-product-parser 2.0.16 → 3.0.1

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 (136) hide show
  1. package/README.md +248 -187
  2. package/dist/cjs/index.cjs +12218 -3139
  3. package/dist/esm/index.mjs +12401 -3327
  4. package/dist/index.d.mts +235 -0
  5. package/dist/index.d.ts +235 -0
  6. package/package.json +6 -4
  7. package/src/@building/building.clean.ts +30 -0
  8. package/src/@building/building.create.ts +42 -0
  9. package/src/@building/building.enhance.ts +56 -0
  10. package/src/@building/building.geometry.ts +48 -0
  11. package/src/@building/building.headers.ts +37 -0
  12. package/src/@building/building.office.ts +43 -0
  13. package/src/@building/building.polygon.ts +71 -0
  14. package/src/@building/building.properties.ts +89 -0
  15. package/src/@building/building.signature.ts +61 -0
  16. package/src/@building/building.tags.ts +24 -0
  17. package/src/@building/building.tracking.ts +68 -0
  18. package/src/@building/building.validate.ts +147 -0
  19. package/src/@core/core.getEvents.ts +25 -0
  20. package/src/@core/core.getNodes.ts +25 -0
  21. package/src/@core/core.getRandomEvent.ts +25 -0
  22. package/src/@core/core.getVersion.ts +25 -0
  23. package/src/@core/core.listener.ts +24 -0
  24. package/src/@core/core.setNode.ts +81 -0
  25. package/src/@core/core.start.ts +59 -0
  26. package/src/@core/core.stop.ts +32 -0
  27. package/src/@dictionaries/dictionaries.betterEventNames.ts +89 -0
  28. package/src/@dictionaries/dictionaries.eventActions.ts +28 -0
  29. package/src/@dictionaries/{awips.ts → dictionaries.eventAwipAbreviations.ts} +13 -7
  30. package/src/@dictionaries/dictionaries.eventCancelMessages.ts +30 -0
  31. package/src/@dictionaries/dictionaries.eventCauses.ts +36 -0
  32. package/src/@dictionaries/dictionaries.eventProducts.ts +25 -0
  33. package/src/@dictionaries/dictionaries.eventRecords.ts +25 -0
  34. package/src/@dictionaries/dictionaries.eventSeverity.ts +27 -0
  35. package/src/@dictionaries/dictionaries.eventStatus.ts +31 -0
  36. package/src/@dictionaries/{signatures.ts → dictionaries.eventTags.ts} +13 -68
  37. package/src/@dictionaries/dictionaries.eventTypes.ts +82 -0
  38. package/src/@dictionaries/dictionaries.eventsOffshore.ts +31 -0
  39. package/src/@dictionaries/dictionaries.hailStrings.ts +33 -0
  40. package/src/@dictionaries/{icao.ts → dictionaries.officeICAOs.ts} +13 -6
  41. package/src/@dictionaries/dictionaries.regExp.ts +28 -0
  42. package/src/@dictionaries/dictionaries.shapefileLinks.ts +36 -0
  43. package/src/@dictionaries/dictionaries.statusCorrelationText.ts +40 -0
  44. package/src/@dictionaries/dictionaries.testSignatures.ts +24 -0
  45. package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +68 -0
  46. package/src/@events/events.api.ts +113 -0
  47. package/src/@events/events.text.ts +79 -0
  48. package/src/@events/events.ugc.ts +83 -0
  49. package/src/@events/events.vtec.ts +87 -0
  50. package/src/@manager/manager.mkEvent.ts +95 -0
  51. package/src/@manager/manager.rmEvent.ts +46 -0
  52. package/src/@manager/manager.setHash.ts +37 -0
  53. package/src/@manager/manager.updateNodes.ts +55 -0
  54. package/src/@manager/manager.updateWebhooks.ts +50 -0
  55. package/src/@modules/@database/database.cache.ts +48 -0
  56. package/src/@modules/@database/database.init.ts +45 -0
  57. package/src/@modules/@database/database.shapefiles.ts +96 -0
  58. package/src/@modules/@database/database.stanza.ts +48 -0
  59. package/src/@modules/@eas/eas.getFloatPCM16.ts +29 -0
  60. package/src/@modules/@eas/eas.getMergedPCM16.ts +32 -0
  61. package/src/@modules/@eas/eas.getPCM16.ts +52 -0
  62. package/src/@modules/@eas/eas.getPCMToFloat.ts +26 -0
  63. package/src/@modules/@eas/eas.getSampledPCM16.ts +36 -0
  64. package/src/@modules/@eas/eas.getWavPCM16.ts +52 -0
  65. package/src/@modules/@eas/eas.setAFSK.ts +52 -0
  66. package/src/@modules/@eas/eas.setAsciiToBits.ts +32 -0
  67. package/src/@modules/@eas/eas.setAttentionTone.ts +40 -0
  68. package/src/@modules/@eas/eas.setEasTone.ts +137 -0
  69. package/src/@modules/@eas/eas.setNoise.ts +31 -0
  70. package/src/@modules/@eas/eas.setRadioEffect.ts +49 -0
  71. package/src/@modules/@eas/eas.setSameHeader.ts +45 -0
  72. package/src/@modules/@stanza/stanza.getAwipsType.ts +46 -0
  73. package/src/@modules/@stanza/stanza.validate.ts +50 -0
  74. package/src/@modules/@utilities/utilities.createHttp.ts +85 -0
  75. package/src/@modules/@utilities/utilities.createWebhook.ts +100 -0
  76. package/src/@modules/@utilities/utilities.getFormattedTime.ts +43 -0
  77. package/src/@modules/@utilities/utilities.getSettings.ts +25 -0
  78. package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +114 -0
  79. package/src/@modules/@utilities/utilities.setCronSchedule.ts +65 -0
  80. package/src/@modules/@utilities/utilities.setEventEmit.ts +41 -0
  81. package/src/@modules/@utilities/utilities.setListener.ts +30 -0
  82. package/src/@modules/@utilities/utilities.setSettings.ts +42 -0
  83. package/src/@modules/@utilities/utilities.setSleep.ts +33 -0
  84. package/src/@modules/@utilities/utilities.setTimeoutAction.ts +59 -0
  85. package/src/@modules/@utilities/utilities.setWarning.ts +34 -0
  86. package/src/@modules/@xmpp/xmpp.xDeploy.ts +58 -0
  87. package/src/@modules/@xmpp/xmpp.xError.ts +29 -0
  88. package/src/@modules/@xmpp/xmpp.xOffline.ts +38 -0
  89. package/src/@modules/@xmpp/xmpp.xOnline.ts +45 -0
  90. package/src/@modules/@xmpp/xmpp.xReconnect.ts +64 -0
  91. package/src/@modules/@xmpp/xmpp.xStanza.ts +63 -0
  92. package/src/@parsers/@hvtec/hvtec.extract.ts +40 -0
  93. package/src/@parsers/@pvtec/pvtec.expires.ts +26 -0
  94. package/src/@parsers/@pvtec/pvtec.extract.ts +49 -0
  95. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +53 -0
  96. package/src/@parsers/@text/text.getPolygonFromProduct.ts +32 -0
  97. package/src/@parsers/@text/text.getTextFromProduct.ts +43 -0
  98. package/src/@parsers/@text/text.getXML.ts +61 -0
  99. package/src/@parsers/@ugc/ugc.coordinates.ts +110 -0
  100. package/src/@parsers/@ugc/ugc.expiry.ts +32 -0
  101. package/src/@parsers/@ugc/ugc.extract.ts +37 -0
  102. package/src/@parsers/@ugc/ugc.header.ts +30 -0
  103. package/src/@parsers/@ugc/ugc.locations.ts +29 -0
  104. package/src/@parsers/@ugc/ugc.zones.ts +52 -0
  105. package/src/@types/type.event.ts +67 -0
  106. package/src/@types/type.properties.ts +75 -0
  107. package/src/@types/types.attributes.ts +28 -0
  108. package/src/@types/types.compiled.ts +35 -0
  109. package/src/@types/types.hash.ts +24 -0
  110. package/src/@types/types.hvtec.ts +25 -0
  111. package/src/@types/types.pvtec.ts +30 -0
  112. package/src/@types/types.settings.ts +76 -0
  113. package/src/@types/types.stanza.ts +37 -0
  114. package/src/@types/types.ugc.ts +24 -0
  115. package/src/@types/types.webhook.ts +26 -0
  116. package/src/bootstrap.ts +85 -163
  117. package/src/index.ts +47 -216
  118. package/test.js +78 -51
  119. package/tsup.config.ts +1 -0
  120. package/src/@dictionaries/events.ts +0 -168
  121. package/src/@parsers/@events/api.ts +0 -146
  122. package/src/@parsers/@events/cap.ts +0 -123
  123. package/src/@parsers/@events/text.ts +0 -104
  124. package/src/@parsers/@events/ugc.ts +0 -107
  125. package/src/@parsers/@events/vtec.ts +0 -76
  126. package/src/@parsers/events.ts +0 -392
  127. package/src/@parsers/hvtec.ts +0 -46
  128. package/src/@parsers/pvtec.ts +0 -72
  129. package/src/@parsers/stanza.ts +0 -97
  130. package/src/@parsers/text.ts +0 -165
  131. package/src/@parsers/ugc.ts +0 -247
  132. package/src/@submodules/database.ts +0 -201
  133. package/src/@submodules/eas.ts +0 -490
  134. package/src/@submodules/utils.ts +0 -191
  135. package/src/@submodules/xmpp.ts +0 -142
  136. package/src/types.ts +0 -259
package/src/index.ts CHANGED
@@ -1,240 +1,71 @@
1
1
  /*
2
- _ _ __ __
2
+ _ _ _ __ __
3
3
  /\ | | | | (_) \ \ / /
4
4
  / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
- / /\ \| __| "_ ` _ \ / _ \/ __| "_ \| "_ \ / _ \ "__| |/ __| > <
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
6
  / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
7
  /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
- | |
8
+ | |
9
9
  |_|
10
-
11
- Written by: KiyoWx (k3yomi)
12
- */
13
-
14
- import * as loader from './bootstrap';
15
- import * as types from './types';
16
- import Utils from './@submodules/utils';
17
- import Xmpp from './@submodules/xmpp';
18
- import EAS from './@submodules/eas';
19
- import Database from './@submodules/database';
20
- import StanzaParser from './@parsers/stanza';
21
- import EventParser from './@parsers/events';
22
- import TextParser from './@parsers/text';
23
- import PVtecParser from './@parsers/pvtec';
24
- import HVtecParser from './@parsers/hvtec';
25
- import UGCParser from './@parsers/ugc';
26
-
27
- export class Manager {
28
- isNoaaWeatherWireService: boolean
29
- job: any
30
- constructor(metadata: types.ClientSettingsTypes) {
31
- this.sigCatch();
32
- this.start(metadata)
33
- }
34
-
35
- /**
36
- * @function setDisplayName
37
- * @description
38
- * Sets the display nickname for the NWWS XMPP session. Trims the provided
39
- * name and validates it, emitting a warning if the name is empty or invalid.
40
- *
41
- * @param {string} [name]
42
- */
43
- public setDisplayName(name?: string) {
44
- const settings = loader.settings as types.ClientSettingsTypes;
45
- const trimmed = name?.trim();
46
- if (!trimmed) {
47
- Utils.warn(loader.definitions.messages.invalid_nickname);
48
- return;
49
- }
50
- settings.noaa_weather_wire_service_settings.credentials.nickname = trimmed;
51
- }
52
10
 
53
- /**
54
- * @function getEventPolygon
55
- * @description
56
- * Retrieves the geographical polygon for a given event based on its
57
- * generated geocode and UGC zones.
58
- *
59
- * @async
60
- * @param {types.EventCompiled} event
61
- * @returns {Promise<types.geometry | null>}
62
- */
63
- public async getEventPolygon(event: types.EventCompiled, isUnion: boolean = true): Promise<types.geometry | null> {
64
- const hasGenerated = event.properties.geocode?.generated ?? null;
65
- const getUgc = event.properties.geocode?.UGC ?? null;
66
- return await EventParser.getEventGeometry(hasGenerated, {zones: getUgc}, isUnion);
67
- }
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
68
15
 
69
- /**
70
- * @function createEasAudio
71
- * @description
72
- * Generates an EAS (Emergency Alert System) audio file using the provided
73
- * description and header.
74
- *
75
- * @async
76
- * @param {string} description
77
- * @param {string} header
78
- * @returns {Promise<string>}
79
- */
80
- public async createEasAudio(description: string, header: string): Promise<string> {
81
- return await EAS.generateEASAudio(description, header);
82
- }
83
-
84
- /**
85
- * @function getAllAlertTypes
86
- * @description
87
- * Generates a list of all possible alert types by combining defined
88
- * event names with action names.
89
- *
90
- * @returns {string[]}
91
- */
92
- public getAllAlertTypes(): string[] {
93
- const events = new Set(Object.values(loader.definitions.events));
94
- const actions = new Set(Object.values(loader.definitions.actions));
95
- return Array.from(events).flatMap(event =>
96
- Array.from(actions).map(action => `${event} ${action}`)
97
- );
98
- }
16
+ Internal Package: @atmosx/event-product-parser
99
17
 
100
- /**
101
- * @function searchStanzaDatabase
102
- * @description
103
- * Searches the stanza database for entries containing the specified query.
104
- * Escapes SQL wildcard characters and returns results in descending order
105
- * by ID, up to the specified limit.
106
- *
107
- * @async
108
- * @param {string} query
109
- * @param {number} [limit=250]
110
- * @returns {Promise<string[]>}
111
- */
112
- public async searchStanzaDatabase(query: string, limit: number = 250): Promise<string[]> {
113
- const escapeLike = (s: string) => s.replace(/[%_]/g, '\\$&');
114
- const rows = await loader.cache.db
115
- .prepare(`SELECT * FROM stanzas WHERE stanza LIKE ? ESCAPE '\\' ORDER BY id DESC LIMIT ${limit}`)
116
- .all(`%${escapeLike(query)}%`);
117
- return rows;
118
- }
18
+ */
119
19
 
120
- /**
121
- * @function setSettings
122
- * @description
123
- * Merges the provided client settings into the current configuration,
124
- * preserving nested structures.
125
- *
126
- * @async
127
- * @param {types.ClientSettingsTypes} settings
128
- * @returns {Promise<void>}
129
- */
130
- public async setSettings(settings: types.ClientSettingsTypes): Promise<void> {
131
- Utils.mergeClientSettings(loader.settings, settings);
132
- }
20
+ import { TypeSettings } from './@types/types.settings'
21
+ import { setSettings } from "./@modules/@utilities/utilities.setSettings"
22
+ import { getEventGeometry } from "./@building/building.geometry";
23
+ import { getCleanedEvent } from "./@building/building.clean"
24
+ import { setEventEmit } from './@modules/@utilities/utilities.setEventEmit';
25
+ import { setWarning } from './@modules/@utilities/utilities.setWarning';
26
+ import { listener } from "./@core/core.listener"
27
+ import { startService } from "./@core/core.start"
28
+ import { stopService } from "./@core/core.stop"
29
+ import { setEasTone } from './@modules/@eas/eas.setEasTone';
30
+ import { setNode } from "./@core/core.setNode"
31
+ import { getEvents } from "./@core/core.getEvents"
32
+ import { getNodes } from "./@core/core.getNodes"
33
+ import { getRandomEvent } from './@core/core.getRandomEvent';
133
34
 
134
- /**
135
- * @function on
136
- * @description
137
- * Registers a callback for a specific event and returns a function
138
- * to unregister the listener.
139
- *
140
- * @param {string} event
141
- * @param {(...args: any[]) => void} callback
142
- * @returns {() => void}
143
- */
144
- public on(event: string, callback: (...args: any[]) => void): () => void {
145
- loader.cache.events.on(event, callback);
146
- return () => loader.cache.events.off(event, callback);
147
- }
35
+ export class Manager {
36
+ constructor(settings: TypeSettings) { this.trycatch(); startService(settings) }
148
37
 
149
- /**
150
- * @function start
151
- * @description
152
- * Initializes the client with the provided settings, starts the NWWS XMPP
153
- * session if applicable, loads cached messages, and sets up scheduled
154
- * tasks (cron jobs) for ongoing processing.
155
- *
156
- * @async
157
- * @param {types.ClientSettingsTypes} metadata
158
- * @returns {Promise<void>}
159
- */
160
- public async start(metadata: types.ClientSettingsTypes): Promise<void> {
161
- if (!loader.cache.isReady) {
162
- Utils.warn(loader.definitions.messages.not_ready);
163
- return;
164
- }
165
- this.setSettings(metadata);
166
- const settings = loader.settings as types.ClientSettingsTypes;
167
- this.isNoaaWeatherWireService = settings.is_wire;
168
- loader.cache.isReady = false;
169
- await Database.loadDatabase();
170
- if (this.isNoaaWeatherWireService) {
171
- (async () => {
172
- try {
173
- await Xmpp.deploySession();
174
- await Database.loadCollectionCache();
175
- } catch (err: unknown) {
176
- const msg = err instanceof Error ? err.message : String(err);
177
- Utils.warn(`Failed to initialize NWWS services: ${msg}`);
178
- }
179
- })();
180
- }
181
- Utils.handleCronJob(this.isNoaaWeatherWireService);
182
- if (this.job) {
183
- try { this.job.stop(); } catch { Utils.warn(`Failed to stop existing cron job.`); }
184
- this.job = null;
185
- }
186
- const interval = !this.isNoaaWeatherWireService ? settings.national_weather_service_settings.interval : 5;
187
- this.job = new loader.packages.jobs.Cron(`*/${interval} * * * * *`, () => {
188
- Utils.handleCronJob(this.isNoaaWeatherWireService);
189
- });
38
+ on(event: string, callback: () => void) {
39
+ listener(event, callback)
190
40
  }
191
41
 
192
- /**
193
- * @function stop
194
- * @description
195
- * Stops active scheduled tasks (cron job) and, if connected, the NWWS
196
- * XMPP session. Updates relevant cache flags to indicate the session
197
- * is no longer active.
198
- *
199
- * @async
200
- * @returns {Promise<void>}
201
- */
202
- public async stop(): Promise<void> {
203
- loader.cache.isReady = true;
204
- if (this.job) {
205
- try { this.job.stop(); } catch { Utils.warn(`Failed to stop cron job.`); }
206
- this.job = null;
207
- }
208
- const session = loader.cache.session;
209
- if (session && this.isNoaaWeatherWireService) {
210
- try { await session.stop(); } catch { Utils.warn(`Failed to stop XMPP session.`); }
211
- loader.cache.sigHalt = true;
212
- loader.cache.isConnected = false;
213
- loader.cache.session = null;
214
- this.isNoaaWeatherWireService = false;
215
- }
216
- }
217
-
218
- /**
219
- * @function sigCatch
220
- * @description
221
- * Sets up a global handler for uncaught exceptions, ignoring specific error codes
222
- *
223
- * @async
224
- * @returns void
225
- */
226
- private sigCatch() {
42
+ trycatch() {
227
43
  process.on('uncaughtException', (err: any) => {
228
44
  const ignored = ['ETIMEDOUT', 'ECONNRESET', 'EHOSTUNREACH', 'STARTTLS_FAILURE'];
229
45
  if (ignored.includes(err?.code)) {
230
- Utils.warn(`XMPP Critical Error: ${err?.code ?? 'Unknown error code'}. This may indicate a connection issue. Attempting to continue...`);
46
+ setEventEmit({
47
+ event: `onServiceStatus`,
48
+ metadata: {
49
+ message: `XMPP Critical Error: ${err?.code ?? 'Unknown error code'}. This may indicate a connection issue. Attempting to continue...`,
50
+ data: {},
51
+ type: `error`,
52
+ error: true
53
+ }
54
+ })
231
55
  return;
232
56
  }
233
- Utils.warn(`Uncaught Exception: ${err instanceof Error ? err.stack || err.message : String(err)}`);
57
+ setWarning({message: `Uncaught Exception: ${err instanceof Error ? err.stack || err.message : String(err)}`})
234
58
  })
235
59
  }
236
60
  }
237
61
 
238
62
  export default Manager;
239
- export type * as types from './types';
240
- export { StanzaParser, EventParser, TextParser, PVtecParser, HVtecParser, UGCParser, EAS, Database, Utils };
63
+ export type { TypeEvent } from './@types/type.event';
64
+ export {
65
+ setSettings, getEventGeometry,
66
+ getCleanedEvent, stopService,
67
+ startService, setNode, getRandomEvent,
68
+ getEvents, getNodes, setEasTone
69
+ }
70
+
71
+
package/test.js CHANGED
@@ -1,62 +1,89 @@
1
- const { AlertManager } = require(`@atmosx/event-product-parser`)
1
+ const { Manager, setSettings, getSettings, getListener } = require(`../dist/cjs/index.cjs`)
2
2
 
3
-
4
- const parser = new AlertManager({
5
- database: `shapefile-manager.db`,
6
- is_wire: true,
7
- journal: true,
8
- noaa_weather_wire_service_settings: {
9
- reconnection_settings: {
10
- enabled: true,
11
- interval: 60,
3
+ const NOAAWeatherWireService = new Manager({
4
+ Database: `shapefile-manager.db`,
5
+ EnableWireService: false,
6
+ EnableJournal: true,
7
+ NOAAWeatherWireServiceSettings: {
8
+ ReconnectionSettings: {
9
+ Enabled: true,
10
+ ReconnectionInterval: 60,
12
11
  },
13
- credentials: {
14
- username: `username123`,
15
- password: `password123`,
16
- nickname: "AtmosphericX Standalone Parser",
12
+ CredentialSettings: {
13
+ Username: `username`,
14
+ Password: `password`,
15
+ Nickname: "nickname (@atmosx/event-product-parser/3.0)",
17
16
  },
18
- cache: {
19
- enabled: false,
20
- max_db_history: 5000,
21
- max_db_cache_size: 1000,
17
+ CacheSettings: {
18
+ Enabled: true,
19
+ MaxDatabaseHistory: 5000,
20
+ MaxRetentionHistory: 555,
22
21
  },
23
- preferences: {
24
- disable_ugc: false,
25
- disable_vtec: false,
26
- disable_text: false,
27
- cap_only: false,
22
+ StanzaSettings: {
23
+ DisableUGC: false,
24
+ DisableVTEC: false,
25
+ DisableText: false,
28
26
  }
29
27
  },
30
- national_weather_service_settings: {
31
- interval: 15,
32
- endpoint: `https://api.weather.gov/alerts/active`,
28
+ NationalWeatherServiceSettings: {
29
+ CallbackInterval: 30,
30
+ EventsEndpoint: `https://api.weather.gov/alerts/active`,
33
31
  },
34
- global_settings: {
35
- parent_events_only: true,
36
- better_event_parsing: true,
37
- ignore_geometry_parsing: false,
38
- shapefile_coordinates: true,
39
- filtering: {
40
- events: [`Severe Thunderstorm Warning`],
41
- filtered_icao: ["PAFC"],
42
- ignored_icao: [],
43
- ignored_events: [`Xx`, `Test Message`],
44
- ugc_filter: [],
45
- state_filter: [],
46
- check_expired: true,
47
- ignore_test_products: true,
32
+ WebhookSettings: [
33
+ {
34
+ webhook: "https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
35
+ title: "AtmosphericX - (Severe Weather Events)",
36
+ message: `<@user_id>`,
37
+ events: [`Severe Thunderstorm Warning`, `Radar Indicated Tornado Warning`],
38
+ rate: 1,
48
39
  },
49
- eas_settings: {
50
- directory: null,
51
- intro_wav: null,
40
+ {
41
+ webhook: "https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
42
+ title: "AtmosphericX - (All Events)",
43
+ message: `<@user_id>`,
44
+ events: [],
45
+ rate: 5,
52
46
  }
53
- }
54
- })
55
-
56
- parser.on(`onEvents`, (alerts) => {
57
- for (const alert of alerts) {
58
- if (alert.geometry != null) {
59
- console.log(`[${ new Date(alert.properties.issued).toLocaleString()}] ${alert.properties.event} for ${alert.properties.locations} (ID: ${alert.properties.details.tracking})`);
47
+ ],
48
+ GlobalSettings: {
49
+ BetterEventNames: true,
50
+ DisableGeometryParsing: false,
51
+ UseShapefileCoordinates: true,
52
+ SPCWatchesOnly: true,
53
+ NodeTTL: 60,
54
+ NodeMinDistance: 120,
55
+ EventFiltering: {
56
+ ListeningEvents: [
57
+ "Tornado Emergency", "PDS Tornado Warning", "Tornado Warning",
58
+ "Confirmed Tornado Warning", "Radar Indicated Tornado Warning",
59
+ "Special Marine Warning (TPROB)", "PDS Tornado Watch", "Tornado Watch",
60
+ "EDS Severe Thunderstorm Warning (TPROB)", "EDS Severe Thunderstorm Warning",
61
+ "Destructive Severe Thunderstorm Warning (TPROB)", "Destructive Severe Thunderstorm Warning",
62
+ "Considerable Severe Thunderstorm Warning (TPROB)", "Considerable Severe Thunderstorm Warning",
63
+ "Severe Thunderstorm Warning (TPROB)", "Severe Thunderstorm Warning",
64
+ "Severe Thunderstorm Watch",
65
+ "Flash Flood Emergency", "Flash Flood Warning",
66
+ "Flash Flood Watch",
67
+ "Tsunami Warning", "Tsunami Watch",
68
+ "Tsunami Advisory", "Special Marine Warning",
69
+ "Earthquake Warning",
70
+ "Hurricane Warning", "Hurricane Watch",
71
+ "Tropical Storm Warning",
72
+ "Winter Storm Warning", "Blizzard Warning",
73
+ "Ice Storm Warning", "Snow Squall Warning",
74
+ "Winter Weather Advisory", "Extreme Cold Watch"
75
+ ],
76
+ ListeningICAO: [],
77
+ IgnoredICAO: [],
78
+ IgnoredEvents: [],
79
+ ListeningUGC: [],
80
+ ListeningStates: [],
81
+ NodeLocationFiltering: false,
82
+ IgnoreTestProducts: true,
83
+ },
84
+ EASSettings: {
85
+ ArchiveDirectory: null,
86
+ IntroWavFile: null,
60
87
  }
61
88
  }
62
- });
89
+ })
package/tsup.config.ts CHANGED
@@ -4,6 +4,7 @@ export default defineConfig({
4
4
  entry: ['src/index.ts'],
5
5
  outDir: 'dist',
6
6
  format: ['esm', 'cjs'],
7
+ dts: true,
7
8
  noExternal: ["@xmpp/client", "@xmpp/sasl", "@xmpp/sasl-plain"],
8
9
  clean: true,
9
10
  outExtension({ format }) {
@@ -1,168 +0,0 @@
1
- /*
2
- _ _ __ __
3
- /\ | | | | (_) \ \ / /
4
- / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
- / /\ \| __| "_ ` _ \ / _ \/ __| "_ \| "_ \ / _ \ "__| |/ __| > <
6
- / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
- /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
- | |
9
- |_|
10
-
11
- Written by: KiyoWx (k3yomi)
12
- */
13
-
14
- export const events: Record<string, string> = {
15
- "AF": "Ashfall",
16
- "AS": "Air Stagnation",
17
- "BH": "Beach Hazard",
18
- "BW": "Brisk Wind",
19
- "BZ": "Blizzard",
20
- "CF": "Coastal Flood",
21
- "DF": "Debris Flow",
22
- "DS": "Dust Storm",
23
- "EC": "Extreme Cold",
24
- "EH": "Excessive Heat",
25
- "XH": "Extreme Heat",
26
- "EW": "Extreme Wind",
27
- "FA": "Areal Flood",
28
- "FF": "Flash Flood",
29
- "FG": "Dense Fog",
30
- "FL": "Flood",
31
- "FR": "Frost",
32
- "FW": "Fire Weather",
33
- "FZ": "Freeze",
34
- "GL": "Gale",
35
- "HF": "Hurricane Force Wind",
36
- "HT": "Heat",
37
- "HU": "Hurricane",
38
- "HW": "High Wind",
39
- "HY": "Hydrologic",
40
- "HZ": "Hard Freeze",
41
- "IS": "Ice Storm",
42
- "LE": "Lake Effect Snow",
43
- "LO": "Low Water",
44
- "LS": "Lakeshore Flood",
45
- "LW": "Lake Wind",
46
- "MA": "Special Marine",
47
- "EQ": "Earthquake",
48
- "MF": "Dense Fog",
49
- "MH": "Ashfall",
50
- "MS": "Dense Smoke",
51
- "RB": "Small Craft for Rough Bar",
52
- "RP": "Rip Current Risk",
53
- "SC": "Small Craft",
54
- "SE": "Hazardous Seas",
55
- "SI": "Small Craft for Winds",
56
- "SM": "Dense Smoke",
57
- "SQ": "Snow Squall",
58
- "SR": "Storm",
59
- "SS": "Storm Surge",
60
- "SU": "High Surf",
61
- "SV": "Severe Thunderstorm",
62
- "SW": "Small Craft for Hazardous Seas",
63
- "TO": "Tornado",
64
- "TR": "Tropical Storm",
65
- "TS": "Tsunami",
66
- "TY": "Typhoon",
67
- "SP": "Special Weather",
68
- "UP": "Heavy Freezing Spray",
69
- "WC": "Wind Chill",
70
- "WI": "Wind",
71
- "WS": "Winter Storm",
72
- "WW": "Winter Weather",
73
- "ZF": "Freezing Fog",
74
- "ZR": "Freezing Rain",
75
- "ZY": "Freezing Spray"
76
- };
77
-
78
- export const offshore: Record<string, string> = {
79
- "Special Weather Statement": "Special Weather Statement",
80
- "Hurricane Warning": "Hurricane Warning",
81
- "Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
82
- "Hurricane Watch": "Hurricane Watch",
83
- "Tropical Storm Warning": "Tropical Storm Warning",
84
- "Tropical Storm Watch": "Tropical Storm Watch",
85
- "High Wind Warning": "High Wind Warning",
86
- "Gale Warning": "Gale Warning",
87
- "Small Craft Advisory": "Small Craft Advisory",
88
- "Small Craft Warning": "Small Craft Warning",
89
- };
90
-
91
- export const actions: Record<string, string> = {
92
- "W": "Warning",
93
- "F": "Forecast",
94
- "A": "Watch",
95
- "O": "Outlook",
96
- "Y": "Advisory",
97
- "N": "Synopsis",
98
- "S": "Statement"
99
- }
100
-
101
-
102
- export const status: Record<string, string> = {
103
- "NEW": "Issued",
104
- "CON": "Updated",
105
- "EXT": "Extended",
106
- "EXA": "Extended",
107
- "EXB": "Extended",
108
- "UPG": "Upgraded",
109
- "COR": "Correction",
110
- "ROU": "Routine",
111
- "CAN": "Cancelled",
112
- "EXP": "Expired"
113
- }
114
-
115
- export const types: Record<string, string> = {
116
- "O": "Operational Product",
117
- "T": "Test Product",
118
- "E": "Experimental Product",
119
- "X": "Experimental Product (Non-Operational)",
120
- }
121
-
122
- export const status_correlations: {type: string, forward: string, cancel: boolean, update: boolean, new: boolean}[] = [
123
- {type: "Update", forward: "Updated", cancel: false, update: true, new: false},
124
- {type: "Cancel", forward: "Cancelled", cancel: true, update: false, new: false},
125
- {type: "Alert", forward: "Issued", cancel: false, update: false, new: true},
126
- {type: "Updated", forward: "Updated", cancel: false, update: true, new: false},
127
- {type: "Expired", forward: "Expired", cancel: true, update: false, new: false},
128
- {type: "Issued", forward: "Issued", cancel: false, update: false, new: true},
129
- {type: "Extended", forward: "Updated", cancel: false, update: true, new: false},
130
- {type: "Correction", forward: "Updated", cancel: false, update: true, new: false},
131
- {type: "Upgraded", forward: "Upgraded", cancel: false, update: true, new: false},
132
- {type: "Cancelled", forward: "Cancelled", cancel: true, update: false, new: false},
133
- {type: "Routine", forward: "Routine", cancel: false, update: true, new: false},
134
- ]
135
-
136
- export const causes : Record<string, string> = {
137
- "SM": "Snow Melt",
138
- "RS": "Rain/Snow Melt",
139
- "ER": "Excessive Rain",
140
- "DM": "Dam/Levee Failure",
141
- "IJ": "Ice Jam",
142
- "GO": "Glacier Lake Outburst",
143
- "IC": "Ice",
144
- "FS": "Flash Flood / Storm Surge",
145
- "FT": "Tidal Effects",
146
- "ET": "Elevated Upstream Flow",
147
- "MC": "Other Multiple Causes",
148
- "WT": "Wind and/or Tidal Effects",
149
- "DR": "Reservoir Release",
150
- "UU": "Unknown",
151
- "OT": "Other Effects"
152
- }
153
-
154
- export const records: Record<string, string> = {
155
- "NO": "No Record Expected",
156
- "NR": "Near Record or possible record",
157
- "UU": "Unknown history of records",
158
- "OO": "Other",
159
- }
160
-
161
- export const severity: Record<string, string> = {
162
- N: "Not Expected",
163
- 0: "Areal Flood or FF Product",
164
- 1: "Minor",
165
- 2: "Moderate",
166
- 3: "Major",
167
- U: "Unknown",
168
- }