@atmosx/event-product-parser 3.0.52 → 3.0.53

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.
@@ -56,6 +56,15 @@ const Client = new Manager({
56
56
  BroadcastifyAttachments: true,
57
57
  BroadcastifyTags: [`Public Safety`, `Amateur Radio`, `Other`, `Rail`, `Aviation`, `Marine`, `Disaster Event`, `Special Event`]
58
58
  },
59
+ NotifyServer: {
60
+ Enabled: false,
61
+ Server: "https://ntfy.domainname.com",
62
+ Attachments: "https://domainname.com/Storage/EasScenarios",
63
+ Credentials: {
64
+ Username: "username",
65
+ Password: "password"
66
+ }
67
+ },
59
68
  ListenerSettings: [
60
69
  {
61
70
  events: [`*Thunderstorm Warning*`, `* Watch`],
@@ -66,6 +75,10 @@ const Client = new Manager({
66
75
  message: "<@&XXXXXXXXXXXXXXXXXXXXX>",
67
76
  ratelimit: 1
68
77
  },
78
+ notify: {
79
+ enabled: false,
80
+ topic: "thunderstorm_events",
81
+ },
69
82
  uploads: {
70
83
  eas: true,
71
84
  file: true,
@@ -91,7 +104,7 @@ const Client = new Manager({
91
104
  "*Tsunami*", "*Hurricane*", "*Tropical Storm*", "*Special Marine*",
92
105
  "*Flash Flood Warning*", "*Flash Flood Watch*", "*Flash Flood Advisory*",
93
106
  "Mesoscale Discussion",
94
- "SPC Day 1 Outlook", "SPC Day 2 Outlook", "SPC Day 3 Outlook",
107
+ "*Storm Prediction Center*",
95
108
  "PDS Tornado Watch", "Tornado Watch", "Severe Thunderstorm Watch", "Flash Flood Watch", "PDS Severe Thunderstorm Watch",
96
109
  "*Administrative*", "National Weather Service Policy",
97
110
  "Fire Weather Warning", "Fire Weather Watch", "Fire Weather Advisory",
@@ -134,6 +147,12 @@ const Client = new Manager({
134
147
  - **BroadcastifyDatabase**: The download url to point to for the collection of broadcastify feeds. (Stored locally once downloaded)
135
148
  - **BroadcastifyTags**: An array of tags to filter broadcastify feeds. (`Public Safety`, `Amateur Radio`, `Other`, `Rail`, `Aviation`, `Marine`, `Disaster Event`, `Special Event`)
136
149
 
150
+ ## NotifyServer
151
+ - **Enabled**: Whether to enable the notify server for events. This uses the [ntfy.sh](https://ntfy.sh/) service to send notifications for events. This is optional and can be disabled if not needed.
152
+ - **Server**: The notify server URL (Ex. `https://ntfy.domainname.com`)
153
+ - **Attachments**: The URL to the attachments directory (Ex. `https://domainname.com/Storage/EasScenarios`)
154
+ - **Credentials**: The username and password for the notify server if required. (Optional)
155
+
137
156
  ### ListenerSettings
138
157
  - **events**: An array of event types that will trigger the listener when they are received by the parser. If this array is empty, the listener will be triggered for all events.
139
158
 
@@ -144,6 +163,10 @@ const Client = new Manager({
144
163
  - **message**: The message you'd like to use for the webhook
145
164
  - **ratelimit**: How many messages can it send before being ratelimited
146
165
 
166
+ #### Notify
167
+ - **enabled**: If the notify server is enabled or not
168
+ - **topic**: The topic you'd like to use for the notify server. This is used to send notifications for events. (Ex. `thunderstorm_events`)
169
+
147
170
  #### Uploads
148
171
  - **eas**: Whether to enable auto eas generated audio files
149
172
  - **file**: Wheather to generate text files
@@ -434,10 +457,10 @@ If you wish to view all supported products, please see: [SUPPORTED_EVENTS.md](./
434
457
  [Documentation](https://atmosphericx.scriptkitty.cafe/documentation) |
435
458
  [Discord Server](https://atmosphericx-discord.scriptkitty.cafe) |
436
459
  [Project Board](https://github.com/users/AtmosphericX/projects/2) |\
437
- [Code of Conduct](/CODE_OF_CONDUCT.md) |
438
- [Contributing](/CONTRIBUTING.md) |
439
- [License](/LICENSE) |
440
- [Security](/SECURITY.md) |
460
+ [Code of Conduct](/.github/CODE_OF_CONDUCT.md) |
461
+ [Contributing](/.github/CONTRIBUTING.md) |
462
+ [License](/.github/LICENSE) |
463
+ [Security](/.github/SECURITY.md) |
441
464
 
442
465
  ## Acknowledgements
443
466
  - [k3yomi](https://github.com/k3yomi)
@@ -293,9 +293,9 @@
293
293
  - Severe Thunderstorm Warning
294
294
  - Severe Weather Statement
295
295
  - Mesoscale Discussion
296
- - Day 1 Outlook
297
- - Day 2 Outlook
298
- - Day 3 Outlook
296
+ - Storm Prediction Center Day 1 Outlook
297
+ - Storm Prediction Center Day 2 Outlook
298
+ - Storm Prediction Center Day 3 Outlook
299
299
  - State Weather Summary
300
300
  - Regional Weather Synopsis
301
301
  - Terminal Aerodrome Forecast
@@ -1124,7 +1124,7 @@ module.exports = __toCommonJS(index_exports);
1124
1124
  var import_path = __toESM(require("path"));
1125
1125
  var import_node_events = require("events");
1126
1126
  var bootstrap = {
1127
- version: `3.0.52`,
1127
+ version: `3.0.53`,
1128
1128
  isReady: true,
1129
1129
  ratelimits: {},
1130
1130
  session_xmpp: null,
@@ -1188,6 +1188,15 @@ var bootstrap = {
1188
1188
  BroadcastifyDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/broadcastify.json`,
1189
1189
  BroadcastifyTags: [`Ham`, `Air`, `Fire`, `Public Safety`, `Weather`, `EMS`, `Police`, `Rail`]
1190
1190
  },
1191
+ NotifyServer: {
1192
+ Enabled: false,
1193
+ Server: `https://ntfy.sh`,
1194
+ Attachments: null,
1195
+ Credentials: {
1196
+ Username: null,
1197
+ Password: null
1198
+ }
1199
+ },
1191
1200
  ListenerSettings: [],
1192
1201
  GlobalSettings: {
1193
1202
  EventManagement: true,
@@ -4523,9 +4532,9 @@ var dict_awips = {
4523
4532
  SVR: `severe-thunderstorm-warning`,
4524
4533
  SVS: `severe-weather-statement`,
4525
4534
  SWOMCD: `mesoscale-discussion`,
4526
- SWODY1: `SPC-day-1-outlook`,
4527
- SWODY2: `SPC-day-2-outlook`,
4528
- SWODY3: `SPC-day-3-outlook`,
4535
+ SWODY1: `storm-prediction-center-day-1-outlook`,
4536
+ SWODY2: `storm-prediction-center-day-2-outlook`,
4537
+ SWODY3: `storm-prediction-center-day-3-outlook`,
4529
4538
  SWS: `state-weather-summary`,
4530
4539
  SYN: `regional-weather-synopsis`,
4531
4540
  TAF: `terminal-aerodrome-forecast`,
@@ -6453,6 +6462,42 @@ var getEmebed = (event) => {
6453
6462
  ].filter(Boolean).join("\n");
6454
6463
  };
6455
6464
 
6465
+ // src/@parsers/@text/text.getRaw.ts
6466
+ var getRaw = (event) => {
6467
+ 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;
6468
+ const line = (label, value, condition = true) => condition && value ? `${label} ${value}` : null;
6469
+ const isStatement = event.properties.status_metadata.is_statement;
6470
+ const isExpired = event.properties.status_metadata.is_expired;
6471
+ return [
6472
+ line(`Locations:`, (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.locations) == null ? void 0 : _b.slice(0, 100)),
6473
+ line(`Issued:`, new Date(event.properties.issued).toUTCString(), !isExpired),
6474
+ line(`Expires:`, new Date(event.properties.expires).toUTCString(), !isStatement),
6475
+ line(`Damage Threat:`, (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat, !isExpired),
6476
+ line(`Flood Threat:`, (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.flood_threat, !isExpired),
6477
+ line(`Tornado Threat:`, (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.parameters) == null ? void 0 : _h.tornado_threat, !isExpired),
6478
+ 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),
6479
+ 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),
6480
+ line(`Discussion:`, (_z = (_y = event == null ? void 0 : event.properties) == null ? void 0 : _y.discussion_parameters) == null ? void 0 : _z.discussion_number, !isExpired),
6481
+ line(`Concern:`, (_B = (_A = event == null ? void 0 : event.properties) == null ? void 0 : _A.discussion_parameters) == null ? void 0 : _B.discussion_concerning, !isExpired),
6482
+ 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),
6483
+ 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),
6484
+ 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),
6485
+ 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),
6486
+ line(`Watch Number:`, (_N = (_M = event == null ? void 0 : event.properties) == null ? void 0 : _M.watch_parameters) == null ? void 0 : _N.watch_number, !isExpired),
6487
+ 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),
6488
+ 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),
6489
+ 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),
6490
+ 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),
6491
+ 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),
6492
+ 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),
6493
+ 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),
6494
+ 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),
6495
+ 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),
6496
+ line(`Sender:`, ((_sa = (_ra = (_qa = event == null ? void 0 : event.properties) == null ? void 0 : _qa.geocode) == null ? void 0 : _ra.office) == null ? void 0 : _sa.name) ? `${(_va = (_ua = (_ta = event == null ? void 0 : event.properties) == null ? void 0 : _ta.geocode) == null ? void 0 : _ua.office) == null ? void 0 : _va.name} (${(_ya = (_xa = (_wa = event == null ? void 0 : event.properties) == null ? void 0 : _wa.geocode) == null ? void 0 : _xa.office) == null ? void 0 : _ya.office})` : (_Ba = (_Aa = (_za = event == null ? void 0 : event.properties) == null ? void 0 : _za.geocode) == null ? void 0 : _Aa.office) == null ? void 0 : _Ba.office),
6497
+ line(`Tracking:`, (_Da = (_Ca = event == null ? void 0 : event.properties) == null ? void 0 : _Ca.metadata) == null ? void 0 : _Da.tracking)
6498
+ ].filter(Boolean).join("\n");
6499
+ };
6500
+
6456
6501
  // src/@modules/@utilities/utilities.createHttp.ts
6457
6502
  var createHttp = (options) => __async(null, null, function* () {
6458
6503
  var _a, _b, _c, _d;
@@ -6469,6 +6514,13 @@ var createHttp = (options) => __async(null, null, function* () {
6469
6514
  const returnHttp = function(error, status, message) {
6470
6515
  return { error, options: requestOptions, status, message };
6471
6516
  };
6517
+ if (options == null ? void 0 : options.auth) {
6518
+ const authString = `${options.auth.username}:${options.auth.password}`;
6519
+ const encodedAuth = Buffer.from(authString).toString("base64");
6520
+ requestOptions.headers = __spreadProps(__spreadValues({}, requestOptions.headers), {
6521
+ "Authorization": `Basic ${encodedAuth}`
6522
+ });
6523
+ }
6472
6524
  if (options == null ? void 0 : options.formData) {
6473
6525
  requestOptions.body = options.formData;
6474
6526
  } else if ((options == null ? void 0 : options.body) != void 0) {
@@ -6508,7 +6560,7 @@ var getMatched = (strings, string) => {
6508
6560
  // src/@manager/manager.updateListener.ts
6509
6561
  var import_fs3 = require("fs");
6510
6562
  var updateListener = (event) => __async(null, null, function* () {
6511
- var _a, _b, _c, _d, _e, _f;
6563
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6512
6564
  const tick = performance.now();
6513
6565
  const settings = bootstrap.settings;
6514
6566
  const listeners2 = settings.ListenerSettings;
@@ -6565,8 +6617,29 @@ var updateListener = (event) => __async(null, null, function* () {
6565
6617
  }
6566
6618
  metadata.json = JSON.stringify(getCleanedEvent(event), null, 2);
6567
6619
  }
6620
+ if (settings.NotifyServer.Enabled && ((_a = listener2 == null ? void 0 : listener2.notify) == null ? void 0 : _a.enabled) && ((_b = listener2 == null ? void 0 : listener2.notify) == null ? void 0 : _b.topic)) {
6621
+ const auth = ((_c = settings.NotifyServer.Credentials) == null ? void 0 : _c.Username) && ((_d = settings.NotifyServer.Credentials) == null ? void 0 : _d.Password) ? {
6622
+ username: settings.NotifyServer.Credentials.Username,
6623
+ password: settings.NotifyServer.Credentials.Password
6624
+ } : void 0;
6625
+ const attachment = metadata.eas && settings.NotifyServer.Attachments ? `${settings.NotifyServer.Attachments}/${metadata.name}_${metadata.status}_${metadata.tracking}.wav` : null;
6626
+ yield createHttp(__spreadProps(__spreadValues({
6627
+ url: `${settings.NotifyServer.Server.replace(/\/$/, "")}/${(_e = listener2 == null ? void 0 : listener2.notify) == null ? void 0 : _e.topic}`,
6628
+ timeout: 15e3,
6629
+ method: "POST"
6630
+ }, auth && { auth }), {
6631
+ headers: __spreadProps(__spreadValues({
6632
+ "Title": `${metadata.name} (${metadata.status})`,
6633
+ "Tags": (_g = (_f = properties2.parameters.tags) == null ? void 0 : _f.join(",")) != null ? _g : "N/A"
6634
+ }, attachment && { "Attach": attachment }), {
6635
+ "Priority": "max",
6636
+ "Sound": "siren"
6637
+ }),
6638
+ body: getRaw(event)
6639
+ }));
6640
+ }
6568
6641
  if ((webhook == null ? void 0 : webhook.enabled) && (webhook == null ? void 0 : webhook.destination)) {
6569
- const isRatelimited = setTimeoutAction({ identifier: webhook.destination, interval: ((_a = webhook.ratelimit) != null ? _a : 2) * 2, max: (_b = webhook.ratelimit) != null ? _b : 2, addTime: true });
6642
+ const isRatelimited = setTimeoutAction({ identifier: webhook.destination, interval: ((_h = webhook.ratelimit) != null ? _h : 2) * 2, max: (_i = webhook.ratelimit) != null ? _i : 2, addTime: true });
6570
6643
  const form = new FormData();
6571
6644
  const embed = {
6572
6645
  title: `${metadata.name} (${metadata.status})`,
@@ -6574,7 +6647,7 @@ var updateListener = (event) => __async(null, null, function* () {
6574
6647
  fields: [],
6575
6648
  color: 16711680,
6576
6649
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6577
- footer: { text: (_c = webhook.title) != null ? _c : `AtmosphericX` }
6650
+ footer: { text: (_j = webhook.title) != null ? _j : `AtmosphericX` }
6578
6651
  };
6579
6652
  if (isRatelimited.limited) {
6580
6653
  return;
@@ -6588,7 +6661,7 @@ var updateListener = (event) => __async(null, null, function* () {
6588
6661
  value: metadata.description ? "```\n" + metadata.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n") + "\n```" : ""
6589
6662
  });
6590
6663
  }
6591
- if (((_d = metadata.attachments) == null ? void 0 : _d.length) > 0) {
6664
+ if (((_k = metadata.attachments) == null ? void 0 : _k.length) > 0) {
6592
6665
  metadata.attachments = metadata.attachments.slice(0, 5);
6593
6666
  embed.fields.push({
6594
6667
  name: "Attachments",
@@ -6608,8 +6681,8 @@ var updateListener = (event) => __async(null, null, function* () {
6608
6681
  }
6609
6682
  }
6610
6683
  form.append("payload_json", JSON.stringify({
6611
- username: (_e = webhook.title) != null ? _e : "AtmosphericX",
6612
- content: (_f = webhook.message) != null ? _f : "",
6684
+ username: (_l = webhook.title) != null ? _l : "AtmosphericX",
6685
+ content: (_m = webhook.message) != null ? _m : "",
6613
6686
  embeds: [embed]
6614
6687
  }));
6615
6688
  yield createHttp({
@@ -6962,9 +7035,9 @@ var getEventAttachments = (event) => {
6962
7035
  const watchNumber = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.watch_parameters) == null ? void 0 : _d.watch_number;
6963
7036
  const locations = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.locations_array;
6964
7037
  const events = [
6965
- { target: "SPC Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
6966
- { target: "SPC Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
6967
- { target: "SPC Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
7038
+ { target: "Storm Prediction Center Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
7039
+ { target: "Storm Prediction Center Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
7040
+ { target: "Storm Prediction Center Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
6968
7041
  { target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
6969
7042
  { target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
6970
7043
  { target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
@@ -1104,7 +1104,7 @@ var require_main3 = __commonJS({
1104
1104
  import path from "path";
1105
1105
  import { EventEmitter } from "events";
1106
1106
  var bootstrap = {
1107
- version: `3.0.52`,
1107
+ version: `3.0.53`,
1108
1108
  isReady: true,
1109
1109
  ratelimits: {},
1110
1110
  session_xmpp: null,
@@ -1168,6 +1168,15 @@ var bootstrap = {
1168
1168
  BroadcastifyDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/broadcastify.json`,
1169
1169
  BroadcastifyTags: [`Ham`, `Air`, `Fire`, `Public Safety`, `Weather`, `EMS`, `Police`, `Rail`]
1170
1170
  },
1171
+ NotifyServer: {
1172
+ Enabled: false,
1173
+ Server: `https://ntfy.sh`,
1174
+ Attachments: null,
1175
+ Credentials: {
1176
+ Username: null,
1177
+ Password: null
1178
+ }
1179
+ },
1171
1180
  ListenerSettings: [],
1172
1181
  GlobalSettings: {
1173
1182
  EventManagement: true,
@@ -4503,9 +4512,9 @@ var dict_awips = {
4503
4512
  SVR: `severe-thunderstorm-warning`,
4504
4513
  SVS: `severe-weather-statement`,
4505
4514
  SWOMCD: `mesoscale-discussion`,
4506
- SWODY1: `SPC-day-1-outlook`,
4507
- SWODY2: `SPC-day-2-outlook`,
4508
- SWODY3: `SPC-day-3-outlook`,
4515
+ SWODY1: `storm-prediction-center-day-1-outlook`,
4516
+ SWODY2: `storm-prediction-center-day-2-outlook`,
4517
+ SWODY3: `storm-prediction-center-day-3-outlook`,
4509
4518
  SWS: `state-weather-summary`,
4510
4519
  SYN: `regional-weather-synopsis`,
4511
4520
  TAF: `terminal-aerodrome-forecast`,
@@ -6433,6 +6442,42 @@ var getEmebed = (event) => {
6433
6442
  ].filter(Boolean).join("\n");
6434
6443
  };
6435
6444
 
6445
+ // src/@parsers/@text/text.getRaw.ts
6446
+ var getRaw = (event) => {
6447
+ 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;
6448
+ const line = (label, value, condition = true) => condition && value ? `${label} ${value}` : null;
6449
+ const isStatement = event.properties.status_metadata.is_statement;
6450
+ const isExpired = event.properties.status_metadata.is_expired;
6451
+ return [
6452
+ line(`Locations:`, (_b = (_a = event == null ? void 0 : event.properties) == null ? void 0 : _a.locations) == null ? void 0 : _b.slice(0, 100)),
6453
+ line(`Issued:`, new Date(event.properties.issued).toUTCString(), !isExpired),
6454
+ line(`Expires:`, new Date(event.properties.expires).toUTCString(), !isStatement),
6455
+ line(`Damage Threat:`, (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.parameters) == null ? void 0 : _d.damage_threat, !isExpired),
6456
+ line(`Flood Threat:`, (_f = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.parameters) == null ? void 0 : _f.flood_threat, !isExpired),
6457
+ line(`Tornado Threat:`, (_h = (_g = event == null ? void 0 : event.properties) == null ? void 0 : _g.parameters) == null ? void 0 : _h.tornado_threat, !isExpired),
6458
+ 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),
6459
+ 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),
6460
+ line(`Discussion:`, (_z = (_y = event == null ? void 0 : event.properties) == null ? void 0 : _y.discussion_parameters) == null ? void 0 : _z.discussion_number, !isExpired),
6461
+ line(`Concern:`, (_B = (_A = event == null ? void 0 : event.properties) == null ? void 0 : _A.discussion_parameters) == null ? void 0 : _B.discussion_concerning, !isExpired),
6462
+ 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),
6463
+ 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),
6464
+ 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),
6465
+ 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),
6466
+ line(`Watch Number:`, (_N = (_M = event == null ? void 0 : event.properties) == null ? void 0 : _M.watch_parameters) == null ? void 0 : _N.watch_number, !isExpired),
6467
+ 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),
6468
+ 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),
6469
+ 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),
6470
+ 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),
6471
+ 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),
6472
+ 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),
6473
+ 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),
6474
+ 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),
6475
+ 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),
6476
+ line(`Sender:`, ((_sa = (_ra = (_qa = event == null ? void 0 : event.properties) == null ? void 0 : _qa.geocode) == null ? void 0 : _ra.office) == null ? void 0 : _sa.name) ? `${(_va = (_ua = (_ta = event == null ? void 0 : event.properties) == null ? void 0 : _ta.geocode) == null ? void 0 : _ua.office) == null ? void 0 : _va.name} (${(_ya = (_xa = (_wa = event == null ? void 0 : event.properties) == null ? void 0 : _wa.geocode) == null ? void 0 : _xa.office) == null ? void 0 : _ya.office})` : (_Ba = (_Aa = (_za = event == null ? void 0 : event.properties) == null ? void 0 : _za.geocode) == null ? void 0 : _Aa.office) == null ? void 0 : _Ba.office),
6477
+ line(`Tracking:`, (_Da = (_Ca = event == null ? void 0 : event.properties) == null ? void 0 : _Ca.metadata) == null ? void 0 : _Da.tracking)
6478
+ ].filter(Boolean).join("\n");
6479
+ };
6480
+
6436
6481
  // src/@modules/@utilities/utilities.createHttp.ts
6437
6482
  var createHttp = (options) => __async(null, null, function* () {
6438
6483
  var _a, _b, _c, _d;
@@ -6449,6 +6494,13 @@ var createHttp = (options) => __async(null, null, function* () {
6449
6494
  const returnHttp = function(error, status, message) {
6450
6495
  return { error, options: requestOptions, status, message };
6451
6496
  };
6497
+ if (options == null ? void 0 : options.auth) {
6498
+ const authString = `${options.auth.username}:${options.auth.password}`;
6499
+ const encodedAuth = Buffer.from(authString).toString("base64");
6500
+ requestOptions.headers = __spreadProps(__spreadValues({}, requestOptions.headers), {
6501
+ "Authorization": `Basic ${encodedAuth}`
6502
+ });
6503
+ }
6452
6504
  if (options == null ? void 0 : options.formData) {
6453
6505
  requestOptions.body = options.formData;
6454
6506
  } else if ((options == null ? void 0 : options.body) != void 0) {
@@ -6488,7 +6540,7 @@ var getMatched = (strings, string) => {
6488
6540
  // src/@manager/manager.updateListener.ts
6489
6541
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync3, readFileSync as readFileSync2, appendFileSync } from "fs";
6490
6542
  var updateListener = (event) => __async(null, null, function* () {
6491
- var _a, _b, _c, _d, _e, _f;
6543
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
6492
6544
  const tick = performance.now();
6493
6545
  const settings = bootstrap.settings;
6494
6546
  const listeners2 = settings.ListenerSettings;
@@ -6545,8 +6597,29 @@ var updateListener = (event) => __async(null, null, function* () {
6545
6597
  }
6546
6598
  metadata.json = JSON.stringify(getCleanedEvent(event), null, 2);
6547
6599
  }
6600
+ if (settings.NotifyServer.Enabled && ((_a = listener2 == null ? void 0 : listener2.notify) == null ? void 0 : _a.enabled) && ((_b = listener2 == null ? void 0 : listener2.notify) == null ? void 0 : _b.topic)) {
6601
+ const auth = ((_c = settings.NotifyServer.Credentials) == null ? void 0 : _c.Username) && ((_d = settings.NotifyServer.Credentials) == null ? void 0 : _d.Password) ? {
6602
+ username: settings.NotifyServer.Credentials.Username,
6603
+ password: settings.NotifyServer.Credentials.Password
6604
+ } : void 0;
6605
+ const attachment = metadata.eas && settings.NotifyServer.Attachments ? `${settings.NotifyServer.Attachments}/${metadata.name}_${metadata.status}_${metadata.tracking}.wav` : null;
6606
+ yield createHttp(__spreadProps(__spreadValues({
6607
+ url: `${settings.NotifyServer.Server.replace(/\/$/, "")}/${(_e = listener2 == null ? void 0 : listener2.notify) == null ? void 0 : _e.topic}`,
6608
+ timeout: 15e3,
6609
+ method: "POST"
6610
+ }, auth && { auth }), {
6611
+ headers: __spreadProps(__spreadValues({
6612
+ "Title": `${metadata.name} (${metadata.status})`,
6613
+ "Tags": (_g = (_f = properties2.parameters.tags) == null ? void 0 : _f.join(",")) != null ? _g : "N/A"
6614
+ }, attachment && { "Attach": attachment }), {
6615
+ "Priority": "max",
6616
+ "Sound": "siren"
6617
+ }),
6618
+ body: getRaw(event)
6619
+ }));
6620
+ }
6548
6621
  if ((webhook == null ? void 0 : webhook.enabled) && (webhook == null ? void 0 : webhook.destination)) {
6549
- const isRatelimited = setTimeoutAction({ identifier: webhook.destination, interval: ((_a = webhook.ratelimit) != null ? _a : 2) * 2, max: (_b = webhook.ratelimit) != null ? _b : 2, addTime: true });
6622
+ const isRatelimited = setTimeoutAction({ identifier: webhook.destination, interval: ((_h = webhook.ratelimit) != null ? _h : 2) * 2, max: (_i = webhook.ratelimit) != null ? _i : 2, addTime: true });
6550
6623
  const form = new FormData();
6551
6624
  const embed = {
6552
6625
  title: `${metadata.name} (${metadata.status})`,
@@ -6554,7 +6627,7 @@ var updateListener = (event) => __async(null, null, function* () {
6554
6627
  fields: [],
6555
6628
  color: 16711680,
6556
6629
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
6557
- footer: { text: (_c = webhook.title) != null ? _c : `AtmosphericX` }
6630
+ footer: { text: (_j = webhook.title) != null ? _j : `AtmosphericX` }
6558
6631
  };
6559
6632
  if (isRatelimited.limited) {
6560
6633
  return;
@@ -6568,7 +6641,7 @@ var updateListener = (event) => __async(null, null, function* () {
6568
6641
  value: metadata.description ? "```\n" + metadata.description.split("\n").map((l) => l.trim()).filter(Boolean).join("\n") + "\n```" : ""
6569
6642
  });
6570
6643
  }
6571
- if (((_d = metadata.attachments) == null ? void 0 : _d.length) > 0) {
6644
+ if (((_k = metadata.attachments) == null ? void 0 : _k.length) > 0) {
6572
6645
  metadata.attachments = metadata.attachments.slice(0, 5);
6573
6646
  embed.fields.push({
6574
6647
  name: "Attachments",
@@ -6588,8 +6661,8 @@ var updateListener = (event) => __async(null, null, function* () {
6588
6661
  }
6589
6662
  }
6590
6663
  form.append("payload_json", JSON.stringify({
6591
- username: (_e = webhook.title) != null ? _e : "AtmosphericX",
6592
- content: (_f = webhook.message) != null ? _f : "",
6664
+ username: (_l = webhook.title) != null ? _l : "AtmosphericX",
6665
+ content: (_m = webhook.message) != null ? _m : "",
6593
6666
  embeds: [embed]
6594
6667
  }));
6595
6668
  yield createHttp({
@@ -6942,9 +7015,9 @@ var getEventAttachments = (event) => {
6942
7015
  const watchNumber = (_d = (_c = event == null ? void 0 : event.properties) == null ? void 0 : _c.watch_parameters) == null ? void 0 : _d.watch_number;
6943
7016
  const locations = (_e = event == null ? void 0 : event.properties) == null ? void 0 : _e.locations_array;
6944
7017
  const events = [
6945
- { target: "SPC Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
6946
- { target: "SPC Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
6947
- { target: "SPC Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
7018
+ { target: "Storm Prediction Center Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
7019
+ { target: "Storm Prediction Center Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
7020
+ { target: "Storm Prediction Center Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
6948
7021
  { target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
6949
7022
  { target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
6950
7023
  { target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atmosx/event-product-parser",
3
- "version": "3.0.52",
3
+ "version": "3.0.53",
4
4
  "description": "NOAA Weather Wire & NWS API Parser - Built for standalone and Project AtmosphericX Integration.",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",
@@ -43,9 +43,9 @@ export const getEventAttachments = (event: TypeEvent): GetEventAttachmentsRespon
43
43
  const watchNumber = event?.properties?.watch_parameters?.watch_number;
44
44
  const locations = event?.properties?.locations_array;
45
45
  const events = [
46
- { target: "SPC Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
47
- { target: "SPC Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
48
- { target: "SPC Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
46
+ { target: "Storm Prediction Center Day 1 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${issuanceTime}.png` },
47
+ { target: "Storm Prediction Center Day 2 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
48
+ { target: "Storm Prediction Center Day 3 Outlook", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
49
49
  { target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${spcNumber}.png` },
50
50
  { target: "Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
51
51
  { target: "PDS Tornado Watch", attachment: `https://www.spc.noaa.gov/products/watch/ww${watchNumber}_radar_big.gif` },
@@ -296,9 +296,9 @@ export const dict_awips: Record<string, string> = {
296
296
  SVR: `severe-thunderstorm-warning`,
297
297
  SVS: `severe-weather-statement`,
298
298
  SWOMCD: `mesoscale-discussion`,
299
- SWODY1: `SPC-day-1-outlook`,
300
- SWODY2: `SPC-day-2-outlook`,
301
- SWODY3: `SPC-day-3-outlook`,
299
+ SWODY1: `storm-prediction-center-day-1-outlook`,
300
+ SWODY2: `storm-prediction-center-day-2-outlook`,
301
+ SWODY3: `storm-prediction-center-day-3-outlook`,
302
302
  SWS: `state-weather-summary`,
303
303
  SYN: `regional-weather-synopsis`,
304
304
  TAF: `terminal-aerodrome-forecast`,
@@ -23,6 +23,7 @@ import { bootstrap } from "../bootstrap"
23
23
  import { setEasTone } from "../@modules/@eas/eas.setEasTone"
24
24
  import { setTimeoutAction } from "../@modules/@utilities/utilities.setTimeoutAction";
25
25
  import { getEmebed } from "../@parsers/@text/text.getEmbed";
26
+ import { getRaw } from "../@parsers/@text/text.getRaw";
26
27
  import { getCleanedEvent } from "../@building/building.clean"
27
28
  import { createHttp } from "../@modules/@utilities/utilities.createHttp";
28
29
  import { setDebug } from "../@modules/@utilities/utilities.setDebug";
@@ -87,6 +88,30 @@ export const updateListener = async (event: TypeEvent): Promise<void> => {
87
88
  metadata.json = JSON.stringify(getCleanedEvent(event), null, 2);
88
89
  }
89
90
 
91
+ if (settings.NotifyServer.Enabled && listener?.notify?.enabled && listener?.notify?.topic) {
92
+ const auth = settings.NotifyServer.Credentials?.Username && settings.NotifyServer.Credentials?.Password
93
+ ? {
94
+ username: settings.NotifyServer.Credentials.Username,
95
+ password: settings.NotifyServer.Credentials.Password
96
+ }
97
+ : undefined;
98
+ const attachment = metadata.eas && settings.NotifyServer.Attachments ? `${settings.NotifyServer.Attachments}/${metadata.name}_${metadata.status}_${metadata.tracking}.wav` : null;
99
+ await createHttp({
100
+ url: `${settings.NotifyServer.Server.replace(/\/$/, "")}/${listener?.notify?.topic}`,
101
+ timeout: 15_000,
102
+ method: "POST",
103
+ ...(auth && { auth }),
104
+ headers: {
105
+ "Title": `${metadata.name} (${metadata.status})`,
106
+ "Tags": properties.parameters.tags?.join(",") ?? "N/A",
107
+ ... (attachment && { "Attach": attachment }),
108
+ "Priority": "max",
109
+ "Sound": "siren",
110
+ },
111
+ body: getRaw(event)
112
+ })
113
+ }
114
+
90
115
  if (webhook?.enabled && webhook?.destination) {
91
116
  const isRatelimited = setTimeoutAction({ identifier: webhook.destination, interval: (webhook.ratelimit ?? 2) * 2, max: (webhook.ratelimit ?? 2), addTime: true })
92
117
  const form = new FormData();
@@ -21,6 +21,10 @@ interface CreateHttpOptions {
21
21
  url: string
22
22
  headers?: any
23
23
  timeout?: number
24
+ auth?: {
25
+ username: string
26
+ password: string
27
+ }
24
28
  method?: `GET` | `POST` | `PUT` | `DELETE`
25
29
  body?: any;
26
30
  formData?: any;
@@ -43,6 +47,15 @@ export const createHttp = async (options: CreateHttpOptions): Promise<any> => {
43
47
  return { error: error, options: requestOptions, status, message };
44
48
  }
45
49
 
50
+ if (options?.auth) {
51
+ const authString = `${options.auth.username}:${options.auth.password}`;
52
+ const encodedAuth = Buffer.from(authString).toString("base64");
53
+ requestOptions.headers = {
54
+ ...requestOptions.headers,
55
+ "Authorization": `Basic ${encodedAuth}`
56
+ };
57
+ }
58
+
46
59
  if (options?.formData) {
47
60
  requestOptions.body = options.formData;
48
61
  } else if (options?.body != undefined) {
@@ -0,0 +1,54 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ import { TypeEvent } from "../../@types/type.event"
21
+
22
+ export const getRaw = (event: TypeEvent): string => {
23
+ const line = (label: string, value: unknown, condition = true) => condition && value ? `${label} ${value}` : null;
24
+ const isStatement = event.properties.status_metadata.is_statement;
25
+ const isExpired = event.properties.status_metadata.is_expired;
26
+ return [
27
+ line(`Locations:`, event?.properties?.locations?.slice(0, 100)),
28
+ line(`Issued:`, new Date(event.properties.issued).toUTCString(), !isExpired),
29
+ line(`Expires:`, new Date(event.properties.expires).toUTCString(), !isStatement),
30
+ line(`Damage Threat:`, event?.properties?.parameters?.damage_threat, !isExpired),
31
+ line(`Flood Threat:`, event?.properties?.parameters?.flood_threat, !isExpired),
32
+ line(`Tornado Threat:`, event?.properties?.parameters?.tornado_threat, !isExpired),
33
+ line(`Estimated Wind Gusts:`, `${event?.properties?.parameters?.estimated_wind_gusts} ${event?.properties?.parameters?.wind_threat ? ` (${event?.properties?.parameters?.wind_threat})` : ''}`, !isExpired && event?.properties?.parameters?.estimated_wind_gusts != null),
34
+ line(`Estimated Hail Size:`, `${event?.properties?.parameters?.estimated_hail_size} ${event?.properties?.parameters?.hail_threat ? ` (${event?.properties?.parameters?.hail_threat})` : ''}`, !isExpired && event?.properties?.parameters?.estimated_hail_size != null),
35
+ line(`Discussion:`, event?.properties?.discussion_parameters?.discussion_number, !isExpired),
36
+ line(`Concern:`, event?.properties?.discussion_parameters?.discussion_concerning, !isExpired),
37
+ line(`SPC Max Tornado Threat:`, event?.properties?.discussion_parameters?.discussion_max_tornado, !isExpired),
38
+ line(`SPC Max Hail Threat:`, event?.properties?.discussion_parameters?.discussion_max_hail, !isExpired),
39
+ line(`SPC Max Wind Threat:`, event?.properties?.discussion_parameters?.discussion_max_wind, !isExpired),
40
+ line(`SPC Watch Issuance Probability:`, event?.properties?.discussion_parameters?.discussion_watch_issuance ? `${event?.properties?.discussion_parameters?.discussion_watch_issuance}%` : null, !isExpired),
41
+ line(`Watch Number:`, event?.properties?.watch_parameters?.watch_number, !isExpired),
42
+ line(`Strong Tornadoes Probability:`, event?.properties?.watch_parameters?.strong_tornadoes_probability ? `${event?.properties?.watch_parameters?.strong_tornadoes_probability}%` : null, !isExpired),
43
+ line(`Additional Tornadoes Probability:`, event?.properties?.watch_parameters?.additional_tornadoes_probability ? `${event?.properties?.watch_parameters?.additional_tornadoes_probability}%` : null, !isExpired),
44
+ line(`Combined Hail/Wind Probability:`, event?.properties?.watch_parameters?.combined_hail_wind_probability ? `${event?.properties?.watch_parameters?.combined_hail_wind_probability}%` : null, !isExpired),
45
+ line(`Severe Hail Probability:`, event?.properties?.watch_parameters?.severe_hail_probability ? `${event?.properties?.watch_parameters?.severe_hail_probability}%` : null, !isExpired),
46
+ line(`Hail >2in Probability:`, event?.properties?.watch_parameters?.hail_2in_probability ? `${event?.properties?.watch_parameters?.hail_2in_probability}%` : null, !isExpired),
47
+ line(`Max Hail Inches:`, event?.properties?.watch_parameters?.max_hail_in, !isExpired),
48
+ line(`Severe Wind Probability:`, event?.properties?.watch_parameters?.severe_wind_probability ? `${event?.properties?.watch_parameters?.severe_wind_probability}%` : null, !isExpired),
49
+ line(`Max Surface Wind:`, event?.properties?.watch_parameters?.max_wind_surface, !isExpired),
50
+ line(`Max Tops (x100 feet):`, event?.properties?.watch_parameters?.max_tops_x100feet, !isExpired),
51
+ line(`Sender:`, event?.properties?.geocode?.office?.name ? `${event?.properties?.geocode?.office?.name} (${event?.properties?.geocode?.office?.office})` : event?.properties?.geocode?.office?.office),
52
+ line(`Tracking:`, event?.properties?.metadata?.tracking),
53
+ ].filter(Boolean).join('\n');
54
+ }
@@ -26,7 +26,12 @@ export type TypeListener = {
26
26
  title: string
27
27
  message: string
28
28
  }
29
+ notify?: {
30
+ enabled: boolean
31
+ topic: string
32
+ }
29
33
  uploads?: {
30
34
  file?: boolean, eas?: boolean, event?: boolean
31
35
  }
36
+
32
37
  }
@@ -54,6 +54,15 @@ export type TypeSettings = {
54
54
  BroadcastifyDatabase: string
55
55
  BroadcastifyTags: string[]
56
56
  },
57
+ NotifyServer: {
58
+ Enabled: boolean
59
+ Server: string
60
+ Attachments?: string
61
+ Credentials?: {
62
+ Username: string | void
63
+ Password: string | void
64
+ }
65
+ }
57
66
  GlobalSettings: {
58
67
  EventManagement: boolean
59
68
  BetterEventNames: boolean
package/src/bootstrap.ts CHANGED
@@ -21,7 +21,7 @@ import path from 'path'
21
21
  import { EventEmitter } from 'node:events';
22
22
 
23
23
  export const bootstrap = {
24
- version: `3.0.52`,
24
+ version: `3.0.53`,
25
25
  isReady: true,
26
26
  ratelimits: {},
27
27
  session_xmpp: null,
@@ -80,6 +80,15 @@ export const bootstrap = {
80
80
  BroadcastifyDatabase: `https://scriptkitty.cafe/ftp/@atmosphericx/assets/broadcastify.json`,
81
81
  BroadcastifyTags: [`Ham`, `Air`, `Fire`, `Public Safety`, `Weather`, `EMS`, `Police`, `Rail`]
82
82
  },
83
+ NotifyServer: {
84
+ Enabled: false,
85
+ Server: `https://ntfy.sh`,
86
+ Attachments: null,
87
+ Credentials: {
88
+ Username: null,
89
+ Password: null
90
+ }
91
+ },
83
92
  ListenerSettings: [],
84
93
  GlobalSettings: {
85
94
  EventManagement: true,
@@ -34,6 +34,15 @@ const Client = new Manager({
34
34
  BroadcastifyAttachments: true,
35
35
  BroadcastifyTags: [`Public Safety`, `Amateur Radio`, `Other`, `Rail`, `Aviation`, `Marine`, `Disaster Event`, `Special Event`]
36
36
  },
37
+ NotifyServer: {
38
+ Enabled: false,
39
+ Server: "https://ntfy.domainname.com",
40
+ Attachments: "https://domainname.com/Storage/EasScenarios",
41
+ Credentials: {
42
+ Username: "username",
43
+ Password: "password"
44
+ }
45
+ },
37
46
  ListenerSettings: [
38
47
  {
39
48
  events: [`*Thunderstorm Warning*`, `* Watch`],
@@ -44,6 +53,10 @@ const Client = new Manager({
44
53
  message: "<@&XXXXXXXXXXXXXXXXXXXXX>",
45
54
  ratelimit: 1
46
55
  },
56
+ notify: {
57
+ enabled: false,
58
+ topic: "thunderstorm_events",
59
+ },
47
60
  uploads: {
48
61
  eas: true,
49
62
  file: true,
@@ -69,7 +82,7 @@ const Client = new Manager({
69
82
  "*Tsunami*", "*Hurricane*", "*Tropical Storm*", "*Special Marine*",
70
83
  "*Flash Flood Warning*", "*Flash Flood Watch*", "*Flash Flood Advisory*",
71
84
  "Mesoscale Discussion",
72
- "SPC Day 1 Outlook", "SPC Day 2 Outlook", "SPC Day 3 Outlook",
85
+ "*Storm Prediction Center*",
73
86
  "PDS Tornado Watch", "Tornado Watch", "Severe Thunderstorm Watch", "Flash Flood Watch", "PDS Severe Thunderstorm Watch",
74
87
  "*Administrative*", "National Weather Service Policy",
75
88
  "Fire Weather Warning", "Fire Weather Watch", "Fire Weather Advisory",
File without changes
File without changes
File without changes