@atmosx/event-product-parser 3.0.42 → 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 +13 -0
- package/dist/cjs/index.cjs +1795 -1666
- package/dist/esm/index.mjs +1770 -1641
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- 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 +2 -2
- package/src/@building/building.outlooks.ts +36 -0
- package/src/@building/building.properties.ts +6 -4
- package/src/@building/building.tracking.ts +3 -3
- package/src/@building/building.validate.ts +4 -2
- package/src/@core/core.query.ts +1 -1
- 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 +1 -1
- package/src/@manager/manager.setHash.ts +1 -1
- package/src/@manager/manager.updateWebhooks.ts +1 -1
- 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 +1 -1
- 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
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
|
|
21
|
+
export const getCleanDescription = (message: string): string => {
|
|
22
|
+
const patches: { regex: RegExp, replacement: string }[] = [
|
|
23
|
+
{ regex: /\.{3,}/g, replacement: ". " },
|
|
24
|
+
{ regex: /\bUTC\b/g, replacement: 'Coordinated Universal Time' },
|
|
25
|
+
{ regex: /\bGMT\b/g, replacement: 'Greenwich Mean Time' },
|
|
26
|
+
{ regex: /\bEST\b(?!\w)/g, replacement: 'Eastern Standard Time' },
|
|
27
|
+
{ regex: /\bEDT\b(?!\w)/g, replacement: 'Eastern Daylight Time' },
|
|
28
|
+
{ regex: /\bCST\b(?!\w)/g, replacement: 'Central Standard Time' },
|
|
29
|
+
{ regex: /\bCDT\b(?!\w)/g, replacement: 'Central Daylight Time' },
|
|
30
|
+
{ regex: /\bMST\b(?!\w)/g, replacement: 'Mountain Standard Time' },
|
|
31
|
+
{ regex: /\bMDT\b(?!\w)/g, replacement: 'Mountain Daylight Time' },
|
|
32
|
+
{ regex: /\bPST\b(?!\w)/g, replacement: 'Pacific Standard Time' },
|
|
33
|
+
{ regex: /\bPDT\b(?!\w)/g, replacement: 'Pacific Daylight Time' },
|
|
34
|
+
{ regex: /\bAKST\b(?!\w)/g, replacement: 'Alaska Standard Time' },
|
|
35
|
+
{ regex: /\bAKDT\b(?!\w)/g, replacement: 'Alaska Daylight Time' },
|
|
36
|
+
{ regex: /\bHST\b(?!\w)/g, replacement: 'Hawaii Standard Time' },
|
|
37
|
+
{ regex: /\bHDT\b(?!\w)/g, replacement: 'Hawaii Daylight Time' },
|
|
38
|
+
{ regex: /\bmph\b(?!\w)/g, replacement: 'miles per hour' },
|
|
39
|
+
{ regex: /\bkm\/h\b(?!\w)/g, replacement: 'kilometers per hour' },
|
|
40
|
+
{ regex: /\bkmh\b(?!\w)/g, replacement: 'kilometers per hour' },
|
|
41
|
+
{ regex: /\bkt\b(?!\w)/g, replacement: 'knots' },
|
|
42
|
+
{ regex: /\bNE\b(?!\w)/g, replacement: 'northeast' },
|
|
43
|
+
{ regex: /\bNW\b(?!\w)/g, replacement: 'northwest' },
|
|
44
|
+
{ regex: /\bSE\b(?!\w)/g, replacement: 'southeast' },
|
|
45
|
+
{ regex: /\bSW\b(?!\w)/g, replacement: 'southwest' },
|
|
46
|
+
{ regex: /\bNM\b(?!\w)/g, replacement: 'nautical miles' },
|
|
47
|
+
{ regex: /\bdeg\b(?!\w)/g, replacement: 'degrees' },
|
|
48
|
+
{ regex: /\btstm\b(?!\w)/g, replacement: 'thunderstorm' },
|
|
49
|
+
{ regex: /\bmm\b(?!\w)/g, replacement: 'millimeters' },
|
|
50
|
+
{ regex: /\bcm\b(?!\w)/g, replacement: 'centimeters' },
|
|
51
|
+
{ regex: /\bin.\b(?!\w)/g, replacement: 'inches' },
|
|
52
|
+
{ regex: /\bft\b(?!\w)/g, replacement: 'feet' },
|
|
53
|
+
{ regex: /\bmi\b(?!\w)/g, replacement: 'miles' },
|
|
54
|
+
{ regex: /\bhr\b(?!\w)/g, replacement: 'hour' },
|
|
55
|
+
{ regex: /\bhourly\b(?!\w)/g, replacement: 'per hour' },
|
|
56
|
+
{ regex: /\bkg\b(?!\w)/g, replacement: 'kilograms' },
|
|
57
|
+
{ regex: /\bg\/kg\b(?!\w)/g, replacement: 'grams per kilogram' },
|
|
58
|
+
{ regex: /\bmb\b(?!\w)/g, replacement: 'millibars' },
|
|
59
|
+
{ regex: /\bhPa\b(?!\w)/g, replacement: 'hectopascals' },
|
|
60
|
+
{ regex: /\bPa\b(?!\w)/g, replacement: 'pascals' },
|
|
61
|
+
{ regex: /\bKPa\b(?!\w)/g, replacement: 'kilopascals' },
|
|
62
|
+
{ regex: /\bC\/hr\b(?!\w)/g, replacement: 'degrees Celsius per hour' },
|
|
63
|
+
{ regex: /\bF\/hr\b(?!\w)/g, replacement: 'degrees Fahrenheit per hour' },
|
|
64
|
+
{ regex: /\bC\/min\b(?!\w)/g, replacement: 'degrees Celsius per minute' },
|
|
65
|
+
{ regex: /\bF\/min\b(?!\w)/g, replacement: 'degrees Fahrenheit per minute' },
|
|
66
|
+
{ regex: /\bC\b(?!\w)/g, replacement: 'degrees Celsius' },
|
|
67
|
+
{ regex: /\bF\b(?!\w)/g, replacement: 'degrees Fahrenheit' },
|
|
68
|
+
]
|
|
69
|
+
const hours: Record<number, string> = {
|
|
70
|
+
0: "twelve", 1: "one", 2: "two", 3: "three", 4: "four",
|
|
71
|
+
5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine",
|
|
72
|
+
10: "ten", 11: "eleven", 12: "twelve",
|
|
73
|
+
};
|
|
74
|
+
const minWord = (m: number) => m === 0 ? "o'clock" : m < 10 ? `oh ${m}` : `${m}`;
|
|
75
|
+
const fmt = (h: number, m: number, ap: string) => `${hours[h % 12]} ${minWord(m)} ${ap}`;
|
|
76
|
+
for (const {regex, replacement} of patches) {
|
|
77
|
+
message = message.replace(regex, replacement)
|
|
78
|
+
}
|
|
79
|
+
return message
|
|
80
|
+
.replace(/\b(\d{1,2}):(\d{2})\s*(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase()))
|
|
81
|
+
.replace(/\b(\d{1,2})\s+(\d{2})\s+(AM|PM)\b/gi, (_, h, m, ap) => fmt(+h, +m, ap.toUpperCase()))
|
|
82
|
+
.replace(/\b(\d{2})(\d{2})\s+(AM|PM)\b/gi, (_, hh, mm, ap) => fmt(+hh, +mm, ap.toUpperCase()))
|
|
83
|
+
.replace(/\*+/g, " ")
|
|
84
|
+
.replace(/-/g, " ")
|
|
85
|
+
.replace(/\n/g, " ")
|
|
86
|
+
.trim();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
|
|
21
|
+
import { platform } from 'os'
|
|
22
|
+
import { execSync } from 'child_process'
|
|
23
|
+
|
|
24
|
+
export const getTTS = async (text: string, outputPath: string): Promise<void> => {
|
|
25
|
+
const vPlatform = platform();
|
|
26
|
+
switch (vPlatform) {
|
|
27
|
+
case 'win32': {
|
|
28
|
+
const command =
|
|
29
|
+
`Add-Type -AssemblyName System.Speech;` +
|
|
30
|
+
`$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer;` +
|
|
31
|
+
`$speak.SetOutputToWaveFile('${outputPath}');` +
|
|
32
|
+
`$speak.Speak('${text}');` +
|
|
33
|
+
`$speak.Dispose();`;
|
|
34
|
+
execSync(`powershell -Command "${command}"`, { stdio: 'ignore' });
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
case 'linux':
|
|
38
|
+
execSync(`espeak -w "${outputPath}" "${text.replace(/"/g, '\\"')}"`);
|
|
39
|
+
break;
|
|
40
|
+
default: break;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
@@ -17,10 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "../../@types/
|
|
21
|
-
import { transcribedMessageReplacements } from "../../@dictionaries/dictionaries.transcribedMessageReplacements";
|
|
20
|
+
import { TypeSettings } from "../../@types/type.settings";
|
|
22
21
|
import { bootstrap } from "../../bootstrap";
|
|
23
|
-
import {
|
|
22
|
+
import { setWarning } from "../@utilities/utilities.setWarning";
|
|
24
23
|
import { getWavPCM16 } from "./eas.getWavPCM16";
|
|
25
24
|
import { getSampledPCM16 } from "./eas.getSampledPCM16";
|
|
26
25
|
import { setRadioEffect } from "./eas.setRadioEffect";
|
|
@@ -29,12 +28,12 @@ import { setAttentionTone } from "./eas.setAttentionTone";
|
|
|
29
28
|
import { getMergedPCM16 } from "./eas.getMergedPCM16";
|
|
30
29
|
import { setNoise } from "./eas.setNoise";
|
|
31
30
|
import { getPCM16 } from "./eas.getPCM16";
|
|
31
|
+
import { getTTS } from "./eas.getTTS";
|
|
32
|
+
import { getCleanDescription } from "./eas.getCleanDescription";
|
|
32
33
|
import { join } from 'path'
|
|
33
34
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'fs'
|
|
34
35
|
import { execSync } from 'child_process'
|
|
35
36
|
import { platform } from 'os'
|
|
36
|
-
import { setWarning } from "../@utilities/utilities.setWarning";
|
|
37
|
-
import say from 'say'
|
|
38
37
|
|
|
39
38
|
interface GenerateEASOptions {
|
|
40
39
|
message: string
|
|
@@ -47,16 +46,17 @@ export const setEasTone = async (options: GenerateEASOptions): Promise<string> =
|
|
|
47
46
|
const prefix = settings.GlobalSettings.EASSettings.IntroWavFile;
|
|
48
47
|
let message = options.message;
|
|
49
48
|
let header = options.header;
|
|
49
|
+
if (!message || !header) {
|
|
50
|
+
setWarning({
|
|
51
|
+
title: `EAS`,
|
|
52
|
+
message: `Message and header are required to generate an EAS tone.`
|
|
53
|
+
})
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
50
56
|
let buffTTS: Buffer;
|
|
51
57
|
let buffRadio: any;
|
|
52
58
|
let buffFull: any[] = [];
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
const tmpTTS = join(directory, `/temp/${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, '')}.wav`)
|
|
56
|
-
const outTTS = join(directory, `/output/${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, '')}.wav`)
|
|
57
|
-
const vTTS = process.platform === `win32` ? `Microsoft David Desktop` : `en-US-GuyNerual`;
|
|
58
|
-
const vPlatform = platform();
|
|
59
|
-
|
|
60
60
|
if (!existsSync(directory)) {
|
|
61
61
|
mkdirSync(directory, { recursive: true });
|
|
62
62
|
}
|
|
@@ -66,22 +66,27 @@ export const setEasTone = async (options: GenerateEASOptions): Promise<string> =
|
|
|
66
66
|
if (!existsSync(join(directory, `/output`))) {
|
|
67
67
|
mkdirSync(join(directory, `/output`), { recursive: true });
|
|
68
68
|
}
|
|
69
|
-
for (const {regex, replacement} of transcribedMessageReplacements) {
|
|
70
|
-
message = message.replace(regex, replacement)
|
|
71
|
-
}
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
const tmpTTS = join(directory, `/temp/${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, '')}.wav`)
|
|
71
|
+
const outTTS = join(directory, `/output/${Math.random().toString(36).substring(2, 15)}-${header.replace(/[^a-zA-Z0-9]/g, '')}.wav`)
|
|
72
|
+
const vPlatform = platform();
|
|
73
|
+
|
|
74
|
+
if (vPlatform === 'darwin') {
|
|
74
75
|
setWarning({
|
|
75
76
|
title: `EAS`,
|
|
76
|
-
message: `
|
|
77
|
-
})
|
|
78
|
-
return null
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
say.export(message, vTTS, 1.0, tmpTTS)
|
|
82
|
-
while (!existsSync(tmpTTS) || (buffTTS = readFileSync(tmpTTS)).length == 0) {
|
|
83
|
-
await setSleep({timeout: 25});
|
|
77
|
+
message: `EAS tone generation is not supported on macOS.`
|
|
78
|
+
});
|
|
79
|
+
return null
|
|
84
80
|
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
await new Promise<void>((resolve, reject) => {
|
|
84
|
+
const tMsg = getCleanDescription(message)
|
|
85
|
+
getTTS(tMsg, tmpTTS).then(() => {
|
|
86
|
+
buffTTS = readFileSync(tmpTTS);
|
|
87
|
+
resolve();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
85
90
|
const vWav = getWavPCM16(buffTTS);
|
|
86
91
|
const vSamples = getSampledPCM16(vWav.samples, vWav.sampleRate, 8000)
|
|
87
92
|
const vRadio = setRadioEffect(vSamples, 8000)
|
|
@@ -130,7 +135,7 @@ export const setEasTone = async (options: GenerateEASOptions): Promise<string> =
|
|
|
130
135
|
const aFinal = setNoise(aSamples, 0.002);
|
|
131
136
|
const aBuffer = getPCM16(Array.from(aFinal).map(v => ({ value: v })), 8000);
|
|
132
137
|
writeFileSync(outTTS, aBuffer)
|
|
133
|
-
try{unlinkSync(tmpTTS)} catch {}
|
|
138
|
+
try{ unlinkSync(tmpTTS) } catch {}
|
|
134
139
|
return outTTS;
|
|
135
140
|
}
|
|
136
141
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "../../@types/
|
|
20
|
+
import { TypeAttributes } from "../../@types/type.attributes"
|
|
21
21
|
import { eventAwipAbreviations } from "../../@dictionaries/dictionaries.eventAwipAbreviations"
|
|
22
22
|
|
|
23
23
|
interface ValidateOptions {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanza } from "../../@types/
|
|
21
|
-
import { TypeStanzaCompiled } from "../../@types/
|
|
20
|
+
import { TypeStanza } from "../../@types/type.stanza"
|
|
21
|
+
import { TypeStanzaCompiled } from "../../@types/type.compiled"
|
|
22
22
|
import { regExp } from "../../@dictionaries/dictionaries.regExp"
|
|
23
23
|
import { getAwipsType } from "./stanza.getAwipsType"
|
|
24
24
|
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
|
|
21
|
+
export const getLatestIssuance = (): string => {
|
|
22
|
+
const now = new Date();
|
|
23
|
+
const current = now.getUTCHours() * 100 + now.getUTCMinutes();
|
|
24
|
+
const issuances = [100, 600, 1300, 1630, 2000];
|
|
25
|
+
let latest = issuances[0];
|
|
26
|
+
for (const issuance of issuances) {
|
|
27
|
+
if (current >= issuance) {
|
|
28
|
+
latest = issuance;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return latest.toString().padStart(4, "0");
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
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 isImageReady = async (url: string): Promise<boolean> => {
|
|
21
|
+
try {
|
|
22
|
+
const res = await fetch(url, { method: "HEAD" })
|
|
23
|
+
return res.ok
|
|
24
|
+
} catch {
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -14,19 +14,45 @@
|
|
|
14
14
|
Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
16
|
Internal Package: @atmosx/event-product-parser
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { TypeSettings } from "../../@types/
|
|
21
|
+
import { TypeSettings } from "../../@types/type.settings";
|
|
22
22
|
import { xReconnect } from "../@xmpp/xmpp.xReconnect"
|
|
23
23
|
import { bootstrap } from "../../bootstrap";
|
|
24
24
|
import { createHttp } from "./utilities.createHttp";
|
|
25
25
|
import { createEvent } from "../../@building/building.create";
|
|
26
26
|
import { setEventEmit } from "./utilities.setEventEmit";
|
|
27
|
+
import { readdirSync, unlinkSync, statSync, existsSync } from "fs";
|
|
28
|
+
import { join } from "path";
|
|
27
29
|
|
|
28
30
|
export const setCronSchedule = async (): Promise<void> => {
|
|
29
31
|
const settings = bootstrap.settings as TypeSettings;
|
|
32
|
+
|
|
33
|
+
const TTL = settings.GlobalSettings.EASSettings.ArchiveTTL
|
|
34
|
+
const TTLCUT = Date.now() - TTL * 1000;
|
|
35
|
+
const walk = (dir: string): void => {
|
|
36
|
+
if (existsSync(dir)) {
|
|
37
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
const fullPath = join(dir, entry.name);
|
|
40
|
+
if (entry.isDirectory()) { walk(fullPath); continue; }
|
|
41
|
+
const stats = statSync(fullPath);
|
|
42
|
+
if (stats.mtime.getTime() < TTLCUT) {
|
|
43
|
+
try {
|
|
44
|
+
unlinkSync(fullPath);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`Failed to delete ${fullPath}:`, err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
walk(settings.GlobalSettings.EASSettings.ArchiveDirectory)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
30
56
|
if (settings.EnableWireService) {
|
|
31
57
|
if (settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.Enabled) {
|
|
32
58
|
void xReconnect(settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval)
|
|
@@ -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
|
|
|
23
23
|
export const setSettings = (newSettings: TypeSettings): TypeSettings => {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { client } from '@xmpp/client';
|
|
21
|
-
import { TypeSettings } from "../../@types/
|
|
21
|
+
import { TypeSettings } from "../../@types/type.settings";
|
|
22
22
|
import { bootstrap } from "../../bootstrap"
|
|
23
23
|
import { setWarning } from "../@utilities/utilities.setWarning";
|
|
24
24
|
import { xOnline } from "./xmpp.xOnline";
|
|
@@ -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 { setEventEmit } from "../@utilities/utilities.setEventEmit";
|
|
23
23
|
import { setWarning } from "../@utilities/utilities.setWarning";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanza } from "../../@types/
|
|
20
|
+
import { TypeStanza } from "../../@types/type.stanza";
|
|
21
21
|
import { bootstrap } from "../../bootstrap";
|
|
22
22
|
import { validate } from "../@stanza/stanza.validate";
|
|
23
23
|
import { createEvent } from "../../@building/building.create";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeHVTEC } from "../../@types/
|
|
20
|
+
import { TypeHVTEC } from "../../@types/type.hvtec";
|
|
21
21
|
import { eventCauses } from "../../@dictionaries/dictionaries.eventCauses";
|
|
22
22
|
import { eventRecords } from "../../@dictionaries/dictionaries.eventRecords";
|
|
23
23
|
import { regExp } from "../../@dictionaries/dictionaries.regExp";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypePVTEC } from "../../@types/
|
|
20
|
+
import { TypePVTEC } from "../../@types/type.pvtec";
|
|
21
21
|
import { regExp } from "../../@dictionaries/dictionaries.regExp";
|
|
22
22
|
import { eventProducts } from "../../@dictionaries/dictionaries.eventProducts";
|
|
23
23
|
import { eventTypes } from "../../@dictionaries/dictionaries.eventTypes";
|
package/src/@types/type.event.ts
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import { TypeEventProperties as BaseTypeEventProperties } from "./type.properties";
|
|
21
|
-
import { TypeHVTEC } from "
|
|
22
|
-
import { TypePVTEC } from "./
|
|
21
|
+
import { TypeHVTEC } from "./type.hvtec";
|
|
22
|
+
import { TypePVTEC } from "./type.pvtec";
|
|
23
23
|
|
|
24
24
|
export type TypeEvent = {
|
|
25
25
|
type: string
|
|
@@ -63,6 +63,8 @@ export type TypeEvent = {
|
|
|
63
63
|
issued: string
|
|
64
64
|
status: string
|
|
65
65
|
}[]
|
|
66
|
+
attachments?: string[]
|
|
67
|
+
raw: string
|
|
66
68
|
}
|
|
67
69
|
} & BaseTypeEventProperties
|
|
68
70
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "./
|
|
20
|
+
import { TypeAttributes } from "./type.attributes";
|
|
21
21
|
|
|
22
22
|
export type TypeEventProperties = {
|
|
23
23
|
locations: string
|
|
@@ -67,6 +67,8 @@ export type TypeEventProperties = {
|
|
|
67
67
|
pds_watch: boolean
|
|
68
68
|
}
|
|
69
69
|
spc_parameters: {
|
|
70
|
+
spc_number: string
|
|
71
|
+
spc_concerning: string
|
|
70
72
|
spc_max_tornado: string
|
|
71
73
|
spc_max_hail: string
|
|
72
74
|
spc_max_wind: string
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeWebhook } from "./
|
|
20
|
+
import { TypeWebhook } from "./type.webhook"
|
|
21
21
|
|
|
22
22
|
export type TypeSettings = {
|
|
23
23
|
Database: string
|
|
@@ -69,8 +69,9 @@ export type TypeSettings = {
|
|
|
69
69
|
IgnoreTestProducts: boolean
|
|
70
70
|
},
|
|
71
71
|
EASSettings: {
|
|
72
|
+
ArchiveTTL: number,
|
|
72
73
|
ArchiveDirectory: string,
|
|
73
|
-
IntroWavFile: string
|
|
74
|
+
IntroWavFile: string
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
}
|
package/src/bootstrap.ts
CHANGED
|
@@ -21,7 +21,7 @@ import path from 'path'
|
|
|
21
21
|
import { EventEmitter } from 'node:events';
|
|
22
22
|
|
|
23
23
|
export const bootstrap = {
|
|
24
|
-
version: `3.0.
|
|
24
|
+
version: `3.0.44`,
|
|
25
25
|
isReady: true,
|
|
26
26
|
ratelimits: {},
|
|
27
27
|
session_xmpp: null,
|
|
@@ -93,6 +93,7 @@ export const bootstrap = {
|
|
|
93
93
|
IgnoreTestProducts: true,
|
|
94
94
|
},
|
|
95
95
|
EASSettings: {
|
|
96
|
+
ArchiveTTL: 60,
|
|
96
97
|
ArchiveDirectory: null,
|
|
97
98
|
IntroWavFile: null,
|
|
98
99
|
}
|
package/src/index.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 { setSettings } from "./@modules/@utilities/utilities.setSettings"
|
|
22
22
|
import { getEventGeometry } from "./@building/building.geometry";
|
|
23
23
|
import { getCleanedEvent } from "./@building/building.clean"
|
|
@@ -1,68 +0,0 @@
|
|
|
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 transcribedMessageReplacements: { regex: RegExp, replacement: string }[] = [
|
|
21
|
-
{ regex: /\*/g, replacement: "" },
|
|
22
|
-
{ regex: /\.{3,}/g, replacement: "" },
|
|
23
|
-
{ regex: /\bUTC\b/g, replacement: 'Coordinated Universal Time' },
|
|
24
|
-
{ regex: /\bGMT\b/g, replacement: 'Greenwich Mean Time' },
|
|
25
|
-
{ regex: /\bEST\b(?!\w)/g, replacement: 'Eastern Standard Time' },
|
|
26
|
-
{ regex: /\bEDT\b(?!\w)/g, replacement: 'Eastern Daylight Time' },
|
|
27
|
-
{ regex: /\bCST\b(?!\w)/g, replacement: 'Central Standard Time' },
|
|
28
|
-
{ regex: /\bCDT\b(?!\w)/g, replacement: 'Central Daylight Time' },
|
|
29
|
-
{ regex: /\bMST\b(?!\w)/g, replacement: 'Mountain Standard Time' },
|
|
30
|
-
{ regex: /\bMDT\b(?!\w)/g, replacement: 'Mountain Daylight Time' },
|
|
31
|
-
{ regex: /\bPST\b(?!\w)/g, replacement: 'Pacific Standard Time' },
|
|
32
|
-
{ regex: /\bPDT\b(?!\w)/g, replacement: 'Pacific Daylight Time' },
|
|
33
|
-
{ regex: /\bAKST\b(?!\w)/g, replacement: 'Alaska Standard Time' },
|
|
34
|
-
{ regex: /\bAKDT\b(?!\w)/g, replacement: 'Alaska Daylight Time' },
|
|
35
|
-
{ regex: /\bHST\b(?!\w)/g, replacement: 'Hawaii Standard Time' },
|
|
36
|
-
{ regex: /\bHDT\b(?!\w)/g, replacement: 'Hawaii Daylight Time' },
|
|
37
|
-
{ regex: /\bmph\b(?!\w)/g, replacement: 'miles per hour' },
|
|
38
|
-
{ regex: /\bkm\/h\b(?!\w)/g, replacement: 'kilometers per hour' },
|
|
39
|
-
{ regex: /\bkmh\b(?!\w)/g, replacement: 'kilometers per hour' },
|
|
40
|
-
{ regex: /\bkt\b(?!\w)/g, replacement: 'knots' },
|
|
41
|
-
{ regex: /\bNE\b(?!\w)/g, replacement: 'northeast' },
|
|
42
|
-
{ regex: /\bNW\b(?!\w)/g, replacement: 'northwest' },
|
|
43
|
-
{ regex: /\bSE\b(?!\w)/g, replacement: 'southeast' },
|
|
44
|
-
{ regex: /\bSW\b(?!\w)/g, replacement: 'southwest' },
|
|
45
|
-
{ regex: /\bNM\b(?!\w)/g, replacement: 'nautical miles' },
|
|
46
|
-
{ regex: /\bdeg\b(?!\w)/g, replacement: 'degrees' },
|
|
47
|
-
{ regex: /\btstm\b(?!\w)/g, replacement: 'thunderstorm' },
|
|
48
|
-
{ regex: /\bmm\b(?!\w)/g, replacement: 'millimeters' },
|
|
49
|
-
{ regex: /\bcm\b(?!\w)/g, replacement: 'centimeters' },
|
|
50
|
-
{ regex: /\bin.\b(?!\w)/g, replacement: 'inches' },
|
|
51
|
-
{ regex: /\bft\b(?!\w)/g, replacement: 'feet' },
|
|
52
|
-
{ regex: /\bmi\b(?!\w)/g, replacement: 'miles' },
|
|
53
|
-
{ regex: /\bhr\b(?!\w)/g, replacement: 'hour' },
|
|
54
|
-
{ regex: /\bhourly\b(?!\w)/g, replacement: 'per hour' },
|
|
55
|
-
{ regex: /\bkg\b(?!\w)/g, replacement: 'kilograms' },
|
|
56
|
-
{ regex: /\bg\/kg\b(?!\w)/g, replacement: 'grams per kilogram' },
|
|
57
|
-
{ regex: /\bmb\b(?!\w)/g, replacement: 'millibars' },
|
|
58
|
-
{ regex: /\bhPa\b(?!\w)/g, replacement: 'hectopascals' },
|
|
59
|
-
{ regex: /\bPa\b(?!\w)/g, replacement: 'pascals' },
|
|
60
|
-
{ regex: /\bKPa\b(?!\w)/g, replacement: 'kilopascals' },
|
|
61
|
-
{ regex: /\bC\/hr\b(?!\w)/g, replacement: 'degrees Celsius per hour' },
|
|
62
|
-
{ regex: /\bF\/hr\b(?!\w)/g, replacement: 'degrees Fahrenheit per hour' },
|
|
63
|
-
{ regex: /\bC\/min\b(?!\w)/g, replacement: 'degrees Celsius per minute' },
|
|
64
|
-
{ regex: /\bF\/min\b(?!\w)/g, replacement: 'degrees Fahrenheit per minute' },
|
|
65
|
-
{ regex: /\bC\b(?!\w)/g, replacement: 'degrees Celsius' },
|
|
66
|
-
{ regex: /\bF\b(?!\w)/g, replacement: 'degrees Fahrenheit' },
|
|
67
|
-
];
|
|
68
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|