@atmosx/event-product-parser 3.0.41 → 3.0.44
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 +22 -0
- package/dist/cjs/index.cjs +1791 -1646
- package/dist/esm/index.mjs +1026 -882
- package/dist/index.d.mts +34 -3
- package/dist/index.d.ts +34 -3
- package/package.json +1 -1
- package/src/@building/building.create.ts +2 -2
- package/src/@building/building.enhance.ts +1 -1
- package/src/@building/building.geometry.ts +1 -1
- package/src/@building/building.headers.ts +1 -1
- package/src/@building/building.office.ts +3 -3
- package/src/@building/building.outlooks.ts +36 -0
- package/src/@building/building.properties.ts +11 -5
- package/src/@building/building.tracking.ts +7 -7
- package/src/@building/building.validate.ts +4 -2
- package/src/@core/core.query.ts +39 -0
- package/src/@core/core.setNode.ts +2 -2
- package/src/@core/core.start.ts +1 -1
- package/src/@events/events.api.ts +4 -1
- package/src/@events/events.text.ts +3 -2
- package/src/@events/events.ugc.ts +3 -2
- package/src/@events/events.vtec.ts +5 -4
- package/src/@manager/manager.createWebhook.ts +93 -81
- package/src/@manager/manager.mkEvent.ts +3 -2
- package/src/@manager/manager.setHash.ts +1 -1
- package/src/@manager/manager.updateWebhooks.ts +1 -2
- 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 +1 -1
- package/src/@modules/@database/database.stanza.ts +2 -2
- package/src/@modules/@eas/eas.getCleanDescription.ts +89 -0
- package/src/@modules/@eas/eas.getTTS.ts +43 -0
- package/src/@modules/@eas/eas.setEasTone.ts +29 -24
- package/src/@modules/@stanza/stanza.getAwipsType.ts +1 -1
- package/src/@modules/@stanza/stanza.validate.ts +2 -2
- package/src/@modules/@utilities/utilities.getLatestIssuance.ts +32 -0
- package/src/@modules/@utilities/utilities.getSettings.ts +1 -1
- package/src/@modules/@utilities/utilities.isImageReady.ts +27 -0
- package/src/@modules/@utilities/utilities.setCronSchedule.ts +28 -2
- package/src/@modules/@utilities/utilities.setSettings.ts +1 -1
- package/src/@modules/@utilities/utilities.setWarning.ts +1 -1
- package/src/@modules/@xmpp/xmpp.xDeploy.ts +1 -1
- package/src/@modules/@xmpp/xmpp.xReconnect.ts +1 -1
- package/src/@modules/@xmpp/xmpp.xStanza.ts +1 -1
- package/src/@parsers/@hvtec/hvtec.extract.ts +1 -1
- package/src/@parsers/@pvtec/pvtec.extract.ts +1 -1
- package/src/@parsers/@ugc/ugc.extract.ts +1 -1
- package/src/@types/{types.compiled.ts → type.compiled.ts} +1 -1
- package/src/@types/type.event.ts +4 -2
- package/src/@types/type.properties.ts +3 -1
- package/src/@types/{types.settings.ts → type.settings.ts} +3 -2
- package/src/@types/{types.webhook.ts → type.webhook.ts} +1 -0
- package/src/bootstrap.ts +2 -1
- package/src/index.ts +3 -2
- package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +0 -68
- /package/src/@types/{types.attributes.ts → type.attributes.ts} +0 -0
- /package/src/@types/{types.hash.ts → type.hash.ts} +0 -0
- /package/src/@types/{types.hvtec.ts → type.hvtec.ts} +0 -0
- /package/src/@types/{types.pvtec.ts → type.pvtec.ts} +0 -0
- /package/src/@types/{types.stanza.ts → type.stanza.ts} +0 -0
- /package/src/@types/{types.ugc.ts → type.ugc.ts} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ type TypeWebhook = {
|
|
|
3
3
|
title: string;
|
|
4
4
|
message: string;
|
|
5
5
|
upload: boolean;
|
|
6
|
+
eas: boolean;
|
|
6
7
|
rate: number;
|
|
7
8
|
events: string[];
|
|
8
9
|
};
|
|
@@ -57,6 +58,7 @@ type TypeSettings = {
|
|
|
57
58
|
IgnoreTestProducts: boolean;
|
|
58
59
|
};
|
|
59
60
|
EASSettings: {
|
|
61
|
+
ArchiveTTL: number;
|
|
60
62
|
ArchiveDirectory: string;
|
|
61
63
|
IntroWavFile: string;
|
|
62
64
|
};
|
|
@@ -122,6 +124,8 @@ type TypeEventProperties = {
|
|
|
122
124
|
pds_watch: boolean;
|
|
123
125
|
};
|
|
124
126
|
spc_parameters: {
|
|
127
|
+
spc_number: string;
|
|
128
|
+
spc_concerning: string;
|
|
125
129
|
spc_max_tornado: string;
|
|
126
130
|
spc_max_hail: string;
|
|
127
131
|
spc_max_wind: string;
|
|
@@ -190,6 +194,8 @@ type TypeEvent = {
|
|
|
190
194
|
issued: string;
|
|
191
195
|
status: string;
|
|
192
196
|
}[];
|
|
197
|
+
attachments?: string[];
|
|
198
|
+
raw: string;
|
|
193
199
|
};
|
|
194
200
|
} & TypeEventProperties;
|
|
195
201
|
};
|
|
@@ -212,7 +218,7 @@ interface GenerateEASOptions {
|
|
|
212
218
|
}
|
|
213
219
|
declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
|
|
214
220
|
|
|
215
|
-
interface
|
|
221
|
+
interface GetNodeOptions {
|
|
216
222
|
identifier: string;
|
|
217
223
|
delete?: boolean;
|
|
218
224
|
coordinates: {
|
|
@@ -220,7 +226,7 @@ interface GetAddChaserOptions {
|
|
|
220
226
|
latitude: number;
|
|
221
227
|
};
|
|
222
228
|
}
|
|
223
|
-
declare const setNode: (options:
|
|
229
|
+
declare const setNode: (options: GetNodeOptions) => void;
|
|
224
230
|
|
|
225
231
|
declare const getEvents: () => any;
|
|
226
232
|
|
|
@@ -228,6 +234,31 @@ declare const getNodes: () => any;
|
|
|
228
234
|
|
|
229
235
|
declare const getRandomEvent: () => any;
|
|
230
236
|
|
|
237
|
+
type TypeStanza = {
|
|
238
|
+
getChild(arg0: string): unknown;
|
|
239
|
+
is(arg0: string): unknown;
|
|
240
|
+
name: string;
|
|
241
|
+
parent: TypeStanza | null;
|
|
242
|
+
children: any;
|
|
243
|
+
attrs: {
|
|
244
|
+
xmlns: string;
|
|
245
|
+
id: string;
|
|
246
|
+
issue: string;
|
|
247
|
+
ttaaii: string;
|
|
248
|
+
cccc: string;
|
|
249
|
+
awipsid: string;
|
|
250
|
+
from: string;
|
|
251
|
+
to: string;
|
|
252
|
+
type: string;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
interface QueryOptions {
|
|
257
|
+
search: string;
|
|
258
|
+
max?: number;
|
|
259
|
+
}
|
|
260
|
+
declare const query: (options: QueryOptions) => Promise<TypeStanza[]>;
|
|
261
|
+
|
|
231
262
|
declare const clearEvents: () => void;
|
|
232
263
|
|
|
233
264
|
declare class Manager {
|
|
@@ -236,4 +267,4 @@ declare class Manager {
|
|
|
236
267
|
trycatch(): void;
|
|
237
268
|
}
|
|
238
269
|
|
|
239
|
-
export { Manager, type TypeEvent, clearEvents, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, setEasTone, setNode, setSettings, startService, stopService };
|
|
270
|
+
export { Manager, type TypeEvent, clearEvents, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, query, setEasTone, setNode, setSettings, startService, stopService };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ type TypeWebhook = {
|
|
|
3
3
|
title: string;
|
|
4
4
|
message: string;
|
|
5
5
|
upload: boolean;
|
|
6
|
+
eas: boolean;
|
|
6
7
|
rate: number;
|
|
7
8
|
events: string[];
|
|
8
9
|
};
|
|
@@ -57,6 +58,7 @@ type TypeSettings = {
|
|
|
57
58
|
IgnoreTestProducts: boolean;
|
|
58
59
|
};
|
|
59
60
|
EASSettings: {
|
|
61
|
+
ArchiveTTL: number;
|
|
60
62
|
ArchiveDirectory: string;
|
|
61
63
|
IntroWavFile: string;
|
|
62
64
|
};
|
|
@@ -122,6 +124,8 @@ type TypeEventProperties = {
|
|
|
122
124
|
pds_watch: boolean;
|
|
123
125
|
};
|
|
124
126
|
spc_parameters: {
|
|
127
|
+
spc_number: string;
|
|
128
|
+
spc_concerning: string;
|
|
125
129
|
spc_max_tornado: string;
|
|
126
130
|
spc_max_hail: string;
|
|
127
131
|
spc_max_wind: string;
|
|
@@ -190,6 +194,8 @@ type TypeEvent = {
|
|
|
190
194
|
issued: string;
|
|
191
195
|
status: string;
|
|
192
196
|
}[];
|
|
197
|
+
attachments?: string[];
|
|
198
|
+
raw: string;
|
|
193
199
|
};
|
|
194
200
|
} & TypeEventProperties;
|
|
195
201
|
};
|
|
@@ -212,7 +218,7 @@ interface GenerateEASOptions {
|
|
|
212
218
|
}
|
|
213
219
|
declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
|
|
214
220
|
|
|
215
|
-
interface
|
|
221
|
+
interface GetNodeOptions {
|
|
216
222
|
identifier: string;
|
|
217
223
|
delete?: boolean;
|
|
218
224
|
coordinates: {
|
|
@@ -220,7 +226,7 @@ interface GetAddChaserOptions {
|
|
|
220
226
|
latitude: number;
|
|
221
227
|
};
|
|
222
228
|
}
|
|
223
|
-
declare const setNode: (options:
|
|
229
|
+
declare const setNode: (options: GetNodeOptions) => void;
|
|
224
230
|
|
|
225
231
|
declare const getEvents: () => any;
|
|
226
232
|
|
|
@@ -228,6 +234,31 @@ declare const getNodes: () => any;
|
|
|
228
234
|
|
|
229
235
|
declare const getRandomEvent: () => any;
|
|
230
236
|
|
|
237
|
+
type TypeStanza = {
|
|
238
|
+
getChild(arg0: string): unknown;
|
|
239
|
+
is(arg0: string): unknown;
|
|
240
|
+
name: string;
|
|
241
|
+
parent: TypeStanza | null;
|
|
242
|
+
children: any;
|
|
243
|
+
attrs: {
|
|
244
|
+
xmlns: string;
|
|
245
|
+
id: string;
|
|
246
|
+
issue: string;
|
|
247
|
+
ttaaii: string;
|
|
248
|
+
cccc: string;
|
|
249
|
+
awipsid: string;
|
|
250
|
+
from: string;
|
|
251
|
+
to: string;
|
|
252
|
+
type: string;
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
interface QueryOptions {
|
|
257
|
+
search: string;
|
|
258
|
+
max?: number;
|
|
259
|
+
}
|
|
260
|
+
declare const query: (options: QueryOptions) => Promise<TypeStanza[]>;
|
|
261
|
+
|
|
231
262
|
declare const clearEvents: () => void;
|
|
232
263
|
|
|
233
264
|
declare class Manager {
|
|
@@ -236,4 +267,4 @@ declare class Manager {
|
|
|
236
267
|
trycatch(): void;
|
|
237
268
|
}
|
|
238
269
|
|
|
239
|
-
export { Manager, type TypeEvent, clearEvents, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, setEasTone, setNode, setSettings, startService, stopService };
|
|
270
|
+
export { Manager, type TypeEvent, clearEvents, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, query, 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.44",
|
|
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",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanzaCompiled } from "../@types/
|
|
21
|
-
import { TypeSettings } from "../@types/
|
|
20
|
+
import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
21
|
+
import { TypeSettings } from "../@types/type.settings"
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
23
|
import { text } from "../@events/events.text"
|
|
24
24
|
import { ugc } from "../@events/events.ugc"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { TypeEvent } from "../@types/type.event";
|
|
21
|
-
import { TypeSettings } from "../@types/
|
|
21
|
+
import { TypeSettings } from "../@types/type.settings";
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
23
|
import { betterEventNames } from "../@dictionaries/dictionaries.betterEventNames"
|
|
24
24
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { getSettings } from "../@modules/@utilities/utilities.getSettings";
|
|
21
|
-
import { TypeSettings } from "../@types/
|
|
21
|
+
import { TypeSettings } from "../@types/type.settings"
|
|
22
22
|
import { TypeEvent } from "../@types/type.event"
|
|
23
23
|
import { getZonePolygon } from "../@parsers/@ugc/ugc.coordinates";
|
|
24
24
|
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "../@types/
|
|
21
|
-
import { TypePVTEC } from "../@types/
|
|
20
|
+
import { TypeAttributes } from "../@types/type.attributes";
|
|
21
|
+
import { TypePVTEC } from "../@types/type.pvtec";
|
|
22
22
|
import { officeICAOs } from "../@dictionaries/dictionaries.officeICAOs";
|
|
23
23
|
|
|
24
24
|
interface GetOfficeOptions {
|
|
@@ -34,7 +34,7 @@ interface GetOfficeResponse {
|
|
|
34
34
|
|
|
35
35
|
export const getEventOffice = (options: GetOfficeOptions): GetOfficeResponse => {
|
|
36
36
|
const office = options.pVtec != null
|
|
37
|
-
? options.pVtec?.tracking?.split(
|
|
37
|
+
? options.pVtec?.tracking?.split(`.`)[0] : (options.attributes?.cccc ??
|
|
38
38
|
(options.organization != null ?
|
|
39
39
|
(Array.isArray(options.organization) ? options.organization?.[0] : options.organization)
|
|
40
40
|
: null));
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { getLatestIssuance } from "../@modules/@utilities/utilities.getLatestIssuance";
|
|
22
|
+
|
|
23
|
+
export const getEventAttachments = (event: TypeEvent): string[] | null => {
|
|
24
|
+
const latestTime = getLatestIssuance();
|
|
25
|
+
const validEvents = [
|
|
26
|
+
{ target: "Day 1", attachment: `https://www.spc.noaa.gov/products/outlook/day1otlk_${latestTime}.png` },
|
|
27
|
+
{ target: "Day 2", attachment: `https://www.spc.noaa.gov/products/outlook/day2otlk.png` },
|
|
28
|
+
{ target: "Day 3", attachment: `https://www.spc.noaa.gov/products/outlook/day3otlk.png` },
|
|
29
|
+
{ target: "Mesoscale Discussion", attachment: `https://www.spc.noaa.gov/products/md/mcd${event?.properties?.spc_parameters?.spc_number}.png` },
|
|
30
|
+
]
|
|
31
|
+
const isValid = validEvents.find(outlook => outlook.target == event.properties.event);
|
|
32
|
+
if (isValid) {
|
|
33
|
+
return isValid?.attachment ? [isValid.attachment] : [];
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { TypeEventProperties } from "../@types/type.properties";
|
|
21
|
-
import { TypeAttributes } from "../@types/
|
|
22
|
-
import { TypeUGC } from "../@types/
|
|
23
|
-
import { TypePVTEC } from "../@types/
|
|
24
|
-
import { TypeHVTEC } from "../@types/
|
|
21
|
+
import { TypeAttributes } from "../@types/type.attributes";
|
|
22
|
+
import { TypeUGC } from "../@types/type.ugc";
|
|
23
|
+
import { TypePVTEC } from "../@types/type.pvtec";
|
|
24
|
+
import { TypeHVTEC } from "../@types/type.hvtec";
|
|
25
25
|
import { regExp } from "../@dictionaries/dictionaries.regExp";
|
|
26
26
|
import { getDescriptionFromProduct } from "../@parsers/@text/text.getDescriptionFromProduct";
|
|
27
27
|
import { getPolygonFromProduct } from "../@parsers/@text/text.getPolygonFromProduct";
|
|
@@ -40,7 +40,7 @@ interface GetPropertiesOptions {
|
|
|
40
40
|
export const properties = (options: GetPropertiesOptions): TypeEventProperties => {
|
|
41
41
|
const organization = options.message.match(regExp.wmo)?.[0] ?? null
|
|
42
42
|
const polygons = getPolygonFromProduct(options.message)
|
|
43
|
-
|
|
43
|
+
const properties = {
|
|
44
44
|
locations: options?.ugc?.locations?.join(`; `) ?? null,
|
|
45
45
|
description: getDescriptionFromProduct({ message: options.message, handle: options?.pVtec?.vtec ?? null }),
|
|
46
46
|
attributes: options.attributes,
|
|
@@ -66,6 +66,8 @@ export const properties = (options: GetPropertiesOptions): TypeEventProperties =
|
|
|
66
66
|
hail_threat: getTextFromProduct({ message: options.message, find: [`HAIL THREAT...`], removal: []}) ?? null,
|
|
67
67
|
},
|
|
68
68
|
spc_parameters: {
|
|
69
|
+
spc_number: getTextFromProduct({ message: options.message, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] }) ?? null,
|
|
70
|
+
spc_concerning: getTextFromProduct({ message: options.message, find: [`Concerning...`] }) ?? null,
|
|
69
71
|
spc_max_tornado: getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] }) ?? null,
|
|
70
72
|
spc_max_hail: getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK HAIL SIZE...`] }) ?? null,
|
|
71
73
|
spc_max_wind: getTextFromProduct({ message: options.message, find: [`MOST PROBABLE PEAK WIND GUST...`] }) ?? null,
|
|
@@ -86,4 +88,8 @@ export const properties = (options: GetPropertiesOptions): TypeEventProperties =
|
|
|
86
88
|
pds_watch: (getTextFromProduct({ message: options.message, find: [`PARTICULARLY DANGEROUS SITUATION`], removal: [`%`, `<`, `:`] }) === `YES`)
|
|
87
89
|
}
|
|
88
90
|
}
|
|
91
|
+
if (isNaN(Number(properties.watch_parameters.watch_number))) {
|
|
92
|
+
properties.watch_parameters.watch_number = null
|
|
93
|
+
}
|
|
94
|
+
return properties;
|
|
89
95
|
}
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "../@types/
|
|
20
|
+
import { TypeAttributes } from "../@types/type.attributes";
|
|
21
21
|
import { TypeEventProperties } from "../@types/type.properties";
|
|
22
|
-
import { TypeStanzaCompiled } from "../@types/
|
|
23
|
-
import { TypePVTEC } from "../@types/
|
|
22
|
+
import { TypeStanzaCompiled } from "../@types/type.compiled";
|
|
23
|
+
import { TypePVTEC } from "../@types/type.pvtec";
|
|
24
24
|
|
|
25
25
|
interface GetTrackingOptions {
|
|
26
26
|
type: `RAW` | `VTEC` | `API`
|
|
@@ -35,16 +35,16 @@ interface GetTrackingOptions {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export const getEventTracking = (options: GetTrackingOptions): string => {
|
|
38
|
-
const
|
|
38
|
+
const properties = options.properties
|
|
39
39
|
const attributes = options.attributes
|
|
40
40
|
const stanza = options.stanza
|
|
41
41
|
const vtec = options.vtec
|
|
42
42
|
if (options.type === `RAW`) {
|
|
43
|
-
const getWatchNumber =
|
|
43
|
+
const getWatchNumber = properties.watch_parameters.watch_number ?? null
|
|
44
44
|
if (getWatchNumber) {
|
|
45
|
-
return `${
|
|
45
|
+
return `${properties.geocode.office.office}.${stanza.getType.prefix}.A.${getWatchNumber}`
|
|
46
46
|
}
|
|
47
|
-
return `${
|
|
47
|
+
return `${properties.geocode.office.office}.${attributes.ttaaii}.${attributes.id.slice(-4).replace(`.`, ``) ?? '0'}`
|
|
48
48
|
}
|
|
49
49
|
if (options.type === `VTEC`) {
|
|
50
50
|
return vtec.tracking;
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
|
|
20
20
|
import { createHash } from "crypto"
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
|
-
import { TypeSettings } from "../@types/
|
|
22
|
+
import { TypeSettings } from "../@types/type.settings";
|
|
23
23
|
import { bootstrap } from "../bootstrap"
|
|
24
24
|
import { getEventEnhancedName } from "./building.enhance";
|
|
25
25
|
import { getEventSignature } from "./building.signature"
|
|
26
26
|
import { mkEvent } from "../@manager/manager.mkEvent";
|
|
27
27
|
import { rmEvent } from "../@manager/manager.rmEvent";
|
|
28
28
|
import { getEventGeometry } from "./building.geometry";
|
|
29
|
+
import { getEventAttachments } from "./building.outlooks";
|
|
29
30
|
import { updateNode } from "../@manager/manager.updateNodes";
|
|
30
31
|
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
31
32
|
|
|
@@ -51,7 +52,8 @@ export const validateEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
51
52
|
delete filteredProperties.metadata.ms;
|
|
52
53
|
}
|
|
53
54
|
filteredProperties.metadata = filteredProperties.metadata ?? {} as any;
|
|
54
|
-
properties.metadata.hash = createHash("sha256").update(JSON.stringify(filteredProperties)).digest("hex")
|
|
55
|
+
properties.metadata.hash = createHash("sha256").update(JSON.stringify(filteredProperties)).digest("hex")
|
|
56
|
+
properties.metadata.attachments = getEventAttachments(event)
|
|
55
57
|
setEventEmit({ event: `onProductType${enhancedEventName.replace(/\s+/g, '')}`, metadata: define });
|
|
56
58
|
|
|
57
59
|
if (properties.status_metadata.is_test) {
|
|
@@ -0,0 +1,39 @@
|
|
|
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 { TypeStanza } from "../@types/type.stanza";
|
|
21
|
+
import { bootstrap } from "../bootstrap";
|
|
22
|
+
|
|
23
|
+
interface QueryOptions {
|
|
24
|
+
search: string
|
|
25
|
+
max?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type RowQuery = {
|
|
29
|
+
rowid: number
|
|
30
|
+
stanza: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const query = async (options: QueryOptions): Promise<TypeStanza[]> => {
|
|
34
|
+
const get = await bootstrap.database.prepare(
|
|
35
|
+
`SELECT * FROM stanzas WHERE stanza LIKE ? LIMIT ?`)
|
|
36
|
+
.all(`%${options.search}%`, options.max ?? 100) as RowQuery[];
|
|
37
|
+
const events = get.map((row) => JSON.parse(row.stanza));
|
|
38
|
+
return events as TypeStanza[];
|
|
39
|
+
}
|
|
@@ -21,13 +21,13 @@ import { bootstrap } from "../bootstrap";
|
|
|
21
21
|
import { setWarning } from "../@modules/@utilities/utilities.setWarning"
|
|
22
22
|
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
23
23
|
|
|
24
|
-
interface
|
|
24
|
+
interface GetNodeOptions {
|
|
25
25
|
identifier: string
|
|
26
26
|
delete?: boolean
|
|
27
27
|
coordinates: { longitude: number; latitude: number }
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export const setNode = (options:
|
|
30
|
+
export const setNode = (options: GetNodeOptions) => {
|
|
31
31
|
const nodes = bootstrap.cache.nodes.features;
|
|
32
32
|
const exists = nodes.find((node) => node.properties.identifier === options.identifier);
|
|
33
33
|
if (options.delete) {
|
package/src/@core/core.start.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "../@types/
|
|
20
|
+
import { TypeSettings } from "../@types/type.settings";
|
|
21
21
|
import { bootstrap } from "../bootstrap";
|
|
22
22
|
import { setWarning } from "../@modules/@utilities/utilities.setWarning"
|
|
23
23
|
import { setSettings } from "../@modules/@utilities/utilities.setSettings"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanzaCompiled } from "../@types/
|
|
20
|
+
import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
22
|
import { getEventTracking } from "../@building/building.tracking";
|
|
23
23
|
import { validateEvents } from "../@building/building.validate";
|
|
@@ -72,6 +72,8 @@ export const api = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
72
72
|
hail_threat: feature?.properties?.parameters?.hailThreat?.[0] ?? null,
|
|
73
73
|
},
|
|
74
74
|
spc_parameters: {
|
|
75
|
+
spc_number: getTextFromProduct({ message: feature?.properties?.description, find: [`Mesoscale Discussion `], removal: [`Mesoscale Discussion`, `Number`, `...`] }) ?? null,
|
|
76
|
+
spc_concerning: getTextFromProduct({ message: feature?.properties?.description, find: [`Concerning...`] }) ?? null,
|
|
75
77
|
spc_max_tornado: getTextFromProduct({ message: feature?.properties?.description, find: [`MOST PROBABLE PEAK TORNADO INTENSITY...`] }) ?? null,
|
|
76
78
|
spc_max_hail: getTextFromProduct({ message: feature?.properties?.description, find: [`MOST PROBABLE PEAK HAIL SIZE...`] }) ?? null,
|
|
77
79
|
spc_max_wind: getTextFromProduct({ message: feature?.properties?.description, find: [`MOST PROBABLE PEAK WIND GUST...`] }) ?? null,
|
|
@@ -98,6 +100,7 @@ export const api = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
98
100
|
header: `ZCZC-ATMOSX-${feature?.properties?.parameters?.WMOidentifier}`,
|
|
99
101
|
vtec: pVtec,
|
|
100
102
|
hvtec: null,
|
|
103
|
+
raw: feature?.properties?.description,
|
|
101
104
|
history: [
|
|
102
105
|
{
|
|
103
106
|
description: feature?.properties?.description,
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "../@types/
|
|
21
|
-
import { TypeStanzaCompiled } from "../@types/
|
|
20
|
+
import { TypeAttributes } from "../@types/type.attributes";
|
|
21
|
+
import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
22
22
|
import { TypeEvent } from "../@types/type.event";
|
|
23
23
|
import { properties } from "../@building/building.properties";
|
|
24
24
|
import { getEventHeader } from "../@building/building.headers";
|
|
@@ -66,6 +66,7 @@ export const text = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
66
66
|
header: header,
|
|
67
67
|
vtec: null,
|
|
68
68
|
hvtec: null,
|
|
69
|
+
raw: message,
|
|
69
70
|
history: [
|
|
70
71
|
{
|
|
71
72
|
description: props.description,
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "../@types/
|
|
21
|
-
import { TypeStanzaCompiled } from "../@types/
|
|
20
|
+
import { TypeAttributes } from "../@types/type.attributes";
|
|
21
|
+
import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
22
22
|
import { TypeEvent } from "../@types/type.event";
|
|
23
23
|
import { eventsMatchText } from "../@dictionaries/dictionaries.eventsMatchText";
|
|
24
24
|
import { ugcExtract } from "../@parsers/@ugc/ugc.extract";
|
|
@@ -69,6 +69,7 @@ export const ugc = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
69
69
|
header: header,
|
|
70
70
|
vtec: null,
|
|
71
71
|
hvtec: null,
|
|
72
|
+
raw: message,
|
|
72
73
|
history: [
|
|
73
74
|
{
|
|
74
75
|
description: props.description,
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "../@types/
|
|
21
|
-
import { TypeStanzaCompiled } from "../@types/
|
|
20
|
+
import { TypeAttributes } from "../@types/type.attributes";
|
|
21
|
+
import { TypeStanzaCompiled } from "../@types/type.compiled"
|
|
22
22
|
import { TypeEvent } from "../@types/type.event";
|
|
23
|
-
import { TypePVTEC } from "../@types/
|
|
24
|
-
import { TypeHVTEC } from "../@types/
|
|
23
|
+
import { TypePVTEC } from "../@types/type.pvtec";
|
|
24
|
+
import { TypeHVTEC } from "../@types/type.hvtec";
|
|
25
25
|
import { pvExtract } from "../@parsers/@pvtec/pvtec.extract";
|
|
26
26
|
import { hvExtract } from "../@parsers/@hvtec/hvtec.extract";
|
|
27
27
|
import { ugcExtract } from "../@parsers/@ugc/ugc.extract";
|
|
@@ -70,6 +70,7 @@ export const vtec = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
|
70
70
|
header: header,
|
|
71
71
|
vtec: pv,
|
|
72
72
|
hvtec: hVtec,
|
|
73
|
+
raw: message,
|
|
73
74
|
history: [
|
|
74
75
|
{
|
|
75
76
|
description: props.description,
|