@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
|
@@ -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
|
|
@@ -21,17 +21,32 @@ import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
23
|
import { setHash } from "./manager.setHash";
|
|
24
|
+
import { updateWebhooks } from "./manager.updateWebhooks";
|
|
25
|
+
import { updateNode } from "./manager.updateNodes";
|
|
26
|
+
import { TypeSettings } from "../@types/types.settings";
|
|
24
27
|
|
|
25
28
|
export const mkEvent = async (event: TypeEvent): Promise<void> => {
|
|
29
|
+
const settings = bootstrap.settings as TypeSettings;
|
|
26
30
|
const features = bootstrap.cache.events.features;
|
|
27
|
-
const
|
|
31
|
+
const map = new Map<string, typeof features[0]>();
|
|
32
|
+
|
|
33
|
+
for (const f of features) {
|
|
34
|
+
const key = f?.properties?.metadata?.tracking;
|
|
35
|
+
if (!key) continue;
|
|
36
|
+
map.set(key, f);
|
|
37
|
+
}
|
|
38
|
+
|
|
28
39
|
const getHash = event.properties.metadata.hash;
|
|
29
40
|
const getTracking = event.properties.metadata.tracking;
|
|
30
|
-
features.forEach(f => f?.properties?.metadata?.tracking && featureMap.set(f?.properties?.metadata?.tracking, f));
|
|
31
41
|
const isEntry = bootstrap.cache.hashes?.find(hash => hash.tracking === getTracking)
|
|
32
42
|
const isHashed = isEntry?.hashes?.includes(getHash) ?? false;
|
|
33
|
-
const getFeature =
|
|
43
|
+
const getFeature = map.get(getTracking);
|
|
44
|
+
|
|
34
45
|
if (isHashed || event.properties.status_metadata.is_expired) return
|
|
46
|
+
await setHash(event, isEntry)
|
|
47
|
+
const isFilteredLocation = await updateNode(event).then(() => event.properties.metadata.filtered_proximity);
|
|
48
|
+
if (!isFilteredLocation && settings.GlobalSettings.EventFiltering.NodeLocationFiltering) { return }
|
|
49
|
+
|
|
35
50
|
setEventEmit({
|
|
36
51
|
event: `onEventStatus`,
|
|
37
52
|
metadata: {
|
|
@@ -40,40 +55,41 @@ export const mkEvent = async (event: TypeEvent): Promise<void> => {
|
|
|
40
55
|
},
|
|
41
56
|
message: `[${getFeature ? 'Updated' : 'New'}] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
42
57
|
})
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
if (settings.GlobalSettings.EventManagement) {
|
|
59
|
+
if (event.properties.status_metadata.is_issued || event.properties.status_metadata.is_updated) {
|
|
60
|
+
if (getFeature) {
|
|
61
|
+
const getIndex = features.indexOf(getFeature);
|
|
62
|
+
const cHistory = getFeature?.properties?.metadata?.history ?? [];
|
|
63
|
+
const cLocations = getFeature?.properties?.locations?.split(";").map((l: string) => l.trim()) ?? [];
|
|
64
|
+
const cUgc = getFeature?.properties?.geocode?.ugc ?? [];
|
|
65
|
+
|
|
66
|
+
const iHistory = event.properties?.metadata?.history ?? [];
|
|
67
|
+
const iLocations = event.properties?.locations?.split(";").map((l: string) => l.trim()) ?? [];
|
|
68
|
+
const iUgc = event.properties?.geocode?.ugc ?? [];
|
|
69
|
+
|
|
70
|
+
const mHistory = [...cHistory, ...iHistory].filter((v, i, a) => a.indexOf(v) === i);
|
|
71
|
+
const mLocations = [...cLocations, ...iLocations].filter((v, i, a) => a.indexOf(v) === i).join('; ');
|
|
72
|
+
const mUgc = [...cUgc, ...iUgc].filter((v, i, a) => a.indexOf(v) === i);
|
|
73
|
+
|
|
74
|
+
bootstrap.cache.events.features[getIndex] = {
|
|
75
|
+
...event,
|
|
76
|
+
properties: {
|
|
77
|
+
...event.properties,
|
|
78
|
+
metadata: {
|
|
79
|
+
...event?.properties?.metadata,
|
|
80
|
+
history: mHistory
|
|
81
|
+
},
|
|
82
|
+
locations: mLocations,
|
|
83
|
+
geocode: {
|
|
84
|
+
...event?.properties?.geocode,
|
|
85
|
+
ugc: mUgc
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
} else {
|
|
90
|
+
features.push(event)
|
|
91
|
+
}
|
|
77
92
|
}
|
|
78
93
|
}
|
|
94
|
+
updateWebhooks(event)
|
|
79
95
|
}
|
|
@@ -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,6 +20,7 @@
|
|
|
20
20
|
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
21
21
|
import { TypeEvent } from "../@types/type.event";
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
|
+
import { updateWebhooks } from "./manager.updateWebhooks";
|
|
23
24
|
|
|
24
25
|
export const rmEvent = (event: TypeEvent): void => {
|
|
25
26
|
const getEvent = bootstrap.cache.events.features.find(f => f?.properties?.metadata?.tracking === event?.properties?.metadata?.tracking);
|
|
@@ -33,6 +34,7 @@ export const rmEvent = (event: TypeEvent): void => {
|
|
|
33
34
|
message: `[Removed] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
34
35
|
})
|
|
35
36
|
setEventEmit({ event: `onExpiredProduct`, metadata: event })
|
|
37
|
+
updateWebhooks(event)
|
|
36
38
|
bootstrap.cache.events.features.splice(bootstrap.cache.events.features.indexOf(getEvent), 1);
|
|
37
39
|
bootstrap.cache.hashes = bootstrap.cache.hashes.filter(hash => hash.tracking !== event.properties.metadata.tracking);
|
|
38
40
|
}
|
|
@@ -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
|
|
@@ -22,7 +22,7 @@ import { TypeHash } from "../@types/types.hash"
|
|
|
22
22
|
import { bootstrap } from "../bootstrap"
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
export const setHash = (event: TypeEvent, entry: TypeHash): void => {
|
|
25
|
+
export const setHash = async (event: TypeEvent, entry: TypeHash): Promise<void> => {
|
|
26
26
|
if (entry) {
|
|
27
27
|
entry.hashes.push(event.properties.metadata.hash);
|
|
28
28
|
entry.expires = event.properties.expires;
|
|
@@ -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
|
|
@@ -19,15 +19,17 @@
|
|
|
19
19
|
|
|
20
20
|
import { getEventNodes } from "../@building/building.polygon";
|
|
21
21
|
import { setEventEmit } from "../@modules/@utilities/utilities.setEventEmit";
|
|
22
|
+
import { TypeEvent } from "../@types/type.event";
|
|
22
23
|
import { bootstrap } from "../bootstrap"
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
export const
|
|
26
|
+
export const updateNode = async (selectedEvent?: TypeEvent): Promise<void> => {
|
|
26
27
|
const events = bootstrap.cache.events.features;
|
|
27
28
|
const ttl = bootstrap.settings.GlobalSettings.NodeTTL * 1e3;
|
|
28
29
|
let total = 0;
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
async function update(evt: TypeEvent) {
|
|
32
|
+
const lastUpdate = evt?.properties?.metadata?.updated ?? null;
|
|
31
33
|
if (lastUpdate != null && (Date.now() - lastUpdate) < ttl) {
|
|
32
34
|
return evt;
|
|
33
35
|
}
|
|
@@ -37,8 +39,10 @@ export const updateNodes = async (): Promise<void> => {
|
|
|
37
39
|
}
|
|
38
40
|
evt.properties.metadata.nodes = node.nodes
|
|
39
41
|
evt.properties.metadata.filtered_proximity = node.filtered
|
|
40
|
-
evt.properties.metadata.
|
|
41
|
-
}
|
|
42
|
+
evt.properties.metadata.updated = node.updated
|
|
43
|
+
}
|
|
44
|
+
if (!selectedEvent) { await Promise.all(events.map(async (evt) => { await update(evt) })) }
|
|
45
|
+
if (selectedEvent) { await update(selectedEvent) }
|
|
42
46
|
if (total > 0) {
|
|
43
47
|
setEventEmit({
|
|
44
48
|
event: `onNodeUpdate`,
|
|
@@ -0,0 +1,50 @@
|
|
|
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 { createWebhook } from "../@modules/@utilities/utilities.createWebhook";
|
|
21
|
+
import { TypeEvent } from "../@types/type.event";
|
|
22
|
+
import { TypeWebhook } from "../@types/types.webhook";
|
|
23
|
+
import { bootstrap } from "../bootstrap"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export const updateWebhooks = async (event: TypeEvent): Promise<void> => {
|
|
27
|
+
const settings = bootstrap.settings;
|
|
28
|
+
const webhooks = settings.WebhookSettings as TypeWebhook[];
|
|
29
|
+
const eventName = event.properties.event;
|
|
30
|
+
for (const socket of webhooks) {
|
|
31
|
+
const events = socket.events;
|
|
32
|
+
if (!events || events.length === 0) {
|
|
33
|
+
await createWebhook({ webhook: socket, event });
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const matched = events.some(pattern => {
|
|
37
|
+
if (!pattern) return false;
|
|
38
|
+
if (pattern === "*" || pattern === eventName) return true;
|
|
39
|
+
if (pattern.includes("*")) {
|
|
40
|
+
const regex = "^" +
|
|
41
|
+
pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") + "$";
|
|
42
|
+
return new RegExp(regex).test(eventName);
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
});
|
|
46
|
+
if (matched) {
|
|
47
|
+
await createWebhook({ webhook: socket, event });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -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
|
|
@@ -49,10 +49,9 @@ export const importShapefiles = async (): Promise<void> => {
|
|
|
49
49
|
const data = await content.files[file].async(`nodebuffer`)
|
|
50
50
|
const output = resolve(directory, `${shapefile?.name ?? ``}_${shapefile?.id ?? ``}${extname(file)}`)
|
|
51
51
|
fs.writeFileSync(output, data)
|
|
52
|
-
setWarning({ message: `Successfully downloaded and extracted ${file}` })
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
|
-
const filepath = resolve(__dirname, '../../shapefiles', shapefile.name + '_' + shapefile.id)
|
|
54
|
+
const filepath = resolve(__dirname, '../../shapefiles', shapefile.name + '_' + shapefile.id)
|
|
56
55
|
const { features } = await read(
|
|
57
56
|
filepath,
|
|
58
57
|
filepath,
|
|
@@ -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
|
|
@@ -26,6 +26,7 @@ import { TypeStanzaCompiled } from '../../@types/types.compiled';
|
|
|
26
26
|
export const importStanza = async (stanza: TypeStanzaCompiled): Promise<void> => {
|
|
27
27
|
const settings = bootstrap.settings as TypeSettings;
|
|
28
28
|
try {
|
|
29
|
+
if (!settings.NOAAWeatherWireServiceSettings.CacheSettings.Enabled) { return }
|
|
29
30
|
bootstrap.database
|
|
30
31
|
.prepare(`INSERT OR IGNORE INTO stanzas (type, stanza, issued) VALUES (?, ?, ?)`)
|
|
31
32
|
.run(stanza.getType.type, JSON.stringify(stanza), stanza.attributes.issue)
|
|
@@ -0,0 +1,29 @@
|
|
|
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 getFloatPCM16 = (float32: Float32Array): Int16Array => {
|
|
22
|
+
const out = new Int16Array(float32.length);
|
|
23
|
+
for (let i = 0; i < float32.length; i++) {
|
|
24
|
+
let v = Math.max(-1, Math.min(1, float32[i]));
|
|
25
|
+
out[i] = Math.round(v * 32767);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -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 getMergedPCM16 = (arrays: Int16Array[]): Int16Array => {
|
|
22
|
+
let total = 0;
|
|
23
|
+
for (const a of arrays) total += a.length;
|
|
24
|
+
const out = new Int16Array(total);
|
|
25
|
+
let o = 0;
|
|
26
|
+
for (const a of arrays) {
|
|
27
|
+
out.set(a, o);
|
|
28
|
+
o += a.length;
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
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 getPCM16 = (samples: Record<string, number>[], sampleRate: number): Buffer => {
|
|
22
|
+
let o = 0;
|
|
23
|
+
const bytesPerSample = 2;
|
|
24
|
+
const blockAlign = 1 * bytesPerSample;
|
|
25
|
+
const byteRate = sampleRate * blockAlign;
|
|
26
|
+
const subchunk2Size = samples.length * bytesPerSample;
|
|
27
|
+
const chunkSize = 36 + subchunk2Size;
|
|
28
|
+
const buffer = Buffer.alloc(44 + subchunk2Size);
|
|
29
|
+
|
|
30
|
+
buffer.write("RIFF", o); o += 4;
|
|
31
|
+
buffer.writeUInt32LE(chunkSize, o); o += 4;
|
|
32
|
+
buffer.write("WAVE", o); o += 4;
|
|
33
|
+
|
|
34
|
+
buffer.write("fmt ", o); o += 4;
|
|
35
|
+
buffer.writeUInt32LE(16, o); o += 4;
|
|
36
|
+
buffer.writeUInt16LE(1, o); o += 2;
|
|
37
|
+
buffer.writeUInt16LE(1, o); o += 2;
|
|
38
|
+
buffer.writeUInt32LE(sampleRate, o); o += 4;
|
|
39
|
+
buffer.writeUInt32LE(byteRate, o); o += 4;
|
|
40
|
+
buffer.writeUInt16LE(blockAlign, o); o += 2;
|
|
41
|
+
buffer.writeUInt16LE(16, o); o += 2;
|
|
42
|
+
|
|
43
|
+
buffer.write("data", o); o += 4;
|
|
44
|
+
buffer.writeUInt32LE(subchunk2Size, o); o += 4;
|
|
45
|
+
|
|
46
|
+
for (let i = 0; i < samples.length; i++, o += 2) {
|
|
47
|
+
buffer.writeInt16LE(samples[i].value, o);
|
|
48
|
+
}
|
|
49
|
+
return buffer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
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 getPCMToFloat = (int16: Int16Array): Float32Array => {
|
|
22
|
+
const out = new Float32Array(int16.length);
|
|
23
|
+
for (let i = 0; i < int16.length; i++) out[i] = int16[i] / 32768;
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
26
|
+
|
|
@@ -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
|
+
|
|
21
|
+
export const getSampledPCM16 = (int16: Int16Array, originalRate: number, targetRate: number): Int16Array => {
|
|
22
|
+
if (originalRate === targetRate) return int16;
|
|
23
|
+
const ratio = targetRate / originalRate;
|
|
24
|
+
const outLen = Math.max(1, Math.round(int16.length * ratio));
|
|
25
|
+
const out = new Int16Array(outLen);
|
|
26
|
+
for (let i = 0; i < outLen; i++) {
|
|
27
|
+
const pos = i / ratio;
|
|
28
|
+
const i0 = Math.floor(pos);
|
|
29
|
+
const i1 = Math.min(i0 + 1, int16.length - 1);
|
|
30
|
+
const frac = pos - i0;
|
|
31
|
+
const v = int16[i0] * (1 - frac) + int16[i1] * frac;
|
|
32
|
+
out[i] = Math.round(v);
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
interface getWavPCM16Response {
|
|
22
|
+
samples: Int16Array
|
|
23
|
+
sampleRate: number
|
|
24
|
+
channels: number
|
|
25
|
+
bitsPerSample: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const getWavPCM16 = (buffer: Buffer): getWavPCM16Response => {
|
|
29
|
+
if (buffer.toString("ascii", 0, 4) !== "RIFF" || buffer.toString("ascii", 8, 12) !== "WAVE") { return null; }
|
|
30
|
+
let fmt = null;
|
|
31
|
+
let data = null;
|
|
32
|
+
let i = 12;
|
|
33
|
+
while (i + 8 <= buffer.length) {
|
|
34
|
+
const id = buffer.toString("ascii", i, i + 4);
|
|
35
|
+
const size = buffer.readUInt32LE(i + 4);
|
|
36
|
+
const start = i + 8;
|
|
37
|
+
const end = start + size;
|
|
38
|
+
if (id === "fmt ") fmt = buffer.slice(start, end);
|
|
39
|
+
if (id === "data") data = buffer.slice(start, end);
|
|
40
|
+
i = end + (size % 2);
|
|
41
|
+
}
|
|
42
|
+
if (!fmt || !data) return null;
|
|
43
|
+
const audioFormat = fmt.readUInt16LE(0);
|
|
44
|
+
const channels = fmt.readUInt16LE(2);
|
|
45
|
+
const sampleRate = fmt.readUInt32LE(4);
|
|
46
|
+
const bitsPerSample = fmt.readUInt16LE(14);
|
|
47
|
+
if (audioFormat !== 1 || bitsPerSample !== 16 || channels !== 1) { return null; }
|
|
48
|
+
const samples = new Int16Array(data.buffer, data.byteOffset, data.length / 2);
|
|
49
|
+
return { samples: new Int16Array(samples), sampleRate, channels, bitsPerSample };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
|
|
22
|
+
export const setAFSK = (bits: number[], sampleRate: number): Int16Array => {
|
|
23
|
+
const baud = 520.83;
|
|
24
|
+
const markFreq = 2083.3;
|
|
25
|
+
const spaceFreq = 1562.5;
|
|
26
|
+
const amplitude = 0.6;
|
|
27
|
+
const twoPi = Math.PI * 2;
|
|
28
|
+
const result = [];
|
|
29
|
+
let phase = 0;
|
|
30
|
+
let frac = 0;
|
|
31
|
+
for (let b = 0; b < bits.length; b++) {
|
|
32
|
+
const bit = bits[b];
|
|
33
|
+
const freq = bit ? markFreq : spaceFreq;
|
|
34
|
+
const samplesPerBit = sampleRate / baud + frac;
|
|
35
|
+
const n = Math.round(samplesPerBit);
|
|
36
|
+
frac = samplesPerBit - n;
|
|
37
|
+
const inc = twoPi * freq / sampleRate;
|
|
38
|
+
for (let i = 0; i < n; i++) {
|
|
39
|
+
result.push(Math.round(Math.sin(phase) * amplitude * 32767));
|
|
40
|
+
phase += inc;
|
|
41
|
+
if (phase > twoPi) phase -= twoPi;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const fadeSamples = Math.floor(sampleRate * 0.002);
|
|
45
|
+
for (let i = 0; i < fadeSamples; i++) {
|
|
46
|
+
const gain = i / fadeSamples;
|
|
47
|
+
result[i] = Math.round(result[i] * gain);
|
|
48
|
+
result[result.length - 1 - i] = Math.round(result[result.length - 1 - i] * gain);
|
|
49
|
+
}
|
|
50
|
+
return Int16Array.from(result);
|
|
51
|
+
}
|
|
52
|
+
|
|
@@ -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
|
+
|
|
22
|
+
export const setAsciiToBits = (str: string): number[] => {
|
|
23
|
+
const bits = [];
|
|
24
|
+
for (let i = 0; i < str.length; i++) {
|
|
25
|
+
const c = str.charCodeAt(i) & 0xFF;
|
|
26
|
+
bits.push(0);
|
|
27
|
+
for (let b = 0; b < 8; b++) bits.push((c >> b) & 1);
|
|
28
|
+
bits.push(1, 1);
|
|
29
|
+
}
|
|
30
|
+
return bits;
|
|
31
|
+
}
|
|
32
|
+
|