@atmosx/event-product-parser 2.0.16 → 3.0.1

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 (136) hide show
  1. package/README.md +248 -187
  2. package/dist/cjs/index.cjs +12218 -3139
  3. package/dist/esm/index.mjs +12401 -3327
  4. package/dist/index.d.mts +235 -0
  5. package/dist/index.d.ts +235 -0
  6. package/package.json +6 -4
  7. package/src/@building/building.clean.ts +30 -0
  8. package/src/@building/building.create.ts +42 -0
  9. package/src/@building/building.enhance.ts +56 -0
  10. package/src/@building/building.geometry.ts +48 -0
  11. package/src/@building/building.headers.ts +37 -0
  12. package/src/@building/building.office.ts +43 -0
  13. package/src/@building/building.polygon.ts +71 -0
  14. package/src/@building/building.properties.ts +89 -0
  15. package/src/@building/building.signature.ts +61 -0
  16. package/src/@building/building.tags.ts +24 -0
  17. package/src/@building/building.tracking.ts +68 -0
  18. package/src/@building/building.validate.ts +147 -0
  19. package/src/@core/core.getEvents.ts +25 -0
  20. package/src/@core/core.getNodes.ts +25 -0
  21. package/src/@core/core.getRandomEvent.ts +25 -0
  22. package/src/@core/core.getVersion.ts +25 -0
  23. package/src/@core/core.listener.ts +24 -0
  24. package/src/@core/core.setNode.ts +81 -0
  25. package/src/@core/core.start.ts +59 -0
  26. package/src/@core/core.stop.ts +32 -0
  27. package/src/@dictionaries/dictionaries.betterEventNames.ts +89 -0
  28. package/src/@dictionaries/dictionaries.eventActions.ts +28 -0
  29. package/src/@dictionaries/{awips.ts → dictionaries.eventAwipAbreviations.ts} +13 -7
  30. package/src/@dictionaries/dictionaries.eventCancelMessages.ts +30 -0
  31. package/src/@dictionaries/dictionaries.eventCauses.ts +36 -0
  32. package/src/@dictionaries/dictionaries.eventProducts.ts +25 -0
  33. package/src/@dictionaries/dictionaries.eventRecords.ts +25 -0
  34. package/src/@dictionaries/dictionaries.eventSeverity.ts +27 -0
  35. package/src/@dictionaries/dictionaries.eventStatus.ts +31 -0
  36. package/src/@dictionaries/{signatures.ts → dictionaries.eventTags.ts} +13 -68
  37. package/src/@dictionaries/dictionaries.eventTypes.ts +82 -0
  38. package/src/@dictionaries/dictionaries.eventsOffshore.ts +31 -0
  39. package/src/@dictionaries/dictionaries.hailStrings.ts +33 -0
  40. package/src/@dictionaries/{icao.ts → dictionaries.officeICAOs.ts} +13 -6
  41. package/src/@dictionaries/dictionaries.regExp.ts +28 -0
  42. package/src/@dictionaries/dictionaries.shapefileLinks.ts +36 -0
  43. package/src/@dictionaries/dictionaries.statusCorrelationText.ts +40 -0
  44. package/src/@dictionaries/dictionaries.testSignatures.ts +24 -0
  45. package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +68 -0
  46. package/src/@events/events.api.ts +113 -0
  47. package/src/@events/events.text.ts +79 -0
  48. package/src/@events/events.ugc.ts +83 -0
  49. package/src/@events/events.vtec.ts +87 -0
  50. package/src/@manager/manager.mkEvent.ts +95 -0
  51. package/src/@manager/manager.rmEvent.ts +46 -0
  52. package/src/@manager/manager.setHash.ts +37 -0
  53. package/src/@manager/manager.updateNodes.ts +55 -0
  54. package/src/@manager/manager.updateWebhooks.ts +50 -0
  55. package/src/@modules/@database/database.cache.ts +48 -0
  56. package/src/@modules/@database/database.init.ts +45 -0
  57. package/src/@modules/@database/database.shapefiles.ts +96 -0
  58. package/src/@modules/@database/database.stanza.ts +48 -0
  59. package/src/@modules/@eas/eas.getFloatPCM16.ts +29 -0
  60. package/src/@modules/@eas/eas.getMergedPCM16.ts +32 -0
  61. package/src/@modules/@eas/eas.getPCM16.ts +52 -0
  62. package/src/@modules/@eas/eas.getPCMToFloat.ts +26 -0
  63. package/src/@modules/@eas/eas.getSampledPCM16.ts +36 -0
  64. package/src/@modules/@eas/eas.getWavPCM16.ts +52 -0
  65. package/src/@modules/@eas/eas.setAFSK.ts +52 -0
  66. package/src/@modules/@eas/eas.setAsciiToBits.ts +32 -0
  67. package/src/@modules/@eas/eas.setAttentionTone.ts +40 -0
  68. package/src/@modules/@eas/eas.setEasTone.ts +137 -0
  69. package/src/@modules/@eas/eas.setNoise.ts +31 -0
  70. package/src/@modules/@eas/eas.setRadioEffect.ts +49 -0
  71. package/src/@modules/@eas/eas.setSameHeader.ts +45 -0
  72. package/src/@modules/@stanza/stanza.getAwipsType.ts +46 -0
  73. package/src/@modules/@stanza/stanza.validate.ts +50 -0
  74. package/src/@modules/@utilities/utilities.createHttp.ts +85 -0
  75. package/src/@modules/@utilities/utilities.createWebhook.ts +100 -0
  76. package/src/@modules/@utilities/utilities.getFormattedTime.ts +43 -0
  77. package/src/@modules/@utilities/utilities.getSettings.ts +25 -0
  78. package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +114 -0
  79. package/src/@modules/@utilities/utilities.setCronSchedule.ts +65 -0
  80. package/src/@modules/@utilities/utilities.setEventEmit.ts +41 -0
  81. package/src/@modules/@utilities/utilities.setListener.ts +30 -0
  82. package/src/@modules/@utilities/utilities.setSettings.ts +42 -0
  83. package/src/@modules/@utilities/utilities.setSleep.ts +33 -0
  84. package/src/@modules/@utilities/utilities.setTimeoutAction.ts +59 -0
  85. package/src/@modules/@utilities/utilities.setWarning.ts +34 -0
  86. package/src/@modules/@xmpp/xmpp.xDeploy.ts +58 -0
  87. package/src/@modules/@xmpp/xmpp.xError.ts +29 -0
  88. package/src/@modules/@xmpp/xmpp.xOffline.ts +38 -0
  89. package/src/@modules/@xmpp/xmpp.xOnline.ts +45 -0
  90. package/src/@modules/@xmpp/xmpp.xReconnect.ts +64 -0
  91. package/src/@modules/@xmpp/xmpp.xStanza.ts +63 -0
  92. package/src/@parsers/@hvtec/hvtec.extract.ts +40 -0
  93. package/src/@parsers/@pvtec/pvtec.expires.ts +26 -0
  94. package/src/@parsers/@pvtec/pvtec.extract.ts +49 -0
  95. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +53 -0
  96. package/src/@parsers/@text/text.getPolygonFromProduct.ts +32 -0
  97. package/src/@parsers/@text/text.getTextFromProduct.ts +43 -0
  98. package/src/@parsers/@text/text.getXML.ts +61 -0
  99. package/src/@parsers/@ugc/ugc.coordinates.ts +110 -0
  100. package/src/@parsers/@ugc/ugc.expiry.ts +32 -0
  101. package/src/@parsers/@ugc/ugc.extract.ts +37 -0
  102. package/src/@parsers/@ugc/ugc.header.ts +30 -0
  103. package/src/@parsers/@ugc/ugc.locations.ts +29 -0
  104. package/src/@parsers/@ugc/ugc.zones.ts +52 -0
  105. package/src/@types/type.event.ts +67 -0
  106. package/src/@types/type.properties.ts +75 -0
  107. package/src/@types/types.attributes.ts +28 -0
  108. package/src/@types/types.compiled.ts +35 -0
  109. package/src/@types/types.hash.ts +24 -0
  110. package/src/@types/types.hvtec.ts +25 -0
  111. package/src/@types/types.pvtec.ts +30 -0
  112. package/src/@types/types.settings.ts +76 -0
  113. package/src/@types/types.stanza.ts +37 -0
  114. package/src/@types/types.ugc.ts +24 -0
  115. package/src/@types/types.webhook.ts +26 -0
  116. package/src/bootstrap.ts +85 -163
  117. package/src/index.ts +47 -216
  118. package/test.js +78 -51
  119. package/tsup.config.ts +1 -0
  120. package/src/@dictionaries/events.ts +0 -168
  121. package/src/@parsers/@events/api.ts +0 -146
  122. package/src/@parsers/@events/cap.ts +0 -123
  123. package/src/@parsers/@events/text.ts +0 -104
  124. package/src/@parsers/@events/ugc.ts +0 -107
  125. package/src/@parsers/@events/vtec.ts +0 -76
  126. package/src/@parsers/events.ts +0 -392
  127. package/src/@parsers/hvtec.ts +0 -46
  128. package/src/@parsers/pvtec.ts +0 -72
  129. package/src/@parsers/stanza.ts +0 -97
  130. package/src/@parsers/text.ts +0 -165
  131. package/src/@parsers/ugc.ts +0 -247
  132. package/src/@submodules/database.ts +0 -201
  133. package/src/@submodules/eas.ts +0 -490
  134. package/src/@submodules/utils.ts +0 -191
  135. package/src/@submodules/xmpp.ts +0 -142
  136. package/src/types.ts +0 -259
