atmosx-nwws-parser 1.0.185 → 1.0.201
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 +3 -86
- package/dist/cjs/bootstrap.cjs +1000 -0
- package/dist/cjs/database.cjs +1105 -0
- package/dist/cjs/dictionaries/awips.cjs +370 -0
- package/dist/cjs/dictionaries/events.cjs +139 -0
- package/dist/cjs/dictionaries/icao.cjs +265 -0
- package/dist/cjs/dictionaries/offshore.cjs +40 -0
- package/dist/cjs/dictionaries/signatures.cjs +132 -0
- package/dist/cjs/eas.cjs +2851 -0
- package/dist/cjs/helper.cjs +3008 -0
- package/dist/cjs/parsers/events.cjs +2851 -0
- package/dist/cjs/parsers/stanza.cjs +1099 -0
- package/dist/cjs/parsers/text.cjs +1133 -0
- package/dist/cjs/parsers/types/api.cjs +2851 -0
- package/dist/cjs/parsers/types/cap.cjs +2851 -0
- package/dist/cjs/parsers/types/text.cjs +2851 -0
- package/dist/cjs/parsers/types/ugc.cjs +2851 -0
- package/dist/cjs/parsers/types/vtec.cjs +2851 -0
- package/dist/cjs/parsers/ugc.cjs +1130 -0
- package/dist/cjs/parsers/vtec.cjs +1051 -0
- package/dist/cjs/types.cjs +17 -0
- package/dist/cjs/utils.cjs +2851 -0
- package/dist/cjs/xmpp.cjs +2851 -0
- package/dist/esm/bootstrap.mjs +963 -0
- package/dist/esm/database.mjs +1070 -0
- package/dist/esm/dictionaries/awips.mjs +346 -0
- package/dist/esm/dictionaries/events.mjs +111 -0
- package/dist/esm/dictionaries/icao.mjs +241 -0
- package/dist/esm/dictionaries/offshore.mjs +16 -0
- package/dist/esm/dictionaries/signatures.mjs +106 -0
- package/dist/esm/eas.mjs +2818 -0
- package/dist/esm/helper.mjs +2968 -0
- package/dist/esm/parsers/events.mjs +2818 -0
- package/dist/esm/parsers/stanza.mjs +1063 -0
- package/dist/esm/parsers/text.mjs +1097 -0
- package/dist/esm/parsers/types/api.mjs +2818 -0
- package/dist/esm/parsers/types/cap.mjs +2818 -0
- package/dist/esm/parsers/types/text.mjs +2818 -0
- package/dist/esm/parsers/types/ugc.mjs +2818 -0
- package/dist/esm/parsers/types/vtec.mjs +2818 -0
- package/dist/esm/parsers/ugc.mjs +1095 -0
- package/dist/esm/parsers/vtec.mjs +1016 -0
- package/dist/esm/types.mjs +0 -0
- package/dist/esm/utils.mjs +2818 -0
- package/dist/esm/xmpp.mjs +2818 -0
- package/package.json +47 -29
- package/src/bootstrap.ts +171 -0
- package/src/database.ts +99 -0
- package/src/dictionaries/awips.ts +342 -0
- package/src/dictionaries/events.ts +109 -0
- package/src/dictionaries/icao.ts +237 -0
- package/src/dictionaries/offshore.ts +12 -0
- package/src/dictionaries/signatures.ts +103 -0
- package/src/eas.ts +428 -0
- package/src/helper.ts +167 -0
- package/src/parsers/events.ts +289 -0
- package/src/parsers/stanza.ts +103 -0
- package/src/parsers/text.ts +167 -0
- package/src/parsers/types/api.ts +94 -0
- package/src/parsers/types/cap.ts +89 -0
- package/src/parsers/types/text.ts +54 -0
- package/src/parsers/types/ugc.ts +85 -0
- package/src/parsers/types/vtec.ts +60 -0
- package/src/parsers/ugc.ts +148 -0
- package/src/parsers/vtec.ts +66 -0
- package/src/types.ts +187 -0
- package/src/utils.ts +217 -0
- package/src/xmpp.ts +123 -0
- package/test.js +1 -36
- package/tsconfig.json +14 -0
- package/tsup.config.ts +11 -0
- package/bootstrap.js +0 -112
- package/index.js +0 -264
- package/src/events.js +0 -339
- package/src/stanza.js +0 -105
- package/src/text.js +0 -108
- package/src/ugc.js +0 -115
- package/src/vtec.js +0 -89
package/README.md
CHANGED
|
@@ -1,89 +1,6 @@
|
|
|
1
|
-
# AtmosphericX - NOAA Weather Wire
|
|
1
|
+
# AtmosphericX - NOAA Weather Wire & NWS API Parser
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
This repository contains the
|
|
4
|
+
This repository contains the parsing of both NOAA Weather Wire Service and National Weather Service. It is designed to handle real time weather alerts and messages from the National Weather Service using XMPP. If you do not know basic programming, this parser is not for you. It is intended for developers who want to integrate alerts from NOAA Weather Wire easily into their applications or services without hassle. If you wish to use NWWS without programming, feel free to use our project where most of this code was used - AtmosphericX.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
To install this package, you can use **NPM** (Node Package Manager). Open your terminal and run the following command:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install atmosx-nwws-parser
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
```js
|
|
15
|
-
const AtmosXWireParser = require(`atmosx-nwws-parser`);
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Configuration and Initialization
|
|
19
|
-
|
|
20
|
-
There are several settings you can configure when intializing the parser. Below is the test.js example that shows some of the settings you can use:
|
|
21
|
-
|
|
22
|
-
```js
|
|
23
|
-
let Client = new AtmosXWireParser({
|
|
24
|
-
alertSettings: {
|
|
25
|
-
onlyCap: false, // Set to true to only receive CAP messages only
|
|
26
|
-
betterEvents: true, // Set to true to receive better event handling
|
|
27
|
-
ugcPolygons: false, // Set to true to receive UGC Polygons instead of reading from raw products.
|
|
28
|
-
expiryCheck: true, // Set to true to check for expired alerts and remove them from the list
|
|
29
|
-
filteredAlerts: [] // Alerts you want to only log, leave empty to receive all alerts (Ex. ["Tornado Warning", "Radar Indicated Tornado Warning"])
|
|
30
|
-
},
|
|
31
|
-
xmpp: {
|
|
32
|
-
reconnect: true, // Set to true to enable automatic reconnection if you lose connection
|
|
33
|
-
reconnectInterval: 60, // Interval in seconds to attempt reconnection
|
|
34
|
-
},
|
|
35
|
-
cacheSettings: {
|
|
36
|
-
maxMegabytes: 2, // Maximum cache size in megabytes
|
|
37
|
-
readCache: false, // Set to true if you wish to reupload the cache from earlier (Now supports reading from CAP, SPS, and Alerts)
|
|
38
|
-
cacheDir: `./cache`, // Directory for cache files
|
|
39
|
-
},
|
|
40
|
-
authentication: {
|
|
41
|
-
username: `USERNAME_HERE`, // Your XMPP username
|
|
42
|
-
password: `PASSWORD_HERE`, // Your XMPP password
|
|
43
|
-
display: `DISPLAY_NAME` // Display name for your XMPP client
|
|
44
|
-
},
|
|
45
|
-
database: `./database.db`, // Path to the SQLite database file (It will be created if it doesn't exist and will be used to store UGC counties and zones.)
|
|
46
|
-
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## Event Handling
|
|
51
|
-
|
|
52
|
-
You can handle various events emitted by the parser. Here are some examples:
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
Client.onEvent(`onAlert`, (alerts: Array) => {});
|
|
56
|
-
Client.onEvent(`onStormReport`, (report: Object) => {});
|
|
57
|
-
Client.onEvent(`onMesoscaleDiscussion`, (discussion: Object) => {});
|
|
58
|
-
Client.onEvent(`onMessage`, (stanza: Object) => {});
|
|
59
|
-
Client.onEvent(`onOccupant`, (occupant: Object) => {});
|
|
60
|
-
Client.onEvent(`onError`, (error: Object) => {});
|
|
61
|
-
Client.onEvent(`onReconnect`, (service: Object) => {});
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Functions and Methods
|
|
66
|
-
You can also use various functions provided by the parser. Here are some examples:
|
|
67
|
-
```js
|
|
68
|
-
// Debugging function to create your own alert manually
|
|
69
|
-
Client.forwardCustomStanza(stanza: String, attributes: Object);
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```js
|
|
73
|
-
// Function to set the display name of the XMPP client (Will only set upon reconnect)
|
|
74
|
-
Client.setDisplayName(displayName: String);
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
## Error Handling
|
|
78
|
-
The parser can emit various errors. Here are some common errors you might encounter:
|
|
79
|
-
|
|
80
|
-
**not-authorized**: This error occurs when the parser is not authorized to connect to the XMPP server. Ensure that your username and password are correct.
|
|
81
|
-
|
|
82
|
-
**unreachable-host**: This error indicates that the parser cannot reach the XMPP server. Check your internet connection and ensure that the server address is correct.
|
|
83
|
-
|
|
84
|
-
**service-error**: This error occurs when there is an issue with the XMPP service. It could be due to server maintenance or other issues. You can try reconnecting after some time.
|
|
85
|
-
|
|
86
|
-
**no-database-dir**: This error occurs when the database directory does not exist. Ensure that the directory specified in the `database` setting exists or create it before running the parser.
|
|
87
|
-
|
|
88
|
-
## Credits
|
|
89
|
-
This parser is developed and maintained by [K3YOMI](https://github.com/K3YOMI) and the AtmosphericX Team. It is open-source and available for contributions and improvements. If you find any issues or have suggestions, feel free to open an issue or submit a pull request in the repository.
|
|
6
|
+
TODO: Complete later...
|