@atmosx/event-product-parser 3.0.44 → 3.0.46
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 +66 -31
- package/SUPPORTED_EVENTS.md +369 -0
- package/dist/cjs/index.cjs +476 -373
- package/dist/esm/index.mjs +454 -352
- package/dist/index.d.mts +42 -24
- package/dist/index.d.ts +42 -24
- package/package.json +1 -1
- package/src/@building/{building.outlooks.ts → building.attachments.ts} +7 -1
- package/src/@building/building.enhance.ts +7 -3
- package/src/@building/building.office.ts +2 -2
- package/src/@building/building.properties.ts +11 -11
- package/src/@building/building.signature.ts +11 -11
- package/src/@building/building.tags.ts +2 -2
- package/src/@building/building.tracking.ts +3 -3
- package/src/@building/building.validate.ts +2 -2
- package/src/@core/core.createEvent.ts +82 -0
- package/src/@dictionaries/{dictionaries.eventActions.ts → dictionaries.actions.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventAwipAbreviations.ts → dictionaries.awips.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventCancelMessages.ts → dictionaries.cancellation.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventCauses.ts → dictionaries.causes.ts} +1 -1
- package/src/@dictionaries/{dictionaries.statusCorrelationText.ts → dictionaries.correlations.ts} +1 -1
- package/src/@dictionaries/{dictionaries.betterEventNames.ts → dictionaries.enhanced.ts} +13 -2
- package/src/@dictionaries/{dictionaries.eventTypes.ts → dictionaries.events.ts} +1 -1
- package/src/@dictionaries/{dictionaries.regExp.ts → dictionaries.expressions.ts} +1 -1
- package/src/@dictionaries/{dictionaries.hailStrings.ts → dictionaries.hail.ts} +4 -1
- package/src/@dictionaries/{dictionaries.officeICAOs.ts → dictionaries.icao.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventsMatchText.ts → dictionaries.matches.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventProducts.ts → dictionaries.products.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventRecords.ts → dictionaries.records.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventSeverity.ts → dictionaries.severity.ts} +1 -1
- package/src/@dictionaries/{dictionaries.shapefileLinks.ts → dictionaries.shapefiles.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventStatus.ts → dictionaries.status.ts} +1 -1
- package/src/@dictionaries/{dictionaries.eventTags.ts → dictionaries.tags.ts} +1 -1
- package/src/@dictionaries/{dictionaries.testSignatures.ts → dictionaries.test.ts} +3 -2
- package/src/@events/events.api.ts +17 -15
- package/src/@events/events.text.ts +2 -2
- package/src/@events/events.ugc.ts +2 -2
- package/src/@manager/manager.mkEvent.ts +3 -3
- package/src/@manager/manager.rmEvent.ts +3 -2
- package/src/@manager/manager.updateListener.ts +124 -0
- package/src/@modules/@database/database.shapefiles.ts +2 -2
- package/src/@modules/@eas/eas.getCleanDescription.ts +2 -0
- package/src/@modules/@eas/eas.getTTS.ts +19 -8
- package/src/@modules/@eas/eas.setEasTone.ts +15 -10
- package/src/@modules/@stanza/stanza.getAwipsType.ts +2 -2
- package/src/@modules/@stanza/stanza.validate.ts +3 -3
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +4 -2
- package/src/@parsers/@hvtec/hvtec.extract.ts +8 -8
- package/src/@parsers/@pvtec/pvtec.extract.ts +12 -12
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +2 -2
- package/src/@parsers/@text/text.getEmbed.ts +60 -0
- package/src/@parsers/@ugc/ugc.header.ts +3 -3
- package/src/@types/type.event.ts +2 -2
- package/src/@types/{type.webhook.ts → type.listener.ts} +11 -7
- package/src/@types/type.properties.ts +9 -9
- package/src/@types/type.settings.ts +7 -6
- package/src/bootstrap.ts +7 -6
- package/src/index.ts +2 -1
- package/test.js +19 -19
- package/src/@manager/manager.createWebhook.ts +0 -129
- package/src/@manager/manager.updateWebhooks.ts +0 -49
- package/src/@modules/@utilities/utilities.isImageReady.ts +0 -27
package/dist/esm/index.mjs
CHANGED
|
@@ -10491,7 +10491,7 @@ var require_form_data = __commonJS({
|
|
|
10491
10491
|
import path from "path";
|
|
10492
10492
|
import { EventEmitter } from "events";
|
|
10493
10493
|
var bootstrap = {
|
|
10494
|
-
version: `3.0.
|
|
10494
|
+
version: `3.0.46`,
|
|
10495
10495
|
isReady: true,
|
|
10496
10496
|
ratelimits: {},
|
|
10497
10497
|
session_xmpp: null,
|
|
@@ -10547,7 +10547,7 @@ var bootstrap = {
|
|
|
10547
10547
|
CallbackInterval: 15,
|
|
10548
10548
|
EventsEndpoint: `https://api.weather.gov/alerts/active`
|
|
10549
10549
|
},
|
|
10550
|
-
|
|
10550
|
+
ListenerSettings: [],
|
|
10551
10551
|
GlobalSettings: {
|
|
10552
10552
|
EventManagement: true,
|
|
10553
10553
|
BetterEventNames: true,
|
|
@@ -10567,10 +10567,11 @@ var bootstrap = {
|
|
|
10567
10567
|
NodeLocationFiltering: false,
|
|
10568
10568
|
IgnoreTestProducts: true
|
|
10569
10569
|
},
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
|
|
10570
|
+
ArchiveSettings: {
|
|
10571
|
+
TTL: 60,
|
|
10572
|
+
TextDirectory: null,
|
|
10573
|
+
EasDirectory: null,
|
|
10574
|
+
EasToneout: null
|
|
10574
10575
|
}
|
|
10575
10576
|
}
|
|
10576
10577
|
}
|
|
@@ -13584,8 +13585,8 @@ var xError = () => {
|
|
|
13584
13585
|
}));
|
|
13585
13586
|
};
|
|
13586
13587
|
|
|
13587
|
-
// src/@dictionaries/dictionaries.
|
|
13588
|
-
var
|
|
13588
|
+
// src/@dictionaries/dictionaries.expressions.ts
|
|
13589
|
+
var dict_expressions = {
|
|
13589
13590
|
pvtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
|
|
13590
13591
|
hvtec: new RegExp(`[a-zA-Z0-9]{4}.[A-Z0-9].[A-Z]{2}.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[A-Z]{2}`, "imu"),
|
|
13591
13592
|
wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
|
|
@@ -13595,8 +13596,8 @@ var regExp = {
|
|
|
13595
13596
|
dateline: new RegExp(`\\d{3,4}\\s*(AM|PM)?\\s*[A-Z]{2,4}\\s+[A-Z]{3,}\\s+[A-Z]{3,}\\s+\\d{1,2}\\s+\\d{4}`, "gim")
|
|
13596
13597
|
};
|
|
13597
13598
|
|
|
13598
|
-
// src/@dictionaries/dictionaries.
|
|
13599
|
-
var
|
|
13599
|
+
// src/@dictionaries/dictionaries.awips.ts
|
|
13600
|
+
var dict_awips = {
|
|
13600
13601
|
ABV: `rawinsonde-data-above-100-millibars`,
|
|
13601
13602
|
ADA: `alarm-alert-administrative-message`,
|
|
13602
13603
|
ADM: `alert-administrative-message`,
|
|
@@ -13951,7 +13952,7 @@ var getAwipsType = (options) => {
|
|
|
13951
13952
|
prefix: null
|
|
13952
13953
|
};
|
|
13953
13954
|
}
|
|
13954
|
-
for (const [prefix, type] of Object.entries(
|
|
13955
|
+
for (const [prefix, type] of Object.entries(dict_awips)) {
|
|
13955
13956
|
if (attributes.awipsid.startsWith(prefix)) {
|
|
13956
13957
|
return { type, prefix };
|
|
13957
13958
|
}
|
|
@@ -13969,8 +13970,8 @@ var validate = (options) => {
|
|
|
13969
13970
|
if (attributes.awipsid && attributes.awipsid.length > 1) {
|
|
13970
13971
|
const isCapEvent = message.includes(`<?xml`);
|
|
13971
13972
|
const isCapAreaDescription = message.includes(`<areaDesc>`);
|
|
13972
|
-
const isVTEC = message.match(
|
|
13973
|
-
const isUGC = message.match(
|
|
13973
|
+
const isVTEC = message.match(dict_expressions.pvtec) != null;
|
|
13974
|
+
const isUGC = message.match(dict_expressions.ugc1) != null;
|
|
13974
13975
|
const getType = getAwipsType({ attributes });
|
|
13975
13976
|
if (getType.type != null) {
|
|
13976
13977
|
return {
|
|
@@ -13994,7 +13995,7 @@ var validate = (options) => {
|
|
|
13994
13995
|
// src/@parsers/@text/text.getDescriptionFromProduct.ts
|
|
13995
13996
|
var getDescriptionFromProduct = (options) => {
|
|
13996
13997
|
let message = options.message;
|
|
13997
|
-
const dates = Array.from(message.matchAll(
|
|
13998
|
+
const dates = Array.from(message.matchAll(dict_expressions.dateline));
|
|
13998
13999
|
if (dates.length) {
|
|
13999
14000
|
const lastMatch = dates[dates.length - 1][0];
|
|
14000
14001
|
const sIndx = message.lastIndexOf(lastMatch);
|
|
@@ -14060,8 +14061,8 @@ var getTextFromProduct = (options) => {
|
|
|
14060
14061
|
return null;
|
|
14061
14062
|
};
|
|
14062
14063
|
|
|
14063
|
-
// src/@dictionaries/dictionaries.
|
|
14064
|
-
var
|
|
14064
|
+
// src/@dictionaries/dictionaries.icao.ts
|
|
14065
|
+
var dict_icao = {
|
|
14065
14066
|
"KLUB": "Lubbock, TX",
|
|
14066
14067
|
"KLCH": "Lake Charles, LA",
|
|
14067
14068
|
"TSTL": "St. Louis, MO",
|
|
@@ -14306,12 +14307,12 @@ var officeICAOs = {
|
|
|
14306
14307
|
var getEventOffice = (options) => {
|
|
14307
14308
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
14308
14309
|
const office = options.pVtec != null ? (_b = (_a = options.pVtec) == null ? void 0 : _a.tracking) == null ? void 0 : _b.split(`.`)[0] : (_e = (_c = options.attributes) == null ? void 0 : _c.cccc) != null ? _e : options.organization != null ? Array.isArray(options.organization) ? (_d = options.organization) == null ? void 0 : _d[0] : options.organization : null;
|
|
14309
|
-
const name = (_g = (_f =
|
|
14310
|
+
const name = (_g = (_f = dict_icao) == null ? void 0 : _f[office]) != null ? _g : null;
|
|
14310
14311
|
return { office, name };
|
|
14311
14312
|
};
|
|
14312
14313
|
|
|
14313
|
-
// src/@dictionaries/dictionaries.
|
|
14314
|
-
var
|
|
14314
|
+
// src/@dictionaries/dictionaries.tags.ts
|
|
14315
|
+
var dict_tags = {
|
|
14315
14316
|
"FROSTBITE AND HYPOTHERMIA ARE LIKELY": "Frostbite and Hypothermia Likely",
|
|
14316
14317
|
"LICKELY BECOME SLICK AND HAZARDOUS": "Slick and Hazardous Roads",
|
|
14317
14318
|
"SLIPPERY ROAD CONDITIONS": "Slippery Roads",
|
|
@@ -14388,13 +14389,13 @@ var eventTags = {
|
|
|
14388
14389
|
|
|
14389
14390
|
// src/@building/building.tags.ts
|
|
14390
14391
|
var getEventTags = (message) => {
|
|
14391
|
-
return Object.entries(
|
|
14392
|
+
return Object.entries(dict_tags).filter(([key]) => message == null ? void 0 : message.toLowerCase().includes(key.toLowerCase())).map(([, value]) => value);
|
|
14392
14393
|
};
|
|
14393
14394
|
|
|
14394
14395
|
// src/@building/building.properties.ts
|
|
14395
14396
|
var properties = (options) => {
|
|
14396
|
-
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;
|
|
14397
|
-
const organization = (_b = (_a = options.message.match(
|
|
14397
|
+
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;
|
|
14398
|
+
const organization = (_b = (_a = options.message.match(dict_expressions.wmo)) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
14398
14399
|
const polygons = getPolygonFromProduct(options.message);
|
|
14399
14400
|
const properties2 = {
|
|
14400
14401
|
locations: (_e = (_d = (_c = options == null ? void 0 : options.ugc) == null ? void 0 : _c.locations) == null ? void 0 : _d.join(`; `)) != null ? _e : null,
|
|
@@ -14421,27 +14422,27 @@ var properties = (options) => {
|
|
|
14421
14422
|
wind_threat: (_s = getTextFromProduct({ message: options.message, find: [`WIND THREAT...`] })) != null ? _s : null,
|
|
14422
14423
|
hail_threat: (_t = getTextFromProduct({ message: options.message, find: [`HAIL THREAT...`], removal: [] })) != null ? _t : null
|
|
14423
14424
|
},
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14425
|
+
discussion_parameters: {
|
|
14426
|
+
discussion_number: (_w = (_v = (_u = getTextFromProduct({ message: options.message, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) == null ? void 0 : _u.toString()) == null ? void 0 : _v.padStart(4, "0")) != null ? _w : null,
|
|
14427
|
+
discussion_concerning: (_x = getTextFromProduct({ message: options.message, find: [`Concerning...`] })) != null ? _x : null,
|
|
14428
|
+
discussion_max_tornado: (_y = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _y : null,
|
|
14429
|
+
discussion_max_hail: (_z = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _z : null,
|
|
14430
|
+
discussion_max_wind: (_A = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _A : null,
|
|
14431
|
+
discussion_watch_issuance: (_B = getTextFromProduct({ message: options.message, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _B : null
|
|
14431
14432
|
},
|
|
14432
14433
|
watch_parameters: {
|
|
14433
|
-
watch_number: (_C = (
|
|
14434
|
+
watch_number: ((_C = options == null ? void 0 : options.pVtec) == null ? void 0 : _C.is_watch) && ((_M = (_L = (_G = (_F = (_E = (_D = getTextFromProduct({ message: options.message, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _D.replace(/(WT|WS|)/g, "")) == null ? void 0 : _E.trim()) == null ? void 0 : _F.toString()) == null ? void 0 : _G.padStart(4, "0")) != null ? _L : (_K = (_J = (_I = (_H = options == null ? void 0 : options.pVtec) == null ? void 0 : _H.tracking) == null ? void 0 : _I.slice(-4)) == null ? void 0 : _J.toString()) == null ? void 0 : _K.padStart(4, "0")) != null ? _M : null),
|
|
14434
14435
|
watch_type: options.message.includes(`TORNADO WATCH`) ? `Tornado` : (options == null ? void 0 : options.message.includes(`SEVERE`)) ? `Severe` : null,
|
|
14435
|
-
additional_tornadoes_probability: (
|
|
14436
|
-
strong_tornadoes_probability: (
|
|
14437
|
-
severe_wind_probability: (
|
|
14438
|
-
severe_hail_probability: (
|
|
14439
|
-
hail_2in_probability: (
|
|
14440
|
-
combined_hail_wind_probability: (
|
|
14441
|
-
max_hail_in: (
|
|
14442
|
-
max_wind_surface: (
|
|
14443
|
-
max_tops_x100feet: (
|
|
14444
|
-
pds_watch: getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`
|
|
14436
|
+
additional_tornadoes_probability: (_N = getTextFromProduct({ message: options.message, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _N : null,
|
|
14437
|
+
strong_tornadoes_probability: (_O = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _O : null,
|
|
14438
|
+
severe_wind_probability: (_P = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _P : null,
|
|
14439
|
+
severe_hail_probability: (_Q = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Q : null,
|
|
14440
|
+
hail_2in_probability: (_R = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? _R : null,
|
|
14441
|
+
combined_hail_wind_probability: (_S = getTextFromProduct({ message: options.message, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _S : null,
|
|
14442
|
+
max_hail_in: (_T = getTextFromProduct({ message: options.message, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _T : null,
|
|
14443
|
+
max_wind_surface: (_U = getTextFromProduct({ message: options.message, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _U : null,
|
|
14444
|
+
max_tops_x100feet: (_V = getTextFromProduct({ message: options.message, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _V : null,
|
|
14445
|
+
pds_watch: getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES` ? true : null
|
|
14445
14446
|
}
|
|
14446
14447
|
};
|
|
14447
14448
|
if (isNaN(Number(properties2.watch_parameters.watch_number))) {
|
|
@@ -14459,8 +14460,8 @@ var getEventHeader = (options) => {
|
|
|
14459
14460
|
return `ZCZC-ATMOSX-${options.getType.prefix}-${ugc2}-${(_b = vtec2 == null ? void 0 : vtec2.status) != null ? _b : `Issued`}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").split(".")[0]}-${(_c = properties2.geocode.office.office) != null ? _c : `KWNS`}`;
|
|
14460
14461
|
};
|
|
14461
14462
|
|
|
14462
|
-
// src/@dictionaries/dictionaries.
|
|
14463
|
-
var
|
|
14463
|
+
// src/@dictionaries/dictionaries.matches.ts
|
|
14464
|
+
var dict_matches = {
|
|
14464
14465
|
"Special Weather Statement": "Special Weather Statement",
|
|
14465
14466
|
"Hurricane Warning": "Hurricane Warning",
|
|
14466
14467
|
"Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
|
|
@@ -14480,7 +14481,7 @@ var eventsMatchText = {
|
|
|
14480
14481
|
|
|
14481
14482
|
// src/@building/building.tracking.ts
|
|
14482
14483
|
var getEventTracking = (options) => {
|
|
14483
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14484
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14484
14485
|
const properties2 = options.properties;
|
|
14485
14486
|
const attributes = options.attributes;
|
|
14486
14487
|
const stanza = options.stanza;
|
|
@@ -14497,26 +14498,26 @@ var getEventTracking = (options) => {
|
|
|
14497
14498
|
}
|
|
14498
14499
|
if (options.type === `API`) {
|
|
14499
14500
|
if (options.vtec) {
|
|
14500
|
-
const vtecValue = Array.isArray(options.vtec) ? options.vtec[0] : options.vtec;
|
|
14501
|
+
const vtecValue = Array.isArray(options.vtec) ? options.vtec[0].vtec : (_c = options.vtec) == null ? void 0 : _c.vtec;
|
|
14501
14502
|
const splitPVTEC = vtecValue.split(".");
|
|
14502
14503
|
return `${splitPVTEC[2]}.${splitPVTEC[3]}.${splitPVTEC[4]}.${splitPVTEC[5]}`;
|
|
14503
14504
|
}
|
|
14504
|
-
const wmoMatch = (
|
|
14505
|
-
const station = (
|
|
14505
|
+
const wmoMatch = (_e = (_d = options.organization) == null ? void 0 : _d.wmoidentifier) == null ? void 0 : _e.match(/([A-Z]{4}\d{2})\s+([A-Z]{4})/);
|
|
14506
|
+
const station = (_f = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _f : "N/A";
|
|
14506
14507
|
if (options.organization.featureId) {
|
|
14507
14508
|
const idMatch = options.organization.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
|
|
14508
|
-
return `${station}.${(
|
|
14509
|
+
return `${station}.${(_h = (_g = idMatch == null ? void 0 : idMatch[0]) == null ? void 0 : _g.replace(/\./g, "")) != null ? _h : "N/A"}`;
|
|
14509
14510
|
}
|
|
14510
|
-
const id2 = (
|
|
14511
|
-
return `${station}.${id2}`;
|
|
14511
|
+
const id2 = (_i = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _i : "N/A";
|
|
14512
|
+
return `${station}.${(_j = id2 == null ? void 0 : id2.replace(/\./g, "")) != null ? _j : "N/A"}`;
|
|
14512
14513
|
}
|
|
14513
14514
|
};
|
|
14514
14515
|
|
|
14515
14516
|
// src/@building/building.validate.ts
|
|
14516
14517
|
import { createHash } from "crypto";
|
|
14517
14518
|
|
|
14518
|
-
// src/@dictionaries/dictionaries.
|
|
14519
|
-
var
|
|
14519
|
+
// src/@dictionaries/dictionaries.enhanced.ts
|
|
14520
|
+
var dict_enhanced = {
|
|
14520
14521
|
"Tornado Warning": {
|
|
14521
14522
|
"Tornado Emergency": {
|
|
14522
14523
|
description: "tornado emergency"
|
|
@@ -14534,6 +14535,11 @@ var betterEventNames = {
|
|
|
14534
14535
|
},
|
|
14535
14536
|
"Radar Indicated Tornado Warning": {}
|
|
14536
14537
|
},
|
|
14538
|
+
"Fire Weather Warning": {
|
|
14539
|
+
"PDS Fire Weather Warning": {
|
|
14540
|
+
description: "particularly dangerous situation"
|
|
14541
|
+
}
|
|
14542
|
+
},
|
|
14537
14543
|
"Blizzard Warning": {
|
|
14538
14544
|
"PDS Blizzard Warning": {
|
|
14539
14545
|
description: "particularly dangerous situation"
|
|
@@ -14551,7 +14557,12 @@ var betterEventNames = {
|
|
|
14551
14557
|
},
|
|
14552
14558
|
"Tornado Watch": {
|
|
14553
14559
|
"PDS Tornado Watch": {
|
|
14554
|
-
|
|
14560
|
+
pdswatch: true
|
|
14561
|
+
}
|
|
14562
|
+
},
|
|
14563
|
+
"Severe Thunderstorm Watch": {
|
|
14564
|
+
"PDS Severe Thunderstorm Watch": {
|
|
14565
|
+
pdswatch: true
|
|
14555
14566
|
}
|
|
14556
14567
|
},
|
|
14557
14568
|
"Flash Flood Warning": {
|
|
@@ -14592,16 +14603,17 @@ var betterEventNames = {
|
|
|
14592
14603
|
|
|
14593
14604
|
// src/@building/building.enhance.ts
|
|
14594
14605
|
var getEventEnhancedName = (event) => {
|
|
14595
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14606
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14596
14607
|
const configurations = bootstrap.settings;
|
|
14597
14608
|
let name = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.event;
|
|
14598
14609
|
if (!((_b = configurations == null ? void 0 : configurations.GlobalSettings) == null ? void 0 : _b.BetterEventNames)) {
|
|
14599
14610
|
return name;
|
|
14600
14611
|
}
|
|
14601
14612
|
const damage = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat;
|
|
14602
|
-
const tornado = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters.tornado_threat;
|
|
14603
|
-
const
|
|
14604
|
-
|
|
14613
|
+
const tornado = (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.tornado_threat;
|
|
14614
|
+
const pdswatch = (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.watch_parameters) == null ? void 0 : _h.pds_watch;
|
|
14615
|
+
const description = (_j = (_i = event == null ? void 0 : event.properties) == null ? void 0 : _i.description) == null ? void 0 : _j.toLowerCase();
|
|
14616
|
+
for (const [eventKey, eventConfig] of Object.entries(dict_enhanced)) {
|
|
14605
14617
|
if (eventKey !== name) continue;
|
|
14606
14618
|
for (const [paramKey, paramValue] of Object.entries(eventConfig)) {
|
|
14607
14619
|
let matches = true;
|
|
@@ -14614,6 +14626,9 @@ var getEventEnhancedName = (event) => {
|
|
|
14614
14626
|
if (paramValue == null ? void 0 : paramValue.tornado) {
|
|
14615
14627
|
if (paramValue.tornado !== tornado) matches = false;
|
|
14616
14628
|
}
|
|
14629
|
+
if (paramValue == null ? void 0 : paramValue.pdswatch) {
|
|
14630
|
+
if (paramValue.pdswatch !== pdswatch) matches = false;
|
|
14631
|
+
}
|
|
14617
14632
|
if (matches) {
|
|
14618
14633
|
name = paramKey;
|
|
14619
14634
|
break;
|
|
@@ -14623,8 +14638,8 @@ var getEventEnhancedName = (event) => {
|
|
|
14623
14638
|
return name;
|
|
14624
14639
|
};
|
|
14625
14640
|
|
|
14626
|
-
// src/@dictionaries/dictionaries.
|
|
14627
|
-
var
|
|
14641
|
+
// src/@dictionaries/dictionaries.correlations.ts
|
|
14642
|
+
var dict_correlations = [
|
|
14628
14643
|
{ type: "Statement", name: "Statement", isCancel: false, isUpdate: false, isIssued: true, isStatement: true },
|
|
14629
14644
|
{ type: "Update", name: "Updated", isCancel: false, isUpdate: true, isIssued: false, isStatement: false },
|
|
14630
14645
|
{ type: "Cancel", name: "Cancelled", isCancel: true, isUpdate: false, isIssued: false, isStatement: false },
|
|
@@ -14639,8 +14654,8 @@ var statusCorrelationText = [
|
|
|
14639
14654
|
{ type: "Routine", name: "Routine", isCancel: false, isUpdate: true, isIssued: false, isStatement: false }
|
|
14640
14655
|
];
|
|
14641
14656
|
|
|
14642
|
-
// src/@dictionaries/dictionaries.
|
|
14643
|
-
var
|
|
14657
|
+
// src/@dictionaries/dictionaries.cancellation.ts
|
|
14658
|
+
var dict_cancellation = [
|
|
14644
14659
|
"has been cancelled",
|
|
14645
14660
|
"subsided sufficiently for the advisory to be cancelled",
|
|
14646
14661
|
"has been cancelled",
|
|
@@ -14652,24 +14667,28 @@ var eventCancelMessages = [
|
|
|
14652
14667
|
"has weakened below severe"
|
|
14653
14668
|
];
|
|
14654
14669
|
|
|
14655
|
-
// src/@dictionaries/dictionaries.
|
|
14656
|
-
var
|
|
14670
|
+
// src/@dictionaries/dictionaries.test.ts
|
|
14671
|
+
var dict_testing = [
|
|
14657
14672
|
`This is a test message`,
|
|
14658
14673
|
`Monitoring message only.`,
|
|
14659
|
-
`THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY
|
|
14674
|
+
`THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY`,
|
|
14675
|
+
"TEST MESSAGE"
|
|
14660
14676
|
];
|
|
14661
14677
|
|
|
14662
|
-
// src/@dictionaries/dictionaries.
|
|
14663
|
-
var
|
|
14678
|
+
// src/@dictionaries/dictionaries.products.ts
|
|
14679
|
+
var dict_products = {
|
|
14664
14680
|
"O": "Operational Product",
|
|
14665
14681
|
"T": "Test Product",
|
|
14666
14682
|
"E": "Experimental Product",
|
|
14667
14683
|
"X": "Experimental Product (Non-Operational)"
|
|
14668
14684
|
};
|
|
14669
14685
|
|
|
14670
|
-
// src/@dictionaries/dictionaries.
|
|
14671
|
-
var
|
|
14686
|
+
// src/@dictionaries/dictionaries.hail.ts
|
|
14687
|
+
var dict_hail = {
|
|
14688
|
+
".25": "Pea",
|
|
14689
|
+
".50": "Penny",
|
|
14672
14690
|
".75": "Penny",
|
|
14691
|
+
"Up to .75": "Penny",
|
|
14673
14692
|
".88": "Nickel",
|
|
14674
14693
|
"0.75": "Penny",
|
|
14675
14694
|
"0.88": "Nickel",
|
|
@@ -14685,25 +14704,25 @@ var hailStrings = {
|
|
|
14685
14704
|
|
|
14686
14705
|
// src/@building/building.signature.ts
|
|
14687
14706
|
var getEventSignature = (event) => {
|
|
14688
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14707
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14689
14708
|
const properties2 = event == null ? void 0 : event.properties;
|
|
14690
14709
|
const vtec2 = (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.metadata) == null ? void 0 : _b.vtec;
|
|
14691
|
-
const status =
|
|
14692
|
-
const csig =
|
|
14710
|
+
const status = dict_correlations.find((c) => c.type === (properties2 == null ? void 0 : properties2.status));
|
|
14711
|
+
const csig = dict_cancellation.find((sig) => properties2.description.toLowerCase().includes(sig.toLowerCase()));
|
|
14693
14712
|
properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_issued: true, is_test: false });
|
|
14694
|
-
if (properties2.parameters.estimated_hail_size) {
|
|
14695
|
-
properties2.parameters.estimated_hail_size += ` (${(
|
|
14713
|
+
if ((_c = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _c.estimated_hail_size) {
|
|
14714
|
+
properties2.parameters.estimated_hail_size += ` (${(_e = dict_hail[(_d = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _d.estimated_hail_size]) != null ? _e : "--"})`;
|
|
14696
14715
|
}
|
|
14697
14716
|
if (status) {
|
|
14698
|
-
properties2.status = (
|
|
14717
|
+
properties2.status = (_f = status.name) != null ? _f : properties2.status;
|
|
14699
14718
|
properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_updated: !!status.isUpdate, is_issued: !!status.isIssued, is_expired: !!status.isCancel, is_statement: !!status.isStatement });
|
|
14700
14719
|
}
|
|
14701
14720
|
if (csig) {
|
|
14702
14721
|
properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_expired: true });
|
|
14703
14722
|
}
|
|
14704
|
-
const getProduct = (
|
|
14705
|
-
const isTestProduct =
|
|
14706
|
-
if (isTestProduct ||
|
|
14723
|
+
const getProduct = (_h = (_g = vtec2 == null ? void 0 : vtec2.vtec) == null ? void 0 : _g.split(`.`)[0]) == null ? void 0 : _h.replace(`/`, ``);
|
|
14724
|
+
const isTestProduct = dict_products[getProduct] == `Test Product`;
|
|
14725
|
+
if (isTestProduct || dict_testing.some((sig) => {
|
|
14707
14726
|
var _a2, _b2, _c2, _d2;
|
|
14708
14727
|
return (_d2 = (_a2 = properties2.description) == null ? void 0 : _a2.toLowerCase().includes(sig.toLowerCase())) != null ? _d2 : (_c2 = (_b2 = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _b2.instructions) == null ? void 0 : _c2.toLowerCase().includes(sig.toLowerCase());
|
|
14709
14728
|
})) {
|
|
@@ -14730,74 +14749,6 @@ var setHash = (event, entry) => {
|
|
|
14730
14749
|
}
|
|
14731
14750
|
};
|
|
14732
14751
|
|
|
14733
|
-
// src/@modules/@utilities/utilities.createHttp.ts
|
|
14734
|
-
import request from "request";
|
|
14735
|
-
var createHttp = (options) => __async(null, null, function* () {
|
|
14736
|
-
return new Promise((resolve6, reject) => {
|
|
14737
|
-
var _a, _b, _c, _d, _e;
|
|
14738
|
-
const requestOptions = {
|
|
14739
|
-
url: (_a = options.url) != null ? _a : `https://api.weather.gov/alerts/active`,
|
|
14740
|
-
headers: (_b = options.headers) != null ? _b : {
|
|
14741
|
-
"User-Agent": "AtmosphericX",
|
|
14742
|
-
"Accept": "application/geo+json, text/plain, */*; q=0.9",
|
|
14743
|
-
"Accept-Language": "en-US,en;q=0.9"
|
|
14744
|
-
},
|
|
14745
|
-
method: (_c = options.method) != null ? _c : `GET`,
|
|
14746
|
-
timeout: (_d = options.timeout) != null ? _d : 1e4,
|
|
14747
|
-
proxy: (_e = options.proxy) != null ? _e : null,
|
|
14748
|
-
maxRedirects: 1
|
|
14749
|
-
};
|
|
14750
|
-
if (options.formData) {
|
|
14751
|
-
requestOptions["formData"] = options.formData;
|
|
14752
|
-
} else if (options.body) {
|
|
14753
|
-
requestOptions["body"] = options.body;
|
|
14754
|
-
}
|
|
14755
|
-
request(requestOptions, (error, response2, body) => {
|
|
14756
|
-
var _a2, _b2, _c2, _d2, _e2;
|
|
14757
|
-
if (error) {
|
|
14758
|
-
return resolve6({
|
|
14759
|
-
error: true,
|
|
14760
|
-
options: requestOptions,
|
|
14761
|
-
status: -1,
|
|
14762
|
-
message: (_a2 = error.message) != null ? _a2 : `Unknown Error`
|
|
14763
|
-
});
|
|
14764
|
-
}
|
|
14765
|
-
if (response2.statusCode < 200 || response2.statusCode >= 300) {
|
|
14766
|
-
return resolve6({
|
|
14767
|
-
error: true,
|
|
14768
|
-
options: requestOptions,
|
|
14769
|
-
status: (_b2 = response2.statusCode) != null ? _b2 : -1,
|
|
14770
|
-
message: `HTTP Status Code ${(_c2 = response2.statusCode) != null ? _c2 : `Unknown Status Code`} (${body})`
|
|
14771
|
-
});
|
|
14772
|
-
}
|
|
14773
|
-
if (body == void 0 || body == null) {
|
|
14774
|
-
return resolve6({
|
|
14775
|
-
error: true,
|
|
14776
|
-
options: requestOptions,
|
|
14777
|
-
status: (_d2 = response2.statusCode) != null ? _d2 : -1,
|
|
14778
|
-
message: `Empty Response Body`
|
|
14779
|
-
});
|
|
14780
|
-
}
|
|
14781
|
-
resolve6({
|
|
14782
|
-
error: false,
|
|
14783
|
-
options: requestOptions,
|
|
14784
|
-
status: (_e2 = response2.statusCode) != null ? _e2 : -1,
|
|
14785
|
-
message: body
|
|
14786
|
-
});
|
|
14787
|
-
});
|
|
14788
|
-
});
|
|
14789
|
-
});
|
|
14790
|
-
|
|
14791
|
-
// src/@modules/@utilities/utilities.isImageReady.ts
|
|
14792
|
-
var isImageReady = (url) => __async(null, null, function* () {
|
|
14793
|
-
try {
|
|
14794
|
-
const res = yield fetch(url, { method: "HEAD" });
|
|
14795
|
-
return res.ok;
|
|
14796
|
-
} catch (e) {
|
|
14797
|
-
return false;
|
|
14798
|
-
}
|
|
14799
|
-
});
|
|
14800
|
-
|
|
14801
14752
|
// src/@modules/@eas/eas.getWavPCM16.ts
|
|
14802
14753
|
var getWavPCM16 = (buffer) => {
|
|
14803
14754
|
if (buffer.toString("ascii", 0, 4) !== "RIFF" || buffer.toString("ascii", 8, 12) !== "WAVE") {
|
|
@@ -15042,17 +14993,34 @@ var getPCM16 = (samples, sampleRate) => {
|
|
|
15042
14993
|
|
|
15043
14994
|
// src/@modules/@eas/eas.getTTS.ts
|
|
15044
14995
|
import { platform } from "os";
|
|
14996
|
+
import { writeFileSync } from "fs";
|
|
15045
14997
|
import { execSync } from "child_process";
|
|
15046
14998
|
var getTTS = (text2, outputPath) => __async(null, null, function* () {
|
|
15047
14999
|
const vPlatform = platform();
|
|
15048
15000
|
switch (vPlatform) {
|
|
15049
15001
|
case "win32": {
|
|
15050
|
-
|
|
15051
|
-
|
|
15002
|
+
try {
|
|
15003
|
+
const txtPath = outputPath + ".txt";
|
|
15004
|
+
writeFileSync(txtPath, text2, "utf8");
|
|
15005
|
+
const command = [
|
|
15006
|
+
"Add-Type -AssemblyName System.Speech;",
|
|
15007
|
+
`$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;`,
|
|
15008
|
+
`$text = Get-Content -Raw -LiteralPath '${txtPath}';`,
|
|
15009
|
+
`$speak.SetOutputToWaveFile('${outputPath}');`,
|
|
15010
|
+
`$speak.Speak($text);`,
|
|
15011
|
+
`$speak.Dispose();`
|
|
15012
|
+
].join(" ");
|
|
15013
|
+
execSync(`powershell -Command "${command}"`, { stdio: "inherit" });
|
|
15014
|
+
} catch (error) {
|
|
15015
|
+
console.error("Error occurred while generating TTS:", error);
|
|
15016
|
+
}
|
|
15052
15017
|
break;
|
|
15053
15018
|
}
|
|
15054
15019
|
case "linux":
|
|
15055
|
-
|
|
15020
|
+
try {
|
|
15021
|
+
execSync(`espeak -w "${outputPath}" "${text2.replace(/"/g, '\\"')}"`);
|
|
15022
|
+
} catch (e) {
|
|
15023
|
+
}
|
|
15056
15024
|
break;
|
|
15057
15025
|
default:
|
|
15058
15026
|
break;
|
|
@@ -15128,20 +15096,22 @@ var getCleanDescription = (message) => {
|
|
|
15128
15096
|
for (const { regex, replacement } of patches) {
|
|
15129
15097
|
message = message.replace(regex, replacement);
|
|
15130
15098
|
}
|
|
15131
|
-
return message.replace(/\b(\d{1,2}):(\d{2})\s*(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{1,2})\s+(\d{2})\s+(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{2})(\d{2})\s+(AM|PM)\b/gi, (_, hh, mm, ap) => fmt(+hh, +mm, ap.toUpperCase())).replace(/\*+/g, " ").replace(/-/g, " ").replace(/\n/g, " ").trim();
|
|
15099
|
+
return message.replace(/'/g, "''").replace(/\b(\d{1,2}):(\d{2})\s*(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{1,2})\s+(\d{2})\s+(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase())).replace(/\b(\d{2})(\d{2})\s+(AM|PM)\b/gi, (_, hh, mm, ap) => fmt(+hh, +mm, ap.toUpperCase())).replace(/\b(\d{1,2})\s+(AM|PM)\b/gi, (_, h, ap) => fmt(+h, 0, ap.toUpperCase())).replace(/\*+/g, " ").replace(/-/g, " ").replace(/\n/g, " ").trim();
|
|
15132
15100
|
};
|
|
15133
15101
|
|
|
15134
15102
|
// src/@modules/@eas/eas.setEasTone.ts
|
|
15135
15103
|
import { join } from "path";
|
|
15136
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "fs";
|
|
15104
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync as writeFileSync2, unlinkSync } from "fs";
|
|
15137
15105
|
import { execSync as execSync2 } from "child_process";
|
|
15138
15106
|
import { platform as platform2 } from "os";
|
|
15139
15107
|
var setEasTone = (options) => __async(null, null, function* () {
|
|
15108
|
+
var _a;
|
|
15140
15109
|
const settings = bootstrap.settings;
|
|
15141
|
-
const directory = settings.GlobalSettings.
|
|
15142
|
-
const prefix = settings.GlobalSettings.
|
|
15110
|
+
const directory = settings.GlobalSettings.ArchiveSettings.EasDirectory;
|
|
15111
|
+
const prefix = settings.GlobalSettings.ArchiveSettings.EasToneout;
|
|
15143
15112
|
let message = options.message;
|
|
15144
15113
|
let header = options.header;
|
|
15114
|
+
let title = (_a = options.title) != null ? _a : `${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
15145
15115
|
if (!message || !header) {
|
|
15146
15116
|
setWarning({
|
|
15147
15117
|
title: `EAS`,
|
|
@@ -15155,14 +15125,14 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15155
15125
|
if (!existsSync(directory)) {
|
|
15156
15126
|
mkdirSync(directory, { recursive: true });
|
|
15157
15127
|
}
|
|
15158
|
-
if (!existsSync(join(directory, `/
|
|
15159
|
-
mkdirSync(join(directory, `/
|
|
15128
|
+
if (!existsSync(join(directory, `/tts`))) {
|
|
15129
|
+
mkdirSync(join(directory, `/tts`), { recursive: true });
|
|
15160
15130
|
}
|
|
15161
|
-
if (!existsSync(join(directory, `/
|
|
15162
|
-
mkdirSync(join(directory, `/
|
|
15131
|
+
if (!existsSync(join(directory, `/encoded`))) {
|
|
15132
|
+
mkdirSync(join(directory, `/encoded`), { recursive: true });
|
|
15163
15133
|
}
|
|
15164
|
-
const tmpTTS = join(directory, `/
|
|
15165
|
-
const outTTS = join(directory, `/
|
|
15134
|
+
const tmpTTS = join(directory, `/tts/${title}.wav`);
|
|
15135
|
+
const outTTS = join(directory, `/encoded/${title}.wav`);
|
|
15166
15136
|
const vPlatform = platform2();
|
|
15167
15137
|
if (vPlatform === "darwin") {
|
|
15168
15138
|
setWarning({
|
|
@@ -15174,10 +15144,13 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15174
15144
|
yield new Promise((resolve6, reject) => {
|
|
15175
15145
|
const tMsg = getCleanDescription(message);
|
|
15176
15146
|
getTTS(tMsg, tmpTTS).then(() => {
|
|
15177
|
-
buffTTS = readFileSync(tmpTTS);
|
|
15178
15147
|
resolve6();
|
|
15179
15148
|
});
|
|
15180
15149
|
});
|
|
15150
|
+
if (!existsSync(tmpTTS)) {
|
|
15151
|
+
return null;
|
|
15152
|
+
}
|
|
15153
|
+
buffTTS = readFileSync(tmpTTS);
|
|
15181
15154
|
const vWav = getWavPCM16(buffTTS);
|
|
15182
15155
|
const vSamples = getSampledPCM16(vWav.samples, vWav.sampleRate, 8e3);
|
|
15183
15156
|
const vRadio = setRadioEffect(vSamples, 8e3);
|
|
@@ -15186,7 +15159,7 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15186
15159
|
let tWav = getWavPCM16(tBuffer);
|
|
15187
15160
|
if (tWav == null) {
|
|
15188
15161
|
try {
|
|
15189
|
-
const converted = join(directory, `/
|
|
15162
|
+
const converted = join(directory, `/tts/${title}.converted.wav`);
|
|
15190
15163
|
execSync2(`ffmpeg -y -i "${prefix}" -ar 8000 -ac 1 -sample_fmt s16 "${converted}"`, { stdio: "ignore" });
|
|
15191
15164
|
if (existsSync(converted)) {
|
|
15192
15165
|
tBuffer = readFileSync(converted);
|
|
@@ -15224,7 +15197,7 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15224
15197
|
const aSamples = getMergedPCM16(buffFull);
|
|
15225
15198
|
const aFinal = setNoise(aSamples, 2e-3);
|
|
15226
15199
|
const aBuffer = getPCM16(Array.from(aFinal).map((v) => ({ value: v })), 8e3);
|
|
15227
|
-
|
|
15200
|
+
writeFileSync2(outTTS, aBuffer);
|
|
15228
15201
|
try {
|
|
15229
15202
|
unlinkSync(tmpTTS);
|
|
15230
15203
|
} catch (e) {
|
|
@@ -15232,130 +15205,196 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15232
15205
|
return outTTS;
|
|
15233
15206
|
});
|
|
15234
15207
|
|
|
15235
|
-
// src/@
|
|
15236
|
-
var
|
|
15237
|
-
|
|
15238
|
-
var createWebhook = (options) => __async(null, null, function* () {
|
|
15239
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
15240
|
-
const event = options.event.properties;
|
|
15241
|
-
const settings = options.webhook;
|
|
15208
|
+
// src/@parsers/@text/text.getEmbed.ts
|
|
15209
|
+
var getEmebed = (event) => {
|
|
15210
|
+
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, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua;
|
|
15242
15211
|
const line = (label, value, condition = true) => condition && value ? `${label} ${value}` : null;
|
|
15243
|
-
const
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
const
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15212
|
+
const isStatement = event.properties.status_metadata.is_statement;
|
|
15213
|
+
const isExpired = event.properties.status_metadata.is_expired;
|
|
15214
|
+
return [
|
|
15215
|
+
line(`**Locations:**`, (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.locations) == null ? void 0 : _b.slice(0, 100)),
|
|
15216
|
+
line(`**Issued:**`, `<t:${Math.floor(new Date(event.properties.issued).getTime() / 1e3)}:R>`, !isExpired),
|
|
15217
|
+
line(`**Expires:**`, `<t:${Math.floor(new Date(event.properties.expires).getTime() / 1e3)}:R>`, !isStatement),
|
|
15218
|
+
line(`**Damage Threat:**`, (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat, !isExpired),
|
|
15219
|
+
line(`**Flood Threat:**`, (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.flood_threat, !isExpired),
|
|
15220
|
+
line(`**Tornado Threat:**`, (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.parameters) == null ? void 0 : _h.tornado_threat, !isExpired),
|
|
15221
|
+
line(`**Estimated Wind Gusts:**`, `${(_j = (_i = event == null ? void 0 : event.properties) == null ? void 0 : _i.parameters) == null ? void 0 : _j.estimated_wind_gusts} ${((_l = (_k = event == null ? void 0 : event.properties) == null ? void 0 : _k.parameters) == null ? void 0 : _l.wind_threat) ? ` (${(_n = (_m = event == null ? void 0 : event.properties) == null ? void 0 : _m.parameters) == null ? void 0 : _n.wind_threat})` : ""}`, !isExpired && ((_p = (_o = event == null ? void 0 : event.properties) == null ? void 0 : _o.parameters) == null ? void 0 : _p.estimated_wind_gusts) != null),
|
|
15222
|
+
line(`**Estimated Hail Size:**`, `${(_r = (_q = event == null ? void 0 : event.properties) == null ? void 0 : _q.parameters) == null ? void 0 : _r.estimated_hail_size} ${((_t = (_s = event == null ? void 0 : event.properties) == null ? void 0 : _s.parameters) == null ? void 0 : _t.hail_threat) ? ` (${(_v = (_u = event == null ? void 0 : event.properties) == null ? void 0 : _u.parameters) == null ? void 0 : _v.hail_threat})` : ""}`, !isExpired && ((_x = (_w = event == null ? void 0 : event.properties) == null ? void 0 : _w.parameters) == null ? void 0 : _x.estimated_hail_size) != null),
|
|
15223
|
+
line(`**Discussion:**`, (_z = (_y = event == null ? void 0 : event.properties) == null ? void 0 : _y.discussion_parameters) == null ? void 0 : _z.discussion_number, !isExpired),
|
|
15224
|
+
line(`**Concern:**`, (_B = (_A = event == null ? void 0 : event.properties) == null ? void 0 : _A.discussion_parameters) == null ? void 0 : _B.discussion_concerning, !isExpired),
|
|
15225
|
+
line(`**SPC Max Tornado Threat:**`, (_D = (_C = event == null ? void 0 : event.properties) == null ? void 0 : _C.discussion_parameters) == null ? void 0 : _D.discussion_max_tornado, !isExpired),
|
|
15226
|
+
line(`**SPC Max Hail Threat:**`, (_F = (_E = event == null ? void 0 : event.properties) == null ? void 0 : _E.discussion_parameters) == null ? void 0 : _F.discussion_max_hail, !isExpired),
|
|
15227
|
+
line(`**SPC Max Wind Threat:**`, (_H = (_G = event == null ? void 0 : event.properties) == null ? void 0 : _G.discussion_parameters) == null ? void 0 : _H.discussion_max_wind, !isExpired),
|
|
15228
|
+
line(`**SPC Watch Issuance Probability:**`, ((_J = (_I = event == null ? void 0 : event.properties) == null ? void 0 : _I.discussion_parameters) == null ? void 0 : _J.discussion_watch_issuance) ? `${(_L = (_K = event == null ? void 0 : event.properties) == null ? void 0 : _K.discussion_parameters) == null ? void 0 : _L.discussion_watch_issuance}%` : null, !isExpired),
|
|
15229
|
+
line(`**Watch Number:**`, (_N = (_M = event == null ? void 0 : event.properties) == null ? void 0 : _M.watch_parameters) == null ? void 0 : _N.watch_number, !isExpired),
|
|
15230
|
+
line(`**Strong Tornadoes Probability:**`, ((_P = (_O = event == null ? void 0 : event.properties) == null ? void 0 : _O.watch_parameters) == null ? void 0 : _P.strong_tornadoes_probability) ? `${(_R = (_Q = event == null ? void 0 : event.properties) == null ? void 0 : _Q.watch_parameters) == null ? void 0 : _R.strong_tornadoes_probability}%` : null, !isExpired),
|
|
15231
|
+
line(`**Additional Tornadoes Probability:**`, ((_T = (_S = event == null ? void 0 : event.properties) == null ? void 0 : _S.watch_parameters) == null ? void 0 : _T.additional_tornadoes_probability) ? `${(_V = (_U = event == null ? void 0 : event.properties) == null ? void 0 : _U.watch_parameters) == null ? void 0 : _V.additional_tornadoes_probability}%` : null, !isExpired),
|
|
15232
|
+
line(`**Combined Hail/Wind Probability:**`, ((_X = (_W = event == null ? void 0 : event.properties) == null ? void 0 : _W.watch_parameters) == null ? void 0 : _X.combined_hail_wind_probability) ? `${(_Z = (_Y = event == null ? void 0 : event.properties) == null ? void 0 : _Y.watch_parameters) == null ? void 0 : _Z.combined_hail_wind_probability}%` : null, !isExpired),
|
|
15233
|
+
line(`**Severe Hail Probability:**`, ((_$ = (__ = event == null ? void 0 : event.properties) == null ? void 0 : __.watch_parameters) == null ? void 0 : _$.severe_hail_probability) ? `${(_ba = (_aa = event == null ? void 0 : event.properties) == null ? void 0 : _aa.watch_parameters) == null ? void 0 : _ba.severe_hail_probability}%` : null, !isExpired),
|
|
15234
|
+
line(`**Hail >2in Probability:**`, ((_da = (_ca = event == null ? void 0 : event.properties) == null ? void 0 : _ca.watch_parameters) == null ? void 0 : _da.hail_2in_probability) ? `${(_fa = (_ea = event == null ? void 0 : event.properties) == null ? void 0 : _ea.watch_parameters) == null ? void 0 : _fa.hail_2in_probability}%` : null, !isExpired),
|
|
15235
|
+
line(`**Max Hail Inches:**`, (_ha = (_ga = event == null ? void 0 : event.properties) == null ? void 0 : _ga.watch_parameters) == null ? void 0 : _ha.max_hail_in, !isExpired),
|
|
15236
|
+
line(`**Severe Wind Probability:**`, ((_ja = (_ia = event == null ? void 0 : event.properties) == null ? void 0 : _ia.watch_parameters) == null ? void 0 : _ja.severe_wind_probability) ? `${(_la = (_ka = event == null ? void 0 : event.properties) == null ? void 0 : _ka.watch_parameters) == null ? void 0 : _la.severe_wind_probability}%` : null, !isExpired),
|
|
15237
|
+
line(`**Max Surface Wind:**`, (_na = (_ma = event == null ? void 0 : event.properties) == null ? void 0 : _ma.watch_parameters) == null ? void 0 : _na.max_wind_surface, !isExpired),
|
|
15238
|
+
line(`**Max Tops (x100 feet):**`, (_pa = (_oa = event == null ? void 0 : event.properties) == null ? void 0 : _oa.watch_parameters) == null ? void 0 : _pa.max_tops_x100feet, !isExpired),
|
|
15239
|
+
line(`**Tags:**`, ((_sa = (_ra = (_qa = event == null ? void 0 : event.properties) == null ? void 0 : _qa.parameters) == null ? void 0 : _ra.tags) == null ? void 0 : _sa.length) > 0 ? (_ua = (_ta = event == null ? void 0 : event.properties) == null ? void 0 : _ta.parameters) == null ? void 0 : _ua.tags.join(", ") : null, !isExpired),
|
|
15240
|
+
line(`**Sender:**`, ((_xa = (_wa = (_va = event == null ? void 0 : event.properties) == null ? void 0 : _va.geocode) == null ? void 0 : _wa.office) == null ? void 0 : _xa.name) ? `${(_Aa = (_za = (_ya = event == null ? void 0 : event.properties) == null ? void 0 : _ya.geocode) == null ? void 0 : _za.office) == null ? void 0 : _Aa.name} (${(_Da = (_Ca = (_Ba = event == null ? void 0 : event.properties) == null ? void 0 : _Ba.geocode) == null ? void 0 : _Ca.office) == null ? void 0 : _Da.office})` : (_Ga = (_Fa = (_Ea = event == null ? void 0 : event.properties) == null ? void 0 : _Ea.geocode) == null ? void 0 : _Fa.office) == null ? void 0 : _Ga.office),
|
|
15241
|
+
line(`**Tracking:**`, (_Ia = (_Ha = event == null ? void 0 : event.properties) == null ? void 0 : _Ha.metadata) == null ? void 0 : _Ia.tracking),
|
|
15242
|
+
line(`**Logs:**`, ((_La = (_Ka = (_Ja = event == null ? void 0 : event.properties) == null ? void 0 : _Ja.metadata) == null ? void 0 : _Ka.history) == null ? void 0 : _La.length) > 0 ? (_Na = (_Ma = event == null ? void 0 : event.properties) == null ? void 0 : _Ma.metadata) == null ? void 0 : _Na.history.length : null),
|
|
15243
|
+
line(``, ((_Qa = (_Pa = (_Oa = event == null ? void 0 : event.properties) == null ? void 0 : _Oa.metadata) == null ? void 0 : _Pa.attachments) == null ? void 0 : _Qa.length) > 0 ? `**Attachments:** ${(_Sa = (_Ra = event == null ? void 0 : event.properties) == null ? void 0 : _Ra.metadata) == null ? void 0 : _Sa.attachments.map((attachment) => {
|
|
15244
|
+
var _a2, _b2;
|
|
15245
|
+
return `[Attachment #${((_b2 = (_a2 = event == null ? void 0 : event.properties) == null ? void 0 : _a2.metadata) == null ? void 0 : _b2.attachments.indexOf(attachment)) + 1}](${attachment})`;
|
|
15246
|
+
}).join(" | ")}` : null),
|
|
15247
|
+
line(``, ((_Ta = event == null ? void 0 : event.properties) == null ? void 0 : _Ta.description) ? "```\n" + ((_Ua = event == null ? void 0 : event.properties) == null ? void 0 : _Ua.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n")) + "\n```" : null, !isExpired)
|
|
15248
|
+
].filter(Boolean).join("\n");
|
|
15249
|
+
};
|
|
15250
|
+
|
|
15251
|
+
// src/@modules/@utilities/utilities.createHttp.ts
|
|
15252
|
+
import request from "request";
|
|
15253
|
+
var createHttp = (options) => __async(null, null, function* () {
|
|
15254
|
+
return new Promise((resolve6, reject) => {
|
|
15255
|
+
var _a, _b, _c, _d, _e;
|
|
15256
|
+
const requestOptions = {
|
|
15257
|
+
url: (_a = options.url) != null ? _a : `https://api.weather.gov/alerts/active`,
|
|
15258
|
+
headers: (_b = options.headers) != null ? _b : {
|
|
15259
|
+
"User-Agent": "AtmosphericX",
|
|
15260
|
+
"Accept": "application/geo+json, text/plain, */*; q=0.9",
|
|
15261
|
+
"Accept-Language": "en-US,en;q=0.9"
|
|
15262
|
+
},
|
|
15263
|
+
method: (_c = options.method) != null ? _c : `GET`,
|
|
15264
|
+
timeout: (_d = options.timeout) != null ? _d : 1e4,
|
|
15265
|
+
proxy: (_e = options.proxy) != null ? _e : null,
|
|
15266
|
+
maxRedirects: 1
|
|
15295
15267
|
};
|
|
15296
|
-
if (
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15268
|
+
if (options.formData) {
|
|
15269
|
+
requestOptions["formData"] = options.formData;
|
|
15270
|
+
} else if (options.body) {
|
|
15271
|
+
requestOptions["body"] = options.body;
|
|
15272
|
+
}
|
|
15273
|
+
request(requestOptions, (error, response2, body) => {
|
|
15274
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
15275
|
+
if (error) {
|
|
15276
|
+
return resolve6({
|
|
15277
|
+
error: true,
|
|
15278
|
+
options: requestOptions,
|
|
15279
|
+
status: -1,
|
|
15280
|
+
message: (_a2 = error.message) != null ? _a2 : `Unknown Error`
|
|
15281
|
+
});
|
|
15301
15282
|
}
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15283
|
+
if (response2.statusCode < 200 || response2.statusCode >= 300) {
|
|
15284
|
+
return resolve6({
|
|
15285
|
+
error: true,
|
|
15286
|
+
options: requestOptions,
|
|
15287
|
+
status: (_b2 = response2.statusCode) != null ? _b2 : -1,
|
|
15288
|
+
message: `HTTP Status Code ${(_c2 = response2.statusCode) != null ? _c2 : `Unknown Status Code`} (${body})`
|
|
15289
|
+
});
|
|
15305
15290
|
}
|
|
15306
|
-
|
|
15307
|
-
|
|
15308
|
-
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15313
|
-
form.append("fUpload", Buffer.from(`${event.metadata.raw}
|
|
15314
|
-
|
|
15315
|
-
${JSON.stringify(getCleanedEvent(event), null, 2)}`), { filename: `${event.event}_${event.status}_${event.metadata.tracking}.txt`, contentType: "application/text" });
|
|
15316
|
-
}
|
|
15317
|
-
if (settings.eas) {
|
|
15318
|
-
const audio = yield setEasTone({
|
|
15319
|
-
message: event.description,
|
|
15320
|
-
header: event.metadata.header
|
|
15321
|
-
});
|
|
15322
|
-
const file = readFileSync2(audio);
|
|
15323
|
-
if (audio) {
|
|
15324
|
-
form.append("fEas", Buffer.from(file), { filename: `${event.event}_${event.status}_${event.metadata.tracking}_eas.mp3`, contentType: "audio/mpeg" });
|
|
15291
|
+
if (body == void 0 || body == null) {
|
|
15292
|
+
return resolve6({
|
|
15293
|
+
error: true,
|
|
15294
|
+
options: requestOptions,
|
|
15295
|
+
status: (_d2 = response2.statusCode) != null ? _d2 : -1,
|
|
15296
|
+
message: `Empty Response Body`
|
|
15297
|
+
});
|
|
15325
15298
|
}
|
|
15326
|
-
|
|
15327
|
-
|
|
15328
|
-
|
|
15329
|
-
|
|
15330
|
-
|
|
15331
|
-
|
|
15332
|
-
body: form
|
|
15299
|
+
resolve6({
|
|
15300
|
+
error: false,
|
|
15301
|
+
options: requestOptions,
|
|
15302
|
+
status: (_e2 = response2.statusCode) != null ? _e2 : -1,
|
|
15303
|
+
message: body
|
|
15304
|
+
});
|
|
15333
15305
|
});
|
|
15334
|
-
}
|
|
15306
|
+
});
|
|
15335
15307
|
});
|
|
15336
15308
|
|
|
15337
|
-
// src/@manager/manager.
|
|
15338
|
-
var
|
|
15309
|
+
// src/@manager/manager.updateListener.ts
|
|
15310
|
+
var import_form_data = __toESM(require_form_data());
|
|
15311
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3, readFileSync as readFileSync2, appendFileSync } from "fs";
|
|
15312
|
+
var updateListener = (event) => __async(null, null, function* () {
|
|
15313
|
+
var _a, _b, _c, _d;
|
|
15339
15314
|
const settings = bootstrap.settings;
|
|
15340
|
-
const
|
|
15341
|
-
const
|
|
15342
|
-
for (const socket of
|
|
15315
|
+
const listeners2 = settings.ListenerSettings;
|
|
15316
|
+
const properties2 = event.properties;
|
|
15317
|
+
for (const socket of listeners2) {
|
|
15343
15318
|
const events = socket.events;
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
continue;
|
|
15347
|
-
}
|
|
15319
|
+
const sWebhook = socket == null ? void 0 : socket.webhook;
|
|
15320
|
+
const sUploads = socket == null ? void 0 : socket.uploads;
|
|
15348
15321
|
const matched = events.some((pattern) => {
|
|
15349
15322
|
if (!pattern) return false;
|
|
15350
|
-
if (pattern === "*" || pattern ===
|
|
15323
|
+
if (pattern === "*" || pattern === properties2.event) return true;
|
|
15351
15324
|
if (pattern.includes("*")) {
|
|
15352
15325
|
const regex = "^" + pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") + "$";
|
|
15353
|
-
return new RegExp(regex).test(
|
|
15326
|
+
return new RegExp(regex).test(properties2.event);
|
|
15354
15327
|
}
|
|
15355
15328
|
return false;
|
|
15356
15329
|
});
|
|
15357
|
-
if (matched) {
|
|
15358
|
-
|
|
15330
|
+
if ((events == null ? void 0 : events.length) == 0 || matched) {
|
|
15331
|
+
let eas;
|
|
15332
|
+
let file;
|
|
15333
|
+
if (sUploads == null ? void 0 : sUploads.eas) {
|
|
15334
|
+
eas = yield setEasTone({
|
|
15335
|
+
title: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}`,
|
|
15336
|
+
message: properties2.description,
|
|
15337
|
+
header: properties2.metadata.header
|
|
15338
|
+
});
|
|
15339
|
+
}
|
|
15340
|
+
if (sUploads == null ? void 0 : sUploads.file) {
|
|
15341
|
+
const destination = bootstrap.settings.GlobalSettings.ArchiveSettings.TextDirectory;
|
|
15342
|
+
if (destination) {
|
|
15343
|
+
if (!existsSync2(destination)) {
|
|
15344
|
+
mkdirSync2(destination, { recursive: true });
|
|
15345
|
+
}
|
|
15346
|
+
if (existsSync2(`${destination}/${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`)) {
|
|
15347
|
+
appendFileSync(`${destination}/${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`, properties2.metadata.raw);
|
|
15348
|
+
} else {
|
|
15349
|
+
writeFileSync3(`${destination}/${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`, properties2.metadata.raw);
|
|
15350
|
+
}
|
|
15351
|
+
}
|
|
15352
|
+
file = properties2.metadata.raw;
|
|
15353
|
+
}
|
|
15354
|
+
if (sWebhook == null ? void 0 : sWebhook.enabled) {
|
|
15355
|
+
const isLimited = setTimeoutAction({ identifier: sWebhook.destination, interval: sWebhook.ratelimit, max: sWebhook.ratelimit, addTime: true });
|
|
15356
|
+
if (!isLimited.limited) {
|
|
15357
|
+
let body = getEmebed(event);
|
|
15358
|
+
if (body.length > 1900) {
|
|
15359
|
+
body = body.substring(0, 1900) + "\n\n[Message truncated due to length]";
|
|
15360
|
+
const blocks = ((_a = body.match(/```/g)) != null ? _a : []).length;
|
|
15361
|
+
if (blocks % 2 !== 0) body += "```";
|
|
15362
|
+
}
|
|
15363
|
+
if (properties2.description.length < 25) {
|
|
15364
|
+
continue;
|
|
15365
|
+
}
|
|
15366
|
+
const form = new import_form_data.default();
|
|
15367
|
+
const embed = {
|
|
15368
|
+
title: `${properties2.event} (${properties2.status})`,
|
|
15369
|
+
description: body,
|
|
15370
|
+
color: 16711680,
|
|
15371
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15372
|
+
image: {},
|
|
15373
|
+
footer: { text: (_b = sWebhook.title) != null ? _b : `AtmosphericX` }
|
|
15374
|
+
};
|
|
15375
|
+
form.append("payload_json", JSON.stringify({
|
|
15376
|
+
username: (_c = sWebhook.title) != null ? _c : "AtmosphericX",
|
|
15377
|
+
content: (_d = sWebhook.message) != null ? _d : "",
|
|
15378
|
+
embeds: [embed]
|
|
15379
|
+
}));
|
|
15380
|
+
if (sUploads == null ? void 0 : sUploads.file) {
|
|
15381
|
+
form.append("fUpload", Buffer.from(file), { filename: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`, contentType: "application/text" });
|
|
15382
|
+
}
|
|
15383
|
+
if (sUploads == null ? void 0 : sUploads.eas) {
|
|
15384
|
+
if (eas) {
|
|
15385
|
+
const file2 = readFileSync2(eas);
|
|
15386
|
+
form.append("fEas", Buffer.from(file2), { filename: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}_eas.mp3`, contentType: "audio/mpeg" });
|
|
15387
|
+
}
|
|
15388
|
+
}
|
|
15389
|
+
const a = yield createHttp({
|
|
15390
|
+
url: sWebhook.destination,
|
|
15391
|
+
timeout: 5e3,
|
|
15392
|
+
method: `POST`,
|
|
15393
|
+
headers: form.getHeaders(),
|
|
15394
|
+
body: form
|
|
15395
|
+
});
|
|
15396
|
+
}
|
|
15397
|
+
}
|
|
15359
15398
|
}
|
|
15360
15399
|
}
|
|
15361
15400
|
});
|
|
@@ -15574,10 +15613,10 @@ var mkEvent = (event) => __async(null, null, function* () {
|
|
|
15574
15613
|
})
|
|
15575
15614
|
})
|
|
15576
15615
|
});
|
|
15577
|
-
|
|
15616
|
+
updateListener(bootstrap.cache.events.features[getIndex]);
|
|
15578
15617
|
} else {
|
|
15579
15618
|
features.push(event);
|
|
15580
|
-
|
|
15619
|
+
updateListener(event);
|
|
15581
15620
|
}
|
|
15582
15621
|
}
|
|
15583
15622
|
}
|
|
@@ -15592,6 +15631,7 @@ var rmEvent = (event) => {
|
|
|
15592
15631
|
const cachedStatus = event.properties.status;
|
|
15593
15632
|
event.properties.expires = (/* @__PURE__ */ new Date()).toISOString();
|
|
15594
15633
|
event.properties.status = `Expired`;
|
|
15634
|
+
event.properties.status_metadata.is_expired = true;
|
|
15595
15635
|
if (getEvent) {
|
|
15596
15636
|
setEventEmit({
|
|
15597
15637
|
event: `onEventStatus`,
|
|
@@ -15602,7 +15642,7 @@ var rmEvent = (event) => {
|
|
|
15602
15642
|
message: `[Removed] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
15603
15643
|
});
|
|
15604
15644
|
setEventEmit({ event: `onExpiredProduct`, metadata: event });
|
|
15605
|
-
if (cachedStatus != `Statement`)
|
|
15645
|
+
if (cachedStatus != `Statement`) updateListener(event);
|
|
15606
15646
|
bootstrap.cache.events.features.splice(bootstrap.cache.events.features.indexOf(getEvent), 1);
|
|
15607
15647
|
bootstrap.cache.hashes = bootstrap.cache.hashes.filter((hash) => hash.tracking !== event.properties.metadata.tracking);
|
|
15608
15648
|
}
|
|
@@ -15627,15 +15667,21 @@ var getLatestIssuance = () => {
|
|
|
15627
15667
|
return latest.toString().padStart(4, "0");
|
|
15628
15668
|
};
|
|
15629
15669
|
|
|
15630
|
-
// src/@building/building.
|
|
15670
|
+
// src/@building/building.attachments.ts
|
|
15631
15671
|
var getEventAttachments = (event) => {
|
|
15632
|
-
var _a, _b;
|
|
15672
|
+
var _a, _b, _c, _d;
|
|
15633
15673
|
const latestTime = getLatestIssuance();
|
|
15674
|
+
const spcNumber = (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.discussion_parameters) == null ? void 0 : _b.discussion_number;
|
|
15675
|
+
const watchNumber = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.watch_parameters) == null ? void 0 : _d.watch_number;
|
|
15634
15676
|
const validEvents = [
|
|
15635
15677
|
{ target: "Day 1", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${latestTime}.png` },
|
|
15636
15678
|
{ target: "Day 2", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
|
|
15637
15679
|
{ target: "Day 3", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
|
|
15638
|
-
{ target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${
|
|
15680
|
+
{ target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
|
|
15681
|
+
{ target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
15682
|
+
{ target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
15683
|
+
{ target: "Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
15684
|
+
{ target: "PDS Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` }
|
|
15639
15685
|
];
|
|
15640
15686
|
const isValid = validEvents.find((outlook) => outlook.target == event.properties.event);
|
|
15641
15687
|
if (isValid) {
|
|
@@ -15685,7 +15731,7 @@ var validateEvents = (events) => __async(null, null, function* () {
|
|
|
15685
15731
|
rmEvent(define2);
|
|
15686
15732
|
return false;
|
|
15687
15733
|
}
|
|
15688
|
-
if ((_c = (_b = properties2.metadata) == null ? void 0 : _b.vtec) == null ? void 0 : _c.is_watch) {
|
|
15734
|
+
if (((_c = (_b = properties2.metadata) == null ? void 0 : _b.vtec) == null ? void 0 : _c.is_watch) && properties2.metadata.source != `events.api`) {
|
|
15689
15735
|
const isSPC = (_e = (_d = properties2.metadata) == null ? void 0 : _d.vtec) == null ? void 0 : _e.prediction_center;
|
|
15690
15736
|
setEventEmit({ event: isSPC ? `onStormPredictionWatch` : `onNonStormPredictionWatch`, metadata: define2 });
|
|
15691
15737
|
if ((bools == null ? void 0 : bools.SPCWatchesOnly) && !isSPC) {
|
|
@@ -15773,7 +15819,7 @@ var text = (stanza) => __async(null, null, function* () {
|
|
|
15773
15819
|
const header = getEventHeader({ properties: props, getType: stanza.getType });
|
|
15774
15820
|
const issued = new Date(attributes.issue);
|
|
15775
15821
|
const expires = new Date(issued.getTime() + 12 * 60 * 60 * 1e3);
|
|
15776
|
-
let event = Object.keys(
|
|
15822
|
+
let event = Object.keys(dict_matches).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
|
|
15777
15823
|
let isStatement = false;
|
|
15778
15824
|
if (!event) {
|
|
15779
15825
|
event = stanza.getType.type.split(`-`).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `);
|
|
@@ -15816,9 +15862,9 @@ var text = (stanza) => __async(null, null, function* () {
|
|
|
15816
15862
|
|
|
15817
15863
|
// src/@parsers/@ugc/ugc.header.ts
|
|
15818
15864
|
var getUGCHeader = (message) => {
|
|
15819
|
-
const start = message.search(
|
|
15865
|
+
const start = message.search(dict_expressions.ugc1);
|
|
15820
15866
|
const sub = message.substring(start);
|
|
15821
|
-
const end = sub.search(
|
|
15867
|
+
const end = sub.search(dict_expressions.ugc2);
|
|
15822
15868
|
const fin = sub.substring(0, end).replace(/\s+/g, "").slice(0, -1);
|
|
15823
15869
|
return fin != null ? fin : null;
|
|
15824
15870
|
};
|
|
@@ -15910,7 +15956,7 @@ var ugc = (stanza) => __async(null, null, function* () {
|
|
|
15910
15956
|
const issued = new Date(attributes.issue);
|
|
15911
15957
|
const expires = new Date(ugc2.expires);
|
|
15912
15958
|
const header = getEventHeader({ properties: props, getType: stanza.getType });
|
|
15913
|
-
let event = Object.keys(
|
|
15959
|
+
let event = Object.keys(dict_matches).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
|
|
15914
15960
|
let isStatement = false;
|
|
15915
15961
|
if (!event) {
|
|
15916
15962
|
event = stanza.getType.type.split(`-`).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `);
|
|
@@ -15952,8 +15998,8 @@ var ugc = (stanza) => __async(null, null, function* () {
|
|
|
15952
15998
|
validateEvents(processed);
|
|
15953
15999
|
});
|
|
15954
16000
|
|
|
15955
|
-
// src/@dictionaries/dictionaries.
|
|
15956
|
-
var
|
|
16001
|
+
// src/@dictionaries/dictionaries.events.ts
|
|
16002
|
+
var dict_events = {
|
|
15957
16003
|
"AF": "Ashfall",
|
|
15958
16004
|
"AS": "Air Stagnation",
|
|
15959
16005
|
"BH": "Beach Hazard",
|
|
@@ -16017,8 +16063,8 @@ var eventTypes = {
|
|
|
16017
16063
|
"ZY": "Freezing Spray"
|
|
16018
16064
|
};
|
|
16019
16065
|
|
|
16020
|
-
// src/@dictionaries/dictionaries.
|
|
16021
|
-
var
|
|
16066
|
+
// src/@dictionaries/dictionaries.actions.ts
|
|
16067
|
+
var dict_actions = {
|
|
16022
16068
|
"W": "Warning",
|
|
16023
16069
|
"F": "Forecast",
|
|
16024
16070
|
"A": "Watch",
|
|
@@ -16028,8 +16074,8 @@ var eventActions = {
|
|
|
16028
16074
|
"S": "Statement"
|
|
16029
16075
|
};
|
|
16030
16076
|
|
|
16031
|
-
// src/@dictionaries/dictionaries.
|
|
16032
|
-
var
|
|
16077
|
+
// src/@dictionaries/dictionaries.status.ts
|
|
16078
|
+
var dict_status = {
|
|
16033
16079
|
"NEW": "Issued",
|
|
16034
16080
|
"CON": "Updated",
|
|
16035
16081
|
"EXT": "Extended",
|
|
@@ -16054,7 +16100,8 @@ var getExpiry2 = (dates) => {
|
|
|
16054
16100
|
// src/@parsers/@pvtec/pvtec.extract.ts
|
|
16055
16101
|
var pvExtract = (message) => {
|
|
16056
16102
|
var _a, _b, _c, _d;
|
|
16057
|
-
|
|
16103
|
+
if (!message) return null;
|
|
16104
|
+
const getVTECs = (_a = message.match(dict_expressions.pvtec)) != null ? _a : [];
|
|
16058
16105
|
const vtecs = [];
|
|
16059
16106
|
for (const vtec2 of getVTECs) {
|
|
16060
16107
|
const sub = vtec2.split(`.`);
|
|
@@ -16062,11 +16109,11 @@ var pvExtract = (message) => {
|
|
|
16062
16109
|
const dates = (_b = sub[6]) == null ? void 0 : _b.split(`-`);
|
|
16063
16110
|
vtecs.push({
|
|
16064
16111
|
vtec: vtec2,
|
|
16065
|
-
product:
|
|
16112
|
+
product: dict_products[sub[0]],
|
|
16066
16113
|
tracking: `${sub[2]}.${sub[3]}.${sub[4]}.${sub[5]}`,
|
|
16067
|
-
event: `${
|
|
16068
|
-
status:
|
|
16069
|
-
organization: (_d = (_c = message.match(
|
|
16114
|
+
event: `${dict_events[sub[3]]} ${dict_actions[sub[4]]}`,
|
|
16115
|
+
status: dict_status[sub[1]],
|
|
16116
|
+
organization: (_d = (_c = message.match(dict_expressions.wmo)) == null ? void 0 : _c[0]) != null ? _d : null,
|
|
16070
16117
|
expires: getExpiry2(dates),
|
|
16071
16118
|
is_watch: (sub[4] == `A` || sub[4] == `Y`) && (sub[3] == `TO` || sub[3] == `SV`),
|
|
16072
16119
|
prediction_center: sub[2] == `KWNS` ? true : false
|
|
@@ -16075,8 +16122,8 @@ var pvExtract = (message) => {
|
|
|
16075
16122
|
return vtecs.length > 0 ? vtecs : null;
|
|
16076
16123
|
};
|
|
16077
16124
|
|
|
16078
|
-
// src/@dictionaries/dictionaries.
|
|
16079
|
-
var
|
|
16125
|
+
// src/@dictionaries/dictionaries.causes.ts
|
|
16126
|
+
var dict_causes = {
|
|
16080
16127
|
"SM": "Snow Melt",
|
|
16081
16128
|
"RS": "Rain/Snow Melt",
|
|
16082
16129
|
"ER": "Excessive Rain",
|
|
@@ -16094,16 +16141,16 @@ var eventCauses = {
|
|
|
16094
16141
|
"OT": "Other Effects"
|
|
16095
16142
|
};
|
|
16096
16143
|
|
|
16097
|
-
// src/@dictionaries/dictionaries.
|
|
16098
|
-
var
|
|
16144
|
+
// src/@dictionaries/dictionaries.records.ts
|
|
16145
|
+
var dict_records = {
|
|
16099
16146
|
"NO": "No Record Expected",
|
|
16100
16147
|
"NR": "Near Record or possible record",
|
|
16101
16148
|
"UU": "Unknown history of records",
|
|
16102
16149
|
"OO": "Other"
|
|
16103
16150
|
};
|
|
16104
16151
|
|
|
16105
|
-
// src/@dictionaries/dictionaries.
|
|
16106
|
-
var
|
|
16152
|
+
// src/@dictionaries/dictionaries.severity.ts
|
|
16153
|
+
var dict_severity = {
|
|
16107
16154
|
N: "Not Expected",
|
|
16108
16155
|
0: "Areal Flood or FF Product",
|
|
16109
16156
|
1: "Minor",
|
|
@@ -16115,16 +16162,16 @@ var eventSeverity = {
|
|
|
16115
16162
|
// src/@parsers/@hvtec/hvtec.extract.ts
|
|
16116
16163
|
var hvExtract = (message) => {
|
|
16117
16164
|
var _a;
|
|
16118
|
-
const getHVTECs = (_a = message.match(
|
|
16165
|
+
const getHVTECs = (_a = message.match(dict_expressions.hvtec)) != null ? _a : [];
|
|
16119
16166
|
const vtecs = [];
|
|
16120
16167
|
for (const vtec2 of getHVTECs) {
|
|
16121
16168
|
const sub = vtec2.split(`.`);
|
|
16122
16169
|
if (sub.length < 7) continue;
|
|
16123
16170
|
vtecs.push({
|
|
16124
16171
|
hvtec: vtec2,
|
|
16125
|
-
severity:
|
|
16126
|
-
cause:
|
|
16127
|
-
record:
|
|
16172
|
+
severity: dict_severity[sub[1]],
|
|
16173
|
+
cause: dict_causes[sub[2]],
|
|
16174
|
+
record: dict_records[sub[6]]
|
|
16128
16175
|
});
|
|
16129
16176
|
}
|
|
16130
16177
|
return vtecs.length > 0 ? vtecs : null;
|
|
@@ -16188,12 +16235,12 @@ var vtec = (stanza) => __async(null, null, function* () {
|
|
|
16188
16235
|
|
|
16189
16236
|
// src/@events/events.api.ts
|
|
16190
16237
|
var api = (stanza) => __async(null, null, function* () {
|
|
16191
|
-
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, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb;
|
|
16238
|
+
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, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa, _Ta, _Ua, _Va, _Wa, _Xa, _Ya, _Za, __a, _$a, _ab, _bb, _cb, _db, _eb, _fb, _gb, _hb, _ib, _jb, _kb, _lb, _mb, _nb, _ob, _pb, _qb, _rb, _sb;
|
|
16192
16239
|
let processed = [];
|
|
16193
16240
|
const messages = Object.values(JSON.parse(stanza.message).features);
|
|
16194
16241
|
for (const feature of messages) {
|
|
16195
16242
|
const tick = performance.now();
|
|
16196
|
-
const pVtec = (_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;
|
|
16243
|
+
const pVtec = (_d = pvExtract((_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;
|
|
16197
16244
|
processed.push({
|
|
16198
16245
|
type: `Feature`,
|
|
16199
16246
|
geometry: {
|
|
@@ -16211,63 +16258,63 @@ var api = (stanza) => __async(null, null, function* () {
|
|
|
16211
16258
|
attributes: (_t = (_s = feature == null ? void 0 : feature.properties) == null ? void 0 : _s.attributes) != null ? _t : {},
|
|
16212
16259
|
geocode: {
|
|
16213
16260
|
office: {
|
|
16214
|
-
office: pVtec ? pVtec.split(`.`)[
|
|
16215
|
-
name: (
|
|
16261
|
+
office: pVtec ? (_u = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _u.tracking.split(`.`)[0] : null,
|
|
16262
|
+
name: (_w = dict_icao[pVtec ? (_v = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _v.tracking.split(`.`)[0] : null]) != null ? _w : null
|
|
16216
16263
|
},
|
|
16217
|
-
organization: (
|
|
16218
|
-
ugc: (
|
|
16219
|
-
polygon: ((
|
|
16220
|
-
polygon_generated: ((
|
|
16264
|
+
organization: (_z = (_y = (_x = feature == null ? void 0 : feature.properties) == null ? void 0 : _x.parameters) == null ? void 0 : _y.WMOidentifier) == null ? void 0 : _z[0],
|
|
16265
|
+
ugc: (_C = (_B = (_A = feature == null ? void 0 : feature.properties) == null ? void 0 : _A.geocode) == null ? void 0 : _B.UGC) != null ? _C : [],
|
|
16266
|
+
polygon: ((_D = feature == null ? void 0 : feature.geometry) == null ? void 0 : _D.coordinates.length) > 0 ? Buffer.from(JSON.stringify([(_E = feature == null ? void 0 : feature.geometry) == null ? void 0 : _E.coordinates[0]])).toString("base64") : null,
|
|
16267
|
+
polygon_generated: ((_F = feature == null ? void 0 : feature.geometry) == null ? void 0 : _F.coordinates.length) > 0 ? true : false
|
|
16221
16268
|
},
|
|
16222
16269
|
parameters: {
|
|
16223
|
-
tags: getEventTags((
|
|
16224
|
-
instructions: (
|
|
16225
|
-
source: (
|
|
16226
|
-
hazards: (
|
|
16227
|
-
impacts: (
|
|
16228
|
-
estimated_hail_size: (
|
|
16229
|
-
estimated_wind_gusts: (
|
|
16230
|
-
damage_threat: (
|
|
16231
|
-
tornado_threat: (
|
|
16232
|
-
flood_threat: (
|
|
16233
|
-
wind_threat: (
|
|
16234
|
-
hail_threat: (
|
|
16270
|
+
tags: getEventTags((_G = feature == null ? void 0 : feature.properties) == null ? void 0 : _G.description),
|
|
16271
|
+
instructions: (_I = (_H = feature == null ? void 0 : feature.properties) == null ? void 0 : _H.instruction) != null ? _I : null,
|
|
16272
|
+
source: (_K = getTextFromProduct({ message: (_J = feature == null ? void 0 : feature.properties) == null ? void 0 : _J.description, find: [`SOURCE...`], removal: [`.`] })) != null ? _K : null,
|
|
16273
|
+
hazards: (_M = getTextFromProduct({ message: (_L = feature == null ? void 0 : feature.properties) == null ? void 0 : _L.description, find: [`HAZARD...`], removal: [`.`] })) != null ? _M : null,
|
|
16274
|
+
impacts: (_O = getTextFromProduct({ message: (_N = feature == null ? void 0 : feature.properties) == null ? void 0 : _N.description, find: [`IMPACT...`], removal: [`.`] })) != null ? _O : null,
|
|
16275
|
+
estimated_hail_size: (_S = (_R = (_Q = (_P = feature == null ? void 0 : feature.properties) == null ? void 0 : _P.parameters) == null ? void 0 : _Q.maxHailSize) == null ? void 0 : _R[0]) != null ? _S : null,
|
|
16276
|
+
estimated_wind_gusts: (_W = (_V = (_U = (_T = feature == null ? void 0 : feature.properties) == null ? void 0 : _T.parameters) == null ? void 0 : _U.maxWindGust) == null ? void 0 : _V[0]) != null ? _W : null,
|
|
16277
|
+
damage_threat: (__ = (_Z = (_Y = (_X = feature == null ? void 0 : feature.properties) == null ? void 0 : _X.parameters) == null ? void 0 : _Y.thunderstormDamageThreat) == null ? void 0 : _Z[0]) != null ? __ : null,
|
|
16278
|
+
tornado_threat: (_ca = (_ba = (_aa = (_$ = feature == null ? void 0 : feature.properties) == null ? void 0 : _$.parameters) == null ? void 0 : _aa.tornadoDetection) == null ? void 0 : _ba[0]) != null ? _ca : null,
|
|
16279
|
+
flood_threat: (_ga = (_fa = (_ea = (_da = feature == null ? void 0 : feature.properties) == null ? void 0 : _da.parameters) == null ? void 0 : _ea.floodDetection) == null ? void 0 : _fa[0]) != null ? _ga : null,
|
|
16280
|
+
wind_threat: (_ka = (_ja = (_ia = (_ha = feature == null ? void 0 : feature.properties) == null ? void 0 : _ha.parameters) == null ? void 0 : _ia.windThreat) == null ? void 0 : _ja[0]) != null ? _ka : null,
|
|
16281
|
+
hail_threat: (_oa = (_na = (_ma = (_la = feature == null ? void 0 : feature.properties) == null ? void 0 : _la.parameters) == null ? void 0 : _ma.hailThreat) == null ? void 0 : _na[0]) != null ? _oa : null
|
|
16235
16282
|
},
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16283
|
+
discussion_parameters: {
|
|
16284
|
+
discussion_number: (_sa = (_ra = (_qa = getTextFromProduct({ message: (_pa = feature == null ? void 0 : feature.properties) == null ? void 0 : _pa.description, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) == null ? void 0 : _qa.toString()) == null ? void 0 : _ra.padStart(4, "0")) != null ? _sa : null,
|
|
16285
|
+
discussion_concerning: (_ua = getTextFromProduct({ message: (_ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _ta.description, find: [`Concerning...`] })) != null ? _ua : null,
|
|
16286
|
+
discussion_max_tornado: (_wa = getTextFromProduct({ message: (_va = feature == null ? void 0 : feature.properties) == null ? void 0 : _va.description, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _wa : null,
|
|
16287
|
+
discussion_max_hail: (_ya = getTextFromProduct({ message: (_xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _xa.description, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _ya : null,
|
|
16288
|
+
discussion_max_wind: (_Aa = getTextFromProduct({ message: (_za = feature == null ? void 0 : feature.properties) == null ? void 0 : _za.description, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _Aa : null,
|
|
16289
|
+
discussion_watch_issuance: (_Ca = getTextFromProduct({ message: (_Ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ba.description, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _Ca : null
|
|
16243
16290
|
},
|
|
16244
16291
|
watch_parameters: {
|
|
16245
|
-
watch_number: (
|
|
16246
|
-
watch_type: ((
|
|
16247
|
-
additional_tornadoes_probability: (
|
|
16248
|
-
strong_tornadoes_probability: (
|
|
16249
|
-
severe_wind_probability: (
|
|
16250
|
-
severe_hail_probability: (
|
|
16251
|
-
hail_2in_probability: (
|
|
16252
|
-
combined_hail_wind_probability: (
|
|
16253
|
-
max_hail_in: (
|
|
16254
|
-
max_wind_surface: (
|
|
16255
|
-
max_tops_x100feet: (
|
|
16256
|
-
pds_watch: getTextFromProduct({ message: (
|
|
16292
|
+
watch_number: ((_Da = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _Da.is_watch) && ((_Oa = (_Na = (_Ia = (_Ha = (_Ga = (_Fa = getTextFromProduct({ message: (_Ea = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ea.description, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _Fa.replace(/(WT|WS|)/g, "")) == null ? void 0 : _Ga.trim()) == null ? void 0 : _Ha.toString()) == null ? void 0 : _Ia.padStart(4, "0")) != null ? _Na : (_Ma = (_La = (_Ka = (_Ja = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _Ja.tracking) == null ? void 0 : _Ka.slice(-4)) == null ? void 0 : _La.toString()) == null ? void 0 : _Ma.padStart(4, "0")) != null ? _Oa : null),
|
|
16293
|
+
watch_type: ((_Pa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Pa.description.includes(`TORNADO WATCH`)) ? `Tornado` : ((_Qa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Qa.description.includes(`SEVERE`)) ? `Severe` : null,
|
|
16294
|
+
additional_tornadoes_probability: (_Sa = getTextFromProduct({ message: (_Ra = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ra.description, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Sa : null,
|
|
16295
|
+
strong_tornadoes_probability: (_Ua = getTextFromProduct({ message: (_Ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ta.description, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Ua : null,
|
|
16296
|
+
severe_wind_probability: (_Wa = getTextFromProduct({ message: (_Va = feature == null ? void 0 : feature.properties) == null ? void 0 : _Va.description, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Wa : null,
|
|
16297
|
+
severe_hail_probability: (_Ya = getTextFromProduct({ message: (_Xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Xa.description, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Ya : null,
|
|
16298
|
+
hail_2in_probability: (__a = getTextFromProduct({ message: (_Za = feature == null ? void 0 : feature.properties) == null ? void 0 : _Za.description, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? __a : null,
|
|
16299
|
+
combined_hail_wind_probability: (_ab = getTextFromProduct({ message: (_$a = feature == null ? void 0 : feature.properties) == null ? void 0 : _$a.description, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _ab : null,
|
|
16300
|
+
max_hail_in: (_cb = getTextFromProduct({ message: (_bb = feature == null ? void 0 : feature.properties) == null ? void 0 : _bb.description, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _cb : null,
|
|
16301
|
+
max_wind_surface: (_eb = getTextFromProduct({ message: (_db = feature == null ? void 0 : feature.properties) == null ? void 0 : _db.description, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _eb : null,
|
|
16302
|
+
max_tops_x100feet: (_gb = getTextFromProduct({ message: (_fb = feature == null ? void 0 : feature.properties) == null ? void 0 : _fb.description, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _gb : null,
|
|
16303
|
+
pds_watch: getTextFromProduct({ message: (_hb = feature == null ? void 0 : feature.properties) == null ? void 0 : _hb.description, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`
|
|
16257
16304
|
},
|
|
16258
16305
|
metadata: {
|
|
16259
16306
|
ms: performance.now() - tick,
|
|
16260
16307
|
source: `events.api`,
|
|
16261
|
-
tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: (
|
|
16262
|
-
header: `ZCZC-ATMOSX-${(
|
|
16263
|
-
vtec: pVtec,
|
|
16308
|
+
tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: (_kb = (_jb = (_ib = feature == null ? void 0 : feature.properties) == null ? void 0 : _ib.parameters) == null ? void 0 : _jb.WMOidentifier) == null ? void 0 : _kb[0], featureId: feature == null ? void 0 : feature.id }, vtec: pVtec == null ? void 0 : pVtec[0] }),
|
|
16309
|
+
header: `ZCZC-ATMOSX-${(_mb = (_lb = feature == null ? void 0 : feature.properties) == null ? void 0 : _lb.parameters) == null ? void 0 : _mb.WMOidentifier}`,
|
|
16310
|
+
vtec: pVtec == null ? void 0 : pVtec[0],
|
|
16264
16311
|
hvtec: null,
|
|
16265
|
-
raw: (
|
|
16312
|
+
raw: (_nb = feature == null ? void 0 : feature.properties) == null ? void 0 : _nb.description,
|
|
16266
16313
|
history: [
|
|
16267
16314
|
{
|
|
16268
|
-
description: (
|
|
16269
|
-
issued: ((
|
|
16270
|
-
status: (
|
|
16315
|
+
description: (_ob = feature == null ? void 0 : feature.properties) == null ? void 0 : _ob.description,
|
|
16316
|
+
issued: ((_pb = feature == null ? void 0 : feature.properties) == null ? void 0 : _pb.sent) ? new Date((_qb = feature == null ? void 0 : feature.properties) == null ? void 0 : _qb.sent).toISOString() : null,
|
|
16317
|
+
status: (_sb = (_rb = feature == null ? void 0 : feature.properties) == null ? void 0 : _rb.messageType) != null ? _sb : null
|
|
16271
16318
|
}
|
|
16272
16319
|
]
|
|
16273
16320
|
}
|
|
@@ -16403,8 +16450,8 @@ var setSleep = (options) => __async(null, null, function* () {
|
|
|
16403
16450
|
});
|
|
16404
16451
|
});
|
|
16405
16452
|
|
|
16406
|
-
// src/@dictionaries/dictionaries.
|
|
16407
|
-
var
|
|
16453
|
+
// src/@dictionaries/dictionaries.shapefiles.ts
|
|
16454
|
+
var dict_shapefiles = [
|
|
16408
16455
|
{ name: "us_counties", id: "C", link: "https://www.weather.gov/source/gis/Shapefiles/County/c_16ap26.zip" },
|
|
16409
16456
|
{ name: "us_states_territories", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/County/s_16ap26.zip" },
|
|
16410
16457
|
{ name: "fire_weather_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/fz16ap26.zip" },
|
|
@@ -16425,7 +16472,7 @@ var importShapefiles = () => __async(null, null, function* () {
|
|
|
16425
16472
|
if (tShapefiles === 0) {
|
|
16426
16473
|
yield setSleep({ timeout: 1e3 });
|
|
16427
16474
|
setWarning({ message: `Shapefiles are currently building, please DO NOT close your terminal. The shapefiles will not finish and will remain incomplete. If you do mess up, you will need to delete ${settings.Database} and restart the application.` });
|
|
16428
|
-
for (const shapefile of
|
|
16475
|
+
for (const shapefile of dict_shapefiles) {
|
|
16429
16476
|
const response2 = yield fetch(shapefile.link);
|
|
16430
16477
|
const arrayBuff = yield response2.arrayBuffer();
|
|
16431
16478
|
const content = yield loadAsync(arrayBuff);
|
|
@@ -16570,14 +16617,14 @@ var xReconnect = (interval) => __async(null, null, function* () {
|
|
|
16570
16617
|
});
|
|
16571
16618
|
|
|
16572
16619
|
// src/@modules/@utilities/utilities.setCronSchedule.ts
|
|
16573
|
-
import { readdirSync, unlinkSync as unlinkSync2, statSync, existsSync as
|
|
16620
|
+
import { readdirSync, unlinkSync as unlinkSync2, statSync, existsSync as existsSync3 } from "fs";
|
|
16574
16621
|
import { join as join2 } from "path";
|
|
16575
16622
|
var setCronSchedule = () => __async(null, null, function* () {
|
|
16576
16623
|
const settings = bootstrap.settings;
|
|
16577
|
-
const TTL = settings.GlobalSettings.
|
|
16624
|
+
const TTL = settings.GlobalSettings.ArchiveSettings.TTL;
|
|
16578
16625
|
const TTLCUT = Date.now() - TTL * 1e3;
|
|
16579
16626
|
const walk = (dir) => {
|
|
16580
|
-
if (
|
|
16627
|
+
if (existsSync3(dir)) {
|
|
16581
16628
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
16582
16629
|
for (const entry of entries) {
|
|
16583
16630
|
const fullPath = join2(dir, entry.name);
|
|
@@ -16596,7 +16643,8 @@ var setCronSchedule = () => __async(null, null, function* () {
|
|
|
16596
16643
|
}
|
|
16597
16644
|
}
|
|
16598
16645
|
};
|
|
16599
|
-
walk(settings.GlobalSettings.
|
|
16646
|
+
walk(settings.GlobalSettings.ArchiveSettings.TextDirectory);
|
|
16647
|
+
walk(settings.GlobalSettings.ArchiveSettings.EasDirectory);
|
|
16600
16648
|
if (settings.EnableWireService) {
|
|
16601
16649
|
if (settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.Enabled) {
|
|
16602
16650
|
void xReconnect(settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval);
|
|
@@ -16764,6 +16812,59 @@ var getNodes = () => {
|
|
|
16764
16812
|
return bootstrap.cache.nodes;
|
|
16765
16813
|
};
|
|
16766
16814
|
|
|
16815
|
+
// src/@core/core.createEvent.ts
|
|
16816
|
+
var createEvent2 = (options) => {
|
|
16817
|
+
var _a;
|
|
16818
|
+
const tick = performance.now();
|
|
16819
|
+
validateEvents([{
|
|
16820
|
+
type: `Feature`,
|
|
16821
|
+
geometry: {
|
|
16822
|
+
type: `Point`,
|
|
16823
|
+
coordinates: options.coordinates
|
|
16824
|
+
},
|
|
16825
|
+
properties: {
|
|
16826
|
+
event: options.event,
|
|
16827
|
+
parent: options.event,
|
|
16828
|
+
status: options.status,
|
|
16829
|
+
issued: options.issued.toISOString(),
|
|
16830
|
+
expires: options.expires.toISOString(),
|
|
16831
|
+
locations: options.locations,
|
|
16832
|
+
description: options.description,
|
|
16833
|
+
geocode: {
|
|
16834
|
+
office: {
|
|
16835
|
+
office: `ATMX`,
|
|
16836
|
+
name: `AtmosphericX Manual Event`
|
|
16837
|
+
},
|
|
16838
|
+
organization: `AtmosphericX`,
|
|
16839
|
+
ugc: [],
|
|
16840
|
+
polygon: options.coordinates.length > 0 ? Buffer.from(JSON.stringify([options.coordinates[0]])).toString("base64") : null,
|
|
16841
|
+
polygon_generated: options.coordinates.length > 0 ? true : false
|
|
16842
|
+
},
|
|
16843
|
+
status_metadata: {
|
|
16844
|
+
is_issued: options.status == `Issued`,
|
|
16845
|
+
is_updated: options.status == `Updated`,
|
|
16846
|
+
is_expired: options.status == `Expired`,
|
|
16847
|
+
is_test: options.status == `Test`,
|
|
16848
|
+
is_statement: options.status == `Statement`
|
|
16849
|
+
},
|
|
16850
|
+
metadata: {
|
|
16851
|
+
ms: performance.now() - tick,
|
|
16852
|
+
source: `events.manual`,
|
|
16853
|
+
tracking: `ATMX-M-W-01`,
|
|
16854
|
+
header: `ZCZC-ATMOSX-ATMX-M-W-01`,
|
|
16855
|
+
raw: options.description,
|
|
16856
|
+
history: [
|
|
16857
|
+
{
|
|
16858
|
+
description: options.description,
|
|
16859
|
+
issued: options.issued.toISOString(),
|
|
16860
|
+
status: (_a = options.status) != null ? _a : null
|
|
16861
|
+
}
|
|
16862
|
+
]
|
|
16863
|
+
}
|
|
16864
|
+
}
|
|
16865
|
+
}]);
|
|
16866
|
+
};
|
|
16867
|
+
|
|
16767
16868
|
// src/@core/core.getRandomEvent.ts
|
|
16768
16869
|
var getRandomEvent = () => {
|
|
16769
16870
|
return bootstrap.cache.events.features[Math.floor(Math.random() * bootstrap.cache.events.features.length)];
|
|
@@ -16823,6 +16924,7 @@ var index_default = Manager;
|
|
|
16823
16924
|
export {
|
|
16824
16925
|
Manager,
|
|
16825
16926
|
clearEvents,
|
|
16927
|
+
createEvent2 as createEvent,
|
|
16826
16928
|
index_default as default,
|
|
16827
16929
|
getCleanedEvent,
|
|
16828
16930
|
getEventGeometry,
|