@atmosx/event-product-parser 2.0.15 → 2.0.16
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/dist/cjs/index.cjs +14 -9
- package/dist/esm/index.mjs +14 -9
- package/package.json +1 -2
- package/src/@submodules/database.ts +3 -2
- package/src/@submodules/utils.ts +12 -5
- package/src/bootstrap.ts +1 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -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"));
|
|
@@ -4766,7 +4765,6 @@ var packages = {
|
|
|
4766
4765
|
xml2js,
|
|
4767
4766
|
sqlite3: import_better_sqlite3.default,
|
|
4768
4767
|
jobs,
|
|
4769
|
-
axios: import_axios.default,
|
|
4770
4768
|
crypto: import_crypto.default,
|
|
4771
4769
|
os: import_os.default,
|
|
4772
4770
|
say: import_say.default,
|
|
@@ -6445,9 +6443,10 @@ var Database = class {
|
|
|
6445
6443
|
const name = shape.name;
|
|
6446
6444
|
const type = shape.id;
|
|
6447
6445
|
const link = shape.link;
|
|
6448
|
-
const response2 = yield
|
|
6446
|
+
const response2 = yield fetch(link);
|
|
6447
|
+
const arrayBuffer = yield response2.arrayBuffer();
|
|
6449
6448
|
const zip = new packages.jszip();
|
|
6450
|
-
const content = yield zip.loadAsync(
|
|
6449
|
+
const content = yield zip.loadAsync(arrayBuffer);
|
|
6451
6450
|
const dirPath = path2.resolve(__dirname, "../../shapefiles");
|
|
6452
6451
|
if (!fs2.existsSync(dirPath)) fs2.mkdirSync(dirPath);
|
|
6453
6452
|
for (const fileName of Object.keys(content.files)) {
|
|
@@ -6772,13 +6771,19 @@ var Utils = class _Utils {
|
|
|
6772
6771
|
headers: __spreadValues(__spreadValues({}, defaultOptions.headers), (_a = options == null ? void 0 : options.headers) != null ? _a : {})
|
|
6773
6772
|
});
|
|
6774
6773
|
try {
|
|
6775
|
-
const
|
|
6774
|
+
const controller = new AbortController();
|
|
6775
|
+
const timeoutId = setTimeout(() => controller.abort(), requestOptions.timeout);
|
|
6776
|
+
const resp = yield fetch(url, {
|
|
6776
6777
|
headers: requestOptions.headers,
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
validateStatus: (status2) => status2 === 200 || status2 === 500
|
|
6778
|
+
signal: controller.signal,
|
|
6779
|
+
redirect: "manual"
|
|
6780
6780
|
});
|
|
6781
|
-
|
|
6781
|
+
clearTimeout(timeoutId);
|
|
6782
|
+
if (resp.status !== 200 && resp.status !== 500) {
|
|
6783
|
+
throw new Error(`HTTP Error: ${resp.status}`);
|
|
6784
|
+
}
|
|
6785
|
+
const data = yield resp.json();
|
|
6786
|
+
return { error: false, message: data };
|
|
6782
6787
|
} catch (err) {
|
|
6783
6788
|
const msg = err instanceof Error ? err.message : String(err);
|
|
6784
6789
|
return { error: true, message: msg };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -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";
|
|
@@ -4754,7 +4753,6 @@ var packages = {
|
|
|
4754
4753
|
xml2js,
|
|
4755
4754
|
sqlite3,
|
|
4756
4755
|
jobs,
|
|
4757
|
-
axios,
|
|
4758
4756
|
crypto: crypto2,
|
|
4759
4757
|
os,
|
|
4760
4758
|
say,
|
|
@@ -6433,9 +6431,10 @@ var Database = class {
|
|
|
6433
6431
|
const name = shape.name;
|
|
6434
6432
|
const type = shape.id;
|
|
6435
6433
|
const link = shape.link;
|
|
6436
|
-
const response2 = yield
|
|
6434
|
+
const response2 = yield fetch(link);
|
|
6435
|
+
const arrayBuffer = yield response2.arrayBuffer();
|
|
6437
6436
|
const zip = new packages.jszip();
|
|
6438
|
-
const content = yield zip.loadAsync(
|
|
6437
|
+
const content = yield zip.loadAsync(arrayBuffer);
|
|
6439
6438
|
const dirPath = path2.resolve(__dirname, "../../shapefiles");
|
|
6440
6439
|
if (!fs2.existsSync(dirPath)) fs2.mkdirSync(dirPath);
|
|
6441
6440
|
for (const fileName of Object.keys(content.files)) {
|
|
@@ -6760,13 +6759,19 @@ var Utils = class _Utils {
|
|
|
6760
6759
|
headers: __spreadValues(__spreadValues({}, defaultOptions.headers), (_a = options == null ? void 0 : options.headers) != null ? _a : {})
|
|
6761
6760
|
});
|
|
6762
6761
|
try {
|
|
6763
|
-
const
|
|
6762
|
+
const controller = new AbortController();
|
|
6763
|
+
const timeoutId = setTimeout(() => controller.abort(), requestOptions.timeout);
|
|
6764
|
+
const resp = yield fetch(url, {
|
|
6764
6765
|
headers: requestOptions.headers,
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
validateStatus: (status2) => status2 === 200 || status2 === 500
|
|
6766
|
+
signal: controller.signal,
|
|
6767
|
+
redirect: "manual"
|
|
6768
6768
|
});
|
|
6769
|
-
|
|
6769
|
+
clearTimeout(timeoutId);
|
|
6770
|
+
if (resp.status !== 200 && resp.status !== 500) {
|
|
6771
|
+
throw new Error(`HTTP Error: ${resp.status}`);
|
|
6772
|
+
}
|
|
6773
|
+
const data = yield resp.json();
|
|
6774
|
+
return { error: false, message: data };
|
|
6770
6775
|
} catch (err) {
|
|
6771
6776
|
const msg = err instanceof Error ? err.message : String(err);
|
|
6772
6777
|
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.
|
|
3
|
+
"version": "2.0.016",
|
|
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",
|
|
@@ -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
|
|
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(
|
|
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)) {
|
package/src/@submodules/utils.ts
CHANGED
|
@@ -112,13 +112,20 @@ export class Utils {
|
|
|
112
112
|
headers: { ...defaultOptions.headers, ...(options?.headers ?? {}) }
|
|
113
113
|
};
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
validateStatus: (status) => status === 200 || status === 500
|
|
119
|
+
signal: controller.signal,
|
|
120
|
+
redirect: 'manual'
|
|
120
121
|
});
|
|
121
|
-
|
|
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,
|
|
39
|
+
shapefile, xml2js, sqlite3, jobs,
|
|
41
40
|
crypto, os, say, child, polygonClipping, jszip
|
|
42
41
|
};
|
|
43
42
|
|