@atmosx/event-product-parser 3.0.0 → 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.
- package/README.md +299 -5
- package/dist/cjs/index.cjs +10188 -237
- package/dist/esm/index.mjs +10186 -237
- package/dist/index.d.mts +235 -0
- package/dist/index.d.ts +235 -0
- package/package.json +4 -3
- package/src/@building/building.clean.ts +1 -1
- package/src/@building/building.create.ts +1 -1
- package/src/@building/building.enhance.ts +1 -1
- package/src/@building/building.geometry.ts +7 -1
- package/src/@building/building.headers.ts +1 -1
- package/src/@building/building.office.ts +1 -1
- package/src/@building/building.polygon.ts +1 -1
- package/src/@building/building.properties.ts +1 -1
- package/src/@building/building.signature.ts +9 -26
- package/src/@building/building.tags.ts +1 -1
- package/src/@building/building.tracking.ts +1 -1
- package/src/@building/building.validate.ts +19 -4
- package/src/@core/core.getEvents.ts +1 -1
- package/src/@core/core.getNodes.ts +1 -1
- package/src/@core/{core.callback.ts → core.getRandomEvent.ts} +3 -17
- package/src/@core/core.getVersion.ts +25 -0
- package/src/@core/core.listener.ts +1 -1
- package/src/@core/core.setNode.ts +2 -2
- package/src/@core/core.start.ts +9 -4
- package/src/@core/core.stop.ts +1 -1
- package/src/@dictionaries/dictionaries.betterEventNames.ts +5 -1
- package/src/@dictionaries/dictionaries.eventActions.ts +1 -1
- package/src/@dictionaries/dictionaries.eventAwipAbreviations.ts +2 -2
- package/src/@dictionaries/dictionaries.eventCancelMessages.ts +2 -1
- package/src/@dictionaries/dictionaries.eventCauses.ts +1 -1
- package/src/@dictionaries/dictionaries.eventProducts.ts +1 -1
- package/src/@dictionaries/dictionaries.eventRecords.ts +1 -1
- package/src/@dictionaries/dictionaries.eventSeverity.ts +1 -1
- package/src/@dictionaries/dictionaries.eventStatus.ts +1 -1
- package/src/@dictionaries/dictionaries.eventTags.ts +1 -1
- package/src/@dictionaries/dictionaries.eventTypes.ts +1 -1
- package/src/@dictionaries/dictionaries.eventsOffshore.ts +1 -1
- package/src/@dictionaries/dictionaries.hailStrings.ts +3 -1
- package/src/@dictionaries/dictionaries.officeICAOs.ts +1 -1
- package/src/@dictionaries/dictionaries.regExp.ts +1 -1
- package/src/@dictionaries/dictionaries.shapefileLinks.ts +1 -1
- package/src/@dictionaries/dictionaries.statusCorrelationText.ts +1 -1
- package/src/@dictionaries/{dictionaries.test_signatures.ts → dictionaries.testSignatures.ts} +3 -2
- package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +1 -1
- package/src/@events/events.api.ts +1 -1
- package/src/@events/events.text.ts +1 -1
- package/src/@events/events.ugc.ts +1 -1
- package/src/@events/events.vtec.ts +5 -5
- package/src/@manager/manager.mkEvent.ts +54 -38
- package/src/@manager/manager.rmEvent.ts +3 -1
- package/src/@manager/manager.setHash.ts +2 -2
- package/src/@manager/manager.updateNodes.ts +10 -6
- package/src/@manager/manager.updateWebhooks.ts +50 -0
- package/src/@modules/@database/database.cache.ts +1 -1
- package/src/@modules/@database/database.init.ts +1 -1
- package/src/@modules/@database/database.shapefiles.ts +2 -3
- package/src/@modules/@database/database.stanza.ts +2 -1
- package/src/@modules/@eas/eas.getFloatPCM16.ts +29 -0
- package/src/@modules/@eas/eas.getMergedPCM16.ts +32 -0
- package/src/@modules/@eas/eas.getPCM16.ts +52 -0
- package/src/@modules/@eas/eas.getPCMToFloat.ts +26 -0
- package/src/@modules/@eas/eas.getSampledPCM16.ts +36 -0
- package/src/@modules/@eas/eas.getWavPCM16.ts +52 -0
- package/src/@modules/@eas/eas.setAFSK.ts +52 -0
- package/src/@modules/@eas/eas.setAsciiToBits.ts +32 -0
- package/src/@modules/@eas/eas.setAttentionTone.ts +40 -0
- package/src/@modules/@eas/eas.setEasTone.ts +137 -0
- package/src/@modules/@eas/eas.setNoise.ts +31 -0
- package/src/@modules/@eas/eas.setRadioEffect.ts +49 -0
- package/src/@modules/@eas/eas.setSameHeader.ts +45 -0
- package/src/@modules/@stanza/stanza.getAwipsType.ts +1 -1
- package/src/@modules/@stanza/stanza.validate.ts +1 -1
- package/src/@modules/@utilities/utilities.createHttp.ts +17 -7
- package/src/@modules/@utilities/utilities.createWebhook.ts +100 -0
- package/src/@modules/@utilities/utilities.getFormattedTime.ts +1 -1
- package/src/@modules/@utilities/utilities.getSettings.ts +1 -1
- package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +1 -1
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +31 -4
- package/src/@modules/@utilities/utilities.setEventEmit.ts +1 -1
- package/src/@modules/@utilities/utilities.setListener.ts +3 -3
- package/src/@modules/@utilities/utilities.setSettings.ts +1 -1
- package/src/@modules/@utilities/utilities.setSleep.ts +3 -3
- package/src/@modules/@utilities/utilities.setTimeoutAction.ts +4 -4
- package/src/@modules/@utilities/utilities.setWarning.ts +3 -3
- package/src/@modules/@xmpp/xmpp.xDeploy.ts +2 -2
- package/src/@modules/@xmpp/xmpp.xError.ts +1 -10
- package/src/@modules/@xmpp/xmpp.xOffline.ts +2 -2
- package/src/@modules/@xmpp/xmpp.xOnline.ts +3 -19
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +7 -2
- package/src/@modules/@xmpp/xmpp.xStanza.ts +3 -3
- package/src/@parsers/@hvtec/hvtec.extract.ts +1 -1
- package/src/@parsers/@pvtec/pvtec.expires.ts +1 -1
- package/src/@parsers/@pvtec/pvtec.extract.ts +3 -4
- package/src/@parsers/@text/text.getDescriptionFromProduct.ts +1 -1
- package/src/@parsers/@text/text.getPolygonFromProduct.ts +1 -1
- package/src/@parsers/@text/text.getTextFromProduct.ts +1 -1
- package/src/@parsers/@text/text.getXML.ts +1 -1
- package/src/@parsers/@ugc/ugc.coordinates.ts +1 -1
- package/src/@parsers/@ugc/ugc.expiry.ts +1 -1
- package/src/@parsers/@ugc/ugc.extract.ts +1 -1
- package/src/@parsers/@ugc/ugc.header.ts +1 -1
- package/src/@parsers/@ugc/ugc.locations.ts +1 -1
- package/src/@parsers/@ugc/ugc.zones.ts +1 -1
- package/src/@types/type.event.ts +12 -12
- package/src/@types/type.properties.ts +1 -1
- package/src/@types/types.attributes.ts +1 -1
- package/src/@types/types.compiled.ts +1 -1
- package/src/@types/types.hash.ts +1 -1
- package/src/@types/types.hvtec.ts +1 -1
- package/src/@types/types.pvtec.ts +2 -1
- package/src/@types/types.settings.ts +10 -5
- package/src/@types/types.stanza.ts +1 -1
- package/src/@types/types.ugc.ts +1 -1
- package/src/@types/types.webhook.ts +26 -0
- package/src/bootstrap.ts +7 -4
- package/src/index.ts +11 -12
- package/test.js +29 -18
- package/tsup.config.ts +1 -0
package/dist/index.d.mts
ADDED
|
@@ -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/dist/index.d.ts
ADDED
|
@@ -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": "3.0.
|
|
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",
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"start": "cd ./test && node ./index.js",
|
|
14
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,7 +34,7 @@
|
|
|
33
34
|
"homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@xmpp/client": "0.14.0",
|
|
36
|
-
"better-sqlite3": "
|
|
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",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -37,6 +37,12 @@ export const getEventGeometry = async (event: TypeEvent): Promise<GetGeometryRes
|
|
|
37
37
|
}
|
|
38
38
|
if (settings.GlobalSettings.UseShapefileCoordinates && generated == null && ugc != null) {
|
|
39
39
|
geo = await getZonePolygon({zones: ugc, isUnion: false})
|
|
40
|
+
if (geo == null) {
|
|
41
|
+
geo = {
|
|
42
|
+
type: `Polygon`,
|
|
43
|
+
coordinates: []
|
|
44
|
+
}
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
return geo;
|
|
42
48
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -20,27 +20,11 @@
|
|
|
20
20
|
import { TypeEvent } from "../@types/type.event";
|
|
21
21
|
import { statusCorrelationText } from "../@dictionaries/dictionaries.statusCorrelationText";
|
|
22
22
|
import { eventCancelMessages } from "../@dictionaries/dictionaries.eventCancelMessages";
|
|
23
|
-
import {
|
|
23
|
+
import { testSignatures} from "../@dictionaries/dictionaries.testSignatures"
|
|
24
24
|
import { eventProducts } from "../@dictionaries/dictionaries.eventProducts";
|
|
25
25
|
import { hailStrings } from "../@dictionaries/dictionaries.hailStrings"
|
|
26
|
-
import { getFormattedTime } from "../@modules/@utilities/utilities.getFormattedTime";
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
/*
|
|
30
|
-
export const hailStrings: Record<string, string> = {
|
|
31
|
-
"0.75": "Penny",
|
|
32
|
-
"0.88": "Nickel",
|
|
33
|
-
"1.00": "Quarter",
|
|
34
|
-
"1.25": "Half Dollar",
|
|
35
|
-
"1.50": "Ping Pong Ball",
|
|
36
|
-
"1.75": "Golf Ball",
|
|
37
|
-
"2.00": "Hen Egg",
|
|
38
|
-
"2.50": "Tennis Ball",
|
|
39
|
-
"2.75": "Baseball",
|
|
40
|
-
"4.00": "CD/DVD"
|
|
41
|
-
}
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
28
|
export const getEventSignature = (event: TypeEvent): TypeEvent => {
|
|
45
29
|
const properties = event?.properties;
|
|
46
30
|
const vtec = event?.properties?.metadata?.vtec
|
|
@@ -50,7 +34,7 @@ export const getEventSignature = (event: TypeEvent): TypeEvent => {
|
|
|
50
34
|
properties.status_metadata = { ...properties.status_metadata, is_issued: true, is_test: false};
|
|
51
35
|
|
|
52
36
|
if (properties.parameters.estimated_hail_size) {
|
|
53
|
-
properties.parameters.estimated_hail_size += ` (${hailStrings[properties.parameters.estimated_hail_size]})`
|
|
37
|
+
properties.parameters.estimated_hail_size += ` (${hailStrings[properties.parameters.estimated_hail_size] ?? '--'})`
|
|
54
38
|
}
|
|
55
39
|
|
|
56
40
|
if (status) {
|
|
@@ -60,13 +44,12 @@ export const getEventSignature = (event: TypeEvent): TypeEvent => {
|
|
|
60
44
|
if (csig) {
|
|
61
45
|
properties.status_metadata = { ...properties.status_metadata, is_expired: true };
|
|
62
46
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
47
|
+
const getProduct = vtec?.vtec?.split(`.`)[0]?.replace(`/`, ``)
|
|
48
|
+
const isTestProduct = eventProducts[getProduct] == `Test Product`
|
|
49
|
+
if (isTestProduct || testSignatures.some(sig => properties.description?.toLowerCase().includes(sig.toLowerCase()) || properties?.parameters?.instructions?.toLowerCase().includes(sig.toLowerCase()))) {
|
|
50
|
+
properties.status_metadata = { ...properties.status_metadata, is_test: true }
|
|
51
|
+
}
|
|
52
|
+
|
|
70
53
|
if (new Date(properties.expires).getTime() < Date.now()) {
|
|
71
54
|
properties.status_metadata = { ...properties.status_metadata, is_expired: true };
|
|
72
55
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
| |
|
|
9
9
|
|_|
|
|
10
10
|
|
|
11
|
-
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx,
|
|
11
|
+
Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
|
|
12
12
|
Discord: https://atmosphericx-discord.scriptkitty.cafe
|
|
13
13
|
Ko-Fi: https://ko-fi.com/k3yomi
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|