atmosx-nwws-parser 1.0.3182 → 1.0.3183
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/dist/cjs/index.cjs +41 -52
- package/dist/esm/index.mjs +40 -51
- package/dist/index.d.mts +1024 -0
- package/dist/index.d.ts +1024 -0
- package/package.json +6 -1
- package/src/@parsers/@events/api.ts +16 -17
- package/src/@parsers/@events/cap.ts +2 -2
- package/src/@parsers/@events/text.ts +4 -4
- package/src/@parsers/@events/ugc.ts +4 -4
- package/src/@parsers/@events/vtec.ts +1 -1
- package/src/@parsers/events.ts +16 -16
- package/src/@parsers/stanza.ts +1 -1
- package/src/@parsers/text.ts +1 -2
- package/src/@parsers/ugc.ts +0 -1
- package/src/@submodules/database.ts +3 -16
- package/src/@submodules/eas.ts +14 -14
- package/src/@submodules/utils.ts +10 -6
- package/src/index.ts +11 -11
- package/src/types.ts +8 -0
- package/test.js +0 -62
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -15
package/dist/cjs/index.cjs
CHANGED
|
@@ -1102,11 +1102,11 @@ var require_main3 = __commonJS({
|
|
|
1102
1102
|
// src/index.ts
|
|
1103
1103
|
var index_exports = {};
|
|
1104
1104
|
__export(index_exports, {
|
|
1105
|
-
AlertManager: () => AlertManager,
|
|
1106
1105
|
Database: () => database_default,
|
|
1107
1106
|
EAS: () => eas_default,
|
|
1108
1107
|
EventParser: () => events_default,
|
|
1109
1108
|
HVtecParser: () => hvtec_default,
|
|
1109
|
+
Manager: () => Manager,
|
|
1110
1110
|
PVtecParser: () => pvtec_default,
|
|
1111
1111
|
StanzaParser: () => stanza_default,
|
|
1112
1112
|
TextParser: () => text_default,
|
|
@@ -1377,7 +1377,7 @@ function escape(local) {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
return local.replaceAll(/^\s+|\s+$/g, "").replaceAll("\\", String.raw`\5c`).replaceAll(" ", String.raw`\20`).replaceAll('"', String.raw`\22`).replaceAll("&", String.raw`\26`).replaceAll("'", String.raw`\27`).replaceAll("/", String.raw`\2f`).replaceAll(":", String.raw`\3a`).replaceAll("<", String.raw`\3c`).replaceAll(">", String.raw`\3e`).replaceAll("@", String.raw`\40`);
|
|
1379
1379
|
}
|
|
1380
|
-
function
|
|
1380
|
+
function unescape(local) {
|
|
1381
1381
|
if (local === null) {
|
|
1382
1382
|
return null;
|
|
1383
1383
|
}
|
|
@@ -1400,10 +1400,10 @@ var JID = class _JID {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
return this.toString();
|
|
1402
1402
|
}
|
|
1403
|
-
toString(
|
|
1403
|
+
toString(unescape2) {
|
|
1404
1404
|
let s = this._domain;
|
|
1405
1405
|
if (this._local) {
|
|
1406
|
-
s = this.getLocal(
|
|
1406
|
+
s = this.getLocal(unescape2) + "@" + s;
|
|
1407
1407
|
}
|
|
1408
1408
|
if (this._resource) {
|
|
1409
1409
|
s = s + "/" + this._resource;
|
|
@@ -1436,9 +1436,9 @@ var JID = class _JID {
|
|
|
1436
1436
|
this._local = local && local.toLowerCase();
|
|
1437
1437
|
return this;
|
|
1438
1438
|
}
|
|
1439
|
-
getLocal(
|
|
1439
|
+
getLocal(unescape2 = false) {
|
|
1440
1440
|
let local = null;
|
|
1441
|
-
local =
|
|
1441
|
+
local = unescape2 ? unescape(this._local) : this._local;
|
|
1442
1442
|
return local;
|
|
1443
1443
|
}
|
|
1444
1444
|
/**
|
|
@@ -1510,7 +1510,7 @@ j.parse = parse;
|
|
|
1510
1510
|
j.equal = equal;
|
|
1511
1511
|
j.detectEscape = detect;
|
|
1512
1512
|
j.escapeLocal = escape;
|
|
1513
|
-
j.unescapeLocal =
|
|
1513
|
+
j.unescapeLocal = unescape;
|
|
1514
1514
|
var jid_default = j;
|
|
1515
1515
|
|
|
1516
1516
|
// node_modules/@xmpp/error/index.js
|
|
@@ -5490,7 +5490,7 @@ var UGCAlerts = class {
|
|
|
5490
5490
|
* @private
|
|
5491
5491
|
* @static
|
|
5492
5492
|
* @param {string} message
|
|
5493
|
-
* @param {Record<string, any>}
|
|
5493
|
+
* @param {Record<string, any>} metadata
|
|
5494
5494
|
* @returns {string}
|
|
5495
5495
|
*/
|
|
5496
5496
|
static getEvent(message, metadata) {
|
|
@@ -5564,7 +5564,7 @@ var TextAlerts = class {
|
|
|
5564
5564
|
*
|
|
5565
5565
|
* @private
|
|
5566
5566
|
* @static
|
|
5567
|
-
* @param {types.EventProperties}
|
|
5567
|
+
* @param {types.EventProperties} properties
|
|
5568
5568
|
* @returns {string}
|
|
5569
5569
|
*/
|
|
5570
5570
|
static getTracking(properties) {
|
|
@@ -5782,23 +5782,20 @@ var APIAlerts = class {
|
|
|
5782
5782
|
* @returns {string}
|
|
5783
5783
|
*/
|
|
5784
5784
|
static getTracking(extracted) {
|
|
5785
|
-
|
|
5785
|
+
var _a, _b, _c, _d;
|
|
5786
|
+
if (extracted.pVtec) {
|
|
5786
5787
|
const vtecValue = Array.isArray(extracted.pVtec) ? extracted.pVtec[0] : extracted.pVtec;
|
|
5787
5788
|
const splitPVTEC = vtecValue.split(".");
|
|
5788
5789
|
return `${splitPVTEC[2]}-${splitPVTEC[3]}-${splitPVTEC[4]}-${splitPVTEC[5]}`;
|
|
5789
|
-
}
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
const
|
|
5794
|
-
return `${station}-${(
|
|
5795
|
-
}
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
const id2 = (_b = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _b : "N/A";
|
|
5799
|
-
const station = (_c = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _c : "N/A";
|
|
5800
|
-
return `${station}-${id2}`;
|
|
5801
|
-
});
|
|
5790
|
+
}
|
|
5791
|
+
const wmoMatch = (_a = extracted.wmoidentifier) == null ? void 0 : _a.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
|
|
5792
|
+
const station = (_b = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _b : "N/A";
|
|
5793
|
+
if (extracted.featureId) {
|
|
5794
|
+
const idMatch = extracted.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
|
|
5795
|
+
return `${station}-${(_c = idMatch == null ? void 0 : idMatch[1]) != null ? _c : "N/A"}`;
|
|
5796
|
+
}
|
|
5797
|
+
const id2 = (_d = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _d : "N/A";
|
|
5798
|
+
return `${station}-${id2}`;
|
|
5802
5799
|
}
|
|
5803
5800
|
/**
|
|
5804
5801
|
* @function getICAO
|
|
@@ -5913,7 +5910,7 @@ var EventParser = class {
|
|
|
5913
5910
|
* @static
|
|
5914
5911
|
* @async
|
|
5915
5912
|
* @param {string} message
|
|
5916
|
-
* @param {types.StanzaCompiled}
|
|
5913
|
+
* @param {types.StanzaCompiled} metadata
|
|
5917
5914
|
* @param {types.UGCEntry} [ugc=null]
|
|
5918
5915
|
* @param {types.PVtecEntry} [pVtec=null]
|
|
5919
5916
|
* @param {types.HVtecEntry} [hVtec=null]
|
|
@@ -5977,7 +5974,7 @@ var EventParser = class {
|
|
|
5977
5974
|
* back to null if no geometry can be determined.
|
|
5978
5975
|
*
|
|
5979
5976
|
* @static
|
|
5980
|
-
* @param {string}
|
|
5977
|
+
* @param {string} generated
|
|
5981
5978
|
* @param {types.UGCEntry} [ugc=null]
|
|
5982
5979
|
* @returns {Promise<types.geometry>}
|
|
5983
5980
|
*/
|
|
@@ -6053,7 +6050,7 @@ var EventParser = class {
|
|
|
6053
6050
|
*
|
|
6054
6051
|
* @static
|
|
6055
6052
|
* @param {unknown[]} events
|
|
6056
|
-
* @returns {void}
|
|
6053
|
+
* @returns {Promise<void>}
|
|
6057
6054
|
*/
|
|
6058
6055
|
static validateEvents(events3) {
|
|
6059
6056
|
return __async(this, null, function* () {
|
|
@@ -6168,7 +6165,7 @@ var EventParser = class {
|
|
|
6168
6165
|
* based on its type flags: API, CAP, pVTEC (Primary VTEC), UGC, or plain text.
|
|
6169
6166
|
*
|
|
6170
6167
|
* @static
|
|
6171
|
-
* @param {types.StanzaCompiled}
|
|
6168
|
+
* @param {types.StanzaCompiled} metadata
|
|
6172
6169
|
* @returns {void}
|
|
6173
6170
|
*/
|
|
6174
6171
|
static eventHandler(metadata) {
|
|
@@ -6191,7 +6188,7 @@ var EventParser = class {
|
|
|
6191
6188
|
* @private
|
|
6192
6189
|
* @static
|
|
6193
6190
|
* @param {types.PVtecEntry | null} pVtec
|
|
6194
|
-
* @param {Record<string, string>}
|
|
6191
|
+
* @param {Record<string, string>} metadata
|
|
6195
6192
|
* @param {RegExpMatchArray | string | null} WMO
|
|
6196
6193
|
* @returns {{ icao: string; name: string }}
|
|
6197
6194
|
*/
|
|
@@ -6209,7 +6206,7 @@ var EventParser = class {
|
|
|
6209
6206
|
*
|
|
6210
6207
|
* @private
|
|
6211
6208
|
* @static
|
|
6212
|
-
* @param {Record<string, string>}
|
|
6209
|
+
* @param {Record<string, string>} metadata
|
|
6213
6210
|
* @returns {string}
|
|
6214
6211
|
*/
|
|
6215
6212
|
static getCorrectIssuedDate(metadata) {
|
|
@@ -6246,7 +6243,7 @@ var EventParser = class {
|
|
|
6246
6243
|
* @private
|
|
6247
6244
|
* @static
|
|
6248
6245
|
* @param {any} event
|
|
6249
|
-
* @returns {
|
|
6246
|
+
* @returns {types.EventCompiled}
|
|
6250
6247
|
*/
|
|
6251
6248
|
static buildDefaultSignature(event) {
|
|
6252
6249
|
var _a, _b, _c, _d;
|
|
@@ -6332,7 +6329,7 @@ var StanzaParser = class {
|
|
|
6332
6329
|
if (stanza.is(`message`)) {
|
|
6333
6330
|
let cb = stanza.getChild(`x`);
|
|
6334
6331
|
if (cb && cb.children) {
|
|
6335
|
-
let message =
|
|
6332
|
+
let message = decodeURI(cb.children[0]);
|
|
6336
6333
|
let attributes = cb.attrs;
|
|
6337
6334
|
if (attributes.awipsid && attributes.awipsid.length > 1) {
|
|
6338
6335
|
const isCap = message.includes(`<?xml`);
|
|
@@ -6383,15 +6380,8 @@ var Database = class {
|
|
|
6383
6380
|
*
|
|
6384
6381
|
* @static
|
|
6385
6382
|
* @async
|
|
6386
|
-
* @param {string} stanza
|
|
6387
|
-
*
|
|
6388
|
-
*
|
|
6389
|
-
* @returns {Promise<void>}
|
|
6390
|
-
* Resolves when the stanza has been inserted and any necessary pruning
|
|
6391
|
-
* of old stanzas has been performed.
|
|
6392
|
-
*
|
|
6393
|
-
* @example
|
|
6394
|
-
* await Database.stanzaCacheImport("<alert>...</alert>");
|
|
6383
|
+
* @param {string} stanza - The raw stanza XML or text to store in the database.
|
|
6384
|
+
* @returns {Promise<void>} - Resolves when the stanza has been inserted and any necessary pruning of old stanzas has been performed.
|
|
6395
6385
|
*/
|
|
6396
6386
|
static stanzaCacheImport(stanza) {
|
|
6397
6387
|
return __async(this, null, function* () {
|
|
@@ -6434,12 +6424,7 @@ var Database = class {
|
|
|
6434
6424
|
*
|
|
6435
6425
|
* @static
|
|
6436
6426
|
* @async
|
|
6437
|
-
* @returns {Promise<void>}
|
|
6438
|
-
* Resolves when the database and shapefiles have been initialized.
|
|
6439
|
-
*
|
|
6440
|
-
* @example
|
|
6441
|
-
* await Database.loadDatabase();
|
|
6442
|
-
* console.log('Database initialized and shapefiles imported.');
|
|
6427
|
+
* @returns {Promise<void>} - Resolves when the database has been initialized and shapefiles have been imported if necessary.
|
|
6443
6428
|
*/
|
|
6444
6429
|
static loadDatabase() {
|
|
6445
6430
|
return __async(this, null, function* () {
|
|
@@ -6692,6 +6677,7 @@ var Utils = class _Utils {
|
|
|
6692
6677
|
* @static
|
|
6693
6678
|
* @param {string} message
|
|
6694
6679
|
* @param {boolean} [force=false]
|
|
6680
|
+
* @returns {void}
|
|
6695
6681
|
*/
|
|
6696
6682
|
static warn(message, force = false) {
|
|
6697
6683
|
cache.events.emit("log", message);
|
|
@@ -6708,6 +6694,7 @@ var Utils = class _Utils {
|
|
|
6708
6694
|
*
|
|
6709
6695
|
* @static
|
|
6710
6696
|
* @async
|
|
6697
|
+
* @returns {Promise<void>}
|
|
6711
6698
|
*/
|
|
6712
6699
|
static loadCollectionCache() {
|
|
6713
6700
|
return __async(this, null, function* () {
|
|
@@ -6742,6 +6729,7 @@ var Utils = class _Utils {
|
|
|
6742
6729
|
*
|
|
6743
6730
|
* @static
|
|
6744
6731
|
* @async
|
|
6732
|
+
* @returns {Promise<void>}
|
|
6745
6733
|
*/
|
|
6746
6734
|
static loadGeoJsonData() {
|
|
6747
6735
|
return __async(this, null, function* () {
|
|
@@ -6816,6 +6804,7 @@ var Utils = class _Utils {
|
|
|
6816
6804
|
*
|
|
6817
6805
|
* @static
|
|
6818
6806
|
* @param {boolean} isWire
|
|
6807
|
+
* @returns {void}
|
|
6819
6808
|
*/
|
|
6820
6809
|
static handleCronJob(isWire) {
|
|
6821
6810
|
try {
|
|
@@ -7347,7 +7336,7 @@ var EAS = class {
|
|
|
7347
7336
|
var eas_default = EAS;
|
|
7348
7337
|
|
|
7349
7338
|
// src/index.ts
|
|
7350
|
-
var
|
|
7339
|
+
var Manager = class {
|
|
7351
7340
|
constructor(metadata) {
|
|
7352
7341
|
this.start(metadata);
|
|
7353
7342
|
}
|
|
@@ -7376,7 +7365,7 @@ var AlertManager = class {
|
|
|
7376
7365
|
*
|
|
7377
7366
|
* @async
|
|
7378
7367
|
* @param {types.EventCompiled} event
|
|
7379
|
-
* @returns {Promise<
|
|
7368
|
+
* @returns {Promise<types.geometry | null>}
|
|
7380
7369
|
*/
|
|
7381
7370
|
getEventPolygon(event, isUnion = true) {
|
|
7382
7371
|
return __async(this, null, function* () {
|
|
@@ -7395,7 +7384,7 @@ var AlertManager = class {
|
|
|
7395
7384
|
* @async
|
|
7396
7385
|
* @param {string} description
|
|
7397
7386
|
* @param {string} header
|
|
7398
|
-
* @returns {Promise<
|
|
7387
|
+
* @returns {Promise<string>}
|
|
7399
7388
|
*/
|
|
7400
7389
|
createEasAudio(description, header) {
|
|
7401
7390
|
return __async(this, null, function* () {
|
|
@@ -7427,7 +7416,7 @@ var AlertManager = class {
|
|
|
7427
7416
|
* @async
|
|
7428
7417
|
* @param {string} query
|
|
7429
7418
|
* @param {number} [limit=250]
|
|
7430
|
-
* @returns {Promise<
|
|
7419
|
+
* @returns {Promise<string[]>}
|
|
7431
7420
|
*/
|
|
7432
7421
|
searchStanzaDatabase(query, limit = 250) {
|
|
7433
7422
|
return __async(this, null, function* () {
|
|
@@ -7549,14 +7538,14 @@ var AlertManager = class {
|
|
|
7549
7538
|
});
|
|
7550
7539
|
}
|
|
7551
7540
|
};
|
|
7552
|
-
var index_default =
|
|
7541
|
+
var index_default = Manager;
|
|
7553
7542
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7554
7543
|
0 && (module.exports = {
|
|
7555
|
-
AlertManager,
|
|
7556
7544
|
Database,
|
|
7557
7545
|
EAS,
|
|
7558
7546
|
EventParser,
|
|
7559
7547
|
HVtecParser,
|
|
7548
|
+
Manager,
|
|
7560
7549
|
PVtecParser,
|
|
7561
7550
|
StanzaParser,
|
|
7562
7551
|
TextParser,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1365,7 +1365,7 @@ function escape(local) {
|
|
|
1365
1365
|
}
|
|
1366
1366
|
return local.replaceAll(/^\s+|\s+$/g, "").replaceAll("\\", String.raw`\5c`).replaceAll(" ", String.raw`\20`).replaceAll('"', String.raw`\22`).replaceAll("&", String.raw`\26`).replaceAll("'", String.raw`\27`).replaceAll("/", String.raw`\2f`).replaceAll(":", String.raw`\3a`).replaceAll("<", String.raw`\3c`).replaceAll(">", String.raw`\3e`).replaceAll("@", String.raw`\40`);
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1368
|
+
function unescape(local) {
|
|
1369
1369
|
if (local === null) {
|
|
1370
1370
|
return null;
|
|
1371
1371
|
}
|
|
@@ -1388,10 +1388,10 @@ var JID = class _JID {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
return this.toString();
|
|
1390
1390
|
}
|
|
1391
|
-
toString(
|
|
1391
|
+
toString(unescape2) {
|
|
1392
1392
|
let s = this._domain;
|
|
1393
1393
|
if (this._local) {
|
|
1394
|
-
s = this.getLocal(
|
|
1394
|
+
s = this.getLocal(unescape2) + "@" + s;
|
|
1395
1395
|
}
|
|
1396
1396
|
if (this._resource) {
|
|
1397
1397
|
s = s + "/" + this._resource;
|
|
@@ -1424,9 +1424,9 @@ var JID = class _JID {
|
|
|
1424
1424
|
this._local = local && local.toLowerCase();
|
|
1425
1425
|
return this;
|
|
1426
1426
|
}
|
|
1427
|
-
getLocal(
|
|
1427
|
+
getLocal(unescape2 = false) {
|
|
1428
1428
|
let local = null;
|
|
1429
|
-
local =
|
|
1429
|
+
local = unescape2 ? unescape(this._local) : this._local;
|
|
1430
1430
|
return local;
|
|
1431
1431
|
}
|
|
1432
1432
|
/**
|
|
@@ -1498,7 +1498,7 @@ j.parse = parse;
|
|
|
1498
1498
|
j.equal = equal;
|
|
1499
1499
|
j.detectEscape = detect;
|
|
1500
1500
|
j.escapeLocal = escape;
|
|
1501
|
-
j.unescapeLocal =
|
|
1501
|
+
j.unescapeLocal = unescape;
|
|
1502
1502
|
var jid_default = j;
|
|
1503
1503
|
|
|
1504
1504
|
// node_modules/@xmpp/error/index.js
|
|
@@ -5478,7 +5478,7 @@ var UGCAlerts = class {
|
|
|
5478
5478
|
* @private
|
|
5479
5479
|
* @static
|
|
5480
5480
|
* @param {string} message
|
|
5481
|
-
* @param {Record<string, any>}
|
|
5481
|
+
* @param {Record<string, any>} metadata
|
|
5482
5482
|
* @returns {string}
|
|
5483
5483
|
*/
|
|
5484
5484
|
static getEvent(message, metadata) {
|
|
@@ -5552,7 +5552,7 @@ var TextAlerts = class {
|
|
|
5552
5552
|
*
|
|
5553
5553
|
* @private
|
|
5554
5554
|
* @static
|
|
5555
|
-
* @param {types.EventProperties}
|
|
5555
|
+
* @param {types.EventProperties} properties
|
|
5556
5556
|
* @returns {string}
|
|
5557
5557
|
*/
|
|
5558
5558
|
static getTracking(properties) {
|
|
@@ -5770,23 +5770,20 @@ var APIAlerts = class {
|
|
|
5770
5770
|
* @returns {string}
|
|
5771
5771
|
*/
|
|
5772
5772
|
static getTracking(extracted) {
|
|
5773
|
-
|
|
5773
|
+
var _a, _b, _c, _d;
|
|
5774
|
+
if (extracted.pVtec) {
|
|
5774
5775
|
const vtecValue = Array.isArray(extracted.pVtec) ? extracted.pVtec[0] : extracted.pVtec;
|
|
5775
5776
|
const splitPVTEC = vtecValue.split(".");
|
|
5776
5777
|
return `${splitPVTEC[2]}-${splitPVTEC[3]}-${splitPVTEC[4]}-${splitPVTEC[5]}`;
|
|
5777
|
-
}
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
const
|
|
5782
|
-
return `${station}-${(
|
|
5783
|
-
}
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
const id2 = (_b = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _b : "N/A";
|
|
5787
|
-
const station = (_c = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _c : "N/A";
|
|
5788
|
-
return `${station}-${id2}`;
|
|
5789
|
-
});
|
|
5778
|
+
}
|
|
5779
|
+
const wmoMatch = (_a = extracted.wmoidentifier) == null ? void 0 : _a.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
|
|
5780
|
+
const station = (_b = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _b : "N/A";
|
|
5781
|
+
if (extracted.featureId) {
|
|
5782
|
+
const idMatch = extracted.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
|
|
5783
|
+
return `${station}-${(_c = idMatch == null ? void 0 : idMatch[1]) != null ? _c : "N/A"}`;
|
|
5784
|
+
}
|
|
5785
|
+
const id2 = (_d = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _d : "N/A";
|
|
5786
|
+
return `${station}-${id2}`;
|
|
5790
5787
|
}
|
|
5791
5788
|
/**
|
|
5792
5789
|
* @function getICAO
|
|
@@ -5901,7 +5898,7 @@ var EventParser = class {
|
|
|
5901
5898
|
* @static
|
|
5902
5899
|
* @async
|
|
5903
5900
|
* @param {string} message
|
|
5904
|
-
* @param {types.StanzaCompiled}
|
|
5901
|
+
* @param {types.StanzaCompiled} metadata
|
|
5905
5902
|
* @param {types.UGCEntry} [ugc=null]
|
|
5906
5903
|
* @param {types.PVtecEntry} [pVtec=null]
|
|
5907
5904
|
* @param {types.HVtecEntry} [hVtec=null]
|
|
@@ -5965,7 +5962,7 @@ var EventParser = class {
|
|
|
5965
5962
|
* back to null if no geometry can be determined.
|
|
5966
5963
|
*
|
|
5967
5964
|
* @static
|
|
5968
|
-
* @param {string}
|
|
5965
|
+
* @param {string} generated
|
|
5969
5966
|
* @param {types.UGCEntry} [ugc=null]
|
|
5970
5967
|
* @returns {Promise<types.geometry>}
|
|
5971
5968
|
*/
|
|
@@ -6041,7 +6038,7 @@ var EventParser = class {
|
|
|
6041
6038
|
*
|
|
6042
6039
|
* @static
|
|
6043
6040
|
* @param {unknown[]} events
|
|
6044
|
-
* @returns {void}
|
|
6041
|
+
* @returns {Promise<void>}
|
|
6045
6042
|
*/
|
|
6046
6043
|
static validateEvents(events3) {
|
|
6047
6044
|
return __async(this, null, function* () {
|
|
@@ -6156,7 +6153,7 @@ var EventParser = class {
|
|
|
6156
6153
|
* based on its type flags: API, CAP, pVTEC (Primary VTEC), UGC, or plain text.
|
|
6157
6154
|
*
|
|
6158
6155
|
* @static
|
|
6159
|
-
* @param {types.StanzaCompiled}
|
|
6156
|
+
* @param {types.StanzaCompiled} metadata
|
|
6160
6157
|
* @returns {void}
|
|
6161
6158
|
*/
|
|
6162
6159
|
static eventHandler(metadata) {
|
|
@@ -6179,7 +6176,7 @@ var EventParser = class {
|
|
|
6179
6176
|
* @private
|
|
6180
6177
|
* @static
|
|
6181
6178
|
* @param {types.PVtecEntry | null} pVtec
|
|
6182
|
-
* @param {Record<string, string>}
|
|
6179
|
+
* @param {Record<string, string>} metadata
|
|
6183
6180
|
* @param {RegExpMatchArray | string | null} WMO
|
|
6184
6181
|
* @returns {{ icao: string; name: string }}
|
|
6185
6182
|
*/
|
|
@@ -6197,7 +6194,7 @@ var EventParser = class {
|
|
|
6197
6194
|
*
|
|
6198
6195
|
* @private
|
|
6199
6196
|
* @static
|
|
6200
|
-
* @param {Record<string, string>}
|
|
6197
|
+
* @param {Record<string, string>} metadata
|
|
6201
6198
|
* @returns {string}
|
|
6202
6199
|
*/
|
|
6203
6200
|
static getCorrectIssuedDate(metadata) {
|
|
@@ -6234,7 +6231,7 @@ var EventParser = class {
|
|
|
6234
6231
|
* @private
|
|
6235
6232
|
* @static
|
|
6236
6233
|
* @param {any} event
|
|
6237
|
-
* @returns {
|
|
6234
|
+
* @returns {types.EventCompiled}
|
|
6238
6235
|
*/
|
|
6239
6236
|
static buildDefaultSignature(event) {
|
|
6240
6237
|
var _a, _b, _c, _d;
|
|
@@ -6320,7 +6317,7 @@ var StanzaParser = class {
|
|
|
6320
6317
|
if (stanza.is(`message`)) {
|
|
6321
6318
|
let cb = stanza.getChild(`x`);
|
|
6322
6319
|
if (cb && cb.children) {
|
|
6323
|
-
let message =
|
|
6320
|
+
let message = decodeURI(cb.children[0]);
|
|
6324
6321
|
let attributes = cb.attrs;
|
|
6325
6322
|
if (attributes.awipsid && attributes.awipsid.length > 1) {
|
|
6326
6323
|
const isCap = message.includes(`<?xml`);
|
|
@@ -6371,15 +6368,8 @@ var Database = class {
|
|
|
6371
6368
|
*
|
|
6372
6369
|
* @static
|
|
6373
6370
|
* @async
|
|
6374
|
-
* @param {string} stanza
|
|
6375
|
-
*
|
|
6376
|
-
*
|
|
6377
|
-
* @returns {Promise<void>}
|
|
6378
|
-
* Resolves when the stanza has been inserted and any necessary pruning
|
|
6379
|
-
* of old stanzas has been performed.
|
|
6380
|
-
*
|
|
6381
|
-
* @example
|
|
6382
|
-
* await Database.stanzaCacheImport("<alert>...</alert>");
|
|
6371
|
+
* @param {string} stanza - The raw stanza XML or text to store in the database.
|
|
6372
|
+
* @returns {Promise<void>} - Resolves when the stanza has been inserted and any necessary pruning of old stanzas has been performed.
|
|
6383
6373
|
*/
|
|
6384
6374
|
static stanzaCacheImport(stanza) {
|
|
6385
6375
|
return __async(this, null, function* () {
|
|
@@ -6422,12 +6412,7 @@ var Database = class {
|
|
|
6422
6412
|
*
|
|
6423
6413
|
* @static
|
|
6424
6414
|
* @async
|
|
6425
|
-
* @returns {Promise<void>}
|
|
6426
|
-
* Resolves when the database and shapefiles have been initialized.
|
|
6427
|
-
*
|
|
6428
|
-
* @example
|
|
6429
|
-
* await Database.loadDatabase();
|
|
6430
|
-
* console.log('Database initialized and shapefiles imported.');
|
|
6415
|
+
* @returns {Promise<void>} - Resolves when the database has been initialized and shapefiles have been imported if necessary.
|
|
6431
6416
|
*/
|
|
6432
6417
|
static loadDatabase() {
|
|
6433
6418
|
return __async(this, null, function* () {
|
|
@@ -6680,6 +6665,7 @@ var Utils = class _Utils {
|
|
|
6680
6665
|
* @static
|
|
6681
6666
|
* @param {string} message
|
|
6682
6667
|
* @param {boolean} [force=false]
|
|
6668
|
+
* @returns {void}
|
|
6683
6669
|
*/
|
|
6684
6670
|
static warn(message, force = false) {
|
|
6685
6671
|
cache.events.emit("log", message);
|
|
@@ -6696,6 +6682,7 @@ var Utils = class _Utils {
|
|
|
6696
6682
|
*
|
|
6697
6683
|
* @static
|
|
6698
6684
|
* @async
|
|
6685
|
+
* @returns {Promise<void>}
|
|
6699
6686
|
*/
|
|
6700
6687
|
static loadCollectionCache() {
|
|
6701
6688
|
return __async(this, null, function* () {
|
|
@@ -6730,6 +6717,7 @@ var Utils = class _Utils {
|
|
|
6730
6717
|
*
|
|
6731
6718
|
* @static
|
|
6732
6719
|
* @async
|
|
6720
|
+
* @returns {Promise<void>}
|
|
6733
6721
|
*/
|
|
6734
6722
|
static loadGeoJsonData() {
|
|
6735
6723
|
return __async(this, null, function* () {
|
|
@@ -6804,6 +6792,7 @@ var Utils = class _Utils {
|
|
|
6804
6792
|
*
|
|
6805
6793
|
* @static
|
|
6806
6794
|
* @param {boolean} isWire
|
|
6795
|
+
* @returns {void}
|
|
6807
6796
|
*/
|
|
6808
6797
|
static handleCronJob(isWire) {
|
|
6809
6798
|
try {
|
|
@@ -7335,7 +7324,7 @@ var EAS = class {
|
|
|
7335
7324
|
var eas_default = EAS;
|
|
7336
7325
|
|
|
7337
7326
|
// src/index.ts
|
|
7338
|
-
var
|
|
7327
|
+
var Manager = class {
|
|
7339
7328
|
constructor(metadata) {
|
|
7340
7329
|
this.start(metadata);
|
|
7341
7330
|
}
|
|
@@ -7364,7 +7353,7 @@ var AlertManager = class {
|
|
|
7364
7353
|
*
|
|
7365
7354
|
* @async
|
|
7366
7355
|
* @param {types.EventCompiled} event
|
|
7367
|
-
* @returns {Promise<
|
|
7356
|
+
* @returns {Promise<types.geometry | null>}
|
|
7368
7357
|
*/
|
|
7369
7358
|
getEventPolygon(event, isUnion = true) {
|
|
7370
7359
|
return __async(this, null, function* () {
|
|
@@ -7383,7 +7372,7 @@ var AlertManager = class {
|
|
|
7383
7372
|
* @async
|
|
7384
7373
|
* @param {string} description
|
|
7385
7374
|
* @param {string} header
|
|
7386
|
-
* @returns {Promise<
|
|
7375
|
+
* @returns {Promise<string>}
|
|
7387
7376
|
*/
|
|
7388
7377
|
createEasAudio(description, header) {
|
|
7389
7378
|
return __async(this, null, function* () {
|
|
@@ -7415,7 +7404,7 @@ var AlertManager = class {
|
|
|
7415
7404
|
* @async
|
|
7416
7405
|
* @param {string} query
|
|
7417
7406
|
* @param {number} [limit=250]
|
|
7418
|
-
* @returns {Promise<
|
|
7407
|
+
* @returns {Promise<string[]>}
|
|
7419
7408
|
*/
|
|
7420
7409
|
searchStanzaDatabase(query, limit = 250) {
|
|
7421
7410
|
return __async(this, null, function* () {
|
|
@@ -7537,13 +7526,13 @@ var AlertManager = class {
|
|
|
7537
7526
|
});
|
|
7538
7527
|
}
|
|
7539
7528
|
};
|
|
7540
|
-
var index_default =
|
|
7529
|
+
var index_default = Manager;
|
|
7541
7530
|
export {
|
|
7542
|
-
AlertManager,
|
|
7543
7531
|
database_default as Database,
|
|
7544
7532
|
eas_default as EAS,
|
|
7545
7533
|
events_default as EventParser,
|
|
7546
7534
|
hvtec_default as HVtecParser,
|
|
7535
|
+
Manager,
|
|
7547
7536
|
pvtec_default as PVtecParser,
|
|
7548
7537
|
stanza_default as StanzaParser,
|
|
7549
7538
|
text_default as TextParser,
|