atmosx-nwws-parser 1.0.211 → 1.0.213
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/README.md +5 -5
- package/dist/cjs/index.cjs +37 -31
- package/dist/esm/index.mjs +37 -31
- package/package.json +1 -1
- package/src/bootstrap.ts +2 -2
- package/src/parsers/events/api.ts +7 -2
- package/src/parsers/events.ts +2 -2
- package/src/types.ts +2 -2
- package/test.js +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<h1 style='font-size: 65px'; align="center">🌪️ AtmosphericX - NOAA
|
|
1
|
+
<h1 style='font-size: 65px'; align="center">🌪️ AtmosphericX - NOAA Wire + API Parser ⚠️</h1>
|
|
2
2
|
<div align="center">
|
|
3
3
|
<p align = "center">This repository contains the primary parser for AtmosphericX's NOAA Weather Wire Service (NWWS) and National Weather Service (NWS) API. It is designed to handle real-time weather alerts and messages from the National Weather Service, using both XMPP (NWWS) and direct API access (Slower). This parser is intended for developers who want to integrate real-time weather alerts, watches, warnings, and forecast data from the NWS seamlessly into their applications or services. It is not recommended for users without basic programming knowledge. If you wish to access NOAA weather data without programming, consider using our end-user project, which leverages this parser and provides an easy-to-use interface for tracking weather alerts.</small></p>
|
|
4
4
|
<p align = "center">Documentation written by @k3yomi</p>
|
|
@@ -57,8 +57,8 @@ const parser = new AlertManager({
|
|
|
57
57
|
better_event_parsing: true,
|
|
58
58
|
filtering: {
|
|
59
59
|
events: [`Severe Thunderstorm Warning`],
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
filtered_icao: [],
|
|
61
|
+
ignored_icao: [`KWNS`],
|
|
62
62
|
ignored_events: [`Xx`, `Test Message`],
|
|
63
63
|
ugc_filter: [],
|
|
64
64
|
state_filter: [],
|
|
@@ -181,7 +181,7 @@ Dynamically updates the parser settings. Accepts the same configuration object a
|
|
|
181
181
|
parser.setSettings({
|
|
182
182
|
global_settings: {
|
|
183
183
|
filtering: {
|
|
184
|
-
|
|
184
|
+
ignored_icao: [`KXYZ`],
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
});
|
|
@@ -203,4 +203,4 @@ parser.stop();
|
|
|
203
203
|
- [k3yomi](https://github.com/k3yomi)
|
|
204
204
|
- Lead developer @ AtmosphericX and maintainer of this module.
|
|
205
205
|
- [StarflightWx](https://x.com/starflightVR)
|
|
206
|
-
- For testing and providing feedback (Co-Developer and Spotter @ AtmosphericX)
|
|
206
|
+
- For testing and providing feedback (Co-Developer and Spotter @ AtmosphericX)
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1011,8 +1011,8 @@ var settings = {
|
|
|
1011
1011
|
better_event_parsing: true,
|
|
1012
1012
|
filtering: {
|
|
1013
1013
|
events: [],
|
|
1014
|
-
|
|
1015
|
-
|
|
1014
|
+
filtered_icao: [],
|
|
1015
|
+
ignored_icao: [`KWNS`],
|
|
1016
1016
|
ignored_events: [`Xx`, `Test Message`],
|
|
1017
1017
|
ugc_filter: [],
|
|
1018
1018
|
state_filter: [],
|
|
@@ -2004,7 +2004,13 @@ var APIAlerts = class {
|
|
|
2004
2004
|
const vtecValue = Array.isArray(extracted.pVtec) ? extracted.pVtec[0] : extracted.pVtec;
|
|
2005
2005
|
const splitPVTEC = vtecValue.split(".");
|
|
2006
2006
|
return `${splitPVTEC[2]}-${splitPVTEC[3]}-${splitPVTEC[4]}-${splitPVTEC[5]}`;
|
|
2007
|
-
})() :
|
|
2007
|
+
})() : (() => {
|
|
2008
|
+
var _a;
|
|
2009
|
+
const wmoMatch = (_a = extracted.wmoidentifier) == null ? void 0 : _a.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
|
|
2010
|
+
const id = (wmoMatch == null ? void 0 : wmoMatch[1]) || "N/A";
|
|
2011
|
+
const station = (wmoMatch == null ? void 0 : wmoMatch[2]) || "N/A";
|
|
2012
|
+
return `${station}-${id}`;
|
|
2013
|
+
})();
|
|
2008
2014
|
}
|
|
2009
2015
|
/**
|
|
2010
2016
|
* @function getICAO
|
|
@@ -2035,17 +2041,17 @@ var APIAlerts = class {
|
|
|
2035
2041
|
*/
|
|
2036
2042
|
static event(validated) {
|
|
2037
2043
|
return __async(this, null, function* () {
|
|
2038
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia;
|
|
2044
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja;
|
|
2039
2045
|
let processed = [];
|
|
2040
2046
|
const messages = Object.values(JSON.parse(validated.message).features);
|
|
2041
2047
|
for (let feature of messages) {
|
|
2042
2048
|
const tick = performance.now();
|
|
2043
2049
|
const getPVTEC = (_d = (_c = (_b = (_a = feature == null ? void 0 : feature.properties) == null ? void 0 : _a.parameters) == null ? void 0 : _b.VTEC) == null ? void 0 : _c[0]) != null ? _d : null;
|
|
2044
|
-
const getWmo = (_g = (_f = (_e = feature == null ? void 0 : feature.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.WMOidentifier[0]) != null ?
|
|
2045
|
-
const getUgc = (
|
|
2046
|
-
const getHeadline = (
|
|
2047
|
-
const getDescription = `${getHeadline} ${(
|
|
2048
|
-
const getAWIP = (
|
|
2050
|
+
const getWmo = (_h = (_g = (_f = (_e = feature == null ? void 0 : feature.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.WMOidentifier) == null ? void 0 : _g[0]) != null ? _h : null;
|
|
2051
|
+
const getUgc = (_k = (_j = (_i = feature == null ? void 0 : feature.properties) == null ? void 0 : _i.geocode) == null ? void 0 : _j.UGC) != null ? _k : null;
|
|
2052
|
+
const getHeadline = (_o = (_n = (_m = (_l = feature == null ? void 0 : feature.properties) == null ? void 0 : _l.parameters) == null ? void 0 : _m.NWSheadline) == null ? void 0 : _n[0]) != null ? _o : "";
|
|
2053
|
+
const getDescription = `${getHeadline} ${(_q = (_p = feature == null ? void 0 : feature.properties) == null ? void 0 : _p.description) != null ? _q : ``}`;
|
|
2054
|
+
const getAWIP = (_u = (_t = (_s = (_r = feature == null ? void 0 : feature.properties) == null ? void 0 : _r.parameters) == null ? void 0 : _s.AWIPSidentifier) == null ? void 0 : _t[0]) != null ? _u : null;
|
|
2049
2055
|
const getHeader = events_default.getHeader(__spreadValues({}, { getAwip: { prefix: getAWIP == null ? void 0 : getAWIP.slice(0, -3) } }));
|
|
2050
2056
|
const getSource = text_default.textProductToString(getDescription, `SOURCE...`, [`.`]) || `N/A`;
|
|
2051
2057
|
const getOffice = this.getICAO(getPVTEC || ``);
|
|
@@ -2056,23 +2062,23 @@ var APIAlerts = class {
|
|
|
2056
2062
|
header: getHeader,
|
|
2057
2063
|
pvtec: getPVTEC || `N/A`,
|
|
2058
2064
|
history: [{
|
|
2059
|
-
description: (
|
|
2060
|
-
action: (
|
|
2061
|
-
time: ((
|
|
2065
|
+
description: (_w = (_v = feature == null ? void 0 : feature.properties) == null ? void 0 : _v.description) != null ? _w : `N/A`,
|
|
2066
|
+
action: (_y = (_x = feature == null ? void 0 : feature.properties) == null ? void 0 : _x.messageType) != null ? _y : `N/A`,
|
|
2067
|
+
time: ((_z = feature == null ? void 0 : feature.properties) == null ? void 0 : _z.sent) ? new Date((_A = feature == null ? void 0 : feature.properties) == null ? void 0 : _A.sent).toLocaleString() : `N/A`
|
|
2062
2068
|
}],
|
|
2063
2069
|
properties: {
|
|
2064
|
-
locations: (
|
|
2065
|
-
event: (
|
|
2066
|
-
issued: ((
|
|
2067
|
-
expires: ((
|
|
2068
|
-
parent: (
|
|
2069
|
-
action_type: (
|
|
2070
|
-
description: (
|
|
2070
|
+
locations: (_C = (_B = feature == null ? void 0 : feature.properties) == null ? void 0 : _B.areaDesc) != null ? _C : `N/A`,
|
|
2071
|
+
event: (_E = (_D = feature == null ? void 0 : feature.properties) == null ? void 0 : _D.event) != null ? _E : `N/A`,
|
|
2072
|
+
issued: ((_F = feature == null ? void 0 : feature.properties) == null ? void 0 : _F.sent) ? new Date((_G = feature == null ? void 0 : feature.properties) == null ? void 0 : _G.sent).toLocaleString() : `N/A`,
|
|
2073
|
+
expires: ((_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.expires) ? new Date((_I = feature == null ? void 0 : feature.properties) == null ? void 0 : _I.expires).toLocaleString() : `N/A`,
|
|
2074
|
+
parent: (_K = (_J = feature == null ? void 0 : feature.properties) == null ? void 0 : _J.event) != null ? _K : `N/A`,
|
|
2075
|
+
action_type: (_M = (_L = feature == null ? void 0 : feature.properties) == null ? void 0 : _L.messageType) != null ? _M : `N/A`,
|
|
2076
|
+
description: (_O = (_N = feature == null ? void 0 : feature.properties) == null ? void 0 : _N.description) != null ? _O : `N/A`,
|
|
2071
2077
|
sender_name: getOffice.name || `N/A`,
|
|
2072
2078
|
sender_icao: getOffice.icao || `N/A`,
|
|
2073
2079
|
attributes: validated.attributes,
|
|
2074
2080
|
geocode: {
|
|
2075
|
-
UGC: (
|
|
2081
|
+
UGC: (_R = (_Q = (_P = feature == null ? void 0 : feature.properties) == null ? void 0 : _P.geocode) == null ? void 0 : _Q.UGC) != null ? _R : [`XX000`]
|
|
2076
2082
|
},
|
|
2077
2083
|
metadata: {},
|
|
2078
2084
|
technical: {
|
|
@@ -2081,20 +2087,20 @@ var APIAlerts = class {
|
|
|
2081
2087
|
hvtec: `N/A`
|
|
2082
2088
|
},
|
|
2083
2089
|
parameters: {
|
|
2084
|
-
wmo: ((
|
|
2090
|
+
wmo: ((_U = (_T = (_S = feature == null ? void 0 : feature.properties) == null ? void 0 : _S.parameters) == null ? void 0 : _T.WMOidentifier) == null ? void 0 : _U[0]) || getWmo || `N/A`,
|
|
2085
2091
|
source: getSource,
|
|
2086
|
-
max_hail_size: ((
|
|
2087
|
-
max_wind_gust: ((
|
|
2088
|
-
damage_threat: ((
|
|
2089
|
-
tornado_detection: ((
|
|
2090
|
-
flood_detection: ((
|
|
2092
|
+
max_hail_size: ((_W = (_V = feature == null ? void 0 : feature.properties) == null ? void 0 : _V.parameters) == null ? void 0 : _W.maxHailSize) || `N/A`,
|
|
2093
|
+
max_wind_gust: ((_Y = (_X = feature == null ? void 0 : feature.properties) == null ? void 0 : _X.parameters) == null ? void 0 : _Y.maxWindGust) || `N/A`,
|
|
2094
|
+
damage_threat: ((__ = (_Z = feature == null ? void 0 : feature.properties) == null ? void 0 : _Z.parameters) == null ? void 0 : __.thunderstormDamageThreat) || [`N/A`],
|
|
2095
|
+
tornado_detection: ((_aa = (_$ = feature == null ? void 0 : feature.properties) == null ? void 0 : _$.parameters) == null ? void 0 : _aa.tornadoDetection) || [`N/A`],
|
|
2096
|
+
flood_detection: ((_ca = (_ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _ba.parameters) == null ? void 0 : _ca.floodDetection) || [`N/A`],
|
|
2091
2097
|
discussion_tornado_intensity: "N/A",
|
|
2092
2098
|
peakWindGust: `N/A`,
|
|
2093
2099
|
peakHailSize: `N/A`
|
|
2094
2100
|
},
|
|
2095
|
-
geometry: ((
|
|
2096
|
-
type: ((
|
|
2097
|
-
coordinates: (
|
|
2101
|
+
geometry: ((_fa = (_ea = (_da = feature == null ? void 0 : feature.geometry) == null ? void 0 : _da.coordinates) == null ? void 0 : _ea[0]) == null ? void 0 : _fa.length) ? {
|
|
2102
|
+
type: ((_ga = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ga.type) || "Polygon",
|
|
2103
|
+
coordinates: (_ja = (_ia = (_ha = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ha.coordinates) == null ? void 0 : _ia[0]) == null ? void 0 : _ja.map((coord) => {
|
|
2098
2104
|
const [lat, lon] = Array.isArray(coord) ? coord : [0, 0];
|
|
2099
2105
|
return [lon, lat];
|
|
2100
2106
|
})
|
|
@@ -2267,8 +2273,8 @@ var EventParser = class {
|
|
|
2267
2273
|
const setting = sets[key];
|
|
2268
2274
|
if (key === "events" && setting.size > 0 && !setting.has(originalEvent.properties.event.toLowerCase())) return false;
|
|
2269
2275
|
if (key === "ignored_events" && setting.size > 0 && setting.has(originalEvent.properties.event.toLowerCase())) return false;
|
|
2270
|
-
if (key === "
|
|
2271
|
-
if (key === "
|
|
2276
|
+
if (key === "filtered_icao" && setting.size > 0 && props.sender_icao != null && !setting.has(props.sender_icao.toLowerCase())) return false;
|
|
2277
|
+
if (key === "ignored_icao" && setting.size > 0 && props.sender_icao != null && setting.has(props.sender_icao.toLowerCase())) return false;
|
|
2272
2278
|
if (key === "ugc_filter" && setting.size > 0 && ugcs.length > 0 && !ugcs.some((ugc) => setting.has(ugc.toLowerCase()))) return false;
|
|
2273
2279
|
if (key === "state_filter" && setting.size > 0 && ugcs.length > 0 && !ugcs.some((ugc) => setting.has(ugc.substring(0, 2).toLowerCase()))) return false;
|
|
2274
2280
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -969,8 +969,8 @@ var settings = {
|
|
|
969
969
|
better_event_parsing: true,
|
|
970
970
|
filtering: {
|
|
971
971
|
events: [],
|
|
972
|
-
|
|
973
|
-
|
|
972
|
+
filtered_icao: [],
|
|
973
|
+
ignored_icao: [`KWNS`],
|
|
974
974
|
ignored_events: [`Xx`, `Test Message`],
|
|
975
975
|
ugc_filter: [],
|
|
976
976
|
state_filter: [],
|
|
@@ -1962,7 +1962,13 @@ var APIAlerts = class {
|
|
|
1962
1962
|
const vtecValue = Array.isArray(extracted.pVtec) ? extracted.pVtec[0] : extracted.pVtec;
|
|
1963
1963
|
const splitPVTEC = vtecValue.split(".");
|
|
1964
1964
|
return `${splitPVTEC[2]}-${splitPVTEC[3]}-${splitPVTEC[4]}-${splitPVTEC[5]}`;
|
|
1965
|
-
})() :
|
|
1965
|
+
})() : (() => {
|
|
1966
|
+
var _a;
|
|
1967
|
+
const wmoMatch = (_a = extracted.wmoidentifier) == null ? void 0 : _a.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
|
|
1968
|
+
const id = (wmoMatch == null ? void 0 : wmoMatch[1]) || "N/A";
|
|
1969
|
+
const station = (wmoMatch == null ? void 0 : wmoMatch[2]) || "N/A";
|
|
1970
|
+
return `${station}-${id}`;
|
|
1971
|
+
})();
|
|
1966
1972
|
}
|
|
1967
1973
|
/**
|
|
1968
1974
|
* @function getICAO
|
|
@@ -1993,17 +1999,17 @@ var APIAlerts = class {
|
|
|
1993
1999
|
*/
|
|
1994
2000
|
static event(validated) {
|
|
1995
2001
|
return __async(this, null, function* () {
|
|
1996
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia;
|
|
2002
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja;
|
|
1997
2003
|
let processed = [];
|
|
1998
2004
|
const messages = Object.values(JSON.parse(validated.message).features);
|
|
1999
2005
|
for (let feature of messages) {
|
|
2000
2006
|
const tick = performance.now();
|
|
2001
2007
|
const getPVTEC = (_d = (_c = (_b = (_a = feature == null ? void 0 : feature.properties) == null ? void 0 : _a.parameters) == null ? void 0 : _b.VTEC) == null ? void 0 : _c[0]) != null ? _d : null;
|
|
2002
|
-
const getWmo = (_g = (_f = (_e = feature == null ? void 0 : feature.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.WMOidentifier[0]) != null ?
|
|
2003
|
-
const getUgc = (
|
|
2004
|
-
const getHeadline = (
|
|
2005
|
-
const getDescription = `${getHeadline} ${(
|
|
2006
|
-
const getAWIP = (
|
|
2008
|
+
const getWmo = (_h = (_g = (_f = (_e = feature == null ? void 0 : feature.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.WMOidentifier) == null ? void 0 : _g[0]) != null ? _h : null;
|
|
2009
|
+
const getUgc = (_k = (_j = (_i = feature == null ? void 0 : feature.properties) == null ? void 0 : _i.geocode) == null ? void 0 : _j.UGC) != null ? _k : null;
|
|
2010
|
+
const getHeadline = (_o = (_n = (_m = (_l = feature == null ? void 0 : feature.properties) == null ? void 0 : _l.parameters) == null ? void 0 : _m.NWSheadline) == null ? void 0 : _n[0]) != null ? _o : "";
|
|
2011
|
+
const getDescription = `${getHeadline} ${(_q = (_p = feature == null ? void 0 : feature.properties) == null ? void 0 : _p.description) != null ? _q : ``}`;
|
|
2012
|
+
const getAWIP = (_u = (_t = (_s = (_r = feature == null ? void 0 : feature.properties) == null ? void 0 : _r.parameters) == null ? void 0 : _s.AWIPSidentifier) == null ? void 0 : _t[0]) != null ? _u : null;
|
|
2007
2013
|
const getHeader = events_default.getHeader(__spreadValues({}, { getAwip: { prefix: getAWIP == null ? void 0 : getAWIP.slice(0, -3) } }));
|
|
2008
2014
|
const getSource = text_default.textProductToString(getDescription, `SOURCE...`, [`.`]) || `N/A`;
|
|
2009
2015
|
const getOffice = this.getICAO(getPVTEC || ``);
|
|
@@ -2014,23 +2020,23 @@ var APIAlerts = class {
|
|
|
2014
2020
|
header: getHeader,
|
|
2015
2021
|
pvtec: getPVTEC || `N/A`,
|
|
2016
2022
|
history: [{
|
|
2017
|
-
description: (
|
|
2018
|
-
action: (
|
|
2019
|
-
time: ((
|
|
2023
|
+
description: (_w = (_v = feature == null ? void 0 : feature.properties) == null ? void 0 : _v.description) != null ? _w : `N/A`,
|
|
2024
|
+
action: (_y = (_x = feature == null ? void 0 : feature.properties) == null ? void 0 : _x.messageType) != null ? _y : `N/A`,
|
|
2025
|
+
time: ((_z = feature == null ? void 0 : feature.properties) == null ? void 0 : _z.sent) ? new Date((_A = feature == null ? void 0 : feature.properties) == null ? void 0 : _A.sent).toLocaleString() : `N/A`
|
|
2020
2026
|
}],
|
|
2021
2027
|
properties: {
|
|
2022
|
-
locations: (
|
|
2023
|
-
event: (
|
|
2024
|
-
issued: ((
|
|
2025
|
-
expires: ((
|
|
2026
|
-
parent: (
|
|
2027
|
-
action_type: (
|
|
2028
|
-
description: (
|
|
2028
|
+
locations: (_C = (_B = feature == null ? void 0 : feature.properties) == null ? void 0 : _B.areaDesc) != null ? _C : `N/A`,
|
|
2029
|
+
event: (_E = (_D = feature == null ? void 0 : feature.properties) == null ? void 0 : _D.event) != null ? _E : `N/A`,
|
|
2030
|
+
issued: ((_F = feature == null ? void 0 : feature.properties) == null ? void 0 : _F.sent) ? new Date((_G = feature == null ? void 0 : feature.properties) == null ? void 0 : _G.sent).toLocaleString() : `N/A`,
|
|
2031
|
+
expires: ((_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.expires) ? new Date((_I = feature == null ? void 0 : feature.properties) == null ? void 0 : _I.expires).toLocaleString() : `N/A`,
|
|
2032
|
+
parent: (_K = (_J = feature == null ? void 0 : feature.properties) == null ? void 0 : _J.event) != null ? _K : `N/A`,
|
|
2033
|
+
action_type: (_M = (_L = feature == null ? void 0 : feature.properties) == null ? void 0 : _L.messageType) != null ? _M : `N/A`,
|
|
2034
|
+
description: (_O = (_N = feature == null ? void 0 : feature.properties) == null ? void 0 : _N.description) != null ? _O : `N/A`,
|
|
2029
2035
|
sender_name: getOffice.name || `N/A`,
|
|
2030
2036
|
sender_icao: getOffice.icao || `N/A`,
|
|
2031
2037
|
attributes: validated.attributes,
|
|
2032
2038
|
geocode: {
|
|
2033
|
-
UGC: (
|
|
2039
|
+
UGC: (_R = (_Q = (_P = feature == null ? void 0 : feature.properties) == null ? void 0 : _P.geocode) == null ? void 0 : _Q.UGC) != null ? _R : [`XX000`]
|
|
2034
2040
|
},
|
|
2035
2041
|
metadata: {},
|
|
2036
2042
|
technical: {
|
|
@@ -2039,20 +2045,20 @@ var APIAlerts = class {
|
|
|
2039
2045
|
hvtec: `N/A`
|
|
2040
2046
|
},
|
|
2041
2047
|
parameters: {
|
|
2042
|
-
wmo: ((
|
|
2048
|
+
wmo: ((_U = (_T = (_S = feature == null ? void 0 : feature.properties) == null ? void 0 : _S.parameters) == null ? void 0 : _T.WMOidentifier) == null ? void 0 : _U[0]) || getWmo || `N/A`,
|
|
2043
2049
|
source: getSource,
|
|
2044
|
-
max_hail_size: ((
|
|
2045
|
-
max_wind_gust: ((
|
|
2046
|
-
damage_threat: ((
|
|
2047
|
-
tornado_detection: ((
|
|
2048
|
-
flood_detection: ((
|
|
2050
|
+
max_hail_size: ((_W = (_V = feature == null ? void 0 : feature.properties) == null ? void 0 : _V.parameters) == null ? void 0 : _W.maxHailSize) || `N/A`,
|
|
2051
|
+
max_wind_gust: ((_Y = (_X = feature == null ? void 0 : feature.properties) == null ? void 0 : _X.parameters) == null ? void 0 : _Y.maxWindGust) || `N/A`,
|
|
2052
|
+
damage_threat: ((__ = (_Z = feature == null ? void 0 : feature.properties) == null ? void 0 : _Z.parameters) == null ? void 0 : __.thunderstormDamageThreat) || [`N/A`],
|
|
2053
|
+
tornado_detection: ((_aa = (_$ = feature == null ? void 0 : feature.properties) == null ? void 0 : _$.parameters) == null ? void 0 : _aa.tornadoDetection) || [`N/A`],
|
|
2054
|
+
flood_detection: ((_ca = (_ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _ba.parameters) == null ? void 0 : _ca.floodDetection) || [`N/A`],
|
|
2049
2055
|
discussion_tornado_intensity: "N/A",
|
|
2050
2056
|
peakWindGust: `N/A`,
|
|
2051
2057
|
peakHailSize: `N/A`
|
|
2052
2058
|
},
|
|
2053
|
-
geometry: ((
|
|
2054
|
-
type: ((
|
|
2055
|
-
coordinates: (
|
|
2059
|
+
geometry: ((_fa = (_ea = (_da = feature == null ? void 0 : feature.geometry) == null ? void 0 : _da.coordinates) == null ? void 0 : _ea[0]) == null ? void 0 : _fa.length) ? {
|
|
2060
|
+
type: ((_ga = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ga.type) || "Polygon",
|
|
2061
|
+
coordinates: (_ja = (_ia = (_ha = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ha.coordinates) == null ? void 0 : _ia[0]) == null ? void 0 : _ja.map((coord) => {
|
|
2056
2062
|
const [lat, lon] = Array.isArray(coord) ? coord : [0, 0];
|
|
2057
2063
|
return [lon, lat];
|
|
2058
2064
|
})
|
|
@@ -2225,8 +2231,8 @@ var EventParser = class {
|
|
|
2225
2231
|
const setting = sets[key];
|
|
2226
2232
|
if (key === "events" && setting.size > 0 && !setting.has(originalEvent.properties.event.toLowerCase())) return false;
|
|
2227
2233
|
if (key === "ignored_events" && setting.size > 0 && setting.has(originalEvent.properties.event.toLowerCase())) return false;
|
|
2228
|
-
if (key === "
|
|
2229
|
-
if (key === "
|
|
2234
|
+
if (key === "filtered_icao" && setting.size > 0 && props.sender_icao != null && !setting.has(props.sender_icao.toLowerCase())) return false;
|
|
2235
|
+
if (key === "ignored_icao" && setting.size > 0 && props.sender_icao != null && setting.has(props.sender_icao.toLowerCase())) return false;
|
|
2230
2236
|
if (key === "ugc_filter" && setting.size > 0 && ugcs.length > 0 && !ugcs.some((ugc) => setting.has(ugc.toLowerCase()))) return false;
|
|
2231
2237
|
if (key === "state_filter" && setting.size > 0 && ugcs.length > 0 && !ugcs.some((ugc) => setting.has(ugc.substring(0, 2).toLowerCase()))) return false;
|
|
2232
2238
|
}
|
package/package.json
CHANGED
package/src/bootstrap.ts
CHANGED
|
@@ -105,8 +105,8 @@ export const settings = {
|
|
|
105
105
|
better_event_parsing: true,
|
|
106
106
|
filtering: {
|
|
107
107
|
events: [],
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
filtered_icao: [],
|
|
109
|
+
ignored_icao: [`KWNS`],
|
|
110
110
|
ignored_events: [`Xx`, `Test Message`],
|
|
111
111
|
ugc_filter: [],
|
|
112
112
|
state_filter: [],
|
|
@@ -36,7 +36,12 @@ export class APIAlerts {
|
|
|
36
36
|
const vtecValue = Array.isArray(extracted.pVtec) ? extracted.pVtec[0] : extracted.pVtec;
|
|
37
37
|
const splitPVTEC = vtecValue.split('.');
|
|
38
38
|
return `${splitPVTEC[2]}-${splitPVTEC[3]}-${splitPVTEC[4]}-${splitPVTEC[5]}`;
|
|
39
|
-
})() :
|
|
39
|
+
})() : (() => {
|
|
40
|
+
const wmoMatch = extracted.wmoidentifier?.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
|
|
41
|
+
const id = wmoMatch?.[1] || 'N/A';
|
|
42
|
+
const station = wmoMatch?.[2] || 'N/A';
|
|
43
|
+
return `${station}-${id}`;
|
|
44
|
+
})();
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
/**
|
|
@@ -72,7 +77,7 @@ export class APIAlerts {
|
|
|
72
77
|
for (let feature of messages) {
|
|
73
78
|
const tick = performance.now();
|
|
74
79
|
const getPVTEC = feature?.properties?.parameters?.VTEC?.[0] ?? null;
|
|
75
|
-
const getWmo = feature?.properties?.parameters?.WMOidentifier[0] ?? null;
|
|
80
|
+
const getWmo = feature?.properties?.parameters?.WMOidentifier?.[0] ?? null;
|
|
76
81
|
const getUgc = feature?.properties?.geocode?.UGC ?? null;
|
|
77
82
|
const getHeadline = feature?.properties?.parameters?.NWSheadline?.[0] ?? "";
|
|
78
83
|
const getDescription = `${getHeadline} ${feature?.properties?.description ?? ``}`
|
package/src/parsers/events.ts
CHANGED
|
@@ -159,8 +159,8 @@ export class EventParser {
|
|
|
159
159
|
const setting = sets[key];
|
|
160
160
|
if (key === 'events' && setting.size > 0 && !setting.has(originalEvent.properties.event.toLowerCase())) return false;
|
|
161
161
|
if (key === 'ignored_events' && setting.size > 0 && setting.has(originalEvent.properties.event.toLowerCase())) return false;
|
|
162
|
-
if (key === '
|
|
163
|
-
if (key === '
|
|
162
|
+
if (key === 'filtered_icao' && setting.size > 0 && props.sender_icao != null && !setting.has(props.sender_icao.toLowerCase())) return false;
|
|
163
|
+
if (key === 'ignored_icao' && setting.size > 0 && props.sender_icao != null && setting.has(props.sender_icao.toLowerCase())) return false;
|
|
164
164
|
if (key === 'ugc_filter' && setting.size > 0 && ugcs.length > 0 && !ugcs.some((ugc: string) => setting.has(ugc.toLowerCase()))) return false;
|
|
165
165
|
if (key === 'state_filter' && setting.size > 0 && ugcs.length > 0 && !ugcs.some((ugc: string) => setting.has(ugc.substring(0, 2).toLowerCase()))) return false;
|
|
166
166
|
}
|
package/src/types.ts
CHANGED
|
@@ -23,8 +23,8 @@ interface LocalLocationFilteringSettings {
|
|
|
23
23
|
|
|
24
24
|
interface LocalAlertFilteringSettings {
|
|
25
25
|
events?: string[];
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
filtered_icao?: string[];
|
|
27
|
+
ignored_icao?: string[];
|
|
28
28
|
ugc_filter?: string[];
|
|
29
29
|
state_filter?: string[];
|
|
30
30
|
ignored_events?: string[];
|
package/test.js
CHANGED
|
@@ -38,8 +38,8 @@ const parser = new AlertManager({
|
|
|
38
38
|
better_event_parsing: true,
|
|
39
39
|
filtering: {
|
|
40
40
|
events: [`Severe Thunderstorm Warning`],
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
filtered_icao: ["PAFC"],
|
|
42
|
+
ignored_icao: [`KWNS`],
|
|
43
43
|
ignored_events: [`Xx`, `Test Message`],
|
|
44
44
|
ugc_filter: [],
|
|
45
45
|
state_filter: [],
|