@@ -0,0 +1,235 @@
1
+ type TypeWebhook = {
2
+ webhook: string;
3
+ title: string;
4
+ message: string;
5
+ rate: number;
6
+ events: string[];
7
+ };
8
+
9
+ type TypeSettings = {
10
+ Database: string;
11
+ EnableWireService: boolean;
12
+ EnableJournal: boolean;
13
+ NOAAWeatherWireServiceSettings: {
14
+ ReconnectionSettings: {
15
+ Enabled: boolean;
16
+ ReconnectionInterval: number;
17
+ };
18
+ CredentialSettings: {
19
+ Username: string | void;
20
+ Password: string | void;
21
+ Nickname: string | void;
22
+ };
23
+ CacheSettings: {
24
+ Enabled: boolean;
25
+ MaxDatabaseHistory: number;
26
+ MaxRetentionHistory: number;
27
+ };
28
+ StanzaSettings: {
29
+ DisableUGC: boolean;
30
+ DisableVTEC: boolean;
31
+ DisableText: boolean;
32
+ };
33
+ };
34
+ NationalWeatherServiceSettings: {
35
+ CallbackInterval: number;
36
+ EventsEndpoint: string;
37
+ };
38
+ GlobalSettings: {
39
+ EventManagement: boolean;
40
+ BetterEventNames: boolean;
41
+ DisableGeometryParsing: boolean;
42
+ UseShapefileCoordinates: boolean;
43
+ SPCWatchesOnly: boolean;
44
+ ShapefileSkipPoints: number;
45
+ NodeTTL: number;
46
+ NodeMinDistance: number;
47
+ WebhookSettings?: TypeWebhook;
48
+ EventFiltering: {
49
+ ListeningEvents: string[];
50
+ ListeningICAO: string[];
51
+ ListeningUGC: string[];
52
+ ListeningStates: string[];
53
+ IgnoredICAO: string[];
54
+ IgnoredEvents: string[];
55
+ NodeLocationFiltering: boolean;
56
+ IgnoreTestProducts: boolean;
57
+ };
58
+ EASSettings: {
59
+ ArchiveDirectory: string;
60
+ IntroWavFile: string;
61
+ };
62
+ };
63
+ };
64
+
65
+ declare const setSettings: (newSettings: TypeSettings) => TypeSettings;
66
+
67
+ type TypeAttributes = {
68
+ xmlns: string;
69
+ id: string;
70
+ issue: string;
71
+ ttaaii: string;
72
+ cccc: string;
73
+ awipsid: string;
74
+ };
75
+
76
+ type TypeEventProperties = {
77
+ locations: string;
78
+ description: string;
79
+ attributes: TypeAttributes;
80
+ geocode: {
81
+ office: {
82
+ name: string;
83
+ office: string;
84
+ };
85
+ organization: string;
86
+ ugc: string[];
87
+ polygon: string;
88
+ polygon_generated: boolean;
89
+ };
90
+ parameters: {
91
+ tags: string[];
92
+ instructions: string;
93
+ source: string;
94
+ hazards: string;
95
+ impacts: string;
96
+ estimated_hail_size: string;
97
+ estimated_wind_gusts: string;
98
+ damage_threat: string;
99
+ tornado_threat: string;
100
+ flood_threat: string;
101
+ wind_threat: string;
102
+ hail_threat: string;
103
+ max_hail_inches?: string;
104
+ max_wind_gusts_surface_knots?: string;
105
+ max_tops_x100feet?: string;
106
+ mean_storm_motion_vector?: string;
107
+ particularly_dangerous_situation?: string;
108
+ };
109
+ watch_parameters?: {
110
+ watch_number: string;
111
+ watch_type: string;
112
+ additional_tornadoes_probability: string;
113
+ strong_tornadoes_probability: string;
114
+ severe_wind_probability: string;
115
+ severe_hail_probability: string;
116
+ hail_2in_probability: string;
117
+ combined_hail_wind_probability: string;
118
+ max_hail_in: string;
119
+ max_wind_surface: string;
120
+ max_tops_x100feet: string;
121
+ pds_watch: boolean;
122
+ };
123
+ spc_parameters: {
124
+ spc_max_tornado: string;
125
+ spc_max_hail: string;
126
+ spc_max_wind: string;
127
+ spc_watch_issuance: string;
128
+ };
129
+ };
130
+
131
+ type TypeHVTEC = {
132
+ hvtec: string;
133
+ severity: string;
134
+ cause: string;
135
+ record: string;
136
+ };
137
+
138
+ type TypePVTEC = {
139
+ vtec: string;
140
+ product: string;
141
+ tracking: string;
142
+ event: string;
143
+ status: string;
144
+ organization: string;
145
+ expires: string;
146
+ is_watch: boolean;
147
+ prediction_center: boolean;
148
+ };
149
+
150
+ type TypeEvent = {
151
+ type: string;
152
+ geometry: {
153
+ type: string;
154
+ coordinates: number[][];
155
+ };
156
+ properties: {
157
+ event: string;
158
+ parent: string;
159
+ status: string;
160
+ issued: string;
161
+ expires: string;
162
+ status_metadata?: {
163
+ is_issued?: boolean;
164
+ is_updated?: boolean;
165
+ is_expired?: boolean;
166
+ is_test?: boolean;
167
+ };
168
+ metadata: {
169
+ ms: number;
170
+ source: string;
171
+ tracking: string;
172
+ hash?: string;
173
+ header: string;
174
+ vtec: TypePVTEC | null;
175
+ hvtec: TypeHVTEC[];
176
+ nodes?: {
177
+ id?: string | number;
178
+ coordinates: [number, number];
179
+ nearest: [number, number];
180
+ miles: number | null;
181
+ kilometers: number | null;
182
+ proximity: boolean;
183
+ }[];
184
+ filtered_proximity?: boolean;
185
+ updated?: number;
186
+ history: {
187
+ description: string;
188
+ issued: string;
189
+ status: string;
190
+ }[];
191
+ };
192
+ } & TypeEventProperties;
193
+ };
194
+
195
+ interface GetGeometryResponse {
196
+ type: `Polygon` | `MultiPolygon`;
197
+ coordinates: any[];
198
+ }
199
+ declare const getEventGeometry: (event: TypeEvent) => Promise<GetGeometryResponse>;
200
+
201
+ declare const getCleanedEvent: <T extends Record<string, any>>(event: T) => T;
202
+
203
+ declare const startService: (settings: TypeSettings) => Promise<void>;
204
+
205
+ declare const stopService: () => Promise<void>;
206
+
207
+ interface GenerateEASOptions {
208
+ message: string;
209
+ header: string;
210
+ }
211
+ declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
212
+
213
+ interface GetAddChaserOptions {
214
+ identifier: string;
215
+ delete?: boolean;
216
+ coordinates: {
217
+ longitude: number;
218
+ latitude: number;
219
+ };
220
+ }
221
+ declare const setNode: (options: GetAddChaserOptions) => void;
222
+
223
+ declare const getEvents: () => any;
224
+
225
+ declare const getNodes: () => any;
226
+
227
+ declare const getRandomEvent: () => any;
228
+
229
+ declare class Manager {
230
+ constructor(settings: TypeSettings);
231
+ on(event: string, callback: () => void): void;
232
+ trycatch(): void;
233
+ }
234
+
235
+ export { Manager, type TypeEvent, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, setEasTone, setNode, setSettings, startService, stopService };
@@ -0,0 +1,235 @@
1
+ type TypeWebhook = {
2
+ webhook: string;
3
+ title: string;
4
+ message: string;
5
+ rate: number;
6
+ events: string[];
7
+ };
8
+
9
+ type TypeSettings = {
10
+ Database: string;
11
+ EnableWireService: boolean;
12
+ EnableJournal: boolean;
13
+ NOAAWeatherWireServiceSettings: {
14
+ ReconnectionSettings: {
15
+ Enabled: boolean;
16
+ ReconnectionInterval: number;
17
+ };
18
+ CredentialSettings: {
19
+ Username: string | void;
20
+ Password: string | void;
21
+ Nickname: string | void;
22
+ };
23
+ CacheSettings: {
24
+ Enabled: boolean;
25
+ MaxDatabaseHistory: number;
26
+ MaxRetentionHistory: number;
27
+ };
28
+ StanzaSettings: {
29
+ DisableUGC: boolean;
30
+ DisableVTEC: boolean;
31
+ DisableText: boolean;
32
+ };
33
+ };
34
+ NationalWeatherServiceSettings: {
35
+ CallbackInterval: number;
36
+ EventsEndpoint: string;
37
+ };
38
+ GlobalSettings: {
39
+ EventManagement: boolean;
40
+ BetterEventNames: boolean;
41
+ DisableGeometryParsing: boolean;
42
+ UseShapefileCoordinates: boolean;
43
+ SPCWatchesOnly: boolean;
44
+ ShapefileSkipPoints: number;
45
+ NodeTTL: number;
46
+ NodeMinDistance: number;
47
+ WebhookSettings?: TypeWebhook;
48
+ EventFiltering: {
49
+ ListeningEvents: string[];
50
+ ListeningICAO: string[];
51
+ ListeningUGC: string[];
52
+ ListeningStates: string[];
53
+ IgnoredICAO: string[];
54
+ IgnoredEvents: string[];
55
+ NodeLocationFiltering: boolean;
56
+ IgnoreTestProducts: boolean;
57
+ };
58
+ EASSettings: {
59
+ ArchiveDirectory: string;
60
+ IntroWavFile: string;
61
+ };
62
+ };
63
+ };
64
+
65
+ declare const setSettings: (newSettings: TypeSettings) => TypeSettings;
66
+
67
+ type TypeAttributes = {
68
+ xmlns: string;
69
+ id: string;
70
+ issue: string;
71
+ ttaaii: string;
72
+ cccc: string;
73
+ awipsid: string;
74
+ };
75
+
76
+ type TypeEventProperties = {
77
+ locations: string;
78
+ description: string;
79
+ attributes: TypeAttributes;
80
+ geocode: {
81
+ office: {
82
+ name: string;
83
+ office: string;
84
+ };
85
+ organization: string;
86
+ ugc: string[];
87
+ polygon: string;
88
+ polygon_generated: boolean;
89
+ };
90
+ parameters: {
91
+ tags: string[];
92
+ instructions: string;
93
+ source: string;
94
+ hazards: string;
95
+ impacts: string;
96
+ estimated_hail_size: string;
97
+ estimated_wind_gusts: string;
98
+ damage_threat: string;
99
+ tornado_threat: string;
100
+ flood_threat: string;
101
+ wind_threat: string;
102
+ hail_threat: string;
103
+ max_hail_inches?: string;
104
+ max_wind_gusts_surface_knots?: string;
105
+ max_tops_x100feet?: string;
106
+ mean_storm_motion_vector?: string;
107
+ particularly_dangerous_situation?: string;
108
+ };
109
+ watch_parameters?: {
110
+ watch_number: string;
111
+ watch_type: string;
112
+ additional_tornadoes_probability: string;
113
+ strong_tornadoes_probability: string;
114
+ severe_wind_probability: string;
115
+ severe_hail_probability: string;
116
+ hail_2in_probability: string;
117
+ combined_hail_wind_probability: string;
118
+ max_hail_in: string;
119
+ max_wind_surface: string;
120
+ max_tops_x100feet: string;
121
+ pds_watch: boolean;
122
+ };
123
+ spc_parameters: {
124
+ spc_max_tornado: string;
125
+ spc_max_hail: string;
126
+ spc_max_wind: string;
127
+ spc_watch_issuance: string;
128
+ };
129
+ };
130
+
131
+ type TypeHVTEC = {
132
+ hvtec: string;
133
+ severity: string;
134
+ cause: string;
135
+ record: string;
136
+ };
137
+
138
+ type TypePVTEC = {
139
+ vtec: string;
140
+ product: string;
141
+ tracking: string;
142
+ event: string;
143
+ status: string;
144
+ organization: string;
145
+ expires: string;
146
+ is_watch: boolean;
147
+ prediction_center: boolean;
148
+ };
149
+
150
+ type TypeEvent = {
151
+ type: string;
152
+ geometry: {
153
+ type: string;
154
+ coordinates: number[][];
155
+ };
156
+ properties: {
157
+ event: string;
158
+ parent: string;
159
+ status: string;
160
+ issued: string;
161
+ expires: string;
162
+ status_metadata?: {
163
+ is_issued?: boolean;
164
+ is_updated?: boolean;
165
+ is_expired?: boolean;
166
+ is_test?: boolean;
167
+ };
168
+ metadata: {
169
+ ms: number;
170
+ source: string;
171
+ tracking: string;
172
+ hash?: string;
173
+ header: string;
174
+ vtec: TypePVTEC | null;
175
+ hvtec: TypeHVTEC[];
176
+ nodes?: {
177
+ id?: string | number;
178
+ coordinates: [number, number];
179
+ nearest: [number, number];
180
+ miles: number | null;
181
+ kilometers: number | null;
182
+ proximity: boolean;
183
+ }[];
184
+ filtered_proximity?: boolean;
185
+ updated?: number;
186
+ history: {
187
+ description: string;
188
+ issued: string;
189
+ status: string;
190
+ }[];
191
+ };
192
+ } & TypeEventProperties;
193
+ };
194
+
195
+ interface GetGeometryResponse {
196
+ type: `Polygon` | `MultiPolygon`;
197
+ coordinates: any[];
198
+ }
199
+ declare const getEventGeometry: (event: TypeEvent) => Promise<GetGeometryResponse>;
200
+
201
+ declare const getCleanedEvent: <T extends Record<string, any>>(event: T) => T;
202
+
203
+ declare const startService: (settings: TypeSettings) => Promise<void>;
204
+
205
+ declare const stopService: () => Promise<void>;
206
+
207
+ interface GenerateEASOptions {
208
+ message: string;
209
+ header: string;
210
+ }
211
+ declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
212
+
213
+ interface GetAddChaserOptions {
214
+ identifier: string;
215
+ delete?: boolean;
216
+ coordinates: {
217
+ longitude: number;
218
+ latitude: number;
219
+ };
220
+ }
221
+ declare const setNode: (options: GetAddChaserOptions) => void;
222
+
223
+ declare const getEvents: () => any;
224
+
225
+ declare const getNodes: () => any;
226
+
227
+ declare const getRandomEvent: () => any;
228
+
229
+ declare class Manager {
230
+ constructor(settings: TypeSettings);
231
+ on(event: string, callback: () => void): void;
232
+ trycatch(): void;
233
+ }
234
+
235
+ export { Manager, type TypeEvent, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, setEasTone, setNode, setSettings, startService, stopService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atmosx/event-product-parser",
3
- "version": "2.0.016",
3
+ "version": "3.0.1",
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",
@@ -11,9 +11,10 @@
11
11
  },
