@atmosx/event-product-parser 3.0.621 → 3.0.622
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 +6 -4
- package/dist/cjs/index.cjs +21157 -6844
- package/dist/esm/index.mjs +21185 -6872
- package/package.json +9 -8
- package/pnpm-workspace.yaml +3 -0
- package/src/@building/CreateEvent.ts +10 -12
- package/src/@building/GetEventAttachments.ts +5 -5
- package/src/@building/GetEventEnhancedName.ts +2 -4
- package/src/@building/GetEventGeometry.ts +4 -4
- package/src/@building/GetEventHeader.ts +2 -2
- package/src/@building/GetEventNodes.ts +8 -8
- package/src/@building/GetEventOffice.ts +3 -3
- package/src/@building/GetEventProperties.ts +16 -11
- package/src/@building/GetEventSignature.ts +6 -6
- package/src/@building/GetEventTags.ts +1 -1
- package/src/@building/GetEventTracking.ts +4 -4
- package/src/@core/ClearEvents.ts +2 -2
- package/src/@core/CreateListener.ts +1 -1
- package/src/@core/GetEvents.ts +1 -1
- package/src/@core/GetNodes.ts +1 -1
- package/src/@core/GetRandomEvent.ts +1 -1
- package/src/@core/GetVersion.ts +1 -1
- package/src/@core/ManualEvent.ts +3 -4
- package/src/@core/QueryStanza.ts +2 -2
- package/src/@core/SetNode.ts +9 -3
- package/src/@core/StartService.ts +11 -11
- package/src/@core/StopService.ts +1 -1
- package/src/@enums/Tags.ts +1 -1
- package/src/@events/ParseAPI.ts +15 -10
- package/src/@events/ParseText.ts +8 -8
- package/src/@events/ParseUGC.ts +9 -9
- package/src/@events/ParseVTEC.ts +12 -12
- package/src/@manager/MakeEvents.ts +20 -17
- package/src/@manager/RemoveEvent.ts +8 -8
- package/src/@manager/SetHash.ts +3 -3
- package/src/@manager/UpdateEvents.ts +4 -4
- package/src/@manager/UpdateNode.ts +4 -4
- package/src/@manager/ValidateEvents.ts +13 -14
- package/src/@modules/@database/GetCachedEvents.ts +6 -7
- package/src/@modules/@database/ImportBroadcastify.ts +3 -3
- package/src/@modules/@database/ImportShapefiles.ts +11 -11
- package/src/@modules/@database/ImportStanza.ts +4 -4
- package/src/@modules/@database/InitializeDatabase.ts +6 -6
- package/src/@modules/@eas/GenerateEASMessage.ts +26 -18
- package/src/@modules/@eas/GetTTS.ts +2 -2
- package/src/@modules/@eas/SetNoise.ts +2 -2
- package/src/@modules/@eas/SetRadioEffect.ts +2 -2
- package/src/@modules/@eas/SetSameHeader.ts +3 -3
- package/src/@modules/@stanza/GetAwipsType.ts +2 -2
- package/src/@modules/@stanza/ValidateStanza.ts +4 -4
- package/src/@modules/@utilities/GetSettings.ts +2 -2
- package/src/@modules/@utilities/QueueManager.ts +71 -0
- package/src/@modules/@utilities/SetCronSchedule.ts +8 -8
- package/src/@modules/@utilities/SetDebug.ts +2 -2
- package/src/@modules/@utilities/SetEventEmit.ts +3 -3
- package/src/@modules/@utilities/SetListener.ts +1 -1
- package/src/@modules/@utilities/SetSettings.ts +2 -2
- package/src/@modules/@utilities/SetTimeoutAction.ts +1 -1
- package/src/@modules/@utilities/SetWarning.ts +2 -2
- package/src/@modules/@xmpp/DeployXMPP.ts +8 -8
- package/src/@modules/@xmpp/ErrorXMPP.ts +1 -1
- package/src/@modules/@xmpp/OfflineXMPP.ts +2 -2
- package/src/@modules/@xmpp/OnlineXMPP.ts +3 -3
- package/src/@modules/@xmpp/ReconnectXMPP.ts +4 -4
- package/src/@modules/@xmpp/StanzaXMPP.ts +6 -6
- package/src/@parsers/@hvtec/HVExtract.ts +5 -5
- package/src/@parsers/@pvtec/VTECExtract.ts +7 -7
- package/src/@parsers/@text/GetDescriptionFromProduct.ts +1 -1
- package/src/@parsers/@text/GetEmbededText.ts +3 -3
- package/src/@parsers/@text/GetStringText.ts +5 -5
- package/src/@parsers/@ugc/GetCache.ts +1 -1
- package/src/@parsers/@ugc/GetLocations.ts +3 -3
- package/src/@parsers/@ugc/GetUGCHeader.ts +1 -1
- package/src/@parsers/@ugc/GetZonePolygon.ts +2 -2
- package/src/@parsers/@ugc/SetCache.ts +1 -1
- package/src/@parsers/@ugc/UGCExtract.ts +5 -5
- package/src/@tasks/CreateTasks.ts +110 -0
- package/src/@tasks/TaskGenerateAudio.ts +35 -0
- package/src/@tasks/TaskGenerateJSON.ts +35 -0
- package/src/@tasks/TaskGenerateText.ts +35 -0
- package/src/@tasks/TaskSendNTFY.ts +93 -0
- package/src/@tasks/TaskSendWebhook.ts +101 -0
- package/src/@types/Event.ts +3 -3
- package/src/@types/Properties.ts +2 -1
- package/src/@types/Settings.ts +1 -1
- package/src/@types/StanzaCompiled.ts +1 -1
- package/src/bootstrap.ts +3 -3
- package/src/index.ts +21 -19
- package/tools/build.js +45 -0
- package/tsconfig.json +20 -1
- package/src/@manager/Tasks.ts +0 -246
- package/tsup.config.ts +0 -16
|
@@ -17,40 +17,42 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { TypeSettings } from "
|
|
22
|
-
import { EnumGlobalFilter } from "
|
|
23
|
-
import { bootstrap } from "
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import { UpdateNode } from "
|
|
27
|
-
import { SetEventEmit } from "
|
|
28
|
-
import { SetTimeoutAction } from "
|
|
20
|
+
import { TypeEvent } from "types/Event"
|
|
21
|
+
import { TypeSettings } from "types/Settings"
|
|
22
|
+
import { EnumGlobalFilter } from "@enums/GlobalFilter"
|
|
23
|
+
import { bootstrap } from "@bootstrap"
|
|
24
|
+
import { CreateTasks } from "@tasks/CreateTasks"
|
|
25
|
+
import { SetHash } from "@manager/SetHash"
|
|
26
|
+
import { UpdateNode } from "@manager/UpdateNode"
|
|
27
|
+
import { SetEventEmit } from "@utilities/SetEventEmit"
|
|
28
|
+
import { SetTimeoutAction } from "@utilities/SetTimeoutAction"
|
|
29
|
+
|
|
29
30
|
|
|
30
31
|
export const MakeEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
31
32
|
let tasked = [];
|
|
32
33
|
const settings = bootstrap.settings as TypeSettings;
|
|
33
34
|
if (events.length === 0) return
|
|
34
|
-
|
|
35
|
+
await Promise.all(events.map(async event => {
|
|
35
36
|
const features = bootstrap.cache.events.features;
|
|
36
37
|
const getHash = event.properties.metadata.hash;
|
|
37
38
|
const getTracking = event.properties.metadata.tracking;
|
|
38
39
|
const isEntry = bootstrap.cache.hashes?.find(hash => hash.tracking === getTracking)
|
|
39
40
|
const isHashed = isEntry?.hashes?.includes(getHash) ?? false;
|
|
40
41
|
const isNodeFiltering = settings.GlobalSettings.EventFiltering.NodeLocationFiltering
|
|
42
|
+
const getNodes = bootstrap.cache.nodes.features;
|
|
41
43
|
const getFeature = features.find(feature => feature.properties.metadata.tracking === getTracking);
|
|
42
|
-
|
|
44
|
+
|
|
43
45
|
if (isHashed || event.properties.status_metadata.is_expired) return
|
|
44
46
|
SetHash(event, isEntry)
|
|
45
|
-
|
|
46
|
-
if (isNodeFiltering) {
|
|
47
|
-
await UpdateNode(event);
|
|
47
|
+
await UpdateNode(event);
|
|
48
|
+
if (isNodeFiltering && getNodes.length > 0) {
|
|
48
49
|
if (!event.properties.metadata.filtered_proximity && !EnumGlobalFilter.includes(event.properties.event.toLowerCase())) {
|
|
49
50
|
return
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
const isRatelimited = SetTimeoutAction({ identifier: getTracking, interval: 1, max: 1, addTime: true })
|
|
55
|
+
const isLocal = event.properties.metadata.filtered_proximity ? `[LOCAL] ` : ``;
|
|
54
56
|
if (!isRatelimited.limited) {
|
|
55
57
|
SetEventEmit({
|
|
56
58
|
event: `onEventStatus`,
|
|
@@ -58,7 +60,7 @@ export const MakeEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
58
60
|
type: getFeature ? `Updated` : `New`,
|
|
59
61
|
event: event
|
|
60
62
|
},
|
|
61
|
-
message:
|
|
63
|
+
message: `${isLocal}[${getFeature ? 'Updated' : 'New'}] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
62
64
|
})
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -93,6 +95,7 @@ export const MakeEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
93
95
|
},
|
|
94
96
|
}
|
|
95
97
|
};
|
|
98
|
+
|
|
96
99
|
tasked.push(bootstrap.cache.events.features[getIndex])
|
|
97
100
|
} else {
|
|
98
101
|
features.push(event);
|
|
@@ -100,7 +103,7 @@ export const MakeEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
}
|
|
104
|
-
await Tasks(tasked)
|
|
106
|
+
}))
|
|
105
107
|
SetEventEmit({ event: `onEventCache`, metadata: bootstrap.cache.events, limited: true })
|
|
108
|
+
return await CreateTasks(tasked)
|
|
106
109
|
}
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { EnumStrings } from "
|
|
22
|
-
import { bootstrap } from "
|
|
23
|
-
import { SetEventEmit } from "
|
|
24
|
-
import { SetTimeoutAction } from "
|
|
25
|
-
import {
|
|
20
|
+
import { TypeEvent } from "types/Event"
|
|
21
|
+
import { EnumStrings } from "@enums/Strings"
|
|
22
|
+
import { bootstrap } from "@bootstrap"
|
|
23
|
+
import { SetEventEmit } from "@utilities/SetEventEmit"
|
|
24
|
+
import { SetTimeoutAction } from "@utilities/SetTimeoutAction"
|
|
25
|
+
import { CreateTasks } from "@tasks/CreateTasks"
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
export const RemoveEvent = async (event: TypeEvent, isTimeBasedExpiration: boolean):Promise<void> => {
|
|
@@ -46,7 +46,7 @@ export const RemoveEvent = async (event: TypeEvent, isTimeBasedExpiration: boole
|
|
|
46
46
|
issued: event.properties.expires,
|
|
47
47
|
status: event.properties.status
|
|
48
48
|
})
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
bootstrap.cache.events.features
|
|
51
51
|
.splice(bootstrap.cache.events.features.indexOf(isTrackingEventLogged), 1);
|
|
52
52
|
bootstrap.cache.hashes = bootstrap.cache.hashes
|
|
@@ -58,7 +58,7 @@ export const RemoveEvent = async (event: TypeEvent, isTimeBasedExpiration: boole
|
|
|
58
58
|
metadata: { type: `Removed`, event: event },
|
|
59
59
|
message: `[Removed] ${event.properties.event} (${event.properties.status}) (${gTracking})`
|
|
60
60
|
})
|
|
61
|
-
|
|
61
|
+
CreateTasks([event])
|
|
62
62
|
}
|
|
63
63
|
SetTimeoutAction({ identifier: gTracking, expire: true })
|
|
64
64
|
}
|
package/src/@manager/SetHash.ts
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { TypeHash } from "
|
|
22
|
-
import { bootstrap } from "
|
|
20
|
+
import { TypeEvent } from "types/Event"
|
|
21
|
+
import { TypeHash } from "types/Hash"
|
|
22
|
+
import { bootstrap } from "@bootstrap"
|
|
23
23
|
|
|
24
24
|
export const SetHash = (event: TypeEvent, entry: TypeHash): void => {
|
|
25
25
|
if (!entry) {
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { bootstrap } from "
|
|
22
|
-
import { SetEventEmit } from "
|
|
23
|
-
import { RemoveEvent } from "
|
|
20
|
+
import { TypeEvent } from "types/Event"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
|
+
import { SetEventEmit } from "@utilities/SetEventEmit"
|
|
23
|
+
import { RemoveEvent } from "@manager/RemoveEvent"
|
|
24
24
|
|
|
25
25
|
export const UpdateEvents = async (selectedEvent?: TypeEvent): Promise<void> => {
|
|
26
26
|
const events = bootstrap.cache.events.features;
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { bootstrap } from "
|
|
22
|
-
import { GetEventNodes } from "
|
|
23
|
-
import { SetEventEmit } from "
|
|
20
|
+
import { TypeEvent } from "types/Event"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
|
+
import { GetEventNodes } from "@building/GetEventNodes"
|
|
23
|
+
import { SetEventEmit } from "@utilities/SetEventEmit"
|
|
24
24
|
|
|
25
25
|
export const UpdateNode = async (selectedEvent?: TypeEvent): Promise<void> => {
|
|
26
26
|
const events = bootstrap.cache.events.features;
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { TypeSettings } from "
|
|
22
|
-
import { bootstrap } from "
|
|
23
|
-
import { GetEventEnhancedName } from "
|
|
24
|
-
import { GetEventSignature } from "
|
|
25
|
-
import { MakeEvents } from "
|
|
26
|
-
import { RemoveEvent } from "
|
|
27
|
-
import { GetEventAttachments } from "
|
|
28
|
-
import { SetEventEmit } from "
|
|
29
|
-
import { SetDebug } from "
|
|
30
|
-
import { GetMatched } from "
|
|
31
|
-
import { GetEventGeometry } from "
|
|
20
|
+
import { TypeEvent } from "types/Event"
|
|
21
|
+
import { TypeSettings } from "types/Settings"
|
|
22
|
+
import { bootstrap } from "@bootstrap"
|
|
23
|
+
import { GetEventEnhancedName } from "@building/GetEventEnhancedName"
|
|
24
|
+
import { GetEventSignature } from "@building/GetEventSignature"
|
|
25
|
+
import { MakeEvents } from "@manager/MakeEvents"
|
|
26
|
+
import { RemoveEvent } from "@manager/RemoveEvent"
|
|
27
|
+
import { GetEventAttachments } from "@building/GetEventAttachments"
|
|
28
|
+
import { SetEventEmit } from "@utilities/SetEventEmit"
|
|
29
|
+
import { SetDebug } from "@utilities/SetDebug"
|
|
30
|
+
import { GetMatched } from "@utilities/GetMatched"
|
|
31
|
+
import { GetEventGeometry } from "@building/GetEventGeometry"
|
|
32
32
|
import { createHash } from "crypto"
|
|
33
33
|
|
|
34
34
|
export const ValidateEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
@@ -136,7 +136,6 @@ export const ValidateEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
136
136
|
return !filtered
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
-
SetDebug({ title: `ValidateEvents (
|
|
139
|
+
SetDebug({ title: `ValidateEvents (${filtering.length}/${events.length})`, message: `${Math.round(performance.now() - tick)}ms` })
|
|
140
140
|
await MakeEvents(filtering)
|
|
141
|
-
SetDebug({ title: `MakeEvents (${filtering.length}/${events.length})`, message: `${Math.round(performance.now() - tick)}ms` })
|
|
142
141
|
}
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "
|
|
21
|
-
import { bootstrap } from
|
|
22
|
-
import { SetWarning } from
|
|
23
|
-
import { CreateEvent } from
|
|
24
|
-
import { ValidateEvents } from "
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
23
|
+
import { CreateEvent } from "@building/CreateEvent"
|
|
24
|
+
import { ValidateEvents } from "@manager/ValidateEvents"
|
|
25
25
|
|
|
26
26
|
export const GetCachedEvents = async (): Promise<void> => {
|
|
27
27
|
try {
|
|
@@ -40,9 +40,8 @@ export const GetCachedEvents = async (): Promise<void> => {
|
|
|
40
40
|
return !isSkippable
|
|
41
41
|
});
|
|
42
42
|
events = events.sort((a, b) => b.issued - a.issued)
|
|
43
|
-
await Promise.all(events.map(event => CreateEvent(event
|
|
43
|
+
await Promise.all(events.map(event => CreateEvent(event)))
|
|
44
44
|
SetWarning({ message: `Processed ${events.length} cached stanzas in ${Math.floor(performance.now() - tick)} ms` })
|
|
45
|
-
await ValidateEvents(bootstrap.cache.processed)
|
|
46
45
|
}
|
|
47
46
|
} catch (error) {
|
|
48
47
|
SetWarning({ message: `An error occurred while fetching cached stanzas: ${error.message} -> ${error.stack}` })
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { bootstrap } from "
|
|
21
|
-
import { CreateHttp } from
|
|
22
|
-
import { SetWarning } from "
|
|
20
|
+
import { bootstrap } from "@bootstrap"
|
|
21
|
+
import { CreateHttp } from "@utilities/CreateHttp"
|
|
22
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
23
23
|
|
|
24
24
|
export const ImportBroadcastify = async (): Promise<void> => {
|
|
25
25
|
const settings = bootstrap.settings;
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "
|
|
21
|
-
import { EnumShapefiles } from
|
|
22
|
-
import { bootstrap } from "
|
|
23
|
-
import { SetSleep } from
|
|
24
|
-
import { SetWarning } from
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { EnumShapefiles } from "@enums/Shapefiles"
|
|
22
|
+
import { bootstrap } from "@bootstrap"
|
|
23
|
+
import { SetSleep } from "@utilities/SetSleep"
|
|
24
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
25
25
|
import { existsSync, mkdirSync, writeFileSync, unlinkSync, rm } from "fs"
|
|
26
|
-
import { resolve, extname} from
|
|
27
|
-
import { loadAsync } from
|
|
28
|
-
import { read } from
|
|
26
|
+
import { resolve, extname} from "path"
|
|
27
|
+
import { loadAsync } from "jszip"
|
|
28
|
+
import { read } from "shapefile"
|
|
29
29
|
|
|
30
30
|
export const ImportShapefiles = async (): Promise<void> => {
|
|
31
31
|
const settings = bootstrap.settings as TypeSettings;
|
|
@@ -39,7 +39,7 @@ export const ImportShapefiles = async (): Promise<void> => {
|
|
|
39
39
|
const response = await fetch(shapefile.link);
|
|
40
40
|
const arrayBuff = await response.arrayBuffer();
|
|
41
41
|
const content = await loadAsync(arrayBuff);
|
|
42
|
-
const directory = resolve(__dirname,
|
|
42
|
+
const directory = resolve(__dirname, `shapefiles`);
|
|
43
43
|
if (!existsSync(directory)) {
|
|
44
44
|
mkdirSync(directory, { recursive: true });
|
|
45
45
|
}
|
|
@@ -50,7 +50,7 @@ export const ImportShapefiles = async (): Promise<void> => {
|
|
|
50
50
|
writeFileSync(output, data)
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
const filepath = resolve(__dirname, '
|
|
53
|
+
const filepath = resolve(__dirname, 'shapefiles', shapefile.name + '_' + shapefile.id)
|
|
54
54
|
const { features } = await read(
|
|
55
55
|
filepath,
|
|
56
56
|
filepath,
|
|
@@ -85,7 +85,7 @@ export const ImportShapefiles = async (): Promise<void> => {
|
|
|
85
85
|
unlinkSync(`${filepath}.dbf`)
|
|
86
86
|
transaction(features)
|
|
87
87
|
}
|
|
88
|
-
rm(resolve(__dirname, '
|
|
88
|
+
rm(resolve(__dirname, 'shapefiles'), { recursive: true, force: true }, () => {});
|
|
89
89
|
}
|
|
90
90
|
} catch (error) {
|
|
91
91
|
SetWarning( {message: `An error occurred while compiling shapefiles: ${error.message}` })
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "
|
|
21
|
-
import { TypeStanzaCompiled } from
|
|
22
|
-
import { bootstrap } from
|
|
23
|
-
import { SetWarning } from
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { TypeStanzaCompiled } from "types/StanzaCompiled"
|
|
22
|
+
import { bootstrap } from "@bootstrap"
|
|
23
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
24
24
|
|
|
25
25
|
export const ImportStanza = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
26
26
|
const settings = bootstrap.settings as TypeSettings;
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
import { TypeSettings } from "
|
|
22
|
-
import { bootstrap } from "
|
|
23
|
-
import { SetWarning } from
|
|
24
|
-
import { ImportShapefiles } from
|
|
25
|
-
import { ImportBroadcastify } from "
|
|
21
|
+
import { TypeSettings } from "types/Settings"
|
|
22
|
+
import { bootstrap } from "@bootstrap"
|
|
23
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
24
|
+
import { ImportShapefiles } from "@database/ImportShapefiles"
|
|
25
|
+
import { ImportBroadcastify } from "@database/ImportBroadcastify"
|
|
26
26
|
import { existsSync, writeFileSync } from "fs"
|
|
27
|
-
import sqlite3 from
|
|
27
|
+
import sqlite3 from "better-sqlite3"
|
|
28
28
|
|
|
29
29
|
export const InitializeDatabase = async (): Promise<void> => {
|
|
30
30
|
const settings = bootstrap.settings as TypeSettings;
|
|
@@ -17,24 +17,24 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "
|
|
21
|
-
import { bootstrap } from "
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { SetDebug } from "
|
|
34
|
-
import { join } from
|
|
35
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from
|
|
36
|
-
import { execSync } from
|
|
37
|
-
import { platform } from
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
|
+
import { GetWavPCM16 } from "@eas/GetWavPCM16"
|
|
23
|
+
import { GetSampledPCM16 } from "@eas/GetSampledPCM16"
|
|
24
|
+
import { SetRadioEffect } from "@eas/SetRadioEffect"
|
|
25
|
+
import { SetSameHeader } from "@eas/SetSameHeader"
|
|
26
|
+
import { SetAttentionTone } from "@eas/SetAttentionTone"
|
|
27
|
+
import { GetMergedPCM16 } from "@eas/GetMergedPCM16"
|
|
28
|
+
import { SetNoise } from "@eas/SetNoise"
|
|
29
|
+
import { GetPCM16 } from "@eas/GetPCM16"
|
|
30
|
+
import { GetTTS } from "@eas/GetTTS"
|
|
31
|
+
import { GetCleanDescription } from "@eas/GetCleanDescription"
|
|
32
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
33
|
+
import { SetDebug } from "@utilities/SetDebug"
|
|
34
|
+
import { join } from "path"
|
|
35
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, unlinkSync } from "fs"
|
|
36
|
+
import { execSync } from "child_process"
|
|
37
|
+
import { platform } from "os"
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
interface GenerateEASMessageOptions {
|
|
@@ -62,6 +62,14 @@ export const GenerateEASMessage = async (options: GenerateEASMessageOptions): Pr
|
|
|
62
62
|
let buffRadio: any;
|
|
63
63
|
let buffFull: any[] = [];
|
|
64
64
|
|
|
65
|
+
if (!directory) {
|
|
66
|
+
SetWarning({
|
|
67
|
+
title: `EAS`,
|
|
68
|
+
message: `EAS directory is not set in the settings. Please set it to generate EAS tones.`
|
|
69
|
+
});
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
65
73
|
if (!existsSync(directory)) {
|
|
66
74
|
mkdirSync(directory, { recursive: true });
|
|
67
75
|
}
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { platform } from
|
|
21
|
+
import { platform } from "os"
|
|
22
22
|
import { writeFileSync } from "fs"
|
|
23
|
-
import { execSync } from
|
|
23
|
+
import { execSync } from "child_process"
|
|
24
24
|
|
|
25
25
|
export const GetTTS = async (text: string, outputPath: string): Promise<void> => {
|
|
26
26
|
const vPlatform = platform();
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { GetPCMToFloat } from "
|
|
22
|
-
import { GetFloatPCM16 } from "
|
|
21
|
+
import { GetPCMToFloat } from "@eas/GetPCMToFloat"
|
|
22
|
+
import { GetFloatPCM16 } from "@eas/GetFloatPCM16"
|
|
23
23
|
|
|
24
24
|
export const SetNoise = (int16: Int16Array, noiseLevel: number = 0.02): Int16Array => {
|
|
25
25
|
const x = GetPCMToFloat(int16);
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { GetPCMToFloat } from "
|
|
22
|
-
import { GetFloatPCM16 } from "
|
|
21
|
+
import { GetPCMToFloat } from "@eas/GetPCMToFloat"
|
|
22
|
+
import { GetFloatPCM16 } from "@eas/GetFloatPCM16"
|
|
23
23
|
|
|
24
24
|
export const SetRadioEffect = (int16: Int16Array, sampleRate: number): Int16Array => {
|
|
25
25
|
const hpCut = 3555;
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { SetAFSK } from "
|
|
22
|
-
import { SetAsciiToBits } from "
|
|
23
|
-
import { GetMergedPCM16 } from "
|
|
21
|
+
import { SetAFSK } from "@eas/SetAFSK"
|
|
22
|
+
import { SetAsciiToBits } from "@eas/SetAsciiToBits"
|
|
23
|
+
import { GetMergedPCM16 } from "@eas/GetMergedPCM16"
|
|
24
24
|
|
|
25
25
|
export const SetSameHeader = (vtec: string, repeats: number, sampleRate: number = 8000, options: {preMarkSec?: number, gapSec?: number} = {}): Int16Array => {
|
|
26
26
|
const preMarkSec = options.preMarkSec ?? 0.3;
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeAttributes } from "
|
|
21
|
-
import { EnumAWIPS } from "
|
|
20
|
+
import { TypeAttributes } from "types/Attributes"
|
|
21
|
+
import { EnumAWIPS } from "@enums/AWIPS"
|
|
22
22
|
|
|
23
23
|
interface GetAwipsTypeOptions {
|
|
24
24
|
attributes: TypeAttributes
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeStanza } from "
|
|
21
|
-
import { TypeStanzaCompiled } from "
|
|
22
|
-
import { EnumExpressions } from "
|
|
23
|
-
import { GetAwipsType } from "
|
|
20
|
+
import { TypeStanza } from "types/Stanza"
|
|
21
|
+
import { TypeStanzaCompiled } from "types/StanzaCompiled"
|
|
22
|
+
import { EnumExpressions } from "@enums/Expressions"
|
|
23
|
+
import { GetAwipsType } from "@stanza/GetAwipsType"
|
|
24
24
|
|
|
25
25
|
interface ValidateStanzaOptions {
|
|
26
26
|
stanza: TypeStanza
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from
|
|
21
|
-
import { bootstrap } from "
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
22
|
|
|
23
23
|
export const GetSettings = (): TypeSettings => {
|
|
24
24
|
return bootstrap.settings;
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
export type QueueTask = () => Promise<void>;
|
|
20
|
+
|
|
21
|
+
export interface QueueManagerOptions {
|
|
22
|
+
concurrency?: number;
|
|
23
|
+
onError?: (error: unknown) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class QueueManager {
|
|
27
|
+
private readonly queue: QueueTask[] = [];
|
|
28
|
+
private readonly concurrency: number;
|
|
29
|
+
private readonly onError: (error: unknown) => void;
|
|
30
|
+
|
|
31
|
+
private running = 0;
|
|
32
|
+
private draining = false;
|
|
33
|
+
|
|
34
|
+
public constructor(options: QueueManagerOptions = {}) {
|
|
35
|
+
const concurrency = options.concurrency ?? 1;
|
|
36
|
+
this.concurrency = concurrency;
|
|
37
|
+
this.onError = options.onError ?? ((error) => {
|
|
38
|
+
console.error("[QueueManager] Task failed:", error);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public enqueue(task: QueueTask): void {
|
|
43
|
+
this.queue.push(task);
|
|
44
|
+
this.drain();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private drain(): void {
|
|
48
|
+
if (this.draining) { return; }
|
|
49
|
+
this.draining = true;
|
|
50
|
+
while (this.running < this.concurrency && this.queue.length > 0) {
|
|
51
|
+
const task = this.queue.shift();
|
|
52
|
+
if (!task) { continue; }
|
|
53
|
+
this.running++;
|
|
54
|
+
void this.execute(task);
|
|
55
|
+
}
|
|
56
|
+
this.draining = false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private async execute(task: QueueTask): Promise<void> {
|
|
60
|
+
try {
|
|
61
|
+
await task();
|
|
62
|
+
} catch (error) {
|
|
63
|
+
try {
|
|
64
|
+
this.onError(error);
|
|
65
|
+
} catch (handlerError) {}
|
|
66
|
+
} finally {
|
|
67
|
+
this.running--;
|
|
68
|
+
this.drain();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { TypeSettings } from "
|
|
22
|
-
import { ReconnectXMPP } from "
|
|
23
|
-
import { bootstrap } from "
|
|
24
|
-
import { CreateHttp } from "
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { readdirSync, unlinkSync, statSync, existsSync } from "fs"
|
|
28
|
-
import { join } from "path"
|
|
21
|
+
import { TypeSettings } from "types/Settings"
|
|
22
|
+
import { ReconnectXMPP } from "@xmpp/ReconnectXMPP"
|
|
23
|
+
import { bootstrap } from "@bootstrap"
|
|
24
|
+
import { CreateHttp } from "@utilities/CreateHttp"
|
|
25
|
+
import { SetEventEmit } from "@utilities/SetEventEmit"
|
|
26
|
+
import { CreateEvent } from "@building/CreateEvent"
|
|
27
|
+
import { readdirSync, unlinkSync, statSync, existsSync } from "fs"
|
|
28
|
+
import { join } from "path"
|
|
29
29
|
|
|
30
30
|
export const SetCronSchedule = async (): Promise<void> => {
|
|
31
31
|
const settings = bootstrap.settings as TypeSettings;
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from "
|
|
21
|
-
import { bootstrap } from "
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
22
|
|
|
23
23
|
interface SetDebugOptions {
|
|
24
24
|
title?: string
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { bootstrap } from "
|
|
21
|
-
import { SetTimeoutAction } from "
|
|
22
|
-
import { SetWarning } from "
|
|
20
|
+
import { bootstrap } from "@bootstrap"
|
|
21
|
+
import { SetTimeoutAction } from "@utilities/SetTimeoutAction"
|
|
22
|
+
import { SetWarning } from "@utilities/SetWarning"
|
|
23
23
|
|
|
24
24
|
interface SetEventEmitOptions {
|
|
25
25
|
event: string
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeSettings } from
|
|
21
|
-
import { bootstrap } from "
|
|
20
|
+
import { TypeSettings } from "types/Settings"
|
|
21
|
+
import { bootstrap } from "@bootstrap"
|
|
22
22
|
|
|
23
23
|
export const SetSettings = (newSettings: TypeSettings): TypeSettings => {
|
|
24
24
|
const settings = bootstrap.settings as Record<string, unknown>;
|