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 CHANGED
@@ -1,4 +1,4 @@
1
- <h1 style='font-size: 65px'; align="center">🌪️ AtmosphericX - NOAA Weather Wire + API Parser ⚠️</h1>
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
- filtered_icoa: [],
61
- ignored_icoa: [`KWNS`],
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
- ignored_icoa: [`KXYZ`],
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)
@@ -1011,8 +1011,8 @@ var settings = {
1011
1011
  better_event_parsing: true,
1012
1012
  filtering: {
1013
1013
  events: [],
1014
- filtered_icoa: [],
1015
- ignored_icoa: [`KWNS`],
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
- })() : `${extracted.wmoidentifier}`;
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 ? _g : null;
2045
- const getUgc = (_j = (_i = (_h = feature == null ? void 0 : feature.properties) == null ? void 0 : _h.geocode) == null ? void 0 : _i.UGC) != null ? _j : null;
2046
- const getHeadline = (_n = (_m = (_l = (_k = feature == null ? void 0 : feature.properties) == null ? void 0 : _k.parameters) == null ? void 0 : _l.NWSheadline) == null ? void 0 : _m[0]) != null ? _n : "";
2047
- const getDescription = `${getHeadline} ${(_p = (_o = feature == null ? void 0 : feature.properties) == null ? void 0 : _o.description) != null ? _p : ``}`;
2048
- const getAWIP = (_t = (_s = (_r = (_q = feature == null ? void 0 : feature.properties) == null ? void 0 : _q.parameters) == null ? void 0 : _r.AWIPSidentifier) == null ? void 0 : _s[0]) != null ? _t : null;
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: (_v = (_u = feature == null ? void 0 : feature.properties) == null ? void 0 : _u.description) != null ? _v : `N/A`,
2060
- action: (_x = (_w = feature == null ? void 0 : feature.properties) == null ? void 0 : _w.messageType) != null ? _x : `N/A`,
2061
- time: ((_y = feature == null ? void 0 : feature.properties) == null ? void 0 : _y.sent) ? new Date((_z = feature == null ? void 0 : feature.properties) == null ? void 0 : _z.sent).toLocaleString() : `N/A`
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: (_B = (_A = feature == null ? void 0 : feature.properties) == null ? void 0 : _A.areaDesc) != null ? _B : `N/A`,
2065
- event: (_D = (_C = feature == null ? void 0 : feature.properties) == null ? void 0 : _C.event) != null ? _D : `N/A`,
2066
- issued: ((_E = feature == null ? void 0 : feature.properties) == null ? void 0 : _E.sent) ? new Date((_F = feature == null ? void 0 : feature.properties) == null ? void 0 : _F.sent).toLocaleString() : `N/A`,
2067
- expires: ((_G = feature == null ? void 0 : feature.properties) == null ? void 0 : _G.expires) ? new Date((_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.expires).toLocaleString() : `N/A`,
2068
- parent: (_J = (_I = feature == null ? void 0 : feature.properties) == null ? void 0 : _I.event) != null ? _J : `N/A`,
2069
- action_type: (_L = (_K = feature == null ? void 0 : feature.properties) == null ? void 0 : _K.messageType) != null ? _L : `N/A`,
2070
- description: (_N = (_M = feature == null ? void 0 : feature.properties) == null ? void 0 : _M.description) != null ? _N : `N/A`,
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: (_Q = (_P = (_O = feature == null ? void 0 : feature.properties) == null ? void 0 : _O.geocode) == null ? void 0 : _P.UGC) != null ? _Q : [`XX000`]
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: ((_T = (_S = (_R = feature == null ? void 0 : feature.properties) == null ? void 0 : _R.parameters) == null ? void 0 : _S.WMOidentifier) == null ? void 0 : _T[0]) || getWmo || `N/A`,
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: ((_V = (_U = feature == null ? void 0 : feature.properties) == null ? void 0 : _U.parameters) == null ? void 0 : _V.maxHailSize) || `N/A`,
2087
- max_wind_gust: ((_X = (_W = feature == null ? void 0 : feature.properties) == null ? void 0 : _W.parameters) == null ? void 0 : _X.maxWindGust) || `N/A`,
2088
- damage_threat: ((_Z = (_Y = feature == null ? void 0 : feature.properties) == null ? void 0 : _Y.parameters) == null ? void 0 : _Z.thunderstormDamageThreat) || [`N/A`],
2089
- tornado_detection: ((_$ = (__ = feature == null ? void 0 : feature.properties) == null ? void 0 : __.parameters) == null ? void 0 : _$.tornadoDetection) || [`N/A`],
2090
- flood_detection: ((_ba = (_aa = feature == null ? void 0 : feature.properties) == null ? void 0 : _aa.parameters) == null ? void 0 : _ba.floodDetection) || [`N/A`],
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: ((_ea = (_da = (_ca = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ca.coordinates) == null ? void 0 : _da[0]) == null ? void 0 : _ea.length) ? {
2096
- type: ((_fa = feature == null ? void 0 : feature.geometry) == null ? void 0 : _fa.type) || "Polygon",
2097
- coordinates: (_ia = (_ha = (_ga = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ga.coordinates) == null ? void 0 : _ha[0]) == null ? void 0 : _ia.map((coord) => {
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 === "filtered_icoa" && setting.size > 0 && props.sender_icao != null && !setting.has(props.sender_icao.toLowerCase())) return false;
2271
- if (key === "ignored_icoa" && setting.size > 0 && props.sender_icao != null && setting.has(props.sender_icao.toLowerCase())) return false;
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
  }
@@ -969,8 +969,8 @@ var settings = {
969
969
  better_event_parsing: true,
970
970
  filtering: {
971
971
  events: [],
972
- filtered_icoa: [],
973
- ignored_icoa: [`KWNS`],
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
- })() : `${extracted.wmoidentifier}`;
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 ? _g : null;
2003
- const getUgc = (_j = (_i = (_h = feature == null ? void 0 : feature.properties) == null ? void 0 : _h.geocode) == null ? void 0 : _i.UGC) != null ? _j : null;
2004
- const getHeadline = (_n = (_m = (_l = (_k = feature == null ? void 0 : feature.properties) == null ? void 0 : _k.parameters) == null ? void 0 : _l.NWSheadline) == null ? void 0 : _m[0]) != null ? _n : "";
2005
- const getDescription = `${getHeadline} ${(_p = (_o = feature == null ? void 0 : feature.properties) == null ? void 0 : _o.description) != null ? _p : ``}`;
2006
- const getAWIP = (_t = (_s = (_r = (_q = feature == null ? void 0 : feature.properties) == null ? void 0 : _q.parameters) == null ? void 0 : _r.AWIPSidentifier) == null ? void 0 : _s[0]) != null ? _t : null;
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: (_v = (_u = feature == null ? void 0 : feature.properties) == null ? void 0 : _u.description) != null ? _v : `N/A`,
2018
- action: (_x = (_w = feature == null ? void 0 : feature.properties) == null ? void 0 : _w.messageType) != null ? _x : `N/A`,
2019
- time: ((_y = feature == null ? void 0 : feature.properties) == null ? void 0 : _y.sent) ? new Date((_z = feature == null ? void 0 : feature.properties) == null ? void 0 : _z.sent).toLocaleString() : `N/A`
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: (_B = (_A = feature == null ? void 0 : feature.properties) == null ? void 0 : _A.areaDesc) != null ? _B : `N/A`,
2023
- event: (_D = (_C = feature == null ? void 0 : feature.properties) == null ? void 0 : _C.event) != null ? _D : `N/A`,
2024
- issued: ((_E = feature == null ? void 0 : feature.properties) == null ? void 0 : _E.sent) ? new Date((_F = feature == null ? void 0 : feature.properties) == null ? void 0 : _F.sent).toLocaleString() : `N/A`,
2025
- expires: ((_G = feature == null ? void 0 : feature.properties) == null ? void 0 : _G.expires) ? new Date((_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.expires).toLocaleString() : `N/A`,
2026
- parent: (_J = (_I = feature == null ? void 0 : feature.properties) == null ? void 0 : _I.event) != null ? _J : `N/A`,
2027
- action_type: (_L = (_K = feature == null ? void 0 : feature.properties) == null ? void 0 : _K.messageType) != null ? _L : `N/A`,
2028
- description: (_N = (_M = feature == null ? void 0 : feature.properties) == null ? void 0 : _M.description) != null ? _N : `N/A`,
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: (_Q = (_P = (_O = feature == null ? void 0 : feature.properties) == null ? void 0 : _O.geocode) == null ? void 0 : _P.UGC) != null ? _Q : [`XX000`]
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: ((_T = (_S = (_R = feature == null ? void 0 : feature.properties) == null ? void 0 : _R.parameters) == null ? void 0 : _S.WMOidentifier) == null ? void 0 : _T[0]) || getWmo || `N/A`,
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: ((_V = (_U = feature == null ? void 0 : feature.properties) == null ? void 0 : _U.parameters) == null ? void 0 : _V.maxHailSize) || `N/A`,
2045
- max_wind_gust: ((_X = (_W = feature == null ? void 0 : feature.properties) == null ? void 0 : _W.parameters) == null ? void 0 : _X.maxWindGust) || `N/A`,
2046
- damage_threat: ((_Z = (_Y = feature == null ? void 0 : feature.properties) == null ? void 0 : _Y.parameters) == null ? void 0 : _Z.thunderstormDamageThreat) || [`N/A`],
2047
- tornado_detection: ((_$ = (__ = feature == null ? void 0 : feature.properties) == null ? void 0 : __.parameters) == null ? void 0 : _$.tornadoDetection) || [`N/A`],
2048
- flood_detection: ((_ba = (_aa = feature == null ? void 0 : feature.properties) == null ? void 0 : _aa.parameters) == null ? void 0 : _ba.floodDetection) || [`N/A`],
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: ((_ea = (_da = (_ca = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ca.coordinates) == null ? void 0 : _da[0]) == null ? void 0 : _ea.length) ? {
2054
- type: ((_fa = feature == null ? void 0 : feature.geometry) == null ? void 0 : _fa.type) || "Polygon",
2055
- coordinates: (_ia = (_ha = (_ga = feature == null ? void 0 : feature.geometry) == null ? void 0 : _ga.coordinates) == null ? void 0 : _ha[0]) == null ? void 0 : _ia.map((coord) => {
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 === "filtered_icoa" && setting.size > 0 && props.sender_icao != null && !setting.has(props.sender_icao.toLowerCase())) return false;
2229
- if (key === "ignored_icoa" && setting.size > 0 && props.sender_icao != null && setting.has(props.sender_icao.toLowerCase())) return false;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atmosx-nwws-parser",
3
- "version": "1.0.211",
3
+ "version": "1.0.213",
4
4
  "description": "NOAA Weather Wire Parser - Built for standalone and Project AtmosphericX Integration.",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",
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
- filtered_icoa: [],
109
- ignored_icoa: [`KWNS`],
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
- })() : `${extracted.wmoidentifier}`;
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 ?? ``}`
@@ -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 === 'filtered_icoa' && setting.size > 0 && props.sender_icao != null && !setting.has(props.sender_icao.toLowerCase())) return false;
163
- if (key === 'ignored_icoa' && setting.size > 0 && props.sender_icao != null && setting.has(props.sender_icao.toLowerCase())) return false;
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
- filtered_icoa?: string[];
27
- ignored_icoa?: string[];
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
- filtered_icoa: [],
42
- ignored_icoa: [`KWNS`],
41
+ filtered_icao: ["PAFC"],
42
+ ignored_icao: [`KWNS`],
43
43
  ignored_events: [`Xx`, `Test Message`],
44
44
  ugc_filter: [],
45
45
  state_filter: [],