12
12
  "scripts": {
13
13
  "start": "cd ./test && node ./index.js",
14
- "build": "tsup && cd ./test && node ./index.js",
14
+ "build": "tsup && cd ./test && node ./index.js",
15
+ "heap-memory-errors": "node --heap-prof --heap-prof-name=heap-profile-%p.heapsnapshot ./test/index.js",
15
16
  "publish": "tsup && npm publish --access public",
16
- "publish-beta": "tsup && npm publish --tag beta --access public"
17
+ "publish-beta-branch": "tsup && npm publish --tag v3-beta-branch --access public"
17
18
  },
18
19
  "keywords": [
19
20
  "NWWS",
@@ -33,10 +34,11 @@
33
34
  "homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
34
35
  "dependencies": {
35
36
  "@xmpp/client": "0.14.0",
36
- "better-sqlite3": "11.10.0",
37
+ "better-sqlite3": "12.10.0",
37
38
  "croner": "10.0.1",
38
39
  "jszip": "3.10.1",
39
40
  "polygon-clipping": "0.15.7",
41
+ "request": "^2.88.2",
40
42
  "say": "0.16.0",
41
43
  "shapefile": "0.6.6",
42
44
  "typescript": "5.9.3",
@@ -0,0 +1,30 @@
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
+ export const getCleanedEvent = <T extends Record<string, any>>(event: T): T => {
21
+ for (const key of Object.keys(event)) {
22
+ const value = event[key];
23
+ if (value === null || value === undefined) {
24
+ delete event[key];
25
+ } else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
26
+ (event as Record<string, any>)[key] = getCleanedEvent(value as Record<string, any>) as any;
27
+ }
28
+ }
29
+ return event;
30
+ };
@@ -0,0 +1,42 @@
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 { TypeStanzaCompiled } from "../@types/types.compiled"
21
+ import { TypeSettings } from "../@types/types.settings"
22
+ import { bootstrap } from "../bootstrap"
23
+ import { text } from "../@events/events.text"
24
+ import { ugc } from "../@events/events.ugc"
25
+ import { vtec } from "../@events/events.vtec"
26
+ import { api } from "../@events/events.api"
27
+
28
+ export const createEvent = async (stanza: TypeStanzaCompiled): Promise<void | string> => {
29
+ const settings = bootstrap.settings as TypeSettings
30
+ const StanzaSettings = settings.NOAAWeatherWireServiceSettings.StanzaSettings;
31
+
32
+ const isVtecEvent = (stanza.isVTEC && stanza.isUGC)
33
+ const isUgcEvent = (!stanza.isVTEC && stanza.isUGC)
34
+ const isTextEvent = (!stanza.isVTEC && !stanza.isUGC)
35
+ const isNWWS = (stanza.isNWWS)
36
+
37
+ if (!isNWWS) return await api(stanza)
38
+ if (!StanzaSettings.DisableVTEC && isVtecEvent) return await vtec(stanza)
39
+ if (!StanzaSettings.DisableUGC && isUgcEvent) return await ugc(stanza);
40
+ if (!StanzaSettings.DisableText && isTextEvent) return await text(stanza);
41
+ return 'nothing picked';
42
+ }
@@ -0,0 +1,56 @@
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
+ import { TypeSettings } from "../@types/types.settings";
22
+ import { bootstrap } from "../bootstrap"
23
+ import { betterEventNames } from "../@dictionaries/dictionaries.betterEventNames"
24
+
25
+ export const getEventEnhancedName = (event: TypeEvent): string => {
26
+ const configurations = bootstrap.settings as TypeSettings
27
+ let name = event?.properties?.event
28
+
29
+ if (!configurations?.GlobalSettings?.BetterEventNames) {
30
+ return name
31
+ }
32
+
33
+ const damage = event?.properties?.parameters?.damage_threat
34
+ const tornado = event?.properties?.parameters.tornado_threat;
35
+ const description = event?.properties?.description?.toLowerCase()
36
+ for (const [eventKey, eventConfig] of Object.entries(betterEventNames)) {
37
+ if (eventKey !== name) continue;
38
+ for (const [paramKey, paramValue] of Object.entries(eventConfig)) {
39
+ let matches = true;
40
+ if (paramValue?.description) {
41
+ if (!description.includes(paramValue.description.toLowerCase())) matches = false;
42
+ }
43
+ if (paramValue?.damage) {
44
+ if (paramValue.damage !== damage) matches = false;
45
+ }
46
+ if (paramValue?.tornado) {
47
+ if (paramValue.tornado !== tornado) matches = false;
48
+ }
49
+ if (matches) {
50
+ name = paramKey;
51
+ break;
52
+ }
53
+ }
54
+ }
55
+ return name;
56
+ }
@@ -0,0 +1,48 @@
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 { getSettings } from "../@modules/@utilities/utilities.getSettings";
21
+ import { TypeSettings } from "../@types/types.settings"
22
+ import { TypeEvent } from "../@types/type.event"
23
+ import { getZonePolygon } from "../@parsers/@ugc/ugc.coordinates";
24
+
25
+ interface GetGeometryResponse {
26
+ type: `Polygon` | `MultiPolygon`
27
+ coordinates: any[]
28
+ }
29
+
30
+ export const getEventGeometry = async (event: TypeEvent): Promise<GetGeometryResponse> => {
31
+ const settings = getSettings() as TypeSettings
32
+ const generated = event?.properties?.geocode?.polygon ?? null;
33
+ const ugc = event?.properties?.geocode?.ugc ?? null;
34
+ let geo: GetGeometryResponse = {
35
+ type: `Polygon`,
36
+ coordinates: generated != null ? JSON.parse(Buffer.from(generated, 'base64').toString('utf-8')) : null
37
+ }
38
+ if (settings.GlobalSettings.UseShapefileCoordinates && generated == null && ugc != null) {
39
+ geo = await getZonePolygon({zones: ugc, isUnion: false})
40
+ if (geo == null) {
41
+ geo = {
42
+ type: `Polygon`,
43
+ coordinates: []
44
+ }
45
+ }
46
+ }
47
+ return geo;
48
+ }