@atmosx/event-product-parser 3.0.44 → 3.0.47
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 +77 -31
- package/SUPPORTED_EVENTS.md +369 -0
- package/dist/cjs/index.cjs +681 -403
- package/dist/esm/index.mjs +659 -382
- package/dist/index.d.mts +54 -25
- package/dist/index.d.ts +54 -25
- package/package.json +1 -1
- package/src/@building/building.attachments.ts +83 -0
- package/src/@building/building.enhance.ts +7 -3
- package/src/@building/building.office.ts +2 -2
- package/src/@building/building.properties.ts +12 -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 +83 -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} +2 -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} +2 -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.states.ts +72 -0
- 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.testing.ts} +3 -2
- package/src/@events/events.api.ts +18 -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 +163 -0
- package/src/@modules/@database/database.broadcastify.ts +67 -0
- package/src/@modules/@database/database.init.ts +14 -1
- package/src/@modules/@database/database.shapefiles.ts +3 -6
- 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.createHttp.ts +56 -47
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +5 -2
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +1 -1
- 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 +58 -0
- package/src/@parsers/@ugc/ugc.header.ts +3 -3
- package/src/@types/type.event.ts +3 -3
- package/src/@types/{type.webhook.ts → type.listener.ts} +11 -7
- package/src/@types/type.properties.ts +10 -9
- package/src/@types/type.settings.ts +13 -6
- package/src/bootstrap.ts +13 -6
- package/src/index.ts +2 -1
- package/test.js +30 -22
- package/src/@building/building.outlooks.ts +0 -36
- 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.47`,
|
|
10495
10495
|
isReady: true,
|
|
10496
10496
|
ratelimits: {},
|
|
10497
10497
|
session_xmpp: null,
|
|
@@ -10547,7 +10547,12 @@ var bootstrap = {
|
|
|
10547
10547
|
CallbackInterval: 15,
|
|
10548
10548
|
EventsEndpoint: `https://api.weather.gov/alerts/active`
|
|
10549
10549
|
},
|
|
10550
|
-
|
|
10550
|
+
BroadcastifySettings: {
|
|
10551
|
+
BroadcastifyAttachments: true,
|
|
10552
|
+
BroadcastifyDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/broadcastify.json`,
|
|
10553
|
+
BroadcastifyTags: [`Ham`, `Air`, `Fire`, `Public Safety`, `Weather`, `EMS`, `Police`, `Rail`]
|
|
10554
|
+
},
|
|
10555
|
+
ListenerSettings: [],
|
|
10551
10556
|
GlobalSettings: {
|
|
10552
10557
|
EventManagement: true,
|
|
10553
10558
|
BetterEventNames: true,
|
|
@@ -10567,10 +10572,12 @@ var bootstrap = {
|
|
|
10567
10572
|
NodeLocationFiltering: false,
|
|
10568
10573
|
IgnoreTestProducts: true
|
|
10569
10574
|
},
|
|
10570
|
-
|
|
10571
|
-
|
|
10572
|
-
|
|
10573
|
-
|
|
10575
|
+
ArchiveSettings: {
|
|
10576
|
+
TTL: 60,
|
|
10577
|
+
EventDirectory: null,
|
|
10578
|
+
TextDirectory: null,
|
|
10579
|
+
EasDirectory: null,
|
|
10580
|
+
EasToneout: null
|
|
10574
10581
|
}
|
|
10575
10582
|
}
|
|
10576
10583
|
}
|
|
@@ -13584,8 +13591,9 @@ var xError = () => {
|
|
|
13584
13591
|
}));
|
|
13585
13592
|
};
|
|
13586
13593
|
|
|
13587
|
-
// src/@dictionaries/dictionaries.
|
|
13588
|
-
var
|
|
13594
|
+
// src/@dictionaries/dictionaries.expressions.ts
|
|
13595
|
+
var dict_expressions = {
|
|
13596
|
+
location: new RegExp(/^([A-Za-z.\-' ]+),\s*([A-Z]{2})$/),
|
|
13589
13597
|
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
13598
|
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
13599
|
wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
|
|
@@ -13595,8 +13603,8 @@ var regExp = {
|
|
|
13595
13603
|
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
13604
|
};
|
|
13597
13605
|
|
|
13598
|
-
// src/@dictionaries/dictionaries.
|
|
13599
|
-
var
|
|
13606
|
+
// src/@dictionaries/dictionaries.awips.ts
|
|
13607
|
+
var dict_awips = {
|
|
13600
13608
|
ABV: `rawinsonde-data-above-100-millibars`,
|
|
13601
13609
|
ADA: `alarm-alert-administrative-message`,
|
|
13602
13610
|
ADM: `alert-administrative-message`,
|
|
@@ -13951,7 +13959,7 @@ var getAwipsType = (options) => {
|
|
|
13951
13959
|
prefix: null
|
|
13952
13960
|
};
|
|
13953
13961
|
}
|
|
13954
|
-
for (const [prefix, type] of Object.entries(
|
|
13962
|
+
for (const [prefix, type] of Object.entries(dict_awips)) {
|
|
13955
13963
|
if (attributes.awipsid.startsWith(prefix)) {
|
|
13956
13964
|
return { type, prefix };
|
|
13957
13965
|
}
|
|
@@ -13969,8 +13977,8 @@ var validate = (options) => {
|
|
|
13969
13977
|
if (attributes.awipsid && attributes.awipsid.length > 1) {
|
|
13970
13978
|
const isCapEvent = message.includes(`<?xml`);
|
|
13971
13979
|
const isCapAreaDescription = message.includes(`<areaDesc>`);
|
|
13972
|
-
const isVTEC = message.match(
|
|
13973
|
-
const isUGC = message.match(
|
|
13980
|
+
const isVTEC = message.match(dict_expressions.pvtec) != null;
|
|
13981
|
+
const isUGC = message.match(dict_expressions.ugc1) != null;
|
|
13974
13982
|
const getType = getAwipsType({ attributes });
|
|
13975
13983
|
if (getType.type != null) {
|
|
13976
13984
|
return {
|
|
@@ -13994,7 +14002,7 @@ var validate = (options) => {
|
|
|
13994
14002
|
// src/@parsers/@text/text.getDescriptionFromProduct.ts
|
|
13995
14003
|
var getDescriptionFromProduct = (options) => {
|
|
13996
14004
|
let message = options.message;
|
|
13997
|
-
const dates = Array.from(message.matchAll(
|
|
14005
|
+
const dates = Array.from(message.matchAll(dict_expressions.dateline));
|
|
13998
14006
|
if (dates.length) {
|
|
13999
14007
|
const lastMatch = dates[dates.length - 1][0];
|
|
14000
14008
|
const sIndx = message.lastIndexOf(lastMatch);
|
|
@@ -14060,8 +14068,8 @@ var getTextFromProduct = (options) => {
|
|
|
14060
14068
|
return null;
|
|
14061
14069
|
};
|
|
14062
14070
|
|
|
14063
|
-
// src/@dictionaries/dictionaries.
|
|
14064
|
-
var
|
|
14071
|
+
// src/@dictionaries/dictionaries.icao.ts
|
|
14072
|
+
var dict_icao = {
|
|
14065
14073
|
"KLUB": "Lubbock, TX",
|
|
14066
14074
|
"KLCH": "Lake Charles, LA",
|
|
14067
14075
|
"TSTL": "St. Louis, MO",
|
|
@@ -14306,12 +14314,12 @@ var officeICAOs = {
|
|
|
14306
14314
|
var getEventOffice = (options) => {
|
|
14307
14315
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
14308
14316
|
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 =
|
|
14317
|
+
const name = (_g = (_f = dict_icao) == null ? void 0 : _f[office]) != null ? _g : null;
|
|
14310
14318
|
return { office, name };
|
|
14311
14319
|
};
|
|
14312
14320
|
|
|
14313
|
-
// src/@dictionaries/dictionaries.
|
|
14314
|
-
var
|
|
14321
|
+
// src/@dictionaries/dictionaries.tags.ts
|
|
14322
|
+
var dict_tags = {
|
|
14315
14323
|
"FROSTBITE AND HYPOTHERMIA ARE LIKELY": "Frostbite and Hypothermia Likely",
|
|
14316
14324
|
"LICKELY BECOME SLICK AND HAZARDOUS": "Slick and Hazardous Roads",
|
|
14317
14325
|
"SLIPPERY ROAD CONDITIONS": "Slippery Roads",
|
|
@@ -14388,60 +14396,61 @@ var eventTags = {
|
|
|
14388
14396
|
|
|
14389
14397
|
// src/@building/building.tags.ts
|
|
14390
14398
|
var getEventTags = (message) => {
|
|
14391
|
-
return Object.entries(
|
|
14399
|
+
return Object.entries(dict_tags).filter(([key]) => message == null ? void 0 : message.toLowerCase().includes(key.toLowerCase())).map(([, value]) => value);
|
|
14392
14400
|
};
|
|
14393
14401
|
|
|
14394
14402
|
// src/@building/building.properties.ts
|
|
14395
14403
|
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(
|
|
14404
|
+
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;
|
|
14405
|
+
const organization = (_b = (_a = options.message.match(dict_expressions.wmo)) == null ? void 0 : _a[0]) != null ? _b : null;
|
|
14398
14406
|
const polygons = getPolygonFromProduct(options.message);
|
|
14399
14407
|
const properties2 = {
|
|
14400
14408
|
locations: (_e = (_d = (_c = options == null ? void 0 : options.ugc) == null ? void 0 : _c.locations) == null ? void 0 : _d.join(`; `)) != null ? _e : null,
|
|
14401
|
-
|
|
14409
|
+
locations_array: (_g = (_f = options == null ? void 0 : options.ugc) == null ? void 0 : _f.locations) != null ? _g : [],
|
|
14410
|
+
description: getDescriptionFromProduct({ message: options.message, handle: (_i = (_h = options == null ? void 0 : options.pVtec) == null ? void 0 : _h.vtec) != null ? _i : null }),
|
|
14402
14411
|
attributes: options.attributes,
|
|
14403
14412
|
geocode: {
|
|
14404
14413
|
office: getEventOffice({ attributes: options.attributes, organization, pVtec: options.pVtec }),
|
|
14405
14414
|
organization,
|
|
14406
|
-
ugc: (
|
|
14415
|
+
ugc: (_k = (_j = options == null ? void 0 : options.ugc) == null ? void 0 : _j.zones) != null ? _k : [],
|
|
14407
14416
|
polygon: polygons.length > 0 ? Buffer.from(JSON.stringify([polygons])).toString("base64") : null,
|
|
14408
14417
|
polygon_generated: polygons.length > 0 ? true : false
|
|
14409
14418
|
},
|
|
14410
14419
|
parameters: {
|
|
14411
14420
|
tags: getEventTags(options.message),
|
|
14412
|
-
instructions: (
|
|
14413
|
-
source: (
|
|
14414
|
-
hazards: (
|
|
14415
|
-
impacts: (
|
|
14416
|
-
estimated_hail_size: (
|
|
14417
|
-
estimated_wind_gusts: (
|
|
14418
|
-
damage_threat: (
|
|
14419
|
-
tornado_threat: (
|
|
14420
|
-
flood_threat: (
|
|
14421
|
-
wind_threat: (
|
|
14422
|
-
hail_threat: (
|
|
14421
|
+
instructions: (_l = getTextFromProduct({ message: options.message, find: [`For your protection`, `do not`, `use extreme caution`], append: `...`, removal: [`.`] })) != null ? _l : null,
|
|
14422
|
+
source: (_m = getTextFromProduct({ message: options.message, find: [`SOURCE...`], removal: [`.`] })) != null ? _m : null,
|
|
14423
|
+
hazards: (_n = getTextFromProduct({ message: options.message, find: [`HAZARD...`], removal: [`.`] })) != null ? _n : null,
|
|
14424
|
+
impacts: (_o = getTextFromProduct({ message: options.message, find: [`IMPACT...`], removal: [`.`] })) != null ? _o : null,
|
|
14425
|
+
estimated_hail_size: (_p = getTextFromProduct({ message: options.message, find: [`MAX HAIL SIZE...`, `HAIL...`], removal: ["in"] })) != null ? _p : null,
|
|
14426
|
+
estimated_wind_gusts: (_q = getTextFromProduct({ message: options.message, find: [`MAX WIND GUST...`, `WIND...`] })) != null ? _q : null,
|
|
14427
|
+
damage_threat: (_r = getTextFromProduct({ message: options.message, find: [`DAMAGE THREAT...`], removal: [] })) != null ? _r : null,
|
|
14428
|
+
tornado_threat: (_s = getTextFromProduct({ message: options.message, find: [`TORNADO...`, `WATERSPOUT...`] })) != null ? _s : null,
|
|
14429
|
+
flood_threat: (_t = getTextFromProduct({ message: options.message, find: [`FLASH FLOOD...`] })) != null ? _t : null,
|
|
14430
|
+
wind_threat: (_u = getTextFromProduct({ message: options.message, find: [`WIND THREAT...`] })) != null ? _u : null,
|
|
14431
|
+
hail_threat: (_v = getTextFromProduct({ message: options.message, find: [`HAIL THREAT...`], removal: [] })) != null ? _v : null
|
|
14423
14432
|
},
|
|
14424
|
-
|
|
14425
|
-
|
|
14426
|
-
|
|
14427
|
-
|
|
14428
|
-
|
|
14429
|
-
|
|
14430
|
-
|
|
14433
|
+
discussion_parameters: {
|
|
14434
|
+
discussion_number: (_y = (_x = (_w = getTextFromProduct({ message: options.message, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) == null ? void 0 : _w.toString()) == null ? void 0 : _x.padStart(4, "0")) != null ? _y : null,
|
|
14435
|
+
discussion_concerning: (_z = getTextFromProduct({ message: options.message, find: [`Concerning...`] })) != null ? _z : null,
|
|
14436
|
+
discussion_max_tornado: (_A = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _A : null,
|
|
14437
|
+
discussion_max_hail: (_B = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _B : null,
|
|
14438
|
+
discussion_max_wind: (_C = getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _C : null,
|
|
14439
|
+
discussion_watch_issuance: (_D = getTextFromProduct({ message: options.message, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _D : null
|
|
14431
14440
|
},
|
|
14432
14441
|
watch_parameters: {
|
|
14433
|
-
watch_number: (
|
|
14442
|
+
watch_number: ((_E = options == null ? void 0 : options.pVtec) == null ? void 0 : _E.is_watch) && ((_O = (_N = (_I = (_H = (_G = (_F = getTextFromProduct({ message: options.message, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _F.replace(/(WT|WS|)/g, "")) == null ? void 0 : _G.trim()) == null ? void 0 : _H.toString()) == null ? void 0 : _I.padStart(4, "0")) != null ? _N : (_M = (_L = (_K = (_J = options == null ? void 0 : options.pVtec) == null ? void 0 : _J.tracking) == null ? void 0 : _K.slice(-4)) == null ? void 0 : _L.toString()) == null ? void 0 : _M.padStart(4, "0")) != null ? _O : null),
|
|
14434
14443
|
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`
|
|
14444
|
+
additional_tornadoes_probability: (_P = getTextFromProduct({ message: options.message, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _P : null,
|
|
14445
|
+
strong_tornadoes_probability: (_Q = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Q : null,
|
|
14446
|
+
severe_wind_probability: (_R = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _R : null,
|
|
14447
|
+
severe_hail_probability: (_S = getTextFromProduct({ message: options.message, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _S : null,
|
|
14448
|
+
hail_2in_probability: (_T = getTextFromProduct({ message: options.message, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? _T : null,
|
|
14449
|
+
combined_hail_wind_probability: (_U = getTextFromProduct({ message: options.message, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _U : null,
|
|
14450
|
+
max_hail_in: (_V = getTextFromProduct({ message: options.message, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _V : null,
|
|
14451
|
+
max_wind_surface: (_W = getTextFromProduct({ message: options.message, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _W : null,
|
|
14452
|
+
max_tops_x100feet: (_X = getTextFromProduct({ message: options.message, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _X : null,
|
|
14453
|
+
pds_watch: getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES` ? true : null
|
|
14445
14454
|
}
|
|
14446
14455
|
};
|
|
14447
14456
|
if (isNaN(Number(properties2.watch_parameters.watch_number))) {
|
|
@@ -14459,8 +14468,8 @@ var getEventHeader = (options) => {
|
|
|
14459
14468
|
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
14469
|
};
|
|
14461
14470
|
|
|
14462
|
-
// src/@dictionaries/dictionaries.
|
|
14463
|
-
var
|
|
14471
|
+
// src/@dictionaries/dictionaries.matches.ts
|
|
14472
|
+
var dict_matches = {
|
|
14464
14473
|
"Special Weather Statement": "Special Weather Statement",
|
|
14465
14474
|
"Hurricane Warning": "Hurricane Warning",
|
|
14466
14475
|
"Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
|
|
@@ -14480,7 +14489,7 @@ var eventsMatchText = {
|
|
|
14480
14489
|
|
|
14481
14490
|
// src/@building/building.tracking.ts
|
|
14482
14491
|
var getEventTracking = (options) => {
|
|
14483
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14492
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14484
14493
|
const properties2 = options.properties;
|
|
14485
14494
|
const attributes = options.attributes;
|
|
14486
14495
|
const stanza = options.stanza;
|
|
@@ -14497,26 +14506,26 @@ var getEventTracking = (options) => {
|
|
|
14497
14506
|
}
|
|
14498
14507
|
if (options.type === `API`) {
|
|
14499
14508
|
if (options.vtec) {
|
|
14500
|
-
const vtecValue = Array.isArray(options.vtec) ? options.vtec[0] : options.vtec;
|
|
14509
|
+
const vtecValue = Array.isArray(options.vtec) ? options.vtec[0].vtec : (_c = options.vtec) == null ? void 0 : _c.vtec;
|
|
14501
14510
|
const splitPVTEC = vtecValue.split(".");
|
|
14502
14511
|
return `${splitPVTEC[2]}.${splitPVTEC[3]}.${splitPVTEC[4]}.${splitPVTEC[5]}`;
|
|
14503
14512
|
}
|
|
14504
|
-
const wmoMatch = (
|
|
14505
|
-
const station = (
|
|
14513
|
+
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})/);
|
|
14514
|
+
const station = (_f = wmoMatch == null ? void 0 : wmoMatch[2]) != null ? _f : "N/A";
|
|
14506
14515
|
if (options.organization.featureId) {
|
|
14507
14516
|
const idMatch = options.organization.featureId.match(/([a-f0-9]+)\.(\d+)\.(\d+)$/);
|
|
14508
|
-
return `${station}.${(
|
|
14517
|
+
return `${station}.${(_h = (_g = idMatch == null ? void 0 : idMatch[0]) == null ? void 0 : _g.replace(/\./g, "")) != null ? _h : "N/A"}`;
|
|
14509
14518
|
}
|
|
14510
|
-
const id2 = (
|
|
14511
|
-
return `${station}.${id2}`;
|
|
14519
|
+
const id2 = (_i = wmoMatch == null ? void 0 : wmoMatch[1]) != null ? _i : "N/A";
|
|
14520
|
+
return `${station}.${(_j = id2 == null ? void 0 : id2.replace(/\./g, "")) != null ? _j : "N/A"}`;
|
|
14512
14521
|
}
|
|
14513
14522
|
};
|
|
14514
14523
|
|
|
14515
14524
|
// src/@building/building.validate.ts
|
|
14516
14525
|
import { createHash } from "crypto";
|
|
14517
14526
|
|
|
14518
|
-
// src/@dictionaries/dictionaries.
|
|
14519
|
-
var
|
|
14527
|
+
// src/@dictionaries/dictionaries.enhanced.ts
|
|
14528
|
+
var dict_enhanced = {
|
|
14520
14529
|
"Tornado Warning": {
|
|
14521
14530
|
"Tornado Emergency": {
|
|
14522
14531
|
description: "tornado emergency"
|
|
@@ -14534,6 +14543,11 @@ var betterEventNames = {
|
|
|
14534
14543
|
},
|
|
14535
14544
|
"Radar Indicated Tornado Warning": {}
|
|
14536
14545
|
},
|
|
14546
|
+
"Fire Weather Warning": {
|
|
14547
|
+
"PDS Fire Weather Warning": {
|
|
14548
|
+
description: "particularly dangerous situation"
|
|
14549
|
+
}
|
|
14550
|
+
},
|
|
14537
14551
|
"Blizzard Warning": {
|
|
14538
14552
|
"PDS Blizzard Warning": {
|
|
14539
14553
|
description: "particularly dangerous situation"
|
|
@@ -14551,7 +14565,12 @@ var betterEventNames = {
|
|
|
14551
14565
|
},
|
|
14552
14566
|
"Tornado Watch": {
|
|
14553
14567
|
"PDS Tornado Watch": {
|
|
14554
|
-
|
|
14568
|
+
pdswatch: true
|
|
14569
|
+
}
|
|
14570
|
+
},
|
|
14571
|
+
"Severe Thunderstorm Watch": {
|
|
14572
|
+
"PDS Severe Thunderstorm Watch": {
|
|
14573
|
+
pdswatch: true
|
|
14555
14574
|
}
|
|
14556
14575
|
},
|
|
14557
14576
|
"Flash Flood Warning": {
|
|
@@ -14592,16 +14611,17 @@ var betterEventNames = {
|
|
|
14592
14611
|
|
|
14593
14612
|
// src/@building/building.enhance.ts
|
|
14594
14613
|
var getEventEnhancedName = (event) => {
|
|
14595
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
14614
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14596
14615
|
const configurations = bootstrap.settings;
|
|
14597
14616
|
let name = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.event;
|
|
14598
14617
|
if (!((_b = configurations == null ? void 0 : configurations.GlobalSettings) == null ? void 0 : _b.BetterEventNames)) {
|
|
14599
14618
|
return name;
|
|
14600
14619
|
}
|
|
14601
14620
|
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
|
-
|
|
14621
|
+
const tornado = (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.tornado_threat;
|
|
14622
|
+
const pdswatch = (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.watch_parameters) == null ? void 0 : _h.pds_watch;
|
|
14623
|
+
const description = (_j = (_i = event == null ? void 0 : event.properties) == null ? void 0 : _i.description) == null ? void 0 : _j.toLowerCase();
|
|
14624
|
+
for (const [eventKey, eventConfig] of Object.entries(dict_enhanced)) {
|
|
14605
14625
|
if (eventKey !== name) continue;
|
|
14606
14626
|
for (const [paramKey, paramValue] of Object.entries(eventConfig)) {
|
|
14607
14627
|
let matches = true;
|
|
@@ -14614,6 +14634,9 @@ var getEventEnhancedName = (event) => {
|
|
|
14614
14634
|
if (paramValue == null ? void 0 : paramValue.tornado) {
|
|
14615
14635
|
if (paramValue.tornado !== tornado) matches = false;
|
|
14616
14636
|
}
|
|
14637
|
+
if (paramValue == null ? void 0 : paramValue.pdswatch) {
|
|
14638
|
+
if (paramValue.pdswatch !== pdswatch) matches = false;
|
|
14639
|
+
}
|
|
14617
14640
|
if (matches) {
|
|
14618
14641
|
name = paramKey;
|
|
14619
14642
|
break;
|
|
@@ -14623,8 +14646,8 @@ var getEventEnhancedName = (event) => {
|
|
|
14623
14646
|
return name;
|
|
14624
14647
|
};
|
|
14625
14648
|
|
|
14626
|
-
// src/@dictionaries/dictionaries.
|
|
14627
|
-
var
|
|
14649
|
+
// src/@dictionaries/dictionaries.correlations.ts
|
|
14650
|
+
var dict_correlations = [
|
|
14628
14651
|
{ type: "Statement", name: "Statement", isCancel: false, isUpdate: false, isIssued: true, isStatement: true },
|
|
14629
14652
|
{ type: "Update", name: "Updated", isCancel: false, isUpdate: true, isIssued: false, isStatement: false },
|
|
14630
14653
|
{ type: "Cancel", name: "Cancelled", isCancel: true, isUpdate: false, isIssued: false, isStatement: false },
|
|
@@ -14639,11 +14662,12 @@ var statusCorrelationText = [
|
|
|
14639
14662
|
{ type: "Routine", name: "Routine", isCancel: false, isUpdate: true, isIssued: false, isStatement: false }
|
|
14640
14663
|
];
|
|
14641
14664
|
|
|
14642
|
-
// src/@dictionaries/dictionaries.
|
|
14643
|
-
var
|
|
14665
|
+
// src/@dictionaries/dictionaries.cancellation.ts
|
|
14666
|
+
var dict_cancellation = [
|
|
14644
14667
|
"has been cancelled",
|
|
14645
14668
|
"subsided sufficiently for the advisory to be cancelled",
|
|
14646
14669
|
"has been cancelled",
|
|
14670
|
+
"no tsunami threat from a nearby earthquake",
|
|
14647
14671
|
"will be allowed to expire",
|
|
14648
14672
|
"has diminished",
|
|
14649
14673
|
"and no longer",
|
|
@@ -14652,24 +14676,28 @@ var eventCancelMessages = [
|
|
|
14652
14676
|
"has weakened below severe"
|
|
14653
14677
|
];
|
|
14654
14678
|
|
|
14655
|
-
// src/@dictionaries/dictionaries.
|
|
14656
|
-
var
|
|
14679
|
+
// src/@dictionaries/dictionaries.testing.ts
|
|
14680
|
+
var dict_testing = [
|
|
14657
14681
|
`This is a test message`,
|
|
14658
14682
|
`Monitoring message only.`,
|
|
14659
|
-
`THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY
|
|
14683
|
+
`THIS_MESSAGE_IS_FOR_TEST_PURPOSES_ONLY`,
|
|
14684
|
+
"TEST MESSAGE"
|
|
14660
14685
|
];
|
|
14661
14686
|
|
|
14662
|
-
// src/@dictionaries/dictionaries.
|
|
14663
|
-
var
|
|
14687
|
+
// src/@dictionaries/dictionaries.products.ts
|
|
14688
|
+
var dict_products = {
|
|
14664
14689
|
"O": "Operational Product",
|
|
14665
14690
|
"T": "Test Product",
|
|
14666
14691
|
"E": "Experimental Product",
|
|
14667
14692
|
"X": "Experimental Product (Non-Operational)"
|
|
14668
14693
|
};
|
|
14669
14694
|
|
|
14670
|
-
// src/@dictionaries/dictionaries.
|
|
14671
|
-
var
|
|
14695
|
+
// src/@dictionaries/dictionaries.hail.ts
|
|
14696
|
+
var dict_hail = {
|
|
14697
|
+
".25": "Pea",
|
|
14698
|
+
".50": "Penny",
|
|
14672
14699
|
".75": "Penny",
|
|
14700
|
+
"Up to .75": "Penny",
|
|
14673
14701
|
".88": "Nickel",
|
|
14674
14702
|
"0.75": "Penny",
|
|
14675
14703
|
"0.88": "Nickel",
|
|
@@ -14685,25 +14713,25 @@ var hailStrings = {
|
|
|
14685
14713
|
|
|
14686
14714
|
// src/@building/building.signature.ts
|
|
14687
14715
|
var getEventSignature = (event) => {
|
|
14688
|
-
var _a, _b, _c, _d, _e, _f;
|
|
14716
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14689
14717
|
const properties2 = event == null ? void 0 : event.properties;
|
|
14690
14718
|
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 =
|
|
14719
|
+
const status = dict_correlations.find((c) => c.type === (properties2 == null ? void 0 : properties2.status));
|
|
14720
|
+
const csig = dict_cancellation.find((sig) => properties2.description.toLowerCase().includes(sig.toLowerCase()));
|
|
14693
14721
|
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 += ` (${(
|
|
14722
|
+
if ((_c = properties2 == null ? void 0 : properties2.parameters) == null ? void 0 : _c.estimated_hail_size) {
|
|
14723
|
+
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
14724
|
}
|
|
14697
14725
|
if (status) {
|
|
14698
|
-
properties2.status = (
|
|
14726
|
+
properties2.status = (_f = status.name) != null ? _f : properties2.status;
|
|
14699
14727
|
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
14728
|
}
|
|
14701
14729
|
if (csig) {
|
|
14702
14730
|
properties2.status_metadata = __spreadProps(__spreadValues({}, properties2.status_metadata), { is_expired: true });
|
|
14703
14731
|
}
|
|
14704
|
-
const getProduct = (
|
|
14705
|
-
const isTestProduct =
|
|
14706
|
-
if (isTestProduct ||
|
|
14732
|
+
const getProduct = (_h = (_g = vtec2 == null ? void 0 : vtec2.vtec) == null ? void 0 : _g.split(`.`)[0]) == null ? void 0 : _h.replace(`/`, ``);
|
|
14733
|
+
const isTestProduct = dict_products[getProduct] == `Test Product`;
|
|
14734
|
+
if (isTestProduct || dict_testing.some((sig) => {
|
|
14707
14735
|
var _a2, _b2, _c2, _d2;
|
|
14708
14736
|
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
14737
|
})) {
|
|
@@ -14730,74 +14758,6 @@ var setHash = (event, entry) => {
|
|
|
14730
14758
|
}
|
|
14731
14759
|
};
|
|
14732
14760
|
|
|
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
14761
|
// src/@modules/@eas/eas.getWavPCM16.ts
|
|
14802
14762
|
var getWavPCM16 = (buffer) => {
|
|
14803
14763
|
if (buffer.toString("ascii", 0, 4) !== "RIFF" || buffer.toString("ascii", 8, 12) !== "WAVE") {
|
|
@@ -15042,17 +15002,34 @@ var getPCM16 = (samples, sampleRate) => {
|
|
|
15042
15002
|
|
|
15043
15003
|
// src/@modules/@eas/eas.getTTS.ts
|
|
15044
15004
|
import { platform } from "os";
|
|
15005
|
+
import { writeFileSync } from "fs";
|
|
15045
15006
|
import { execSync } from "child_process";
|
|
15046
15007
|
var getTTS = (text2, outputPath) => __async(null, null, function* () {
|
|
15047
15008
|
const vPlatform = platform();
|
|
15048
15009
|
switch (vPlatform) {
|
|
15049
15010
|
case "win32": {
|
|
15050
|
-
|
|
15051
|
-
|
|
15011
|
+
try {
|
|
15012
|
+
const txtPath = outputPath + ".txt";
|
|
15013
|
+
writeFileSync(txtPath, text2, "utf8");
|
|
15014
|
+
const command = [
|
|
15015
|
+
"Add-Type -AssemblyName System.Speech;",
|
|
15016
|
+
`$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;`,
|
|
15017
|
+
`$text = Get-Content -Raw -LiteralPath '${txtPath}';`,
|
|
15018
|
+
`$speak.SetOutputToWaveFile('${outputPath}');`,
|
|
15019
|
+
`$speak.Speak($text);`,
|
|
15020
|
+
`$speak.Dispose();`
|
|
15021
|
+
].join(" ");
|
|
15022
|
+
execSync(`powershell -Command "${command}"`, { stdio: "inherit" });
|
|
15023
|
+
} catch (error) {
|
|
15024
|
+
console.error("Error occurred while generating TTS:", error);
|
|
15025
|
+
}
|
|
15052
15026
|
break;
|
|
15053
15027
|
}
|
|
15054
15028
|
case "linux":
|
|
15055
|
-
|
|
15029
|
+
try {
|
|
15030
|
+
execSync(`espeak -w "${outputPath}" "${text2.replace(/"/g, '\\"')}"`);
|
|
15031
|
+
} catch (e) {
|
|
15032
|
+
}
|
|
15056
15033
|
break;
|
|
15057
15034
|
default:
|
|
15058
15035
|
break;
|
|
@@ -15128,20 +15105,22 @@ var getCleanDescription = (message) => {
|
|
|
15128
15105
|
for (const { regex, replacement } of patches) {
|
|
15129
15106
|
message = message.replace(regex, replacement);
|
|
15130
15107
|
}
|
|
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();
|
|
15108
|
+
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
15109
|
};
|
|
15133
15110
|
|
|
15134
15111
|
// src/@modules/@eas/eas.setEasTone.ts
|
|
15135
15112
|
import { join } from "path";
|
|
15136
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "fs";
|
|
15113
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync as writeFileSync2, unlinkSync } from "fs";
|
|
15137
15114
|
import { execSync as execSync2 } from "child_process";
|
|
15138
15115
|
import { platform as platform2 } from "os";
|
|
15139
15116
|
var setEasTone = (options) => __async(null, null, function* () {
|
|
15117
|
+
var _a;
|
|
15140
15118
|
const settings = bootstrap.settings;
|
|
15141
|
-
const directory = settings.GlobalSettings.
|
|
15142
|
-
const prefix = settings.GlobalSettings.
|
|
15119
|
+
const directory = settings.GlobalSettings.ArchiveSettings.EasDirectory;
|
|
15120
|
+
const prefix = settings.GlobalSettings.ArchiveSettings.EasToneout;
|
|
15143
15121
|
let message = options.message;
|
|
15144
15122
|
let header = options.header;
|
|
15123
|
+
let title = (_a = options.title) != null ? _a : `${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
15145
15124
|
if (!message || !header) {
|
|
15146
15125
|
setWarning({
|
|
15147
15126
|
title: `EAS`,
|
|
@@ -15155,14 +15134,14 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15155
15134
|
if (!existsSync(directory)) {
|
|
15156
15135
|
mkdirSync(directory, { recursive: true });
|
|
15157
15136
|
}
|
|
15158
|
-
if (!existsSync(join(directory, `/
|
|
15159
|
-
mkdirSync(join(directory, `/
|
|
15137
|
+
if (!existsSync(join(directory, `/tts`))) {
|
|
15138
|
+
mkdirSync(join(directory, `/tts`), { recursive: true });
|
|
15160
15139
|
}
|
|
15161
|
-
if (!existsSync(join(directory, `/
|
|
15162
|
-
mkdirSync(join(directory, `/
|
|
15140
|
+
if (!existsSync(join(directory, `/encoded`))) {
|
|
15141
|
+
mkdirSync(join(directory, `/encoded`), { recursive: true });
|
|
15163
15142
|
}
|
|
15164
|
-
const tmpTTS = join(directory, `/
|
|
15165
|
-
const outTTS = join(directory, `/
|
|
15143
|
+
const tmpTTS = join(directory, `/tts/${title}.wav`);
|
|
15144
|
+
const outTTS = join(directory, `/encoded/${title}.wav`);
|
|
15166
15145
|
const vPlatform = platform2();
|
|
15167
15146
|
if (vPlatform === "darwin") {
|
|
15168
15147
|
setWarning({
|
|
@@ -15174,10 +15153,13 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15174
15153
|
yield new Promise((resolve6, reject) => {
|
|
15175
15154
|
const tMsg = getCleanDescription(message);
|
|
15176
15155
|
getTTS(tMsg, tmpTTS).then(() => {
|
|
15177
|
-
buffTTS = readFileSync(tmpTTS);
|
|
15178
15156
|
resolve6();
|
|
15179
15157
|
});
|
|
15180
15158
|
});
|
|
15159
|
+
if (!existsSync(tmpTTS)) {
|
|
15160
|
+
return null;
|
|
15161
|
+
}
|
|
15162
|
+
buffTTS = readFileSync(tmpTTS);
|
|
15181
15163
|
const vWav = getWavPCM16(buffTTS);
|
|
15182
15164
|
const vSamples = getSampledPCM16(vWav.samples, vWav.sampleRate, 8e3);
|
|
15183
15165
|
const vRadio = setRadioEffect(vSamples, 8e3);
|
|
@@ -15186,7 +15168,7 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15186
15168
|
let tWav = getWavPCM16(tBuffer);
|
|
15187
15169
|
if (tWav == null) {
|
|
15188
15170
|
try {
|
|
15189
|
-
const converted = join(directory, `/
|
|
15171
|
+
const converted = join(directory, `/tts/${title}.converted.wav`);
|
|
15190
15172
|
execSync2(`ffmpeg -y -i "${prefix}" -ar 8000 -ac 1 -sample_fmt s16 "${converted}"`, { stdio: "ignore" });
|
|
15191
15173
|
if (existsSync(converted)) {
|
|
15192
15174
|
tBuffer = readFileSync(converted);
|
|
@@ -15224,7 +15206,7 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15224
15206
|
const aSamples = getMergedPCM16(buffFull);
|
|
15225
15207
|
const aFinal = setNoise(aSamples, 2e-3);
|
|
15226
15208
|
const aBuffer = getPCM16(Array.from(aFinal).map((v) => ({ value: v })), 8e3);
|
|
15227
|
-
|
|
15209
|
+
writeFileSync2(outTTS, aBuffer);
|
|
15228
15210
|
try {
|
|
15229
15211
|
unlinkSync(tmpTTS);
|
|
15230
15212
|
} catch (e) {
|
|
@@ -15232,130 +15214,233 @@ var setEasTone = (options) => __async(null, null, function* () {
|
|
|
15232
15214
|
return outTTS;
|
|
15233
15215
|
});
|
|
15234
15216
|
|
|
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;
|
|
15217
|
+
// src/@parsers/@text/text.getEmbed.ts
|
|
15218
|
+
var getEmebed = (event) => {
|
|
15219
|
+
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;
|
|
15242
15220
|
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
|
-
line(``, event.description ? "```\n" + event.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n") + "\n```" : null, !isExpired)
|
|
15277
|
-
].filter(Boolean).join("\n");
|
|
15278
|
-
if (body.length > 1900) {
|
|
15279
|
-
body = body.substring(0, 1900) + "\n\n[Message truncated due to length]";
|
|
15280
|
-
const blocks = ((_i = body.match(/```/g)) != null ? _i : []).length;
|
|
15281
|
-
if (blocks % 2 !== 0) body += "```";
|
|
15282
|
-
}
|
|
15283
|
-
if (event.description.length < 25) {
|
|
15284
|
-
return;
|
|
15285
|
-
}
|
|
15286
|
-
const form = new import_form_data.default();
|
|
15287
|
-
const img = (_j = event.metadata.attachments) == null ? void 0 : _j[0];
|
|
15288
|
-
const embed = {
|
|
15289
|
-
title: `${event.event} (${event.status})`,
|
|
15290
|
-
description: body,
|
|
15291
|
-
color: 16711680,
|
|
15292
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15293
|
-
image: {},
|
|
15294
|
-
footer: { text: settings.title }
|
|
15295
|
-
};
|
|
15296
|
-
if (img) {
|
|
15297
|
-
for (let i = 0; i < 5; i++) {
|
|
15298
|
-
const ok = yield isImageReady(img);
|
|
15299
|
-
if (ok) break;
|
|
15300
|
-
yield new Promise((r) => setTimeout(r, 5e3));
|
|
15301
|
-
}
|
|
15302
|
-
const finalCheck = yield isImageReady(img);
|
|
15303
|
-
if (finalCheck) {
|
|
15304
|
-
embed.image = { url: img };
|
|
15305
|
-
}
|
|
15306
|
-
}
|
|
15307
|
-
form.append("payload_json", JSON.stringify({
|
|
15308
|
-
username: (_k = settings.title) != null ? _k : "AtmosphericX",
|
|
15309
|
-
content: (_l = settings.message) != null ? _l : "",
|
|
15310
|
-
embeds: [embed]
|
|
15311
|
-
}));
|
|
15312
|
-
if (settings.upload) {
|
|
15313
|
-
form.append("fUpload", Buffer.from(`${event.metadata.raw}
|
|
15221
|
+
const isStatement = event.properties.status_metadata.is_statement;
|
|
15222
|
+
const isExpired = event.properties.status_metadata.is_expired;
|
|
15223
|
+
return [
|
|
15224
|
+
line(`**Locations:**`, (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.locations) == null ? void 0 : _b.slice(0, 100)),
|
|
15225
|
+
line(`**Issued:**`, `<t:${Math.floor(new Date(event.properties.issued).getTime() / 1e3)}:R>`, !isExpired),
|
|
15226
|
+
line(`**Expires:**`, `<t:${Math.floor(new Date(event.properties.expires).getTime() / 1e3)}:R>`, !isStatement),
|
|
15227
|
+
line(`**Damage Threat:**`, (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat, !isExpired),
|
|
15228
|
+
line(`**Flood Threat:**`, (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.flood_threat, !isExpired),
|
|
15229
|
+
line(`**Tornado Threat:**`, (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.parameters) == null ? void 0 : _h.tornado_threat, !isExpired),
|
|
15230
|
+
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),
|
|
15231
|
+
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),
|
|
15232
|
+
line(`**Discussion:**`, (_z = (_y = event == null ? void 0 : event.properties) == null ? void 0 : _y.discussion_parameters) == null ? void 0 : _z.discussion_number, !isExpired),
|
|
15233
|
+
line(`**Concern:**`, (_B = (_A = event == null ? void 0 : event.properties) == null ? void 0 : _A.discussion_parameters) == null ? void 0 : _B.discussion_concerning, !isExpired),
|
|
15234
|
+
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),
|
|
15235
|
+
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),
|
|
15236
|
+
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),
|
|
15237
|
+
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),
|
|
15238
|
+
line(`**Watch Number:**`, (_N = (_M = event == null ? void 0 : event.properties) == null ? void 0 : _M.watch_parameters) == null ? void 0 : _N.watch_number, !isExpired),
|
|
15239
|
+
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),
|
|
15240
|
+
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),
|
|
15241
|
+
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),
|
|
15242
|
+
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),
|
|
15243
|
+
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),
|
|
15244
|
+
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),
|
|
15245
|
+
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),
|
|
15246
|
+
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),
|
|
15247
|
+
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),
|
|
15248
|
+
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),
|
|
15249
|
+
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),
|
|
15250
|
+
line(`**Tracking:**`, (_Ia = (_Ha = event == null ? void 0 : event.properties) == null ? void 0 : _Ha.metadata) == null ? void 0 : _Ia.tracking),
|
|
15251
|
+
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)
|
|
15252
|
+
].filter(Boolean).join("\n");
|
|
15253
|
+
};
|
|
15314
15254
|
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15321
|
-
|
|
15322
|
-
|
|
15323
|
-
|
|
15324
|
-
|
|
15255
|
+
// src/@modules/@utilities/utilities.createHttp.ts
|
|
15256
|
+
import request from "request";
|
|
15257
|
+
var createHttp = (options) => __async(null, null, function* () {
|
|
15258
|
+
return new Promise((resolve6, reject) => {
|
|
15259
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15260
|
+
try {
|
|
15261
|
+
const requestOptions = {
|
|
15262
|
+
url: (_a = options.url) != null ? _a : `https://api.weather.gov/alerts/active`,
|
|
15263
|
+
headers: (_b = options.headers) != null ? _b : {
|
|
15264
|
+
"User-Agent": "AtmosphericX",
|
|
15265
|
+
"Accept": "application/geo+json, text/plain, */*; q=0.9",
|
|
15266
|
+
"Accept-Language": "en-US,en;q=0.9"
|
|
15267
|
+
},
|
|
15268
|
+
method: (_c = options.method) != null ? _c : `GET`,
|
|
15269
|
+
timeout: (_d = options.timeout) != null ? _d : 1e4,
|
|
15270
|
+
proxy: (_e = options.proxy) != null ? _e : null,
|
|
15271
|
+
maxRedirects: 1
|
|
15272
|
+
};
|
|
15273
|
+
if (options.formData) {
|
|
15274
|
+
requestOptions["formData"] = options.formData;
|
|
15275
|
+
} else if (options.body) {
|
|
15276
|
+
requestOptions["body"] = options.body;
|
|
15325
15277
|
}
|
|
15278
|
+
request(requestOptions, (error, response2, body) => {
|
|
15279
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
15280
|
+
if (error) {
|
|
15281
|
+
return resolve6({
|
|
15282
|
+
error: true,
|
|
15283
|
+
options: requestOptions,
|
|
15284
|
+
status: -1,
|
|
15285
|
+
message: (_a2 = error.message) != null ? _a2 : `Unknown Error`
|
|
15286
|
+
});
|
|
15287
|
+
}
|
|
15288
|
+
if (response2.statusCode < 200 || response2.statusCode >= 300) {
|
|
15289
|
+
return resolve6({
|
|
15290
|
+
error: true,
|
|
15291
|
+
options: requestOptions,
|
|
15292
|
+
status: (_b2 = response2.statusCode) != null ? _b2 : -1,
|
|
15293
|
+
message: `HTTP Status Code ${(_c2 = response2.statusCode) != null ? _c2 : `Unknown Status Code`} (${body})`
|
|
15294
|
+
});
|
|
15295
|
+
}
|
|
15296
|
+
if (body == void 0 || body == null) {
|
|
15297
|
+
return resolve6({
|
|
15298
|
+
error: true,
|
|
15299
|
+
options: requestOptions,
|
|
15300
|
+
status: (_d2 = response2.statusCode) != null ? _d2 : -1,
|
|
15301
|
+
message: `Empty Response Body`
|
|
15302
|
+
});
|
|
15303
|
+
}
|
|
15304
|
+
resolve6({
|
|
15305
|
+
error: false,
|
|
15306
|
+
options: requestOptions,
|
|
15307
|
+
status: (_e2 = response2.statusCode) != null ? _e2 : -1,
|
|
15308
|
+
message: body
|
|
15309
|
+
});
|
|
15310
|
+
});
|
|
15311
|
+
} catch (error) {
|
|
15312
|
+
return resolve6({
|
|
15313
|
+
error: true,
|
|
15314
|
+
options: {},
|
|
15315
|
+
status: -1,
|
|
15316
|
+
message: (_f = error.message) != null ? _f : `Unknown Error`
|
|
15317
|
+
});
|
|
15326
15318
|
}
|
|
15327
|
-
|
|
15328
|
-
url: settings.webhook,
|
|
15329
|
-
timeout: 2e3,
|
|
15330
|
-
method: `POST`,
|
|
15331
|
-
headers: form.getHeaders(),
|
|
15332
|
-
body: form
|
|
15333
|
-
});
|
|
15334
|
-
}
|
|
15319
|
+
});
|
|
15335
15320
|
});
|
|
15336
15321
|
|
|
15337
|
-
// src/@manager/manager.
|
|
15338
|
-
var
|
|
15322
|
+
// src/@manager/manager.updateListener.ts
|
|
15323
|
+
var import_form_data = __toESM(require_form_data());
|
|
15324
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3, readFileSync as readFileSync2, appendFileSync } from "fs";
|
|
15325
|
+
var updateListener = (event) => __async(null, null, function* () {
|
|
15326
|
+
var _a, _b, _c, _d;
|
|
15339
15327
|
const settings = bootstrap.settings;
|
|
15340
|
-
const
|
|
15341
|
-
const
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15328
|
+
const listeners2 = settings.ListenerSettings;
|
|
15329
|
+
const properties2 = event.properties;
|
|
15330
|
+
const metadata = {
|
|
15331
|
+
file: null,
|
|
15332
|
+
eas: null,
|
|
15333
|
+
name: properties2.event,
|
|
15334
|
+
status: properties2.status,
|
|
15335
|
+
description: properties2.description,
|
|
15336
|
+
tracking: properties2.metadata.tracking,
|
|
15337
|
+
header: properties2.metadata.header,
|
|
15338
|
+
raw: properties2.metadata.raw,
|
|
15339
|
+
expired: properties2.status_metadata.is_expired,
|
|
15340
|
+
attachments: properties2.metadata.attachments
|
|
15341
|
+
};
|
|
15342
|
+
for (const listener2 of listeners2) {
|
|
15343
|
+
const events = listener2 == null ? void 0 : listener2.events;
|
|
15344
|
+
const webhook = listener2 == null ? void 0 : listener2.webhook;
|
|
15345
|
+
const uploads = listener2 == null ? void 0 : listener2.uploads;
|
|
15346
|
+
const isMatched = events.some((pattern) => {
|
|
15349
15347
|
if (!pattern) return false;
|
|
15350
|
-
if (pattern === "*" || pattern ===
|
|
15348
|
+
if (pattern === "*" || pattern === metadata.name) return true;
|
|
15351
15349
|
if (pattern.includes("*")) {
|
|
15352
15350
|
const regex = "^" + pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") + "$";
|
|
15353
|
-
return new RegExp(regex).test(
|
|
15351
|
+
return new RegExp(regex).test(metadata.name);
|
|
15354
15352
|
}
|
|
15355
15353
|
return false;
|
|
15356
15354
|
});
|
|
15357
|
-
if (
|
|
15358
|
-
|
|
15355
|
+
if ((events == null ? void 0 : events.length) == 0 || isMatched) {
|
|
15356
|
+
if (uploads == null ? void 0 : uploads.eas) {
|
|
15357
|
+
metadata.eas = yield setEasTone({
|
|
15358
|
+
title: `${metadata.name}_${metadata.status}_${metadata.tracking}`,
|
|
15359
|
+
message: metadata.description,
|
|
15360
|
+
header: metadata.header
|
|
15361
|
+
});
|
|
15362
|
+
}
|
|
15363
|
+
if (uploads == null ? void 0 : uploads.file) {
|
|
15364
|
+
const fDestination = settings.GlobalSettings.ArchiveSettings.TextDirectory;
|
|
15365
|
+
if (fDestination) {
|
|
15366
|
+
if (!existsSync2(fDestination)) {
|
|
15367
|
+
mkdirSync2(fDestination, { recursive: true });
|
|
15368
|
+
}
|
|
15369
|
+
if (existsSync2(`${fDestination}/${metadata.name}_${metadata.status}_${metadata.tracking}.txt`)) {
|
|
15370
|
+
appendFileSync(`${fDestination}/${metadata.name}_${metadata.status}_${metadata.tracking}.txt`, metadata.raw);
|
|
15371
|
+
} else {
|
|
15372
|
+
writeFileSync3(`${fDestination}/${metadata.name}_${metadata.status}_${metadata.tracking}.txt`, metadata.raw);
|
|
15373
|
+
}
|
|
15374
|
+
}
|
|
15375
|
+
metadata.file = metadata.raw;
|
|
15376
|
+
}
|
|
15377
|
+
if (uploads == null ? void 0 : uploads.event) {
|
|
15378
|
+
const eDestination = settings.GlobalSettings.ArchiveSettings.EventDirectory;
|
|
15379
|
+
if (eDestination) {
|
|
15380
|
+
if (!existsSync2(eDestination)) {
|
|
15381
|
+
mkdirSync2(eDestination, { recursive: true });
|
|
15382
|
+
}
|
|
15383
|
+
writeFileSync3(`${eDestination}/${metadata.name}_${metadata.status}_${metadata.tracking}.json`, JSON.stringify(getCleanedEvent(event), null, 2));
|
|
15384
|
+
}
|
|
15385
|
+
}
|
|
15386
|
+
if (webhook.enabled && webhook.destination) {
|
|
15387
|
+
const ratelimit = setTimeoutAction({ identifier: webhook.destination, interval: webhook.ratelimit, max: webhook.ratelimit, addTime: true });
|
|
15388
|
+
const form = new import_form_data.default();
|
|
15389
|
+
const embed = {
|
|
15390
|
+
title: `${metadata.name} (${metadata.status})`,
|
|
15391
|
+
description: getEmebed(event),
|
|
15392
|
+
fields: [],
|
|
15393
|
+
color: 16711680,
|
|
15394
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
15395
|
+
footer: { text: (_a = webhook.title) != null ? _a : `AtmosphericX` }
|
|
15396
|
+
};
|
|
15397
|
+
if (ratelimit.limited) {
|
|
15398
|
+
return;
|
|
15399
|
+
}
|
|
15400
|
+
if (metadata.description && !metadata.expired) {
|
|
15401
|
+
if (metadata.description.length > 900) {
|
|
15402
|
+
metadata.description = metadata.description.substring(0, 900) + "\n\n[Message truncated due to length]";
|
|
15403
|
+
}
|
|
15404
|
+
embed.fields.push({
|
|
15405
|
+
name: "Description",
|
|
15406
|
+
value: metadata.description ? "```\n" + metadata.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n") + "\n```" : ""
|
|
15407
|
+
});
|
|
15408
|
+
}
|
|
15409
|
+
if (((_b = metadata.attachments) == null ? void 0 : _b.length) > 0) {
|
|
15410
|
+
metadata.attachments = metadata.attachments.slice(0, 5);
|
|
15411
|
+
embed.fields.push({
|
|
15412
|
+
name: "Attachments",
|
|
15413
|
+
value: metadata.attachments.map((attachment) => `- [${attachment.name.length > 45 ? attachment.name.substring(0, 45) + "..." : attachment.name}](${attachment.link})`).join("\n")
|
|
15414
|
+
});
|
|
15415
|
+
}
|
|
15416
|
+
if (uploads == null ? void 0 : uploads.file) {
|
|
15417
|
+
form.append("fUpload", Buffer.from(metadata.file), {
|
|
15418
|
+
filename: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}.txt`,
|
|
15419
|
+
contentType: "application/text"
|
|
15420
|
+
});
|
|
15421
|
+
}
|
|
15422
|
+
if (uploads == null ? void 0 : uploads.eas) {
|
|
15423
|
+
if (metadata.eas) {
|
|
15424
|
+
const file = readFileSync2(metadata.eas);
|
|
15425
|
+
form.append("fEas", Buffer.from(file), {
|
|
15426
|
+
filename: `${properties2.event}_${properties2.status}_${properties2.metadata.tracking}_eas.mp3`,
|
|
15427
|
+
contentType: "audio/mpeg"
|
|
15428
|
+
});
|
|
15429
|
+
}
|
|
15430
|
+
}
|
|
15431
|
+
form.append("payload_json", JSON.stringify({
|
|
15432
|
+
username: (_c = webhook.title) != null ? _c : "AtmosphericX",
|
|
15433
|
+
content: (_d = webhook.message) != null ? _d : "",
|
|
15434
|
+
embeds: [embed]
|
|
15435
|
+
}));
|
|
15436
|
+
yield createHttp({
|
|
15437
|
+
url: webhook.destination,
|
|
15438
|
+
timeout: 5e3,
|
|
15439
|
+
method: `POST`,
|
|
15440
|
+
headers: form.getHeaders(),
|
|
15441
|
+
body: form
|
|
15442
|
+
});
|
|
15443
|
+
}
|
|
15359
15444
|
}
|
|
15360
15445
|
}
|
|
15361
15446
|
});
|
|
@@ -15574,10 +15659,10 @@ var mkEvent = (event) => __async(null, null, function* () {
|
|
|
15574
15659
|
})
|
|
15575
15660
|
})
|
|
15576
15661
|
});
|
|
15577
|
-
|
|
15662
|
+
updateListener(bootstrap.cache.events.features[getIndex]);
|
|
15578
15663
|
} else {
|
|
15579
15664
|
features.push(event);
|
|
15580
|
-
|
|
15665
|
+
updateListener(event);
|
|
15581
15666
|
}
|
|
15582
15667
|
}
|
|
15583
15668
|
}
|
|
@@ -15592,6 +15677,7 @@ var rmEvent = (event) => {
|
|
|
15592
15677
|
const cachedStatus = event.properties.status;
|
|
15593
15678
|
event.properties.expires = (/* @__PURE__ */ new Date()).toISOString();
|
|
15594
15679
|
event.properties.status = `Expired`;
|
|
15680
|
+
event.properties.status_metadata.is_expired = true;
|
|
15595
15681
|
if (getEvent) {
|
|
15596
15682
|
setEventEmit({
|
|
15597
15683
|
event: `onEventStatus`,
|
|
@@ -15602,7 +15688,7 @@ var rmEvent = (event) => {
|
|
|
15602
15688
|
message: `[Removed] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
15603
15689
|
});
|
|
15604
15690
|
setEventEmit({ event: `onExpiredProduct`, metadata: event });
|
|
15605
|
-
if (cachedStatus != `Statement`)
|
|
15691
|
+
if (cachedStatus != `Statement`) updateListener(event);
|
|
15606
15692
|
bootstrap.cache.events.features.splice(bootstrap.cache.events.features.indexOf(getEvent), 1);
|
|
15607
15693
|
bootstrap.cache.hashes = bootstrap.cache.hashes.filter((hash) => hash.tracking !== event.properties.metadata.tracking);
|
|
15608
15694
|
}
|
|
@@ -15627,21 +15713,105 @@ var getLatestIssuance = () => {
|
|
|
15627
15713
|
return latest.toString().padStart(4, "0");
|
|
15628
15714
|
};
|
|
15629
15715
|
|
|
15630
|
-
// src/@
|
|
15716
|
+
// src/@dictionaries/dictionaries.states.ts
|
|
15717
|
+
var dict_states = {
|
|
15718
|
+
"AL": "Alabama",
|
|
15719
|
+
"AK": "Alaska",
|
|
15720
|
+
"AZ": "Arizona",
|
|
15721
|
+
"AR": "Arkansas",
|
|
15722
|
+
"CA": "California",
|
|
15723
|
+
"CO": "Colorado",
|
|
15724
|
+
"CT": "Connecticut",
|
|
15725
|
+
"DE": "Delaware",
|
|
15726
|
+
"FL": "Florida",
|
|
15727
|
+
"GA": "Georgia",
|
|
15728
|
+
"HI": "Hawaii",
|
|
15729
|
+
"ID": "Idaho",
|
|
15730
|
+
"IL": "Illinois",
|
|
15731
|
+
"IN": "Indiana",
|
|
15732
|
+
"IA": "Iowa",
|
|
15733
|
+
"KS": "Kansas",
|
|
15734
|
+
"KY": "Kentucky",
|
|
15735
|
+
"LA": "Louisiana",
|
|
15736
|
+
"ME": "Maine",
|
|
15737
|
+
"MD": "Maryland",
|
|
15738
|
+
"MA": "Massachusetts",
|
|
15739
|
+
"MI": "Michigan",
|
|
15740
|
+
"MN": "Minnesota",
|
|
15741
|
+
"MS": "Mississippi",
|
|
15742
|
+
"MO": "Missouri",
|
|
15743
|
+
"MT": "Montana",
|
|
15744
|
+
"NE": "Nebraska",
|
|
15745
|
+
"NV": "Nevada",
|
|
15746
|
+
"NH": "New Hampshire",
|
|
15747
|
+
"NJ": "New Jersey",
|
|
15748
|
+
"NM": "New Mexico",
|
|
15749
|
+
"NY": "New York",
|
|
15750
|
+
"NC": "North Carolina",
|
|
15751
|
+
"ND": "North Dakota",
|
|
15752
|
+
"OH": "Ohio",
|
|
15753
|
+
"OK": "Oklahoma",
|
|
15754
|
+
"OR": "Oregon",
|
|
15755
|
+
"PA": "Pennsylvania",
|
|
15756
|
+
"RI": "Rhode Island",
|
|
15757
|
+
"SC": "South Carolina",
|
|
15758
|
+
"SD": "South Dakota",
|
|
15759
|
+
"TN": "Tennessee",
|
|
15760
|
+
"TX": "Texas",
|
|
15761
|
+
"UT": "Utah",
|
|
15762
|
+
"VT": "Vermont",
|
|
15763
|
+
"VA": "Virginia",
|
|
15764
|
+
"WA": "Washington",
|
|
15765
|
+
"WV": "West Virginia",
|
|
15766
|
+
"WI": "Wisconsin",
|
|
15767
|
+
"WY": "Wyoming",
|
|
15768
|
+
"DC": "District of Columbia"
|
|
15769
|
+
};
|
|
15770
|
+
|
|
15771
|
+
// src/@building/building.attachments.ts
|
|
15631
15772
|
var getEventAttachments = (event) => {
|
|
15632
|
-
var _a, _b;
|
|
15773
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
15774
|
+
let attachments = [];
|
|
15633
15775
|
const latestTime = getLatestIssuance();
|
|
15634
|
-
const
|
|
15776
|
+
const spcNumber = (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.discussion_parameters) == null ? void 0 : _b.discussion_number;
|
|
15777
|
+
const watchNumber = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.watch_parameters) == null ? void 0 : _d.watch_number;
|
|
15778
|
+
const locations = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.locations_array;
|
|
15779
|
+
const events = [
|
|
15635
15780
|
{ target: "Day 1", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${latestTime}.png` },
|
|
15636
15781
|
{ target: "Day 2", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
|
|
15637
15782
|
{ 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${
|
|
15783
|
+
{ target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
|
|
15784
|
+
{ target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
15785
|
+
{ target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
15786
|
+
{ target: "Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
|
|
15787
|
+
{ target: "PDS Severe Thunderstorm Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` }
|
|
15639
15788
|
];
|
|
15640
|
-
|
|
15641
|
-
|
|
15642
|
-
|
|
15789
|
+
if (events.find((e) => e.target === event.properties.event)) {
|
|
15790
|
+
attachments.push({ name: `Image: Graphic`, link: events.find((e) => e.target === event.properties.event).attachment });
|
|
15791
|
+
}
|
|
15792
|
+
for (const location of locations) {
|
|
15793
|
+
if (dict_expressions.location.test(location)) {
|
|
15794
|
+
const lines = [`Northern`, `Southern`, `Eastern`, `Western`, `Inland`, `Costal`, `County`];
|
|
15795
|
+
const county = (_f = location == null ? void 0 : location.split(",")[0]) == null ? void 0 : _f.trim().replace(new RegExp(`^(${lines.join("|")}) `), "");
|
|
15796
|
+
const state = dict_states[(_g = location == null ? void 0 : location.split(",")[1]) == null ? void 0 : _g.trim()];
|
|
15797
|
+
const feeds = bootstrap.database.prepare(`SELECT * FROM broadcastify WHERE state = ? AND county = ?`).all(state, county).sort((a, b) => {
|
|
15798
|
+
const typeOrder = ["Other", "Public Safety"];
|
|
15799
|
+
const indexA = typeOrder.indexOf(a.type);
|
|
15800
|
+
const indexB = typeOrder.indexOf(b.type);
|
|
15801
|
+
return indexA - indexB;
|
|
15802
|
+
});
|
|
15803
|
+
const tags = bootstrap.settings.BroadcastifySettings.BroadcastifyTags;
|
|
15804
|
+
const filtered = feeds.filter((feed) => tags.includes(feed.type));
|
|
15805
|
+
if (filtered.length > 0) {
|
|
15806
|
+
filtered.map((filtered2) => {
|
|
15807
|
+
if (!attachments.some((a) => a.link === filtered2.link)) {
|
|
15808
|
+
attachments.push({ name: `${filtered2.type}: ${filtered2.feed}`, link: filtered2.link });
|
|
15809
|
+
}
|
|
15810
|
+
});
|
|
15811
|
+
}
|
|
15812
|
+
}
|
|
15643
15813
|
}
|
|
15644
|
-
return
|
|
15814
|
+
return attachments;
|
|
15645
15815
|
};
|
|
15646
15816
|
|
|
15647
15817
|
// src/@building/building.validate.ts
|
|
@@ -15685,7 +15855,7 @@ var validateEvents = (events) => __async(null, null, function* () {
|
|
|
15685
15855
|
rmEvent(define2);
|
|
15686
15856
|
return false;
|
|
15687
15857
|
}
|
|
15688
|
-
if ((_c = (_b = properties2.metadata) == null ? void 0 : _b.vtec) == null ? void 0 : _c.is_watch) {
|
|
15858
|
+
if (((_c = (_b = properties2.metadata) == null ? void 0 : _b.vtec) == null ? void 0 : _c.is_watch) && properties2.metadata.source != `events.api`) {
|
|
15689
15859
|
const isSPC = (_e = (_d = properties2.metadata) == null ? void 0 : _d.vtec) == null ? void 0 : _e.prediction_center;
|
|
15690
15860
|
setEventEmit({ event: isSPC ? `onStormPredictionWatch` : `onNonStormPredictionWatch`, metadata: define2 });
|
|
15691
15861
|
if ((bools == null ? void 0 : bools.SPCWatchesOnly) && !isSPC) {
|
|
@@ -15773,7 +15943,7 @@ var text = (stanza) => __async(null, null, function* () {
|
|
|
15773
15943
|
const header = getEventHeader({ properties: props, getType: stanza.getType });
|
|
15774
15944
|
const issued = new Date(attributes.issue);
|
|
15775
15945
|
const expires = new Date(issued.getTime() + 12 * 60 * 60 * 1e3);
|
|
15776
|
-
let event = Object.keys(
|
|
15946
|
+
let event = Object.keys(dict_matches).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
|
|
15777
15947
|
let isStatement = false;
|
|
15778
15948
|
if (!event) {
|
|
15779
15949
|
event = stanza.getType.type.split(`-`).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `);
|
|
@@ -15816,9 +15986,9 @@ var text = (stanza) => __async(null, null, function* () {
|
|
|
15816
15986
|
|
|
15817
15987
|
// src/@parsers/@ugc/ugc.header.ts
|
|
15818
15988
|
var getUGCHeader = (message) => {
|
|
15819
|
-
const start = message.search(
|
|
15989
|
+
const start = message.search(dict_expressions.ugc1);
|
|
15820
15990
|
const sub = message.substring(start);
|
|
15821
|
-
const end = sub.search(
|
|
15991
|
+
const end = sub.search(dict_expressions.ugc2);
|
|
15822
15992
|
const fin = sub.substring(0, end).replace(/\s+/g, "").slice(0, -1);
|
|
15823
15993
|
return fin != null ? fin : null;
|
|
15824
15994
|
};
|
|
@@ -15910,7 +16080,7 @@ var ugc = (stanza) => __async(null, null, function* () {
|
|
|
15910
16080
|
const issued = new Date(attributes.issue);
|
|
15911
16081
|
const expires = new Date(ugc2.expires);
|
|
15912
16082
|
const header = getEventHeader({ properties: props, getType: stanza.getType });
|
|
15913
|
-
let event = Object.keys(
|
|
16083
|
+
let event = Object.keys(dict_matches).find((event2) => message.toLowerCase().includes(event2.toLowerCase()));
|
|
15914
16084
|
let isStatement = false;
|
|
15915
16085
|
if (!event) {
|
|
15916
16086
|
event = stanza.getType.type.split(`-`).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(` `);
|
|
@@ -15952,8 +16122,8 @@ var ugc = (stanza) => __async(null, null, function* () {
|
|
|
15952
16122
|
validateEvents(processed);
|
|
15953
16123
|
});
|
|
15954
16124
|
|
|
15955
|
-
// src/@dictionaries/dictionaries.
|
|
15956
|
-
var
|
|
16125
|
+
// src/@dictionaries/dictionaries.events.ts
|
|
16126
|
+
var dict_events = {
|
|
15957
16127
|
"AF": "Ashfall",
|
|
15958
16128
|
"AS": "Air Stagnation",
|
|
15959
16129
|
"BH": "Beach Hazard",
|
|
@@ -16017,8 +16187,8 @@ var eventTypes = {
|
|
|
16017
16187
|
"ZY": "Freezing Spray"
|
|
16018
16188
|
};
|
|
16019
16189
|
|
|
16020
|
-
// src/@dictionaries/dictionaries.
|
|
16021
|
-
var
|
|
16190
|
+
// src/@dictionaries/dictionaries.actions.ts
|
|
16191
|
+
var dict_actions = {
|
|
16022
16192
|
"W": "Warning",
|
|
16023
16193
|
"F": "Forecast",
|
|
16024
16194
|
"A": "Watch",
|
|
@@ -16028,8 +16198,8 @@ var eventActions = {
|
|
|
16028
16198
|
"S": "Statement"
|
|
16029
16199
|
};
|
|
16030
16200
|
|
|
16031
|
-
// src/@dictionaries/dictionaries.
|
|
16032
|
-
var
|
|
16201
|
+
// src/@dictionaries/dictionaries.status.ts
|
|
16202
|
+
var dict_status = {
|
|
16033
16203
|
"NEW": "Issued",
|
|
16034
16204
|
"CON": "Updated",
|
|
16035
16205
|
"EXT": "Extended",
|
|
@@ -16054,7 +16224,8 @@ var getExpiry2 = (dates) => {
|
|
|
16054
16224
|
// src/@parsers/@pvtec/pvtec.extract.ts
|
|
16055
16225
|
var pvExtract = (message) => {
|
|
16056
16226
|
var _a, _b, _c, _d;
|
|
16057
|
-
|
|
16227
|
+
if (!message) return null;
|
|
16228
|
+
const getVTECs = (_a = message.match(dict_expressions.pvtec)) != null ? _a : [];
|
|
16058
16229
|
const vtecs = [];
|
|
16059
16230
|
for (const vtec2 of getVTECs) {
|
|
16060
16231
|
const sub = vtec2.split(`.`);
|
|
@@ -16062,11 +16233,11 @@ var pvExtract = (message) => {
|
|
|
16062
16233
|
const dates = (_b = sub[6]) == null ? void 0 : _b.split(`-`);
|
|
16063
16234
|
vtecs.push({
|
|
16064
16235
|
vtec: vtec2,
|
|
16065
|
-
product:
|
|
16236
|
+
product: dict_products[sub[0]],
|
|
16066
16237
|
tracking: `${sub[2]}.${sub[3]}.${sub[4]}.${sub[5]}`,
|
|
16067
|
-
event: `${
|
|
16068
|
-
status:
|
|
16069
|
-
organization: (_d = (_c = message.match(
|
|
16238
|
+
event: `${dict_events[sub[3]]} ${dict_actions[sub[4]]}`,
|
|
16239
|
+
status: dict_status[sub[1]],
|
|
16240
|
+
organization: (_d = (_c = message.match(dict_expressions.wmo)) == null ? void 0 : _c[0]) != null ? _d : null,
|
|
16070
16241
|
expires: getExpiry2(dates),
|
|
16071
16242
|
is_watch: (sub[4] == `A` || sub[4] == `Y`) && (sub[3] == `TO` || sub[3] == `SV`),
|
|
16072
16243
|
prediction_center: sub[2] == `KWNS` ? true : false
|
|
@@ -16075,8 +16246,8 @@ var pvExtract = (message) => {
|
|
|
16075
16246
|
return vtecs.length > 0 ? vtecs : null;
|
|
16076
16247
|
};
|
|
16077
16248
|
|
|
16078
|
-
// src/@dictionaries/dictionaries.
|
|
16079
|
-
var
|
|
16249
|
+
// src/@dictionaries/dictionaries.causes.ts
|
|
16250
|
+
var dict_causes = {
|
|
16080
16251
|
"SM": "Snow Melt",
|
|
16081
16252
|
"RS": "Rain/Snow Melt",
|
|
16082
16253
|
"ER": "Excessive Rain",
|
|
@@ -16094,16 +16265,16 @@ var eventCauses = {
|
|
|
16094
16265
|
"OT": "Other Effects"
|
|
16095
16266
|
};
|
|
16096
16267
|
|
|
16097
|
-
// src/@dictionaries/dictionaries.
|
|
16098
|
-
var
|
|
16268
|
+
// src/@dictionaries/dictionaries.records.ts
|
|
16269
|
+
var dict_records = {
|
|
16099
16270
|
"NO": "No Record Expected",
|
|
16100
16271
|
"NR": "Near Record or possible record",
|
|
16101
16272
|
"UU": "Unknown history of records",
|
|
16102
16273
|
"OO": "Other"
|
|
16103
16274
|
};
|
|
16104
16275
|
|
|
16105
|
-
// src/@dictionaries/dictionaries.
|
|
16106
|
-
var
|
|
16276
|
+
// src/@dictionaries/dictionaries.severity.ts
|
|
16277
|
+
var dict_severity = {
|
|
16107
16278
|
N: "Not Expected",
|
|
16108
16279
|
0: "Areal Flood or FF Product",
|
|
16109
16280
|
1: "Minor",
|
|
@@ -16115,16 +16286,16 @@ var eventSeverity = {
|
|
|
16115
16286
|
// src/@parsers/@hvtec/hvtec.extract.ts
|
|
16116
16287
|
var hvExtract = (message) => {
|
|
16117
16288
|
var _a;
|
|
16118
|
-
const getHVTECs = (_a = message.match(
|
|
16289
|
+
const getHVTECs = (_a = message.match(dict_expressions.hvtec)) != null ? _a : [];
|
|
16119
16290
|
const vtecs = [];
|
|
16120
16291
|
for (const vtec2 of getHVTECs) {
|
|
16121
16292
|
const sub = vtec2.split(`.`);
|
|
16122
16293
|
if (sub.length < 7) continue;
|
|
16123
16294
|
vtecs.push({
|
|
16124
16295
|
hvtec: vtec2,
|
|
16125
|
-
severity:
|
|
16126
|
-
cause:
|
|
16127
|
-
record:
|
|
16296
|
+
severity: dict_severity[sub[1]],
|
|
16297
|
+
cause: dict_causes[sub[2]],
|
|
16298
|
+
record: dict_records[sub[6]]
|
|
16128
16299
|
});
|
|
16129
16300
|
}
|
|
16130
16301
|
return vtecs.length > 0 ? vtecs : null;
|
|
@@ -16188,12 +16359,12 @@ var vtec = (stanza) => __async(null, null, function* () {
|
|
|
16188
16359
|
|
|
16189
16360
|
// src/@events/events.api.ts
|
|
16190
16361
|
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;
|
|
16362
|
+
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, _tb, _ub;
|
|
16192
16363
|
let processed = [];
|
|
16193
16364
|
const messages = Object.values(JSON.parse(stanza.message).features);
|
|
16194
16365
|
for (const feature of messages) {
|
|
16195
16366
|
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;
|
|
16367
|
+
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
16368
|
processed.push({
|
|
16198
16369
|
type: `Feature`,
|
|
16199
16370
|
geometry: {
|
|
@@ -16207,67 +16378,68 @@ var api = (stanza) => __async(null, null, function* () {
|
|
|
16207
16378
|
issued: ((_k = feature == null ? void 0 : feature.properties) == null ? void 0 : _k.sent) ? new Date((_l = feature == null ? void 0 : feature.properties) == null ? void 0 : _l.sent).toISOString() : null,
|
|
16208
16379
|
expires: ((_m = feature == null ? void 0 : feature.properties) == null ? void 0 : _m.expires) ? new Date((_n = feature == null ? void 0 : feature.properties) == null ? void 0 : _n.expires).toISOString() : null,
|
|
16209
16380
|
locations: (_p = (_o = feature == null ? void 0 : feature.properties) == null ? void 0 : _o.areaDesc) != null ? _p : null,
|
|
16210
|
-
|
|
16211
|
-
|
|
16381
|
+
locations_array: ((_q = feature == null ? void 0 : feature.properties) == null ? void 0 : _q.areaDesc) ? (_r = feature == null ? void 0 : feature.properties) == null ? void 0 : _r.areaDesc.split(";") : [],
|
|
16382
|
+
description: (_t = (_s = feature == null ? void 0 : feature.properties) == null ? void 0 : _s.description) != null ? _t : null,
|
|
16383
|
+
attributes: (_v = (_u = feature == null ? void 0 : feature.properties) == null ? void 0 : _u.attributes) != null ? _v : {},
|
|
16212
16384
|
geocode: {
|
|
16213
16385
|
office: {
|
|
16214
|
-
office: pVtec ? pVtec.split(`.`)[
|
|
16215
|
-
name: (
|
|
16386
|
+
office: pVtec ? (_w = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _w.tracking.split(`.`)[0] : null,
|
|
16387
|
+
name: (_y = dict_icao[pVtec ? (_x = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _x.tracking.split(`.`)[0] : null]) != null ? _y : null
|
|
16216
16388
|
},
|
|
16217
|
-
organization: (
|
|
16218
|
-
ugc: (
|
|
16219
|
-
polygon: ((
|
|
16220
|
-
polygon_generated: ((
|
|
16389
|
+
organization: (_B = (_A = (_z = feature == null ? void 0 : feature.properties) == null ? void 0 : _z.parameters) == null ? void 0 : _A.WMOidentifier) == null ? void 0 : _B[0],
|
|
16390
|
+
ugc: (_E = (_D = (_C = feature == null ? void 0 : feature.properties) == null ? void 0 : _C.geocode) == null ? void 0 : _D.UGC) != null ? _E : [],
|
|
16391
|
+
polygon: ((_F = feature == null ? void 0 : feature.geometry) == null ? void 0 : _F.coordinates.length) > 0 ? Buffer.from(JSON.stringify([(_G = feature == null ? void 0 : feature.geometry) == null ? void 0 : _G.coordinates[0]])).toString("base64") : null,
|
|
16392
|
+
polygon_generated: ((_H = feature == null ? void 0 : feature.geometry) == null ? void 0 : _H.coordinates.length) > 0 ? true : false
|
|
16221
16393
|
},
|
|
16222
16394
|
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: (
|
|
16395
|
+
tags: getEventTags((_I = feature == null ? void 0 : feature.properties) == null ? void 0 : _I.description),
|
|
16396
|
+
instructions: (_K = (_J = feature == null ? void 0 : feature.properties) == null ? void 0 : _J.instruction) != null ? _K : null,
|
|
16397
|
+
source: (_M = getTextFromProduct({ message: (_L = feature == null ? void 0 : feature.properties) == null ? void 0 : _L.description, find: [`SOURCE...`], removal: [`.`] })) != null ? _M : null,
|
|
16398
|
+
hazards: (_O = getTextFromProduct({ message: (_N = feature == null ? void 0 : feature.properties) == null ? void 0 : _N.description, find: [`HAZARD...`], removal: [`.`] })) != null ? _O : null,
|
|
16399
|
+
impacts: (_Q = getTextFromProduct({ message: (_P = feature == null ? void 0 : feature.properties) == null ? void 0 : _P.description, find: [`IMPACT...`], removal: [`.`] })) != null ? _Q : null,
|
|
16400
|
+
estimated_hail_size: (_U = (_T = (_S = (_R = feature == null ? void 0 : feature.properties) == null ? void 0 : _R.parameters) == null ? void 0 : _S.maxHailSize) == null ? void 0 : _T[0]) != null ? _U : null,
|
|
16401
|
+
estimated_wind_gusts: (_Y = (_X = (_W = (_V = feature == null ? void 0 : feature.properties) == null ? void 0 : _V.parameters) == null ? void 0 : _W.maxWindGust) == null ? void 0 : _X[0]) != null ? _Y : null,
|
|
16402
|
+
damage_threat: (_aa = (_$ = (__ = (_Z = feature == null ? void 0 : feature.properties) == null ? void 0 : _Z.parameters) == null ? void 0 : __.thunderstormDamageThreat) == null ? void 0 : _$[0]) != null ? _aa : null,
|
|
16403
|
+
tornado_threat: (_ea = (_da = (_ca = (_ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _ba.parameters) == null ? void 0 : _ca.tornadoDetection) == null ? void 0 : _da[0]) != null ? _ea : null,
|
|
16404
|
+
flood_threat: (_ia = (_ha = (_ga = (_fa = feature == null ? void 0 : feature.properties) == null ? void 0 : _fa.parameters) == null ? void 0 : _ga.floodDetection) == null ? void 0 : _ha[0]) != null ? _ia : null,
|
|
16405
|
+
wind_threat: (_ma = (_la = (_ka = (_ja = feature == null ? void 0 : feature.properties) == null ? void 0 : _ja.parameters) == null ? void 0 : _ka.windThreat) == null ? void 0 : _la[0]) != null ? _ma : null,
|
|
16406
|
+
hail_threat: (_qa = (_pa = (_oa = (_na = feature == null ? void 0 : feature.properties) == null ? void 0 : _na.parameters) == null ? void 0 : _oa.hailThreat) == null ? void 0 : _pa[0]) != null ? _qa : null
|
|
16235
16407
|
},
|
|
16236
|
-
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16408
|
+
discussion_parameters: {
|
|
16409
|
+
discussion_number: (_ua = (_ta = (_sa = getTextFromProduct({ message: (_ra = feature == null ? void 0 : feature.properties) == null ? void 0 : _ra.description, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] })) == null ? void 0 : _sa.toString()) == null ? void 0 : _ta.padStart(4, "0")) != null ? _ua : null,
|
|
16410
|
+
discussion_concerning: (_wa = getTextFromProduct({ message: (_va = feature == null ? void 0 : feature.properties) == null ? void 0 : _va.description, find: [`Concerning...`] })) != null ? _wa : null,
|
|
16411
|
+
discussion_max_tornado: (_ya = getTextFromProduct({ message: (_xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _xa.description, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] })) != null ? _ya : null,
|
|
16412
|
+
discussion_max_hail: (_Aa = getTextFromProduct({ message: (_za = feature == null ? void 0 : feature.properties) == null ? void 0 : _za.description, find: [`MOST PROBABLE PEAK HAIL SIZE...`] })) != null ? _Aa : null,
|
|
16413
|
+
discussion_max_wind: (_Ca = getTextFromProduct({ message: (_Ba = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ba.description, find: [`MOST PROBABLE PEAK WIND GUST...`] })) != null ? _Ca : null,
|
|
16414
|
+
discussion_watch_issuance: (_Ea = getTextFromProduct({ message: (_Da = feature == null ? void 0 : feature.properties) == null ? void 0 : _Da.description, find: [`Probability of Watch Issuance...`], removal: [`percent`] })) != null ? _Ea : null
|
|
16243
16415
|
},
|
|
16244
16416
|
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: (
|
|
16417
|
+
watch_number: ((_Fa = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _Fa.is_watch) && ((_Qa = (_Pa = (_Ka = (_Ja = (_Ia = (_Ha = getTextFromProduct({ message: (_Ga = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ga.description, find: [`ITIES FOR`, `UPDATE FOR`, `Watch Number `], removal: [`%`, `<`, `:`] })) == null ? void 0 : _Ha.replace(/(WT|WS|)/g, "")) == null ? void 0 : _Ia.trim()) == null ? void 0 : _Ja.toString()) == null ? void 0 : _Ka.padStart(4, "0")) != null ? _Pa : (_Oa = (_Na = (_Ma = (_La = pVtec == null ? void 0 : pVtec[0]) == null ? void 0 : _La.tracking) == null ? void 0 : _Ma.slice(-4)) == null ? void 0 : _Na.toString()) == null ? void 0 : _Oa.padStart(4, "0")) != null ? _Qa : null),
|
|
16418
|
+
watch_type: ((_Ra = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ra.description.includes(`TORNADO WATCH`)) ? `Tornado` : ((_Sa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Sa.description.includes(`SEVERE`)) ? `Severe` : null,
|
|
16419
|
+
additional_tornadoes_probability: (_Ua = getTextFromProduct({ message: (_Ta = feature == null ? void 0 : feature.properties) == null ? void 0 : _Ta.description, find: [`PROB OF 2 OR MORE TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Ua : null,
|
|
16420
|
+
strong_tornadoes_probability: (_Wa = getTextFromProduct({ message: (_Va = feature == null ? void 0 : feature.properties) == null ? void 0 : _Va.description, find: [`PROB OF 1 OR MORE STRONG /EF2-EF5/ TORNADOES`], removal: [`%`, `<`, `:`] })) != null ? _Wa : null,
|
|
16421
|
+
severe_wind_probability: (_Ya = getTextFromProduct({ message: (_Xa = feature == null ? void 0 : feature.properties) == null ? void 0 : _Xa.description, find: [`PROB OF 10 OR MORE SEVERE WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _Ya : null,
|
|
16422
|
+
severe_hail_probability: (__a = getTextFromProduct({ message: (_Za = feature == null ? void 0 : feature.properties) == null ? void 0 : _Za.description, find: [`PROB OF 10 OR MORE SEVERE HAIL EVENTS`], removal: [`%`, `<`, `:`] })) != null ? __a : null,
|
|
16423
|
+
hail_2in_probability: (_ab = getTextFromProduct({ message: (_$a = feature == null ? void 0 : feature.properties) == null ? void 0 : _$a.description, find: [`PROB OF 1 OR MORE HAIL EVENTS >= 2 INCHES`], removal: [`%`, `<`, `:`] })) != null ? _ab : null,
|
|
16424
|
+
combined_hail_wind_probability: (_cb = getTextFromProduct({ message: (_bb = feature == null ? void 0 : feature.properties) == null ? void 0 : _bb.description, find: [`PROB OF 6 OR MORE COMBINED SEVERE HAIL/WIND EVENTS`], removal: [`%`, `<`, `:`] })) != null ? _cb : null,
|
|
16425
|
+
max_hail_in: (_eb = getTextFromProduct({ message: (_db = feature == null ? void 0 : feature.properties) == null ? void 0 : _db.description, find: [`MAX HAIL /INCHES/`], removal: [`%`, `<`, `:`] })) != null ? _eb : null,
|
|
16426
|
+
max_wind_surface: (_gb = getTextFromProduct({ message: (_fb = feature == null ? void 0 : feature.properties) == null ? void 0 : _fb.description, find: [`MAX WIND GUSTS SURFACE /KNOTS/`], removal: [`%`, `<`, `:`] })) != null ? _gb : null,
|
|
16427
|
+
max_tops_x100feet: (_ib = getTextFromProduct({ message: (_hb = feature == null ? void 0 : feature.properties) == null ? void 0 : _hb.description, find: [`MAX TOPS /X 100 FEET/`], removal: [`%`, `<`, `:`] })) != null ? _ib : null,
|
|
16428
|
+
pds_watch: getTextFromProduct({ message: (_jb = feature == null ? void 0 : feature.properties) == null ? void 0 : _jb.description, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`
|
|
16257
16429
|
},
|
|
16258
16430
|
metadata: {
|
|
16259
16431
|
ms: performance.now() - tick,
|
|
16260
16432
|
source: `events.api`,
|
|
16261
|
-
tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: (
|
|
16262
|
-
header: `ZCZC-ATMOSX-${(
|
|
16263
|
-
vtec: pVtec,
|
|
16433
|
+
tracking: getEventTracking({ type: `API`, organization: { wmoidentifier: (_mb = (_lb = (_kb = feature == null ? void 0 : feature.properties) == null ? void 0 : _kb.parameters) == null ? void 0 : _lb.WMOidentifier) == null ? void 0 : _mb[0], featureId: feature == null ? void 0 : feature.id }, vtec: pVtec == null ? void 0 : pVtec[0] }),
|
|
16434
|
+
header: `ZCZC-ATMOSX-${(_ob = (_nb = feature == null ? void 0 : feature.properties) == null ? void 0 : _nb.parameters) == null ? void 0 : _ob.WMOidentifier}`,
|
|
16435
|
+
vtec: pVtec == null ? void 0 : pVtec[0],
|
|
16264
16436
|
hvtec: null,
|
|
16265
|
-
raw: (
|
|
16437
|
+
raw: (_pb = feature == null ? void 0 : feature.properties) == null ? void 0 : _pb.description,
|
|
16266
16438
|
history: [
|
|
16267
16439
|
{
|
|
16268
|
-
description: (
|
|
16269
|
-
issued: ((
|
|
16270
|
-
status: (
|
|
16440
|
+
description: (_qb = feature == null ? void 0 : feature.properties) == null ? void 0 : _qb.description,
|
|
16441
|
+
issued: ((_rb = feature == null ? void 0 : feature.properties) == null ? void 0 : _rb.sent) ? new Date((_sb = feature == null ? void 0 : feature.properties) == null ? void 0 : _sb.sent).toISOString() : null,
|
|
16442
|
+
status: (_ub = (_tb = feature == null ? void 0 : feature.properties) == null ? void 0 : _tb.messageType) != null ? _ub : null
|
|
16271
16443
|
}
|
|
16272
16444
|
]
|
|
16273
16445
|
}
|
|
@@ -16403,8 +16575,8 @@ var setSleep = (options) => __async(null, null, function* () {
|
|
|
16403
16575
|
});
|
|
16404
16576
|
});
|
|
16405
16577
|
|
|
16406
|
-
// src/@dictionaries/dictionaries.
|
|
16407
|
-
var
|
|
16578
|
+
// src/@dictionaries/dictionaries.shapefiles.ts
|
|
16579
|
+
var dict_shapefiles = [
|
|
16408
16580
|
{ name: "us_counties", id: "C", link: "https://www.weather.gov/source/gis/Shapefiles/County/c_16ap26.zip" },
|
|
16409
16581
|
{ name: "us_states_territories", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/County/s_16ap26.zip" },
|
|
16410
16582
|
{ name: "fire_weather_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/fz16ap26.zip" },
|
|
@@ -16424,8 +16596,7 @@ var importShapefiles = () => __async(null, null, function* () {
|
|
|
16424
16596
|
const tShapefiles = bootstrap.database.prepare(`SELECT COUNT(*) AS count FROM shapefiles`).get().count;
|
|
16425
16597
|
if (tShapefiles === 0) {
|
|
16426
16598
|
yield setSleep({ timeout: 1e3 });
|
|
16427
|
-
|
|
16428
|
-
for (const shapefile of shapefileLinks) {
|
|
16599
|
+
for (const shapefile of dict_shapefiles) {
|
|
16429
16600
|
const response2 = yield fetch(shapefile.link);
|
|
16430
16601
|
const arrayBuff = yield response2.arrayBuffer();
|
|
16431
16602
|
const content = yield loadAsync(arrayBuff);
|
|
@@ -16445,7 +16616,7 @@ var importShapefiles = () => __async(null, null, function* () {
|
|
|
16445
16616
|
filepath,
|
|
16446
16617
|
filepath
|
|
16447
16618
|
);
|
|
16448
|
-
setWarning({ message: `Importing ${features.length} features from ${shapefile.name}_${shapefile.id}` });
|
|
16619
|
+
setWarning({ message: `Importing ${features.length} features from ${shapefile.name}_${shapefile.id} for Shapefiles` });
|
|
16449
16620
|
const insert = bootstrap.database.prepare(`INSERT OR REPLACE INTO shapefiles (id, location, geometry) VALUES (?, ?, ?)`);
|
|
16450
16621
|
const transaction = bootstrap.database.transaction((entries) => {
|
|
16451
16622
|
var _a2, _b2, _c;
|
|
@@ -16470,10 +16641,8 @@ var importShapefiles = () => __async(null, null, function* () {
|
|
|
16470
16641
|
});
|
|
16471
16642
|
fs.unlinkSync(`${filepath}.shp`);
|
|
16472
16643
|
fs.unlinkSync(`${filepath}.dbf`);
|
|
16473
|
-
setWarning({ message: `Cleaned up temporary files for ${shapefile.name}_${shapefile.id}` });
|
|
16474
16644
|
transaction(features);
|
|
16475
16645
|
}
|
|
16476
|
-
setWarning({ message: `Shapefiles have finished compiling, you can now continue and close this terminal` });
|
|
16477
16646
|
fs.rm(resolve5(__dirname, "../../shapefiles"), { recursive: true, force: true }, () => {
|
|
16478
16647
|
});
|
|
16479
16648
|
}
|
|
@@ -16482,6 +16651,49 @@ var importShapefiles = () => __async(null, null, function* () {
|
|
|
16482
16651
|
}
|
|
16483
16652
|
});
|
|
16484
16653
|
|
|
16654
|
+
// src/@modules/@database/database.broadcastify.ts
|
|
16655
|
+
var importBroadcastify = () => __async(null, null, function* () {
|
|
16656
|
+
const settings = bootstrap.settings;
|
|
16657
|
+
const isBroadcastifyImported = bootstrap.database.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='broadcastify';`).get();
|
|
16658
|
+
if (!settings.BroadcastifySettings.BroadcastifyAttachments) {
|
|
16659
|
+
return;
|
|
16660
|
+
}
|
|
16661
|
+
if (isBroadcastifyImported) {
|
|
16662
|
+
return;
|
|
16663
|
+
}
|
|
16664
|
+
const broadcastify = yield createHttp({
|
|
16665
|
+
url: settings.BroadcastifySettings.BroadcastifyDatabase,
|
|
16666
|
+
timeout: 5e3
|
|
16667
|
+
});
|
|
16668
|
+
if (!broadcastify.error) {
|
|
16669
|
+
bootstrap.database.prepare(`CREATE TABLE broadcastify ( state TEXT, county TEXT, feed TEXT, type TEXT, link TEXT);`).run();
|
|
16670
|
+
const states = JSON.parse(broadcastify.message);
|
|
16671
|
+
const insert = bootstrap.database.prepare(`INSERT INTO broadcastify (state, county, feed, type, link) VALUES (?, ?, ?, ?, ?)`);
|
|
16672
|
+
const transaction = bootstrap.database.transaction((rows) => {
|
|
16673
|
+
for (const row of rows) {
|
|
16674
|
+
insert.run(row);
|
|
16675
|
+
}
|
|
16676
|
+
});
|
|
16677
|
+
const batch = [];
|
|
16678
|
+
for (const state of states) {
|
|
16679
|
+
setWarning({ message: `Importing ${state.counties.length} counties from ${state.state} for Broadcastify` });
|
|
16680
|
+
for (const county of state.counties) {
|
|
16681
|
+
const countyName = county.county;
|
|
16682
|
+
for (const feed of county.feeds) {
|
|
16683
|
+
batch.push([
|
|
16684
|
+
state.state,
|
|
16685
|
+
countyName,
|
|
16686
|
+
feed.name,
|
|
16687
|
+
feed.type,
|
|
16688
|
+
feed.link
|
|
16689
|
+
]);
|
|
16690
|
+
}
|
|
16691
|
+
}
|
|
16692
|
+
}
|
|
16693
|
+
transaction(batch);
|
|
16694
|
+
}
|
|
16695
|
+
});
|
|
16696
|
+
|
|
16485
16697
|
// src/@modules/@database/database.init.ts
|
|
16486
16698
|
var initializeDatabase = () => __async(null, null, function* () {
|
|
16487
16699
|
const settings = bootstrap.settings;
|
|
@@ -16493,7 +16705,14 @@ var initializeDatabase = () => __async(null, null, function* () {
|
|
|
16493
16705
|
bootstrap.database = new sqlite3(settings.Database);
|
|
16494
16706
|
bootstrap.database.prepare(`CREATE TABLE IF NOT EXISTS stanzas ( id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT, issued TEXT, stanza TEXT )`).run();
|
|
16495
16707
|
bootstrap.database.prepare(`CREATE TABLE IF NOT EXISTS shapefiles (id TEXT PRIMARY KEY, location TEXT, geometry TEXT)`).run();
|
|
16496
|
-
|
|
16708
|
+
const isNeedingShapefiles = bootstrap.database.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='shapefiles';`).get();
|
|
16709
|
+
const isNeedingBroadcastify = bootstrap.database.prepare(`SELECT name FROM sqlite_master WHERE type='table' AND name='broadcastify';`).get();
|
|
16710
|
+
if (!isNeedingShapefiles || !isNeedingBroadcastify) {
|
|
16711
|
+
setWarning({ message: `Required database tables are currently building, please ${bootstrap.ansi_colors.RED}DO NOT${bootstrap.ansi_colors.RESET} close your terminal. The building will not finish and will remain incomplete. If you do mess up, you will need to delete ${settings.Database} and restart the application.` });
|
|
16712
|
+
yield importBroadcastify();
|
|
16713
|
+
yield importShapefiles();
|
|
16714
|
+
setWarning({ message: `Building has completed, you can now continue or close the terminal` });
|
|
16715
|
+
}
|
|
16497
16716
|
} catch (error) {
|
|
16498
16717
|
setWarning({ message: `An error occurred while initializing the database: ${error.message}` });
|
|
16499
16718
|
}
|
|
@@ -16554,7 +16773,8 @@ var xReconnect = (interval) => __async(null, null, function* () {
|
|
|
16554
16773
|
},
|
|
16555
16774
|
type: `reconnect`,
|
|
16556
16775
|
error: true
|
|
16557
|
-
}
|
|
16776
|
+
},
|
|
16777
|
+
message: `Attempting to reconnect to XMPP Service (Reconnect Attempt ${bootstrap.cache.tReconnects})`
|
|
16558
16778
|
});
|
|
16559
16779
|
yield bootstrap.session_xmpp.stop().catch(() => {
|
|
16560
16780
|
});
|
|
@@ -16570,14 +16790,14 @@ var xReconnect = (interval) => __async(null, null, function* () {
|
|
|
16570
16790
|
});
|
|
16571
16791
|
|
|
16572
16792
|
// src/@modules/@utilities/utilities.setCronSchedule.ts
|
|
16573
|
-
import { readdirSync, unlinkSync as unlinkSync2, statSync, existsSync as
|
|
16793
|
+
import { readdirSync, unlinkSync as unlinkSync2, statSync, existsSync as existsSync3 } from "fs";
|
|
16574
16794
|
import { join as join2 } from "path";
|
|
16575
16795
|
var setCronSchedule = () => __async(null, null, function* () {
|
|
16576
16796
|
const settings = bootstrap.settings;
|
|
16577
|
-
const TTL = settings.GlobalSettings.
|
|
16797
|
+
const TTL = settings.GlobalSettings.ArchiveSettings.TTL;
|
|
16578
16798
|
const TTLCUT = Date.now() - TTL * 1e3;
|
|
16579
16799
|
const walk = (dir) => {
|
|
16580
|
-
if (
|
|
16800
|
+
if (existsSync3(dir)) {
|
|
16581
16801
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
16582
16802
|
for (const entry of entries) {
|
|
16583
16803
|
const fullPath = join2(dir, entry.name);
|
|
@@ -16596,7 +16816,9 @@ var setCronSchedule = () => __async(null, null, function* () {
|
|
|
16596
16816
|
}
|
|
16597
16817
|
}
|
|
16598
16818
|
};
|
|
16599
|
-
walk(settings.GlobalSettings.
|
|
16819
|
+
walk(settings.GlobalSettings.ArchiveSettings.TextDirectory);
|
|
16820
|
+
walk(settings.GlobalSettings.ArchiveSettings.EasDirectory);
|
|
16821
|
+
walk(settings.GlobalSettings.ArchiveSettings.EventDirectory);
|
|
16600
16822
|
if (settings.EnableWireService) {
|
|
16601
16823
|
if (settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.Enabled) {
|
|
16602
16824
|
void xReconnect(settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval);
|
|
@@ -16764,6 +16986,60 @@ var getNodes = () => {
|
|
|
16764
16986
|
return bootstrap.cache.nodes;
|
|
16765
16987
|
};
|
|
16766
16988
|
|
|
16989
|
+
// src/@core/core.createEvent.ts
|
|
16990
|
+
var createEvent2 = (options) => {
|
|
16991
|
+
var _a;
|
|
16992
|
+
const tick = performance.now();
|
|
16993
|
+
validateEvents([{
|
|
16994
|
+
type: `Feature`,
|
|
16995
|
+
geometry: {
|
|
16996
|
+
type: `Point`,
|
|
16997
|
+
coordinates: options.coordinates
|
|
16998
|
+
},
|
|
16999
|
+
properties: {
|
|
17000
|
+
event: options.event,
|
|
17001
|
+
parent: options.event,
|
|
17002
|
+
status: options.status,
|
|
17003
|
+
issued: options.issued.toISOString(),
|
|
17004
|
+
expires: options.expires.toISOString(),
|
|
17005
|
+
locations: options.locations,
|
|
17006
|
+
locations_array: options.locations ? options.locations.split(";") : [],
|
|
17007
|
+
description: options.description,
|
|
17008
|
+
geocode: {
|
|
17009
|
+
office: {
|
|
17010
|
+
office: `ATMX`,
|
|
17011
|
+
name: `AtmosphericX Manual Event`
|
|
17012
|
+
},
|
|
17013
|
+
organization: `AtmosphericX`,
|
|
17014
|
+
ugc: [],
|
|
17015
|
+
polygon: options.coordinates.length > 0 ? Buffer.from(JSON.stringify([options.coordinates[0]])).toString("base64") : null,
|
|
17016
|
+
polygon_generated: options.coordinates.length > 0 ? true : false
|
|
17017
|
+
},
|
|
17018
|
+
status_metadata: {
|
|
17019
|
+
is_issued: options.status == `Issued`,
|
|
17020
|
+
is_updated: options.status == `Updated`,
|
|
17021
|
+
is_expired: options.status == `Expired`,
|
|
17022
|
+
is_test: options.status == `Test`,
|
|
17023
|
+
is_statement: options.status == `Statement`
|
|
17024
|
+
},
|
|
17025
|
+
metadata: {
|
|
17026
|
+
ms: performance.now() - tick,
|
|
17027
|
+
source: `events.manual`,
|
|
17028
|
+
tracking: `ATMX-M-W-01`,
|
|
17029
|
+
header: `ZCZC-ATMOSX-ATMX-M-W-01`,
|
|
17030
|
+
raw: options.description,
|
|
17031
|
+
history: [
|
|
17032
|
+
{
|
|
17033
|
+
description: options.description,
|
|
17034
|
+
issued: options.issued.toISOString(),
|
|
17035
|
+
status: (_a = options.status) != null ? _a : null
|
|
17036
|
+
}
|
|
17037
|
+
]
|
|
17038
|
+
}
|
|
17039
|
+
}
|
|
17040
|
+
}]);
|
|
17041
|
+
};
|
|
17042
|
+
|
|
16767
17043
|
// src/@core/core.getRandomEvent.ts
|
|
16768
17044
|
var getRandomEvent = () => {
|
|
16769
17045
|
return bootstrap.cache.events.features[Math.floor(Math.random() * bootstrap.cache.events.features.length)];
|
|
@@ -16823,6 +17099,7 @@ var index_default = Manager;
|
|
|
16823
17099
|
export {
|
|
16824
17100
|
Manager,
|
|
16825
17101
|
clearEvents,
|
|
17102
|
+
createEvent2 as createEvent,
|
|
16826
17103
|
index_default as default,
|
|
16827
17104
|
getCleanedEvent,
|
|
16828
17105
|
getEventGeometry,
|