@atmosx/event-product-parser 2.0.15 → 2.0.17

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.
@@ -3890,7 +3890,6 @@ var xml2js = __toESM(require("xml2js"));
3890
3890
  var jobs = __toESM(require("croner"));
3891
3891
  var polygonClipping = __toESM(require("polygon-clipping"));
3892
3892
  var import_better_sqlite3 = __toESM(require("better-sqlite3"));
3893
- var import_axios = __toESM(require("axios"));
3894
3893
  var import_crypto = __toESM(require("crypto"));
3895
3894
  var import_os = __toESM(require("os"));
3896
3895
  var import_say = __toESM(require("say"));
@@ -3963,11 +3962,6 @@ var events = {
3963
3962
  };
3964
3963
  var offshore = {
3965
3964
  "Special Weather Statement": "Special Weather Statement",
3966
- "Hurricane Warning": "Hurricane Warning",
3967
- "Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
3968
- "Hurricane Watch": "Hurricane Watch",
3969
- "Tropical Storm Warning": "Tropical Storm Warning",
3970
- "Tropical Storm Watch": "Tropical Storm Watch",
3971
3965
  "High Wind Warning": "High Wind Warning",
3972
3966
  "Gale Warning": "Gale Warning",
3973
3967
  "Small Craft Advisory": "Small Craft Advisory",
@@ -4766,7 +4760,6 @@ var packages = {
4766
4760
  xml2js,
4767
4761
  sqlite3: import_better_sqlite3.default,
4768
4762
  jobs,
4769
- axios: import_axios.default,
4770
4763
  crypto: import_crypto.default,
4771
4764
  os: import_os.default,
4772
4765
  say: import_say.default,
@@ -4867,6 +4860,15 @@ var definitions = {
4867
4860
  { "Special Marine Warning": {
4868
4861
  "Tornadic Special Marine Warning": { condition: (tornadoThreatTag) => tornadoThreatTag === "POSSIBLE" }
4869
4862
  } },
4863
+ { "Snow Squall Warning": {
4864
+ "Significant Snow Squall Warning": { condition: (damageThreatTag) => damageThreatTag === "SIGNIFICANT" }
4865
+ } },
4866
+ { "Blizzard Warning": {
4867
+ "PDS Blizzard Warning": { description: "particularly dangerous situation" }
4868
+ } },
4869
+ { "Ice Storm Warning": {
4870
+ "PDS Ice Storm Warning": { description: "particularly dangerous situation" }
4871
+ } },
4870
4872
  { "Tornado Watch": {
4871
4873
  "PDS Tornado Watch": { description: "particularly dangerous situation" }
4872
4874
  } },
@@ -6445,9 +6447,10 @@ var Database = class {
6445
6447
  const name = shape.name;
6446
6448
  const type = shape.id;
6447
6449
  const link = shape.link;
6448
- const response2 = yield packages.axios.get(link, { responseType: "arraybuffer" });
6450
+ const response2 = yield fetch(link);
6451
+ const arrayBuffer = yield response2.arrayBuffer();
6449
6452
  const zip = new packages.jszip();
6450
- const content = yield zip.loadAsync(response2.data);
6453
+ const content = yield zip.loadAsync(arrayBuffer);
6451
6454
  const dirPath = path2.resolve(__dirname, "../../shapefiles");
6452
6455
  if (!fs2.existsSync(dirPath)) fs2.mkdirSync(dirPath);
6453
6456
  for (const fileName of Object.keys(content.files)) {
@@ -6772,13 +6775,19 @@ var Utils = class _Utils {
6772
6775
  headers: __spreadValues(__spreadValues({}, defaultOptions.headers), (_a = options == null ? void 0 : options.headers) != null ? _a : {})
6773
6776
  });
6774
6777
  try {
6775
- const resp = yield packages.axios.get(url, {
6778
+ const controller = new AbortController();
6779
+ const timeoutId = setTimeout(() => controller.abort(), requestOptions.timeout);
6780
+ const resp = yield fetch(url, {
6776
6781
  headers: requestOptions.headers,
6777
- timeout: requestOptions.timeout,
6778
- maxRedirects: 0,
6779
- validateStatus: (status2) => status2 === 200 || status2 === 500
6782
+ signal: controller.signal,
6783
+ redirect: "manual"
6780
6784
  });
6781
- return { error: false, message: resp.data };
6785
+ clearTimeout(timeoutId);
6786
+ if (resp.status !== 200 && resp.status !== 500) {
6787
+ throw new Error(`HTTP Error: ${resp.status}`);
6788
+ }
6789
+ const data = yield resp.json();
6790
+ return { error: false, message: data };
6782
6791
  } catch (err) {
6783
6792
  const msg = err instanceof Error ? err.message : String(err);
6784
6793
  return { error: true, message: msg };
@@ -3878,7 +3878,6 @@ import * as xml2js from "xml2js";
3878
3878
  import * as jobs from "croner";
3879
3879
  import * as polygonClipping from "polygon-clipping";
3880
3880
  import sqlite3 from "better-sqlite3";
3881
- import axios from "axios";
3882
3881
  import crypto2 from "crypto";
3883
3882
  import os from "os";
3884
3883
  import say from "say";
@@ -3951,11 +3950,6 @@ var events = {
3951
3950
  };
3952
3951
  var offshore = {
3953
3952
  "Special Weather Statement": "Special Weather Statement",
3954
- "Hurricane Warning": "Hurricane Warning",
3955
- "Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
3956
- "Hurricane Watch": "Hurricane Watch",
3957
- "Tropical Storm Warning": "Tropical Storm Warning",
3958
- "Tropical Storm Watch": "Tropical Storm Watch",
3959
3953
  "High Wind Warning": "High Wind Warning",
3960
3954
  "Gale Warning": "Gale Warning",
3961
3955
  "Small Craft Advisory": "Small Craft Advisory",
@@ -4754,7 +4748,6 @@ var packages = {
4754
4748
  xml2js,
4755
4749
  sqlite3,
4756
4750
  jobs,
4757
- axios,
4758
4751
  crypto: crypto2,
4759
4752
  os,
4760
4753
  say,
@@ -4855,6 +4848,15 @@ var definitions = {
4855
4848
  { "Special Marine Warning": {
4856
4849
  "Tornadic Special Marine Warning": { condition: (tornadoThreatTag) => tornadoThreatTag === "POSSIBLE" }
4857
4850
  } },
4851
+ { "Snow Squall Warning": {
4852
+ "Significant Snow Squall Warning": { condition: (damageThreatTag) => damageThreatTag === "SIGNIFICANT" }
4853
+ } },
4854
+ { "Blizzard Warning": {
4855
+ "PDS Blizzard Warning": { description: "particularly dangerous situation" }
4856
+ } },
4857
+ { "Ice Storm Warning": {
4858
+ "PDS Ice Storm Warning": { description: "particularly dangerous situation" }
4859
+ } },
4858
4860
  { "Tornado Watch": {
4859
4861
  "PDS Tornado Watch": { description: "particularly dangerous situation" }
4860
4862
  } },
@@ -6433,9 +6435,10 @@ var Database = class {
6433
6435
  const name = shape.name;
6434
6436
  const type = shape.id;
6435
6437
  const link = shape.link;
6436
- const response2 = yield packages.axios.get(link, { responseType: "arraybuffer" });
6438
+ const response2 = yield fetch(link);
6439
+ const arrayBuffer = yield response2.arrayBuffer();
6437
6440
  const zip = new packages.jszip();
6438
- const content = yield zip.loadAsync(response2.data);
6441
+ const content = yield zip.loadAsync(arrayBuffer);
6439
6442
  const dirPath = path2.resolve(__dirname, "../../shapefiles");
6440
6443
  if (!fs2.existsSync(dirPath)) fs2.mkdirSync(dirPath);
6441
6444
  for (const fileName of Object.keys(content.files)) {
@@ -6760,13 +6763,19 @@ var Utils = class _Utils {
6760
6763
  headers: __spreadValues(__spreadValues({}, defaultOptions.headers), (_a = options == null ? void 0 : options.headers) != null ? _a : {})
6761
6764
  });
6762
6765
  try {
6763
- const resp = yield packages.axios.get(url, {
6766
+ const controller = new AbortController();
6767
+ const timeoutId = setTimeout(() => controller.abort(), requestOptions.timeout);
6768
+ const resp = yield fetch(url, {
6764
6769
  headers: requestOptions.headers,
6765
- timeout: requestOptions.timeout,
6766
- maxRedirects: 0,
6767
- validateStatus: (status2) => status2 === 200 || status2 === 500
6770
+ signal: controller.signal,
6771
+ redirect: "manual"
6768
6772
  });
6769
- return { error: false, message: resp.data };
6773
+ clearTimeout(timeoutId);
6774
+ if (resp.status !== 200 && resp.status !== 500) {
6775
+ throw new Error(`HTTP Error: ${resp.status}`);
6776
+ }
6777
+ const data = yield resp.json();
6778
+ return { error: false, message: data };
6770
6779
  } catch (err) {
6771
6780
  const msg = err instanceof Error ? err.message : String(err);
6772
6781
  return { error: true, message: msg };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atmosx/event-product-parser",
3
- "version": "2.0.015",
3
+ "version": "2.0.017",
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",
@@ -33,7 +33,6 @@
33
33
  "homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
34
34
  "dependencies": {
35
35
  "@xmpp/client": "0.14.0",
36
- "axios": "1.13.2",
37
36
  "better-sqlite3": "11.10.0",
38
37
  "croner": "10.0.1",
39
38
  "jszip": "3.10.1",
@@ -77,11 +77,6 @@ export const events: Record<string, string> = {
77
77
 
78
78
  export const offshore: Record<string, string> = {
79
79
  "Special Weather Statement": "Special Weather Statement",
80
- "Hurricane Warning": "Hurricane Warning",
81
- "Hurricane Force Wind Warning": "Hurricane Force Wind Warning",
82
- "Hurricane Watch": "Hurricane Watch",
83
- "Tropical Storm Warning": "Tropical Storm Warning",
84
- "Tropical Storm Watch": "Tropical Storm Watch",
85
80
  "High Wind Warning": "High Wind Warning",
86
81
  "Gale Warning": "Gale Warning",
87
82
  "Small Craft Advisory": "Small Craft Advisory",
@@ -100,9 +100,10 @@ export class Database {
100
100
  const name = shape.name;
101
101
  const type = shape.id;
102
102
  const link = shape.link;
103
- const response = await loader.packages.axios.get(link, { responseType: 'arraybuffer' });
103
+ const response = await fetch(link);
104
+ const arrayBuffer = await response.arrayBuffer();
104
105
  const zip = new loader.packages.jszip();
105
- const content = await zip.loadAsync(response.data);
106
+ const content = await zip.loadAsync(arrayBuffer);
106
107
  const dirPath = path.resolve(__dirname, '../../shapefiles');
107
108
  if (!fs.existsSync(dirPath)) fs.mkdirSync(dirPath);
108
109
  for (const fileName of Object.keys(content.files)) {
@@ -112,13 +112,20 @@ export class Utils {
112
112
  headers: { ...defaultOptions.headers, ...(options?.headers ?? {}) }
113
113
  };
114
114
  try {
115
- const resp = await loader.packages.axios.get<T>(url, {
115
+ const controller = new AbortController();
116
+ const timeoutId = setTimeout(() => controller.abort(), requestOptions.timeout);
117
+ const resp = await fetch(url, {
116
118
  headers: requestOptions.headers,
117
- timeout: requestOptions.timeout,
118
- maxRedirects: 0,
119
- validateStatus: (status) => status === 200 || status === 500
119
+ signal: controller.signal,
120
+ redirect: 'manual'
120
121
  });
121
- return { error: false, message: resp.data };
122
+ clearTimeout(timeoutId);
123
+ if (resp.status !== 200 && resp.status !== 500) {
124
+ throw new Error(`HTTP Error: ${resp.status}`);
125
+ }
126
+
127
+ const data = await resp.json() as T;
128
+ return { error: false, message: data };
122
129
  } catch (err: unknown) {
123
130
  const msg = err instanceof Error ? err.message : String(err);
124
131
  return { error: true, message: msg };
package/src/bootstrap.ts CHANGED
@@ -20,7 +20,6 @@ import * as xml2js from 'xml2js';
20
20
  import * as jobs from 'croner';
21
21
  import * as polygonClipping from 'polygon-clipping';
22
22
  import sqlite3 from 'better-sqlite3';
23
- import axios from 'axios';
24
23
  import crypto from 'crypto';
25
24
  import os from 'os';
26
25
  import say from 'say';
@@ -37,7 +36,7 @@ import * as dictICAOs from './@dictionaries/icao';
37
36
 
38
37
  export const packages = {
39
38
  fs, path, events, xmpp,
40
- shapefile, xml2js, sqlite3, jobs, axios,
39
+ shapefile, xml2js, sqlite3, jobs,
41
40
  crypto, os, say, child, polygonClipping, jszip
42
41
  };
43
42
 
@@ -137,6 +136,15 @@ export const definitions = {
137
136
  {"Special Marine Warning": {
138
137
  "Tornadic Special Marine Warning": {condition: (tornadoThreatTag: string) => tornadoThreatTag === 'POSSIBLE'},
139
138
  }},
139
+ {"Snow Squall Warning": {
140
+ "Significant Snow Squall Warning": { condition: (damageThreatTag: string) => damageThreatTag === 'SIGNIFICANT'},
141
+ }},
142
+ {"Blizzard Warning": {
143
+ "PDS Blizzard Warning": { description: "particularly dangerous situation" },
144
+ }},
145
+ {"Ice Storm Warning": {
146
+ "PDS Ice Storm Warning": { description: "particularly dangerous situation" },
147
+ }},
140
148
  {"Tornado Watch": {
141
149
  "PDS Tornado Watch": { description: "particularly dangerous situation"}
142
150
  }},