atmosx-nwws-parser 1.0.191 → 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.
Files changed (84) hide show
  1. package/README.md +3 -87
  2. package/dist/cjs/bootstrap.cjs +1000 -0
  3. package/dist/cjs/database.cjs +1105 -0
  4. package/dist/cjs/dictionaries/awips.cjs +370 -0
  5. package/dist/cjs/dictionaries/events.cjs +139 -0
  6. package/dist/cjs/dictionaries/icao.cjs +265 -0
  7. package/dist/cjs/dictionaries/offshore.cjs +40 -0
  8. package/dist/cjs/dictionaries/signatures.cjs +132 -0
  9. package/dist/cjs/eas.cjs +2851 -0
  10. package/dist/cjs/helper.cjs +3008 -0
  11. package/dist/cjs/parsers/events.cjs +2851 -0
  12. package/dist/cjs/parsers/stanza.cjs +1099 -0
  13. package/dist/cjs/parsers/text.cjs +1133 -0
  14. package/dist/cjs/parsers/types/api.cjs +2851 -0
  15. package/dist/cjs/parsers/types/cap.cjs +2851 -0
  16. package/dist/cjs/parsers/types/text.cjs +2851 -0
  17. package/dist/cjs/parsers/types/ugc.cjs +2851 -0
  18. package/dist/cjs/parsers/types/vtec.cjs +2851 -0
  19. package/dist/cjs/parsers/ugc.cjs +1130 -0
  20. package/dist/cjs/parsers/vtec.cjs +1051 -0
  21. package/dist/cjs/types.cjs +17 -0
  22. package/dist/cjs/utils.cjs +2851 -0
  23. package/dist/cjs/xmpp.cjs +2851 -0
  24. package/dist/esm/bootstrap.mjs +963 -0
  25. package/dist/esm/database.mjs +1070 -0
  26. package/dist/esm/dictionaries/awips.mjs +346 -0
  27. package/dist/esm/dictionaries/events.mjs +111 -0
  28. package/dist/esm/dictionaries/icao.mjs +241 -0
  29. package/dist/esm/dictionaries/offshore.mjs +16 -0
  30. package/dist/esm/dictionaries/signatures.mjs +106 -0
  31. package/dist/esm/eas.mjs +2818 -0
  32. package/dist/esm/helper.mjs +2968 -0
  33. package/dist/esm/parsers/events.mjs +2818 -0
  34. package/dist/esm/parsers/stanza.mjs +1063 -0
  35. package/dist/esm/parsers/text.mjs +1097 -0
  36. package/dist/esm/parsers/types/api.mjs +2818 -0
  37. package/dist/esm/parsers/types/cap.mjs +2818 -0
  38. package/dist/esm/parsers/types/text.mjs +2818 -0
  39. package/dist/esm/parsers/types/ugc.mjs +2818 -0
  40. package/dist/esm/parsers/types/vtec.mjs +2818 -0
  41. package/dist/esm/parsers/ugc.mjs +1095 -0
  42. package/dist/esm/parsers/vtec.mjs +1016 -0
  43. package/dist/esm/types.mjs +0 -0
  44. package/dist/esm/utils.mjs +2818 -0
  45. package/dist/esm/xmpp.mjs +2818 -0
  46. package/package.json +47 -37
  47. package/src/bootstrap.ts +171 -0
  48. package/src/database.ts +99 -0
  49. package/src/dictionaries/awips.ts +342 -0
  50. package/src/dictionaries/events.ts +109 -0
  51. package/src/dictionaries/icao.ts +237 -0
  52. package/src/dictionaries/offshore.ts +12 -0
  53. package/src/dictionaries/signatures.ts +103 -0
  54. package/src/eas.ts +428 -0
  55. package/src/helper.ts +132 -263
  56. package/src/parsers/events.ts +289 -0
  57. package/src/parsers/stanza.ts +103 -0
  58. package/src/parsers/text.ts +167 -0
  59. package/src/parsers/types/api.ts +94 -0
  60. package/src/parsers/types/cap.ts +89 -0
  61. package/src/parsers/types/text.ts +54 -0
  62. package/src/parsers/types/ugc.ts +85 -0
  63. package/src/parsers/types/vtec.ts +60 -0
  64. package/src/parsers/ugc.ts +148 -0
  65. package/src/parsers/vtec.ts +66 -0
  66. package/src/types.ts +187 -0
  67. package/src/utils.ts +217 -0
  68. package/src/xmpp.ts +123 -0
  69. package/test.js +1 -41
  70. package/tsconfig.json +12 -5
  71. package/tsup.config.ts +11 -0
  72. package/bootstrap.ts +0 -122
  73. package/dist/bootstrap.js +0 -153
  74. package/dist/src/events.js +0 -585
  75. package/dist/src/helper.js +0 -463
  76. package/dist/src/stanza.js +0 -147
  77. package/dist/src/text-parser.js +0 -119
  78. package/dist/src/ugc.js +0 -214
  79. package/dist/src/vtec.js +0 -125
  80. package/src/events.ts +0 -394
  81. package/src/stanza.ts +0 -102
  82. package/src/text-parser.ts +0 -120
  83. package/src/ugc.ts +0 -122
  84. package/src/vtec.ts +0 -99
