@atmosx/event-product-parser 2.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.
- package/LICENSE +17 -0
- package/README.md +269 -0
- package/dist/cjs/index.cjs +7554 -0
- package/dist/esm/index.mjs +7542 -0
- package/dist/index.d.mts +1024 -0
- package/dist/index.d.ts +1024 -0
- package/package.json +55 -0
- package/src/@dictionaries/awips.ts +358 -0
- package/src/@dictionaries/events.ts +168 -0
- package/src/@dictionaries/icao.ts +250 -0
- package/src/@dictionaries/signatures.ts +139 -0
- package/src/@parsers/@events/api.ts +146 -0
- package/src/@parsers/@events/cap.ts +123 -0
- package/src/@parsers/@events/text.ts +104 -0
- package/src/@parsers/@events/ugc.ts +107 -0
- package/src/@parsers/@events/vtec.ts +76 -0
- package/src/@parsers/events.ts +392 -0
- package/src/@parsers/hvtec.ts +46 -0
- package/src/@parsers/pvtec.ts +72 -0
- package/src/@parsers/stanza.ts +97 -0
- package/src/@parsers/text.ts +165 -0
- package/src/@parsers/ugc.ts +247 -0
- package/src/@submodules/database.ts +162 -0
- package/src/@submodules/eas.ts +490 -0
- package/src/@submodules/utils.ts +222 -0
- package/src/@submodules/xmpp.ts +142 -0
- package/src/bootstrap.ts +190 -0
- package/src/index.ts +218 -0
- package/src/types.ts +259 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1024 @@
|
|
|
1
|
+
interface LocalEasSettings {
|
|
2
|
+
directory?: string;
|
|
3
|
+
intro_wav?: string;
|
|
4
|
+
}
|
|
5
|
+
interface LocalAlertFilteringSettings {
|
|
6
|
+
events?: string[];
|
|
7
|
+
filtered_icao?: string[];
|
|
8
|
+
ignored_icao?: string[];
|
|
9
|
+
ugc_filter?: string[];
|
|
10
|
+
state_filter?: string[];
|
|
11
|
+
ignored_events?: string[];
|
|
12
|
+
check_expired?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface LocalGlobalSettings {
|
|
15
|
+
parent_events_only?: boolean;
|
|
16
|
+
better_event_parsing?: boolean;
|
|
17
|
+
shapefile_coordinates?: boolean;
|
|
18
|
+
shapefile_skip?: number;
|
|
19
|
+
eas_settings?: LocalEasSettings;
|
|
20
|
+
filtering?: LocalAlertFilteringSettings;
|
|
21
|
+
}
|
|
22
|
+
interface LocalClientReconnectionSettings {
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
interval?: number;
|
|
25
|
+
}
|
|
26
|
+
interface LocalClientCredentialSettings {
|
|
27
|
+
username?: string;
|
|
28
|
+
password?: string;
|
|
29
|
+
nickname?: string;
|
|
30
|
+
}
|
|
31
|
+
interface LocalCacheSettings {
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
max_db_history?: number;
|
|
34
|
+
use_db_for_cache?: boolean;
|
|
35
|
+
max_db_cache_size?: number;
|
|
36
|
+
}
|
|
37
|
+
interface LocalAlertPreferenceSettings {
|
|
38
|
+
disable_ugc?: boolean;
|
|
39
|
+
disable_vtec?: boolean;
|
|
40
|
+
disable_text?: boolean;
|
|
41
|
+
cap_only?: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface LocalNoaaWeatherWireServiceSettings {
|
|
44
|
+
reconnection_settings?: LocalClientReconnectionSettings;
|
|
45
|
+
credentials?: LocalClientCredentialSettings;
|
|
46
|
+
cache?: LocalCacheSettings;
|
|
47
|
+
preferences?: LocalAlertPreferenceSettings;
|
|
48
|
+
}
|
|
49
|
+
interface LocalNationalWeatherServiceSettings {
|
|
50
|
+
interval?: number;
|
|
51
|
+
endpoint?: string;
|
|
52
|
+
}
|
|
53
|
+
interface ClientSettingsTypes {
|
|
54
|
+
database?: string;
|
|
55
|
+
is_wire?: boolean;
|
|
56
|
+
journal?: boolean;
|
|
57
|
+
noaa_weather_wire_service_settings?: LocalNoaaWeatherWireServiceSettings;
|
|
58
|
+
national_weather_service_settings?: LocalNationalWeatherServiceSettings;
|
|
59
|
+
global_settings?: LocalGlobalSettings;
|
|
60
|
+
}
|
|
61
|
+
interface LocalEventHistory {
|
|
62
|
+
description?: string;
|
|
63
|
+
issued?: string;
|
|
64
|
+
type?: string;
|
|
65
|
+
}
|
|
66
|
+
interface LocalEventParameters {
|
|
67
|
+
wmo?: string;
|
|
68
|
+
source?: string;
|
|
69
|
+
max_hail_size?: string;
|
|
70
|
+
max_wind_gust?: string;
|
|
71
|
+
damage_threat?: string;
|
|
72
|
+
tornado_detection?: string;
|
|
73
|
+
flood_detection?: string;
|
|
74
|
+
discussion_tornado_intensity?: string;
|
|
75
|
+
discussion_wind_intensity?: string;
|
|
76
|
+
discussion_hail_intensity?: string;
|
|
77
|
+
WMOidentifier?: string[];
|
|
78
|
+
VTEC?: string;
|
|
79
|
+
maxHailSize?: string;
|
|
80
|
+
maxWindGust?: string;
|
|
81
|
+
thunderstormDamageThreat?: string[];
|
|
82
|
+
tornadoDetection?: string[];
|
|
83
|
+
waterspoutDetection?: string[];
|
|
84
|
+
floodDetection?: string[];
|
|
85
|
+
AWIPSidentifier?: string[];
|
|
86
|
+
NWSheadline?: string[];
|
|
87
|
+
}
|
|
88
|
+
interface LocalEventProperties {
|
|
89
|
+
parent?: string;
|
|
90
|
+
event?: string;
|
|
91
|
+
locations?: string;
|
|
92
|
+
issued?: string;
|
|
93
|
+
expires?: string;
|
|
94
|
+
geocode?: {
|
|
95
|
+
UGC: string[];
|
|
96
|
+
generated?: string | null;
|
|
97
|
+
};
|
|
98
|
+
description?: string;
|
|
99
|
+
instruction?: string;
|
|
100
|
+
sender_name?: string;
|
|
101
|
+
sender_icao?: string;
|
|
102
|
+
raw?: DefaultAttributesType;
|
|
103
|
+
parameters?: LocalEventParameters;
|
|
104
|
+
messageType?: string;
|
|
105
|
+
sent?: string;
|
|
106
|
+
areaDesc?: string;
|
|
107
|
+
action_type?: string;
|
|
108
|
+
is_updated?: boolean;
|
|
109
|
+
is_cancelled?: boolean;
|
|
110
|
+
is_issued?: boolean;
|
|
111
|
+
is_test?: boolean;
|
|
112
|
+
hash?: string;
|
|
113
|
+
tags?: string[];
|
|
114
|
+
details?: Record<string, any>;
|
|
115
|
+
}
|
|
116
|
+
interface StanzaAttributesType {
|
|
117
|
+
xmlns?: string;
|
|
118
|
+
id?: string;
|
|
119
|
+
issue?: string;
|
|
120
|
+
ttaaii?: string;
|
|
121
|
+
cccc?: string;
|
|
122
|
+
awipsid?: string;
|
|
123
|
+
}
|
|
124
|
+
interface DefaultAttributesType {
|
|
125
|
+
attributes?: {
|
|
126
|
+
xmlns?: string;
|
|
127
|
+
id?: string;
|
|
128
|
+
issue?: string;
|
|
129
|
+
ttaaii?: string;
|
|
130
|
+
cccc?: string;
|
|
131
|
+
awipsid?: string;
|
|
132
|
+
};
|
|
133
|
+
getAwip?: Record<string, string>;
|
|
134
|
+
awipsType?: Record<string, string>;
|
|
135
|
+
isCap?: boolean;
|
|
136
|
+
raw?: boolean;
|
|
137
|
+
}
|
|
138
|
+
interface StanzaCompiled {
|
|
139
|
+
message?: string;
|
|
140
|
+
attributes?: DefaultAttributesType;
|
|
141
|
+
isCap?: boolean;
|
|
142
|
+
isApi?: boolean;
|
|
143
|
+
isCapDescription?: boolean;
|
|
144
|
+
isPVtec?: boolean;
|
|
145
|
+
isUGC?: boolean;
|
|
146
|
+
getAwip?: Record<string, string>;
|
|
147
|
+
awipsType?: Record<string, string>;
|
|
148
|
+
awipsPrefix?: string;
|
|
149
|
+
ignore?: boolean;
|
|
150
|
+
awipsid?: string;
|
|
151
|
+
}
|
|
152
|
+
interface PVtecEntry {
|
|
153
|
+
raw?: string;
|
|
154
|
+
type?: string;
|
|
155
|
+
tracking?: string;
|
|
156
|
+
event?: string;
|
|
157
|
+
status?: string;
|
|
158
|
+
wmo?: string;
|
|
159
|
+
expires?: Date | string;
|
|
160
|
+
isKWNS?: boolean;
|
|
161
|
+
}
|
|
162
|
+
interface UGCEntry {
|
|
163
|
+
zones?: string[];
|
|
164
|
+
locations?: string[];
|
|
165
|
+
expiry?: Date | string;
|
|
166
|
+
polygon?: [number, number][];
|
|
167
|
+
}
|
|
168
|
+
interface HVtecEntry {
|
|
169
|
+
severity?: string;
|
|
170
|
+
cause?: string;
|
|
171
|
+
record?: string;
|
|
172
|
+
raw?: string;
|
|
173
|
+
}
|
|
174
|
+
interface geometry {
|
|
175
|
+
type?: string;
|
|
176
|
+
coordinates?: [number, number][];
|
|
177
|
+
}
|
|
178
|
+
interface EventCompiled {
|
|
179
|
+
performance?: number;
|
|
180
|
+
id?: string;
|
|
181
|
+
tracking?: string;
|
|
182
|
+
header?: string;
|
|
183
|
+
pvtec?: string;
|
|
184
|
+
hvtec?: string;
|
|
185
|
+
history?: LocalEventHistory[];
|
|
186
|
+
properties?: LocalEventProperties;
|
|
187
|
+
geometry?: {
|
|
188
|
+
type?: string;
|
|
189
|
+
coordinates?: [number, number][];
|
|
190
|
+
} | null;
|
|
191
|
+
}
|
|
192
|
+
type EventProperties = LocalEventProperties;
|
|
193
|
+
type StanzaAttributes = DefaultAttributesType;
|
|
194
|
+
type Coordinates = {
|
|
195
|
+
lon: number;
|
|
196
|
+
lat: number;
|
|
197
|
+
};
|
|
198
|
+
type HTTPSettings = {
|
|
199
|
+
timeout?: number;
|
|
200
|
+
headers?: Record<string, string>;
|
|
201
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
202
|
+
body?: string;
|
|
203
|
+
};
|
|
204
|
+
interface EnhancedEventCondition {
|
|
205
|
+
description?: string;
|
|
206
|
+
condition?: (value: string) => boolean;
|
|
207
|
+
}
|
|
208
|
+
interface GenericHTTPResponse {
|
|
209
|
+
error?: boolean;
|
|
210
|
+
message?: {
|
|
211
|
+
features: Record<string, any>[];
|
|
212
|
+
} | string;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
type types_ClientSettingsTypes = ClientSettingsTypes;
|
|
216
|
+
type types_Coordinates = Coordinates;
|
|
217
|
+
type types_DefaultAttributesType = DefaultAttributesType;
|
|
218
|
+
type types_EnhancedEventCondition = EnhancedEventCondition;
|
|
219
|
+
type types_EventCompiled = EventCompiled;
|
|
220
|
+
type types_EventProperties = EventProperties;
|
|
221
|
+
type types_GenericHTTPResponse = GenericHTTPResponse;
|
|
222
|
+
type types_HTTPSettings = HTTPSettings;
|
|
223
|
+
type types_HVtecEntry = HVtecEntry;
|
|
224
|
+
type types_PVtecEntry = PVtecEntry;
|
|
225
|
+
type types_StanzaAttributes = StanzaAttributes;
|
|
226
|
+
type types_StanzaAttributesType = StanzaAttributesType;
|
|
227
|
+
type types_StanzaCompiled = StanzaCompiled;
|
|
228
|
+
type types_UGCEntry = UGCEntry;
|
|
229
|
+
type types_geometry = geometry;
|
|
230
|
+
declare namespace types {
|
|
231
|
+
export type { types_ClientSettingsTypes as ClientSettingsTypes, types_Coordinates as Coordinates, types_DefaultAttributesType as DefaultAttributesType, types_EnhancedEventCondition as EnhancedEventCondition, types_EventCompiled as EventCompiled, types_EventProperties as EventProperties, types_GenericHTTPResponse as GenericHTTPResponse, types_HTTPSettings as HTTPSettings, types_HVtecEntry as HVtecEntry, types_PVtecEntry as PVtecEntry, types_StanzaAttributes as StanzaAttributes, types_StanzaAttributesType as StanzaAttributesType, types_StanzaCompiled as StanzaCompiled, types_UGCEntry as UGCEntry, types_geometry as geometry };
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
declare class Utils {
|
|
235
|
+
/**
|
|
236
|
+
* @function sleep
|
|
237
|
+
* @description
|
|
238
|
+
* Pauses execution for a specified number of milliseconds.
|
|
239
|
+
*
|
|
240
|
+
* @static
|
|
241
|
+
* @async
|
|
242
|
+
* @param {number} ms
|
|
243
|
+
* @returns {Promise<void>}
|
|
244
|
+
*/
|
|
245
|
+
static sleep(ms: number): Promise<void>;
|
|
246
|
+
/**
|
|
247
|
+
* @function warn
|
|
248
|
+
* @description
|
|
249
|
+
* Emits a log event and prints a warning to the console. Throttles repeated
|
|
250
|
+
* warnings within a short interval unless `force` is `true`.
|
|
251
|
+
*
|
|
252
|
+
* @static
|
|
253
|
+
* @param {string} message
|
|
254
|
+
* @param {boolean} [force=false]
|
|
255
|
+
* @returns {void}
|
|
256
|
+
*/
|
|
257
|
+
static warn(message: string, force?: boolean): void;
|
|
258
|
+
/**
|
|
259
|
+
* @function loadCollectionCache
|
|
260
|
+
* @description
|
|
261
|
+
* Loads cached stanzas from the database, validates them, and processes them through the event parser.
|
|
262
|
+
* Only processes stanzas that are not marked to be ignored and match the CAP preferences.
|
|
263
|
+
*
|
|
264
|
+
* @static
|
|
265
|
+
* @async
|
|
266
|
+
* @returns {Promise<void>}
|
|
267
|
+
*/
|
|
268
|
+
static loadCollectionCache(): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* @function loadGeoJsonData
|
|
271
|
+
* @description
|
|
272
|
+
* Fetches GeoJSON data from the National Weather Service endpoint and
|
|
273
|
+
* passes it to the event parser for processing.
|
|
274
|
+
*
|
|
275
|
+
* @static
|
|
276
|
+
* @async
|
|
277
|
+
* @returns {Promise<void>}
|
|
278
|
+
*/
|
|
279
|
+
static loadGeoJsonData(): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* @function createHttpRequest
|
|
282
|
+
* @description
|
|
283
|
+
* Performs an HTTP GET request with default headers and timeout, returning
|
|
284
|
+
* either the response data or an error message.
|
|
285
|
+
*
|
|
286
|
+
* @static
|
|
287
|
+
* @template T
|
|
288
|
+
* @param {string} url
|
|
289
|
+
* @param {types.HTTPSettings} [options]
|
|
290
|
+
* @returns {Promise<{ error: boolean; message: T | string }>}
|
|
291
|
+
*/
|
|
292
|
+
static createHttpRequest<T = unknown>(url: string, options?: HTTPSettings): Promise<{
|
|
293
|
+
error: boolean;
|
|
294
|
+
message: T | string;
|
|
295
|
+
}>;
|
|
296
|
+
/**
|
|
297
|
+
* @function handleCronJob
|
|
298
|
+
* @description
|
|
299
|
+
* Performs scheduled tasks for NWWS XMPP session maintenance or GeoJSON data
|
|
300
|
+
* updates depending on the job type.
|
|
301
|
+
*
|
|
302
|
+
* @static
|
|
303
|
+
* @param {boolean} isWire
|
|
304
|
+
* @returns {void}
|
|
305
|
+
*/
|
|
306
|
+
static handleCronJob(isWire: boolean): void;
|
|
307
|
+
/**
|
|
308
|
+
* @function mergeClientSettings
|
|
309
|
+
* @description
|
|
310
|
+
* Recursively merges a ClientSettings object into a target object,
|
|
311
|
+
* preserving nested structures and overriding existing values.
|
|
312
|
+
*
|
|
313
|
+
* @static
|
|
314
|
+
* @param {Record<string, unknown>} target
|
|
315
|
+
* @param {types.ClientSettingsTypes} settings
|
|
316
|
+
* @returns {Record<string, unknown>}
|
|
317
|
+
*/
|
|
318
|
+
static mergeClientSettings(target: Record<string, unknown>, settings: ClientSettingsTypes): Record<string, unknown>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
declare class EAS {
|
|
322
|
+
/**
|
|
323
|
+
* @function generateEASAudio
|
|
324
|
+
* @description
|
|
325
|
+
* Generates an EAS (Emergency Alert System) audio file for a given message
|
|
326
|
+
* and SAME/VTEC code. The audio is composed of optional intro tones, SAME
|
|
327
|
+
* headers, attention tones, TTS narration of the message, and repeated
|
|
328
|
+
* SAME headers. The resulting audio is processed for NWR-style broadcast
|
|
329
|
+
* quality and saved as a WAV file.
|
|
330
|
+
*
|
|
331
|
+
* @static
|
|
332
|
+
* @async
|
|
333
|
+
* @param {string} message
|
|
334
|
+
* @param {string} header
|
|
335
|
+
* @returns {Promise<string | null>}
|
|
336
|
+
*/
|
|
337
|
+
static generateEASAudio(message: string, header: string): Promise<string | null>;
|
|
338
|
+
/**
|
|
339
|
+
* @function encodeWavPCM16
|
|
340
|
+
* @description
|
|
341
|
+
* Encodes an array of 16-bit PCM samples into a standard WAV file buffer.
|
|
342
|
+
* Produces mono audio with 16 bits per sample and a specified sample rate.
|
|
343
|
+
*
|
|
344
|
+
* The input `samples` array should be an array of objects containing a
|
|
345
|
+
* numeric `value` property representing the PCM sample.
|
|
346
|
+
*
|
|
347
|
+
* @private
|
|
348
|
+
* @static
|
|
349
|
+
* @param {Record<string, number>[]} samples
|
|
350
|
+
* @param {number} [sampleRate=8000]
|
|
351
|
+
* @returns {Buffer}
|
|
352
|
+
*/
|
|
353
|
+
private static encodeWavPCM16;
|
|
354
|
+
/**
|
|
355
|
+
* @function parseWavPCM16
|
|
356
|
+
* @description
|
|
357
|
+
* Parses a WAV buffer containing 16-bit PCM mono audio and extracts
|
|
358
|
+
* the sample data along with format information.
|
|
359
|
+
*
|
|
360
|
+
* Only supports PCM format (audioFormat = 1), 16 bits per sample,
|
|
361
|
+
* and single-channel (mono) audio. Returns `null` if the buffer
|
|
362
|
+
* is invalid or does not meet these requirements.
|
|
363
|
+
*
|
|
364
|
+
* @private
|
|
365
|
+
* @static
|
|
366
|
+
* @param {Buffer} buffer
|
|
367
|
+
* @returns { { samples: Int16Array; sampleRate: number; channels: number; bitsPerSample: number } | null }
|
|
368
|
+
*/
|
|
369
|
+
private static parseWavPCM16;
|
|
370
|
+
/**
|
|
371
|
+
* @function concatPCM16
|
|
372
|
+
* @description
|
|
373
|
+
* Concatenates multiple Int16Array PCM audio buffers into a single
|
|
374
|
+
* contiguous Int16Array.
|
|
375
|
+
*
|
|
376
|
+
* @private
|
|
377
|
+
* @static
|
|
378
|
+
* @param {Int16Array[]} arrays
|
|
379
|
+
* @returns {Int16Array}
|
|
380
|
+
*/
|
|
381
|
+
private static concatPCM16;
|
|
382
|
+
/**
|
|
383
|
+
* @function pcm16toFloat
|
|
384
|
+
* @description
|
|
385
|
+
* Converts a PCM16 Int16Array audio buffer to a Float32Array
|
|
386
|
+
* with normalized values in the range [-1, 1).
|
|
387
|
+
*
|
|
388
|
+
* @private
|
|
389
|
+
* @static
|
|
390
|
+
* @param {Int16Array} int16
|
|
391
|
+
* @returns {Float32Array}
|
|
392
|
+
*/
|
|
393
|
+
private static pcm16toFloat;
|
|
394
|
+
/**
|
|
395
|
+
* @function floatToPcm16
|
|
396
|
+
* @description
|
|
397
|
+
* Converts a Float32Array of audio samples in the range [-1, 1]
|
|
398
|
+
* to a PCM16 Int16Array.
|
|
399
|
+
*
|
|
400
|
+
* @private
|
|
401
|
+
* @static
|
|
402
|
+
* @param {Float32Array} float32
|
|
403
|
+
* @returns {Int16Array}
|
|
404
|
+
*/
|
|
405
|
+
private static floatToPcm16;
|
|
406
|
+
/**
|
|
407
|
+
* @function resamplePCM16
|
|
408
|
+
* @description
|
|
409
|
+
* Resamples a PCM16 audio buffer from an original sample rate to a
|
|
410
|
+
* target sample rate using linear interpolation.
|
|
411
|
+
*
|
|
412
|
+
* @private
|
|
413
|
+
* @static
|
|
414
|
+
* @param {Int16Array} int16
|
|
415
|
+
* @param {number} originalRate
|
|
416
|
+
* @param {number} targetRate
|
|
417
|
+
* @returns {Int16Array}
|
|
418
|
+
*/
|
|
419
|
+
private static resamplePCM16;
|
|
420
|
+
/**
|
|
421
|
+
* @function generateSilence
|
|
422
|
+
* @description
|
|
423
|
+
* Generates a PCM16 audio buffer containing silence for a specified
|
|
424
|
+
* duration.
|
|
425
|
+
*
|
|
426
|
+
* @private
|
|
427
|
+
* @static
|
|
428
|
+
* @param {number} ms
|
|
429
|
+
* @param {number} [sampleRate=8000]
|
|
430
|
+
* @returns {Int16Array}
|
|
431
|
+
*/
|
|
432
|
+
private static generateSilence;
|
|
433
|
+
/**
|
|
434
|
+
* @function generateAttentionTone
|
|
435
|
+
* @description
|
|
436
|
+
* Generates a dual-frequency Attention Tone (853 Hz and 960 Hz) used in
|
|
437
|
+
* EAS/SAME alerts. Produces a PCM16 buffer of the specified duration.
|
|
438
|
+
*
|
|
439
|
+
* @private
|
|
440
|
+
* @static
|
|
441
|
+
* @param {number} ms
|
|
442
|
+
* @param {number} [sampleRate=8000]
|
|
443
|
+
* @returns {Int16Array}
|
|
444
|
+
*/
|
|
445
|
+
private static generateAttentionTone;
|
|
446
|
+
/**
|
|
447
|
+
* @function applyNWREffect
|
|
448
|
+
* @description
|
|
449
|
+
* Applies a National Weather Radio (NWR)-style audio effect to a PCM16
|
|
450
|
+
* buffer, including high-pass and low-pass filtering, soft clipping
|
|
451
|
+
* compression, and optional bit reduction to simulate vintage broadcast
|
|
452
|
+
* characteristics.
|
|
453
|
+
*
|
|
454
|
+
* @private
|
|
455
|
+
* @static
|
|
456
|
+
* @param {Int16Array} int16
|
|
457
|
+
* @param {number} [sampleRate=8000]
|
|
458
|
+
* @returns {Int16Array}
|
|
459
|
+
*/
|
|
460
|
+
private static applyNWREffect;
|
|
461
|
+
/**
|
|
462
|
+
* @function addNoise
|
|
463
|
+
* @description
|
|
464
|
+
* Adds random noise to a PCM16 audio buffer and normalizes the signal
|
|
465
|
+
* to prevent clipping. Useful for simulating real-world signal conditions
|
|
466
|
+
* or reducing digital artifacts.
|
|
467
|
+
*
|
|
468
|
+
* @private
|
|
469
|
+
* @static
|
|
470
|
+
* @param {Int16Array} int16
|
|
471
|
+
* @param {number} [noiseLevel=0.02]
|
|
472
|
+
* @returns {Int16Array}
|
|
473
|
+
*/
|
|
474
|
+
private static addNoise;
|
|
475
|
+
/**
|
|
476
|
+
* @function asciiTo8N1Bits
|
|
477
|
+
* @description
|
|
478
|
+
* Converts an ASCII string into a sequence of bits using the 8N1 framing
|
|
479
|
+
* convention (1 start bit, 8 data bits, 2 stop bits) commonly used in
|
|
480
|
+
* serial and EAS transmissions.
|
|
481
|
+
*
|
|
482
|
+
* @private
|
|
483
|
+
* @static
|
|
484
|
+
* @param {string} str
|
|
485
|
+
* @returns {number[]}
|
|
486
|
+
*/
|
|
487
|
+
private static asciiTo8N1Bits;
|
|
488
|
+
/**
|
|
489
|
+
* @function generateAFSK
|
|
490
|
+
* @description
|
|
491
|
+
* Converts a sequence of bits into AFSK-modulated PCM16 audio data for EAS
|
|
492
|
+
* alerts. Applies a fade-in and fade-out to reduce clicks and generates
|
|
493
|
+
* the audio at the specified sample rate.
|
|
494
|
+
*
|
|
495
|
+
* @private
|
|
496
|
+
* @static
|
|
497
|
+
* @param {number[]} bits
|
|
498
|
+
* @param {number} [sampleRate=8000]
|
|
499
|
+
* @returns {Int16Array}
|
|
500
|
+
*/
|
|
501
|
+
private static generateAFSK;
|
|
502
|
+
/**
|
|
503
|
+
* @function generateSAMEHeader
|
|
504
|
+
* @description
|
|
505
|
+
* Generates a SAME (Specific Area Message Encoding) audio header for
|
|
506
|
+
* EAS alerts. Converts a VTEC string into AFSK-modulated PCM16 audio,
|
|
507
|
+
* optionally repeating the signal with pre-mark and gap intervals.
|
|
508
|
+
*
|
|
509
|
+
* @private
|
|
510
|
+
* @static
|
|
511
|
+
* @param {string} vtec
|
|
512
|
+
* @param {number} repeats
|
|
513
|
+
* @param {number} [sampleRate=8000]
|
|
514
|
+
* @param {{preMarkSec?: number, gapSec?: number}} [options={}]
|
|
515
|
+
* @returns {Int16Array}
|
|
516
|
+
*/
|
|
517
|
+
private static generateSAMEHeader;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
declare class Database {
|
|
521
|
+
/**
|
|
522
|
+
* @function stanzaCacheImport
|
|
523
|
+
* @description
|
|
524
|
+
* Inserts a single NWWS stanza into the database cache. If the total number
|
|
525
|
+
* of stanzas exceeds the configured maximum history, it deletes the oldest
|
|
526
|
+
* entries to maintain the limit. Duplicate stanzas are ignored.
|
|
527
|
+
*
|
|
528
|
+
* @static
|
|
529
|
+
* @async
|
|
530
|
+
* @param {string} stanza - The raw stanza XML or text to store in the database.
|
|
531
|
+
* @returns {Promise<void>} - Resolves when the stanza has been inserted and any necessary pruning of old stanzas has been performed.
|
|
532
|
+
*/
|
|
533
|
+
static stanzaCacheImport(stanza: Record<string, any>): Promise<void>;
|
|
534
|
+
/**
|
|
535
|
+
* @function loadDatabase
|
|
536
|
+
* @description
|
|
537
|
+
* Initializes the application's SQLite database, creating necessary tables
|
|
538
|
+
* for storing stanzas and shapefiles. If the shapefiles table is empty,
|
|
539
|
+
* it imports predefined shapefiles from disk, processes their features,
|
|
540
|
+
* and populates the database. Emits warnings during the import process.
|
|
541
|
+
*
|
|
542
|
+
* @static
|
|
543
|
+
* @async
|
|
544
|
+
* @returns {Promise<void>} - Resolves when the database has been initialized and shapefiles have been imported if necessary.
|
|
545
|
+
*/
|
|
546
|
+
static loadDatabase(): Promise<void>;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
declare class StanzaParser {
|
|
550
|
+
/**
|
|
551
|
+
* @function validate
|
|
552
|
+
* @description
|
|
553
|
+
* Validates and parses a stanza message, extracting its attributes and metadata.
|
|
554
|
+
* Handles both raw message strings (for debug/testing) and actual stanza objects.
|
|
555
|
+
* Determines whether the message is a CAP alert, contains VTEC codes, or contains UGCs,
|
|
556
|
+
* and identifies the AWIPS product type and prefix.
|
|
557
|
+
*
|
|
558
|
+
* @static
|
|
559
|
+
* @param {any} stanza
|
|
560
|
+
* @param {boolean | types.StanzaAttributes} [isDebug=false]
|
|
561
|
+
* @returns {{
|
|
562
|
+
* message: string;
|
|
563
|
+
* attributes: types.StanzaAttributes;
|
|
564
|
+
* isCap: boolean,
|
|
565
|
+
* isPVtec: boolean;
|
|
566
|
+
* isCapDescription: boolean;
|
|
567
|
+
* awipsType: Record<string, string>;
|
|
568
|
+
* isApi: boolean;
|
|
569
|
+
* ignore: boolean;
|
|
570
|
+
* isUGC?: boolean;
|
|
571
|
+
* }}
|
|
572
|
+
*/
|
|
573
|
+
static validate(stanza: any, isDebug?: boolean | StanzaAttributes): {
|
|
574
|
+
message: string;
|
|
575
|
+
attributes: StanzaAttributes;
|
|
576
|
+
isCap: any;
|
|
577
|
+
isPVtec: boolean;
|
|
578
|
+
isCapDescription: any;
|
|
579
|
+
awipsType: any;
|
|
580
|
+
isApi: boolean;
|
|
581
|
+
ignore: boolean;
|
|
582
|
+
isUGC?: boolean;
|
|
583
|
+
};
|
|
584
|
+
/**
|
|
585
|
+
* @function getType
|
|
586
|
+
* @description
|
|
587
|
+
* Determines the AWIPS product type and prefix from a stanza's attributes.
|
|
588
|
+
* Returns a default type of 'XX' if the attributes are missing or the AWIPS ID
|
|
589
|
+
* does not match any known definitions.
|
|
590
|
+
*
|
|
591
|
+
* @private
|
|
592
|
+
* @static
|
|
593
|
+
* @param {unknown} attributes
|
|
594
|
+
* @returns {Record<string, string>}
|
|
595
|
+
*/
|
|
596
|
+
private static getType;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
declare class EventParser {
|
|
600
|
+
/**
|
|
601
|
+
* @function getBaseProperties
|
|
602
|
+
* @description
|
|
603
|
+
* Extracts and compiles the core properties of a weather
|
|
604
|
+
* alert message into a structured object. Combines parsed
|
|
605
|
+
* textual data, UGC information, VTEC entries, and additional
|
|
606
|
+
* metadata for downstream use.
|
|
607
|
+
*
|
|
608
|
+
* @static
|
|
609
|
+
* @async
|
|
610
|
+
* @param {string} message
|
|
611
|
+
* @param {types.StanzaCompiled} metadata
|
|
612
|
+
* @param {types.UGCEntry} [ugc=null]
|
|
613
|
+
* @param {types.PVtecEntry} [pVtec=null]
|
|
614
|
+
* @param {types.HVtecEntry} [hVtec=null]
|
|
615
|
+
* @returns {Promise<Record<string, any>>}
|
|
616
|
+
*/
|
|
617
|
+
static getBaseProperties(message: string, metadata: DefaultAttributesType, ugc?: UGCEntry, pVtec?: PVtecEntry, hVtec?: HVtecEntry): Promise<Record<string, any>>;
|
|
618
|
+
/**
|
|
619
|
+
* @function getEventGeometry
|
|
620
|
+
* @description
|
|
621
|
+
* Determines the geometry of an event using polygon data fromEntries
|
|
622
|
+
* in the message or UGC shapefile coordinates if enabled in settings. Falls
|
|
623
|
+
* back to null if no geometry can be determined.
|
|
624
|
+
*
|
|
625
|
+
* @static
|
|
626
|
+
* @param {string} generated
|
|
627
|
+
* @param {types.UGCEntry} [ugc=null]
|
|
628
|
+
* @returns {Promise<types.geometry>}
|
|
629
|
+
*/
|
|
630
|
+
static getEventGeometry(generated: string, ugc?: UGCEntry, isUnion?: boolean): Promise<geometry>;
|
|
631
|
+
/**
|
|
632
|
+
* @function betterParsedEventName
|
|
633
|
+
* @description
|
|
634
|
+
* Enhances the parsing of an event name using additional criteria
|
|
635
|
+
* from its description and parameters. Can optionally use
|
|
636
|
+
* the original parent event name instead.
|
|
637
|
+
*
|
|
638
|
+
* @static
|
|
639
|
+
* @param {types.EventCompiled} event
|
|
640
|
+
* @param {boolean} [betterParsing=false]
|
|
641
|
+
* @param {boolean} [useParentEvents=false]
|
|
642
|
+
* @returns {string}
|
|
643
|
+
*/
|
|
644
|
+
static betterParsedEventName(event: EventCompiled, betterParsing?: boolean, useParentEvents?: boolean): string;
|
|
645
|
+
/**
|
|
646
|
+
* @function validateEvents
|
|
647
|
+
* @description
|
|
648
|
+
* Processes an array of event objects and filters them based on
|
|
649
|
+
* global and EAS filtering settings, and
|
|
650
|
+
* other criteria such as expired or test products. Valid events
|
|
651
|
+
* trigger relevant event emitters.
|
|
652
|
+
*
|
|
653
|
+
* @static
|
|
654
|
+
* @param {unknown[]} events
|
|
655
|
+
* @returns {Promise<void>}
|
|
656
|
+
*/
|
|
657
|
+
static validateEvents(events: unknown[]): Promise<void>;
|
|
658
|
+
/**
|
|
659
|
+
* @function getHeader
|
|
660
|
+
* @description
|
|
661
|
+
* Constructs a standardized alert header string using provided
|
|
662
|
+
* stanza attributes, event properties, and optional VTEC data.
|
|
663
|
+
*
|
|
664
|
+
* @static
|
|
665
|
+
* @param {types.StanzaAttributes} attributes
|
|
666
|
+
* @param {types.EventProperties} [properties]
|
|
667
|
+
* @param {types.PVtecEntry} [pVtec]
|
|
668
|
+
* @returns {string}
|
|
669
|
+
*/
|
|
670
|
+
static getHeader(attributes: StanzaAttributes, properties?: EventProperties, pVtec?: PVtecEntry): string;
|
|
671
|
+
/**
|
|
672
|
+
* @function eventHandler
|
|
673
|
+
* @description
|
|
674
|
+
* Routes a validated stanza object to the appropriate alert handler
|
|
675
|
+
* based on its type flags: API, CAP, pVTEC (Primary VTEC), UGC, or plain text.
|
|
676
|
+
*
|
|
677
|
+
* @static
|
|
678
|
+
* @param {types.StanzaCompiled} metadata
|
|
679
|
+
* @returns {void}
|
|
680
|
+
*/
|
|
681
|
+
static eventHandler(metadata: StanzaCompiled): Promise<void>;
|
|
682
|
+
/**
|
|
683
|
+
* @function getICAO
|
|
684
|
+
* @description
|
|
685
|
+
* Determines the ICAO code and corresponding name for an event.
|
|
686
|
+
* Priority is given to the VTEC tracking code, then the attributes' `cccc` property,
|
|
687
|
+
* and finally the WMO code if available. Returns null if none are found.
|
|
688
|
+
*
|
|
689
|
+
* @private
|
|
690
|
+
* @static
|
|
691
|
+
* @param {types.PVtecEntry | null} pVtec
|
|
692
|
+
* @param {Record<string, string>} metadata
|
|
693
|
+
* @param {RegExpMatchArray | string | null} WMO
|
|
694
|
+
* @returns {{ icao: string; name: string }}
|
|
695
|
+
*/
|
|
696
|
+
private static getICAO;
|
|
697
|
+
/**
|
|
698
|
+
* @function getCorrectIssuedDate
|
|
699
|
+
* @description
|
|
700
|
+
* Determines the issued date for an event based on the provided attributes.
|
|
701
|
+
* Falls back to the current date and time if no valid issue date is available.
|
|
702
|
+
*
|
|
703
|
+
* @private
|
|
704
|
+
* @static
|
|
705
|
+
* @param {Record<string, string>} metadata
|
|
706
|
+
* @returns {string}
|
|
707
|
+
*/
|
|
708
|
+
private static getCorrectIssuedDate;
|
|
709
|
+
/**
|
|
710
|
+
* @function getCorrectExpiryDate
|
|
711
|
+
* @description
|
|
712
|
+
* Determines the most appropriate expiry date for an event using VTEC or UGC data.
|
|
713
|
+
* Falls back to one hour from the current time if no valid expiry is available.
|
|
714
|
+
*
|
|
715
|
+
* @private
|
|
716
|
+
* @static
|
|
717
|
+
* @param {types.PVtecEntry} pVtec
|
|
718
|
+
* @param {types.UGCEntry} ugc
|
|
719
|
+
* @returns {string}
|
|
720
|
+
*/
|
|
721
|
+
private static getCorrectExpiryDate;
|
|
722
|
+
/**
|
|
723
|
+
* @function buildDefaultSignature
|
|
724
|
+
* @description
|
|
725
|
+
* Populates default properties for an event object, including action type flags,
|
|
726
|
+
* tags, and status updates. Determines if the event is issued, updated, or cancelled
|
|
727
|
+
* based on correlations, description content, VTEC codes, and expiration time.
|
|
728
|
+
*
|
|
729
|
+
* @private
|
|
730
|
+
* @static
|
|
731
|
+
* @param {any} event
|
|
732
|
+
* @returns {types.EventCompiled}
|
|
733
|
+
*/
|
|
734
|
+
private static buildDefaultSignature;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
declare class TextParser {
|
|
738
|
+
/**
|
|
739
|
+
* @function textProductToString
|
|
740
|
+
* @description
|
|
741
|
+
* Searches a text product message for a line containing a specific value,
|
|
742
|
+
* extracts the substring immediately following that value, and optionally
|
|
743
|
+
* removes additional specified strings. Cleans up the extracted string by
|
|
744
|
+
* trimming whitespace and removing any remaining occurrences of the search
|
|
745
|
+
* value or '<' characters.
|
|
746
|
+
*
|
|
747
|
+
* @static
|
|
748
|
+
* @param {string} message
|
|
749
|
+
* @param {string} value
|
|
750
|
+
* @param {string[]} [removal=[]]
|
|
751
|
+
* @returns {string | null}
|
|
752
|
+
*/
|
|
753
|
+
static textProductToString(message: string, value: string, removal?: string[]): string | null;
|
|
754
|
+
/**
|
|
755
|
+
* @function textProductToPolygon
|
|
756
|
+
* @description
|
|
757
|
+
* Parses a text product message to extract polygon coordinates based on
|
|
758
|
+
* LAT...LON data. Coordinates are converted to [latitude, longitude] pairs
|
|
759
|
+
* with longitude negated (assumes Western Hemisphere). If the polygon has
|
|
760
|
+
* more than two points, the first point is repeated at the end to close it.
|
|
761
|
+
*
|
|
762
|
+
* @static
|
|
763
|
+
* @param {string} message
|
|
764
|
+
* @returns {[number, number][]}
|
|
765
|
+
*/
|
|
766
|
+
static textProductToPolygon(message: string): [number, number][];
|
|
767
|
+
/**
|
|
768
|
+
* @function textProductToDescription
|
|
769
|
+
* @description
|
|
770
|
+
* Extracts a clean description portion from a text product message, optionally
|
|
771
|
+
* removing a handle and any extra metadata such as "STANZA ATTRIBUTES...".
|
|
772
|
+
* Also trims and normalizes whitespace.
|
|
773
|
+
*
|
|
774
|
+
* @static
|
|
775
|
+
* @param {string} message
|
|
776
|
+
* @param {string | null} [handle=null]
|
|
777
|
+
* @returns {string}
|
|
778
|
+
*/
|
|
779
|
+
static textProductToDescription(message: string, handle?: string): string;
|
|
780
|
+
/**
|
|
781
|
+
* @function getXmlValues
|
|
782
|
+
* @description
|
|
783
|
+
* Recursively extracts specified values from a parsed XML-like object.
|
|
784
|
+
* Searches both object keys and array items for matching keys (case-insensitive)
|
|
785
|
+
* and returns the corresponding values. If multiple unique values are found for
|
|
786
|
+
* a key, an array is returned; if one value is found, it returns that value;
|
|
787
|
+
* if none are found, returns `null`.
|
|
788
|
+
*
|
|
789
|
+
* @static
|
|
790
|
+
* @param {any} parsed
|
|
791
|
+
* @param {string[]} valuesToExtract
|
|
792
|
+
* @returns {Record<string, string | string[] | null>}
|
|
793
|
+
*/
|
|
794
|
+
static getXmlValues(parsed: any, valuesToExtract: string[]): Record<string, string>;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
declare class PVtecParser {
|
|
798
|
+
/**
|
|
799
|
+
* @function pVtecExtractor
|
|
800
|
+
* @description
|
|
801
|
+
* Extracts VTEC entries from a raw NWWS message string and returns
|
|
802
|
+
* structured objects containing type, tracking, event, status,
|
|
803
|
+
* WMO identifiers, and expiry date.
|
|
804
|
+
*
|
|
805
|
+
* @static
|
|
806
|
+
* @param {string} message
|
|
807
|
+
* @returns {Promise<types.VtecEntry[] | null>}
|
|
808
|
+
*/
|
|
809
|
+
static pVtecExtractor(message: string): Promise<PVtecEntry[] | null>;
|
|
810
|
+
/**
|
|
811
|
+
* @function parseExpiryDate
|
|
812
|
+
* @description
|
|
813
|
+
* Converts a NWWS VTEC/expiry timestamp string into a formatted local ISO date string
|
|
814
|
+
* with an Eastern Time offset (-04:00). Returns `Invalid Date Format` if the input
|
|
815
|
+
* is `000000T0000Z`.
|
|
816
|
+
*
|
|
817
|
+
* @private
|
|
818
|
+
* @static
|
|
819
|
+
* @param {string[]} args
|
|
820
|
+
* @returns {string}
|
|
821
|
+
*/
|
|
822
|
+
private static parseExpiryDate;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
declare class HVtecParser {
|
|
826
|
+
/**
|
|
827
|
+
* @function HVtecExtractor
|
|
828
|
+
* @description
|
|
829
|
+
* Extracts VTEC entries from a raw NWWS message string and returns
|
|
830
|
+
* structured objects containing type, tracking, event, status,
|
|
831
|
+
* WMO identifiers, and expiry date.
|
|
832
|
+
*
|
|
833
|
+
* @static
|
|
834
|
+
* @param {string} message
|
|
835
|
+
* @returns {Promise<types.HtecEntry[] | null>}
|
|
836
|
+
*/
|
|
837
|
+
static HVtecExtractor(message: string): Promise<HVtecEntry[] | null>;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
declare class UGCParser {
|
|
841
|
+
/**
|
|
842
|
+
* @function ugcExtractor
|
|
843
|
+
* @description
|
|
844
|
+
* Extracts UGC (Universal Geographic Code) information from a message.
|
|
845
|
+
* This includes parsing the header, resolving zones, calculating the expiry
|
|
846
|
+
* date, and retrieving associated location names from the database.
|
|
847
|
+
*
|
|
848
|
+
* @static
|
|
849
|
+
* @async
|
|
850
|
+
* @param {string} message
|
|
851
|
+
* @returns {Promise<types.UGCEntry | null>}
|
|
852
|
+
*/
|
|
853
|
+
static ugcExtractor(message: string): Promise<UGCEntry | null>;
|
|
854
|
+
/**
|
|
855
|
+
* @function getHeader
|
|
856
|
+
* @description
|
|
857
|
+
* Extracts the UGC header from a message by locating patterns defined in
|
|
858
|
+
* `ugc1` and `ugc2` regular expressions. Removes all whitespace and the
|
|
859
|
+
* trailing character from the matched header.
|
|
860
|
+
*
|
|
861
|
+
* @static
|
|
862
|
+
* @param {string} message
|
|
863
|
+
* @returns {string | null}
|
|
864
|
+
*/
|
|
865
|
+
static getHeader(message: string): string | null;
|
|
866
|
+
/**
|
|
867
|
+
* @function getExpiry
|
|
868
|
+
* @description
|
|
869
|
+
* Extracts an expiration date from a message using the UGC3 format.
|
|
870
|
+
* The function parses day, hour, and minute from the message and constructs
|
|
871
|
+
* a Date object in the current month and year. Returns `null` if no valid
|
|
872
|
+
* expiration is found.
|
|
873
|
+
*
|
|
874
|
+
* @static
|
|
875
|
+
* @param {string} message
|
|
876
|
+
* @returns {Date | null}
|
|
877
|
+
*/
|
|
878
|
+
static getExpiry(message: string): Date | null;
|
|
879
|
+
/**
|
|
880
|
+
* @function getLocations
|
|
881
|
+
* @description
|
|
882
|
+
* Retrieves human-readable location names for an array of zone identifiers
|
|
883
|
+
* from the shapefiles database. If a zone is not found, the zone ID itself
|
|
884
|
+
* is returned. Duplicate locations are removed and the result is sorted.
|
|
885
|
+
*
|
|
886
|
+
* @static
|
|
887
|
+
* @async
|
|
888
|
+
* @param {string[]} zones
|
|
889
|
+
* @returns {Promise<string[]>}
|
|
890
|
+
*/
|
|
891
|
+
static getLocations(zones: string[]): Promise<string[]>;
|
|
892
|
+
/**
|
|
893
|
+
* @function getCoordinates
|
|
894
|
+
* @description
|
|
895
|
+
* Calculates the outer boundary coordinates for a set of UGC zones by
|
|
896
|
+
* querying their geometries from the database, merging them, and extracting
|
|
897
|
+
* the largest outer ring. The coordinates are downsampled based on a skip
|
|
898
|
+
* setting to reduce complexity. Returns `null` if no valid coordinates are found.
|
|
899
|
+
*
|
|
900
|
+
* @static
|
|
901
|
+
* @param {string[]} zones
|
|
902
|
+
* @returns {[number, number][]}
|
|
903
|
+
*/
|
|
904
|
+
static getCoordinates(zones: string[], isUnion?: boolean): any | null;
|
|
905
|
+
/**
|
|
906
|
+
* @function getZones
|
|
907
|
+
* @description
|
|
908
|
+
* Parses a UGC header string and returns an array of individual zone
|
|
909
|
+
* identifiers. Handles ranges indicated with `>` and preserves the
|
|
910
|
+
* state and format prefixes.
|
|
911
|
+
*
|
|
912
|
+
* @static
|
|
913
|
+
* @param {string} header
|
|
914
|
+
* @returns {string[]}
|
|
915
|
+
*/
|
|
916
|
+
static getZones(header: string): string[];
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
declare class Manager {
|
|
920
|
+
isNoaaWeatherWireService: boolean;
|
|
921
|
+
job: any;
|
|
922
|
+
constructor(metadata: ClientSettingsTypes);
|
|
923
|
+
/**
|
|
924
|
+
* @function setDisplayName
|
|
925
|
+
* @description
|
|
926
|
+
* Sets the display nickname for the NWWS XMPP session. Trims the provided
|
|
927
|
+
* name and validates it, emitting a warning if the name is empty or invalid.
|
|
928
|
+
*
|
|
929
|
+
* @param {string} [name]
|
|
930
|
+
*/
|
|
931
|
+
setDisplayName(name?: string): void;
|
|
932
|
+
/**
|
|
933
|
+
* @function getEventPolygon
|
|
934
|
+
* @description
|
|
935
|
+
* Retrieves the geographical polygon for a given event based on its
|
|
936
|
+
* generated geocode and UGC zones.
|
|
937
|
+
*
|
|
938
|
+
* @async
|
|
939
|
+
* @param {types.EventCompiled} event
|
|
940
|
+
* @returns {Promise<types.geometry | null>}
|
|
941
|
+
*/
|
|
942
|
+
getEventPolygon(event: EventCompiled, isUnion?: boolean): Promise<geometry | null>;
|
|
943
|
+
/**
|
|
944
|
+
* @function createEasAudio
|
|
945
|
+
* @description
|
|
946
|
+
* Generates an EAS (Emergency Alert System) audio file using the provided
|
|
947
|
+
* description and header.
|
|
948
|
+
*
|
|
949
|
+
* @async
|
|
950
|
+
* @param {string} description
|
|
951
|
+
* @param {string} header
|
|
952
|
+
* @returns {Promise<string>}
|
|
953
|
+
*/
|
|
954
|
+
createEasAudio(description: string, header: string): Promise<string>;
|
|
955
|
+
/**
|
|
956
|
+
* @function getAllAlertTypes
|
|
957
|
+
* @description
|
|
958
|
+
* Generates a list of all possible alert types by combining defined
|
|
959
|
+
* event names with action names.
|
|
960
|
+
*
|
|
961
|
+
* @returns {string[]}
|
|
962
|
+
*/
|
|
963
|
+
getAllAlertTypes(): string[];
|
|
964
|
+
/**
|
|
965
|
+
* @function searchStanzaDatabase
|
|
966
|
+
* @description
|
|
967
|
+
* Searches the stanza database for entries containing the specified query.
|
|
968
|
+
* Escapes SQL wildcard characters and returns results in descending order
|
|
969
|
+
* by ID, up to the specified limit.
|
|
970
|
+
*
|
|
971
|
+
* @async
|
|
972
|
+
* @param {string} query
|
|
973
|
+
* @param {number} [limit=250]
|
|
974
|
+
* @returns {Promise<string[]>}
|
|
975
|
+
*/
|
|
976
|
+
searchStanzaDatabase(query: string, limit?: number): Promise<string[]>;
|
|
977
|
+
/**
|
|
978
|
+
* @function setSettings
|
|
979
|
+
* @description
|
|
980
|
+
* Merges the provided client settings into the current configuration,
|
|
981
|
+
* preserving nested structures.
|
|
982
|
+
*
|
|
983
|
+
* @async
|
|
984
|
+
* @param {types.ClientSettingsTypes} settings
|
|
985
|
+
* @returns {Promise<void>}
|
|
986
|
+
*/
|
|
987
|
+
setSettings(settings: ClientSettingsTypes): Promise<void>;
|
|
988
|
+
/**
|
|
989
|
+
* @function on
|
|
990
|
+
* @description
|
|
991
|
+
* Registers a callback for a specific event and returns a function
|
|
992
|
+
* to unregister the listener.
|
|
993
|
+
*
|
|
994
|
+
* @param {string} event
|
|
995
|
+
* @param {(...args: any[]) => void} callback
|
|
996
|
+
* @returns {() => void}
|
|
997
|
+
*/
|
|
998
|
+
on(event: string, callback: (...args: any[]) => void): () => void;
|
|
999
|
+
/**
|
|
1000
|
+
* @function start
|
|
1001
|
+
* @description
|
|
1002
|
+
* Initializes the client with the provided settings, starts the NWWS XMPP
|
|
1003
|
+
* session if applicable, loads cached messages, and sets up scheduled
|
|
1004
|
+
* tasks (cron jobs) for ongoing processing.
|
|
1005
|
+
*
|
|
1006
|
+
* @async
|
|
1007
|
+
* @param {types.ClientSettingsTypes} metadata
|
|
1008
|
+
* @returns {Promise<void>}
|
|
1009
|
+
*/
|
|
1010
|
+
start(metadata: ClientSettingsTypes): Promise<void>;
|
|
1011
|
+
/**
|
|
1012
|
+
* @function stop
|
|
1013
|
+
* @description
|
|
1014
|
+
* Stops active scheduled tasks (cron job) and, if connected, the NWWS
|
|
1015
|
+
* XMPP session. Updates relevant cache flags to indicate the session
|
|
1016
|
+
* is no longer active.
|
|
1017
|
+
*
|
|
1018
|
+
* @async
|
|
1019
|
+
* @returns {Promise<void>}
|
|
1020
|
+
*/
|
|
1021
|
+
stop(): Promise<void>;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
export { Database, EAS, EventParser, HVtecParser, Manager, PVtecParser, StanzaParser, TextParser, UGCParser, Utils, Manager as default, types };
|