package/README.md CHANGED
@@ -1,90 +1,6 @@
1
- # AtmosphericX - NOAA Weather Wire Service Parser
1
+ # AtmosphericX - NOAA Weather Wire & NWS API Parser
2
2
 
3
3
 
4
- This repository contains the primary parser for AtmosphericX's NOAA Weather Wire Service parser. 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](https://github.com/k3yomi/AtmosphericX).
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
- ## Installation Guide
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`); // CJS
16
- import * as AtmosXWireParser from `atmosx-nwws-parser`; // ESM
17
- ```
18
-
19
- ## Configuration and Initialization
20
-
21
- 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:
22
-
23
- ```js
24
- let Client = new AtmosXWireParser.Parser({
25
- alertSettings: {
26
- onlyCap: false, // Set to true to only receive CAP messages only
27
- betterEvents: true, // Set to true to receive better event handling
28
- ugcPolygons: false, // Set to true to receive UGC Polygons instead of reading from raw products.
29
- expiryCheck: true, // Set to true to check for expired alerts and remove them from the list
30
- filteredAlerts: [] // Alerts you want to only log, leave empty to receive all alerts (Ex. ["Tornado Warning", "Radar Indicated Tornado Warning"])
31
- },
32
- xmpp: {
33
- reconnect: true, // Set to true to enable automatic reconnection if you lose connection
34
- reconnectInterval: 60, // Interval in seconds to attempt reconnection
35
- },
36
- cacheSettings: {
37
- maxMegabytes: 2, // Maximum cache size in megabytes
38
- readCache: false, // Set to true if you wish to reupload the cache from earlier (Now supports reading from CAP, SPS, and Alerts)
39
- cacheDir: `./cache`, // Directory for cache files
40
- },
41
- authentication: {
42
- username: `USERNAME_HERE`, // Your XMPP username
43
- password: `PASSWORD_HERE`, // Your XMPP password
44
- display: `DISPLAY_NAME` // Display name for your XMPP client
45
- },
46
- 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.)
47
- });
48
- ```
49
-
50
-
51
- ## Event Handling
52
-
53
- You can handle various events emitted by the parser. Here are some examples:
54
-
55
- ```js
56
- Client.onEvent(`onAlert`, (alerts: Array) => {});
57
- Client.onEvent(`onStormReport`, (report: Object) => {});
58
- Client.onEvent(`onMesoscaleDiscussion`, (discussion: Object) => {});
59
- Client.onEvent(`onMessage`, (stanza: Object) => {});
60
- Client.onEvent(`onOccupant`, (occupant: Object) => {});
61
- Client.onEvent(`onError`, (error: Object) => {});
62
- Client.onEvent(`onReconnect`, (service: Object) => {});
63
-
64
- ```
65
-
66
- ## Functions and Methods
67
- You can also use various functions provided by the parser. Here are some examples:
68
-
69
- ```js
70
- // Function to set the display name of the XMPP client (Will only set upon reconnect)
71
- Client.setDisplayName(displayName: String);
72
- ```
73
-
74
- ```js
75
- // Function to manually trigger the cache initialization (Usually called automatically on startup if readCache is true)
76
- Client.initalizeCache()
77
- ```
78
-
79
- ## Error Handling
80
- The parser can emit various errors. Here are some common errors you might encounter:
81
-
82
- **error-database-not-configured**: This error occurs when the database is not configured properly. Please set the database path in the constructor.
83
-
84
- **error-reconnecting-too-fast**: This error occurs when the client is attempting to reconnect too fast. Please wait a few seconds before trying again.
85
-
86
- **error-connection-lost**: This error occurs when the connection to the XMPP server has been lost. Please try reconnecting manually as the automatic reconnect feature is not setup for offline halt conditions.
87
-
88
-
89
- ## Credits
90
- 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...