@atmosx/event-product-parser 3.0.6 → 3.0.7
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/.github/docs/docs-functions.md +2 -2
- package/.github/docs/docs-general-configurations.md +2 -12
- package/.github/docs/docs-integrations.md +4 -3
- package/.github/docs/docs-listeners.md +1 -1
- package/.github/docs/docs-source-configuration.md +1 -1
- package/.github/docs/docs-technical.md +1 -1
- package/{.github/README.md → README.md} +15 -9
- package/dist/cjs/index.cjs +24073 -7018
- package/dist/esm/index.mjs +24035 -6983
- package/package.json +56 -47
- package/pnpm-workspace.yaml +4 -0
- package/src/bootstrap.ts +64 -48
- package/src/{@building → building}/CreateEvent.ts +22 -24
- package/src/{@building → building}/GetCleanedEvent.ts +2 -2
- package/src/{@building → building}/GetEventAttachments.ts +14 -12
- package/src/building/GetEventDirection.ts +28 -0
- package/src/{@building → building}/GetEventEnhancedName.ts +5 -8
- package/src/{@building → building}/GetEventGeometry.ts +19 -13
- package/src/{@building → building}/GetEventHeader.ts +13 -13
- package/src/{@building → building}/GetEventNodes.ts +21 -19
- package/src/{@building → building}/GetEventOffice.ts +13 -13
- package/src/building/GetEventProperties.ts +105 -0
- package/src/{@building → building}/GetEventSignature.ts +9 -9
- package/src/{@building → building}/GetEventTags.ts +3 -3
- package/src/building/GetEventTheme.ts +26 -0
- package/src/building/GetEventTracking.ts +64 -0
- package/src/components/audio/GenerateAudioMessage.ts +149 -0
- package/src/{@modules/@eas → components/audio/components}/GetCleanDescription.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetFloatPCM16.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetMergedPCM16.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetPCM16.ts +13 -8
- package/src/{@modules/@eas → components/audio/components}/GetPCMToFloat.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/GetSampledPCM16.ts +14 -8
- package/src/{@modules/@eas → components/audio/components}/GetTTS.ts +17 -10
- package/src/{@modules/@eas → components/audio/components}/GetWavPCM16.ts +7 -7
- package/src/{@modules/@eas → components/audio/components}/SetAFSK.ts +13 -8
- package/src/{@modules/@eas → components/audio/components}/SetAsciiToBits.ts +2 -2
- package/src/{@modules/@eas → components/audio/components}/SetAttentionTone.ts +11 -6
- package/src/{@modules/@eas → components/audio/components}/SetNoise.ts +12 -7
- package/src/{@modules/@eas → components/audio/components}/SetRadioEffect.ts +12 -7
- package/src/{@modules/@eas → components/audio/components}/SetSameHeader.ts +22 -14
- package/src/{@modules/@utilities/SetWarning.ts → components/database/CreateQuery.ts} +18 -13
- package/src/{@modules/@database → components/database}/GetCachedEvents.ts +18 -15
- package/src/components/database/ImportBoundaries.ts +168 -0
- package/src/{@modules/@database → components/database}/ImportBroadcastify.ts +14 -24
- package/src/components/database/ImportCities.ts +87 -0
- package/src/{@modules/@database → components/database}/ImportShapefiles.ts +23 -26
- package/src/{@modules/@database → components/database}/ImportStanza.ts +15 -19
- package/src/components/database/InitializeDatabase.ts +71 -0
- package/src/components/images/GenerateGraphic.ts +234 -0
- package/src/components/images/components/CreateRectangle.ts +22 -0
- package/src/components/images/components/CreateText.ts +22 -0
- package/src/components/images/modules/CreateSVG.ts +37 -0
- package/src/components/images/modules/GetGeographicalBoundaries.ts +72 -0
- package/src/components/images/modules/GetGeographicalCities.ts +58 -0
- package/src/components/images/modules/GetGeographicalEvents.ts +48 -0
- package/src/components/images/modules/GetGeometryBounds.ts +82 -0
- package/src/components/images/modules/GetParsedBoundary.ts +58 -0
- package/src/components/images/modules/GetSVGPath.ts +53 -0
- package/src/components/images/modules/NormalizePolygon.ts +57 -0
- package/src/{@modules/@stanza → components/stanza}/GetAwipsType.ts +16 -17
- package/src/{@modules/@stanza → components/stanza}/ValidateStanza.ts +27 -15
- package/src/{@modules/@utilities → components/utilities}/CreateHttp.ts +26 -26
- package/src/{@modules/@utilities → components/utilities}/GetFormattedTime.ts +2 -2
- package/src/{@modules/@utilities → components/utilities}/GetLatestIssuance.ts +2 -2
- package/src/{@modules/@utilities → components/utilities}/GetMatched.ts +10 -5
- package/src/{@modules/@utilities → components/utilities}/GetShapeNearestPoint.ts +24 -19
- package/src/components/utilities/GetUnionPolygon.ts +36 -0
- package/src/components/utilities/QueueManager.ts +70 -0
- package/src/{@modules/@utilities → components/utilities}/SetCronSchedule.ts +29 -25
- package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +12 -12
- package/src/components/utilities/SetEventEmit.ts +42 -0
- package/src/{@modules/@utilities → components/utilities}/SetSettings.ts +7 -7
- package/src/{@modules/@utilities → components/utilities}/SetSleep.ts +5 -5
- package/src/components/utilities/SetTimeoutAction.ts +64 -0
- package/src/components/utilities/SetWarning.ts +47 -0
- package/src/{@modules/@xmpp → components/xmpp}/DeployXMPP.ts +20 -20
- package/src/{@core/CreateListener.ts → components/xmpp/ErrorXMPP.ts} +8 -5
- package/src/{@modules/@xmpp → components/xmpp}/OfflineXMPP.ts +13 -13
- package/src/{@modules/@xmpp → components/xmpp}/OnlineXMPP.ts +18 -18
- package/src/components/xmpp/ReconnectXMPP.ts +64 -0
- package/src/{@modules/@xmpp → components/xmpp}/StanzaXMPP.ts +25 -25
- package/src/{@core → core}/ClearEvents.ts +9 -9
- package/src/{@core → core}/GetEvents.ts +4 -4
- package/src/{@core → core}/GetNodes.ts +4 -4
- package/src/{@core → core}/GetRandomEvent.ts +4 -4
- package/src/{@core → core}/GetVersion.ts +4 -4
- package/src/{@core → core}/ManualEvent.ts +23 -24
- package/src/{@core → core}/QueryStanza.ts +12 -11
- package/src/core/SetNode.ts +87 -0
- package/src/{@core → core}/StartService.ts +21 -20
- package/src/{@core → core}/StopService.ts +10 -10
- package/src/{@enums → enums}/AWIPS.ts +2 -2
- package/src/{@enums → enums}/Actions.ts +2 -2
- package/src/{@enums → enums}/Cancellation.ts +2 -2
- package/src/{@enums → enums}/Causes.ts +2 -2
- package/src/{@enums → enums}/Correlations.ts +2 -2
- package/src/{@enums → enums}/Enhanced.ts +2 -2
- package/src/{@enums → enums}/Events.ts +2 -2
- package/src/{@enums → enums}/Expressions.ts +3 -3
- package/src/{@enums → enums}/GlobalFilter.ts +2 -2
- package/src/{@enums → enums}/Hail.ts +2 -2
- package/src/{@enums → enums}/ICAO.ts +2 -2
- package/src/{@enums → enums}/Matches.ts +8 -3
- package/src/{@enums → enums}/Products.ts +2 -2
- package/src/{@enums → enums}/Records.ts +2 -2
- package/src/{@enums → enums}/Severity.ts +2 -2
- package/src/{@enums → enums}/Shapefiles.ts +2 -2
- package/src/{@enums → enums}/States.ts +68 -4
- package/src/{@enums → enums}/Status.ts +2 -2
- package/src/{@enums → enums}/Strings.ts +2 -2
- package/src/{@enums → enums}/Tags.ts +9 -4
- package/src/{@enums → enums}/Testing.ts +2 -2
- package/src/enums/Themes.ts +70 -0
- package/src/events/ParseAPI.ts +129 -0
- package/src/{@events → events}/ParseText.ts +24 -22
- package/src/{@events → events}/ParseUGC.ts +27 -26
- package/src/{@events → events}/ParseVTEC.ts +38 -37
- package/src/index.ts +57 -37
- package/src/manager/MakeEvents.ts +110 -0
- package/src/manager/RemoveEvent.ts +74 -0
- package/src/{@manager → manager}/SetHash.ts +18 -13
- package/src/{@manager → manager}/UpdateEvents.ts +12 -12
- package/src/{@manager → manager}/UpdateNode.ts +14 -14
- package/src/{@building → manager}/ValidateEvents.ts +47 -57
- package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +11 -11
- package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
- package/src/{@parsers/@text → parsers/text}/GetEmbededText.ts +7 -6
- package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
- package/src/{@parsers/@text → parsers/text}/GetStringText.ts +9 -9
- package/src/{@parsers/@text → parsers/text}/GetTextFromProduct.ts +12 -12
- package/src/parsers/ugc/GetCache.ts +24 -0
- package/src/{@parsers/@ugc → parsers/ugc}/GetExpiry.ts +2 -2
- package/src/{@parsers/@ugc/GetUGCHeader.ts → parsers/ugc/GetHeader.ts} +4 -4
- package/src/{@parsers/@ugc → parsers/ugc}/GetLocations.ts +10 -10
- package/src/parsers/ugc/GetZonePolygon.ts +73 -0
- package/src/{@parsers/@ugc → parsers/ugc}/GetZones.ts +3 -3
- package/src/{@parsers/@ugc → parsers/ugc}/SetCache.ts +13 -8
- package/src/{@parsers/@ugc → parsers/ugc}/UGCExtract.ts +14 -14
- package/src/{@parsers/@pvtec → parsers/vtec}/GetExpiry.ts +2 -2
- package/src/parsers/vtec/VTECExtract.ts +49 -0
- package/src/{@types → static}/Attributes.ts +2 -3
- package/src/{@types → static}/Event.ts +8 -7
- package/src/{@types → static}/Properties.ts +7 -3
- package/src/{@types → static}/Stanza.ts +2 -2
- package/src/tasks/CreateTasks.ts +123 -0
- package/src/tasks/TaskGenerateJSON.ts +34 -0
- package/src/tasks/TaskGenerateText.ts +34 -0
- package/src/tasks/TaskSendNTFY.ts +97 -0
- package/src/tasks/TaskSendWebhook.ts +107 -0
- package/src/{@types → types}/Actions.ts +3 -3
- package/src/{@types → types}/HVTEC.ts +6 -6
- package/src/{@types → types}/Hash.ts +5 -5
- package/src/types/Nodes.ts +29 -0
- package/src/{@types → types}/Settings.ts +16 -8
- package/src/{@types → types}/StanzaCompiled.ts +15 -15
- package/src/{@types → types}/UGC.ts +5 -5
- package/src/{@modules/@utilities/GetSettings.ts → types/VTEC.ts} +12 -7
- package/tools/build.js +47 -0
- package/tsconfig.json +28 -1
- package/src/@building/GetEventProperties.ts +0 -96
- package/src/@building/GetEventTracking.ts +0 -68
- package/src/@core/SetNode.ts +0 -81
- package/src/@events/ParseAPI.ts +0 -117
- package/src/@manager/CreateActions.ts +0 -213
- package/src/@manager/MakeEvent.ts +0 -99
- package/src/@manager/RemoveEvent.ts +0 -70
- package/src/@modules/@database/InitializeDatabase.ts +0 -59
- package/src/@modules/@eas/GenerateEASMessage.ts +0 -144
- package/src/@modules/@utilities/SetEventEmit.ts +0 -41
- package/src/@modules/@utilities/SetListener.ts +0 -30
- package/src/@modules/@utilities/SetTimeoutAction.ts +0 -64
- package/src/@modules/@xmpp/ErrorXMPP.ts +0 -27
- package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
- package/src/@parsers/@pvtec/VTECExtract.ts +0 -49
- package/src/@parsers/@text/GetPolygonFromProduct.ts +0 -53
- package/src/@parsers/@text/GetXML.ts +0 -61
- package/src/@parsers/@ugc/GetCache.ts +0 -24
- package/src/@parsers/@ugc/GetZonePolygon.ts +0 -111
- package/src/@types/VTEC.ts +0 -30
- package/tsup.config.ts +0 -16
|
@@ -0,0 +1,110 @@
|
|
|
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: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
|
+
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { TypeEvent } from "StaticTypes/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
|
+
import { GetStringText } from "@ParsingText/GetStringText"
|
|
30
|
+
|
|
31
|
+
export const MakeEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
32
|
+
let tasked = [] as TypeEvent[];
|
|
33
|
+
const settings = Bootstrap.Settings as TypeSettings;
|
|
34
|
+
if (events.length === 0) return
|
|
35
|
+
await Promise.all(events.map(async event => {
|
|
36
|
+
const features = Bootstrap.Cache.Events.features;
|
|
37
|
+
const getHash = event.properties.metadata.hash;
|
|
38
|
+
const getTracking = event.properties.metadata.tracking;
|
|
39
|
+
const isEntry = Bootstrap.Cache.Hashes?.find(hash => hash.Tracking === getTracking)
|
|
40
|
+
const isHashed = isEntry?.Hashes?.includes(getHash) ?? false;
|
|
41
|
+
const isNodeFiltering = settings.GlobalSettings.EventFiltering.NodeLocationFiltering
|
|
42
|
+
const getNodes = Bootstrap.Cache.Nodes.features;
|
|
43
|
+
const getFeature = features.find(feature => feature.properties.metadata.tracking === getTracking);
|
|
44
|
+
|
|
45
|
+
if (isHashed || event.properties.status_metadata.is_expired) return
|
|
46
|
+
SetHash({ Event: event, Entry: isEntry })
|
|
47
|
+
await UpdateNode(event);
|
|
48
|
+
if (isNodeFiltering && getNodes.length > 0) {
|
|
49
|
+
if (!event.properties.metadata.filtered_proximity && !EnumGlobalFilter.includes(event.properties.event.toLowerCase())) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const isRatelimited = SetTimeoutAction({ Identifier: getTracking, Interval: 1, Max: 1, AddTime: true })
|
|
55
|
+
const isLocal = event.properties.metadata.filtered_proximity ? `[LOCAL] ` : ``;
|
|
56
|
+
if (!isRatelimited.Limited) {
|
|
57
|
+
SetEventEmit({
|
|
58
|
+
Event: `onEventStatus`,
|
|
59
|
+
Metadata: {
|
|
60
|
+
Type: getFeature ? `Updated` : `New`,
|
|
61
|
+
Event: event
|
|
62
|
+
},
|
|
63
|
+
Tree: Bootstrap.Settings.EnhancedEventJournaling ? GetStringText(event).split('\n').filter(line => line.trim() !== '') : [],
|
|
64
|
+
Message: `${isLocal}[${getFeature ? 'Updated' : 'New'}] ${event.properties.event} (${event.properties.status}) (${event.properties.metadata.tracking})`
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (settings.GlobalSettings.EventManagement) {
|
|
69
|
+
if (event.properties.status_metadata.is_issued || event.properties.status_metadata.is_updated) {
|
|
70
|
+
if (getFeature) {
|
|
71
|
+
const getIndex = features.indexOf(getFeature);
|
|
72
|
+
const cHistory = getFeature?.properties?.metadata?.history ?? [];
|
|
73
|
+
const cLocations = getFeature?.properties?.locations?.split(";").map((l: string) => l.trim()) ?? [];
|
|
74
|
+
const cUgc = getFeature?.properties?.geocode?.ugc ?? [];
|
|
75
|
+
|
|
76
|
+
const iHistory = event.properties?.metadata?.history ?? [];
|
|
77
|
+
const iLocations = event.properties?.locations?.split(";").map((l: string) => l.trim()) ?? [];
|
|
78
|
+
const iUgc = event.properties?.geocode?.ugc ?? [];
|
|
79
|
+
|
|
80
|
+
const mHistory = [...cHistory, ...iHistory].filter((v, i, a) => a.indexOf(v) === i).filter((v, i, a) => a.findIndex(h => h.description === v.description && h.issued === v.issued) === i);
|
|
81
|
+
const mLocations = [...cLocations, ...iLocations].filter((v, i, a) => a.indexOf(v) === i).join('; ');
|
|
82
|
+
const mUgc = [...cUgc, ...iUgc].filter((v, i, a) => a.indexOf(v) === i);
|
|
83
|
+
|
|
84
|
+
Bootstrap.Cache.Events.features[getIndex] = {
|
|
85
|
+
...event,
|
|
86
|
+
properties: {
|
|
87
|
+
...event.properties,
|
|
88
|
+
metadata: {
|
|
89
|
+
...event?.properties?.metadata,
|
|
90
|
+
history: mHistory
|
|
91
|
+
},
|
|
92
|
+
locations: mLocations,
|
|
93
|
+
geocode: {
|
|
94
|
+
...event?.properties?.geocode,
|
|
95
|
+
ugc: mUgc
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
tasked.push(Bootstrap.Cache.Events.features[getIndex])
|
|
101
|
+
} else {
|
|
102
|
+
features.push(event);
|
|
103
|
+
tasked.push(event)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}))
|
|
108
|
+
SetEventEmit({ Event: `onEventCache`, Metadata: Bootstrap.Cache.Events, Limited: true })
|
|
109
|
+
return await CreateTasks(tasked)
|
|
110
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
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: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
|
+
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { TypeEvent } from "StaticTypes/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
|
+
|
|
27
|
+
interface RemoveEventOptions {
|
|
28
|
+
Event: TypeEvent
|
|
29
|
+
IsTimeBasedExpiration: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const RemoveEvent = async ({ Event, IsTimeBasedExpiration }: RemoveEventOptions):Promise<void> => {
|
|
33
|
+
const gTracking = Event.properties.metadata.tracking;
|
|
34
|
+
const isTrackingEventLogged = Bootstrap.Cache.Events.features
|
|
35
|
+
.find(f => f?.properties?.metadata?.tracking === gTracking);
|
|
36
|
+
const isStatement = Event.properties.status_metadata.is_statement;
|
|
37
|
+
|
|
38
|
+
if (isTrackingEventLogged) {
|
|
39
|
+
Event.properties.expires = new Date().toISOString();
|
|
40
|
+
Event.properties.status = `Expired`;
|
|
41
|
+
Event.properties.status_metadata.is_expired = true;
|
|
42
|
+
|
|
43
|
+
const description = IsTimeBasedExpiration ? EnumStrings.cancellation
|
|
44
|
+
.replace(`{SENDER}`, Event.properties.geocode.office.name)
|
|
45
|
+
.replace(`{EVENT}`, Event.properties.event) : Event.properties.description
|
|
46
|
+
Event.properties.description = description;
|
|
47
|
+
Event.properties.metadata.raw = IsTimeBasedExpiration ? description : Event.properties.metadata.raw;
|
|
48
|
+
Event.properties.metadata.history.push({
|
|
49
|
+
description: IsTimeBasedExpiration ? description : Event.properties.description,
|
|
50
|
+
issued: Event.properties.expires,
|
|
51
|
+
status: Event.properties.status
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
Bootstrap.Cache.Events.features
|
|
55
|
+
.splice(Bootstrap.Cache.Events.features.indexOf(isTrackingEventLogged), 1);
|
|
56
|
+
Bootstrap.Cache.Hashes = Bootstrap.Cache.Hashes
|
|
57
|
+
.filter(hash => hash.Tracking !== gTracking);
|
|
58
|
+
|
|
59
|
+
if (!isStatement) {
|
|
60
|
+
SetEventEmit({
|
|
61
|
+
Event: `onEventStatus`,
|
|
62
|
+
Metadata: { type: `Removed`, event: Event },
|
|
63
|
+
Message: `[Removed] ${Event.properties.event} (${Event.properties.status}) (${gTracking})`
|
|
64
|
+
})
|
|
65
|
+
CreateTasks([Event])
|
|
66
|
+
}
|
|
67
|
+
SetTimeoutAction({ Identifier: gTracking, Expire: true })
|
|
68
|
+
}
|
|
69
|
+
SetEventEmit({
|
|
70
|
+
Event: `onEventCache`,
|
|
71
|
+
Metadata: Bootstrap.Cache.Events,
|
|
72
|
+
Limited: true
|
|
73
|
+
})
|
|
74
|
+
}
|
|
@@ -11,26 +11,31 @@
|
|
|
11
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
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { TypeHash } from "
|
|
22
|
-
import {
|
|
20
|
+
import { TypeEvent } from "StaticTypes/Event"
|
|
21
|
+
import { TypeHash } from "Types/Hash"
|
|
22
|
+
import { Bootstrap } from "@Bootstrap"
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
interface SetHashOptions {
|
|
25
|
+
Event: TypeEvent
|
|
26
|
+
Entry: TypeHash
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SetHash = ({ Event, Entry }: SetHashOptions): void => {
|
|
30
|
+
if (!Entry) {
|
|
31
|
+
Bootstrap.Cache.Hashes.push({
|
|
32
|
+
Tracking: Event.properties.metadata.tracking,
|
|
33
|
+
Hashes: [Event.properties.metadata.hash],
|
|
34
|
+
Expires: Event.properties.expires
|
|
30
35
|
});
|
|
31
36
|
return;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
Entry.Hashes.push(Event.properties.metadata.hash);
|
|
40
|
+
Entry.Expires = Event.properties.expires;
|
|
36
41
|
}
|
|
@@ -11,25 +11,25 @@
|
|
|
11
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
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import {
|
|
22
|
-
import { SetEventEmit } from "
|
|
23
|
-
import { RemoveEvent } from "
|
|
20
|
+
import { TypeEvent } from "StaticTypes/Event"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
23
|
+
import { RemoveEvent } from "@Manager/RemoveEvent"
|
|
24
24
|
|
|
25
|
-
export const UpdateEvents = async (
|
|
26
|
-
const events =
|
|
25
|
+
export const UpdateEvents = async (selected?: TypeEvent): Promise<void> => {
|
|
26
|
+
const events = Bootstrap.Cache.Events.features;
|
|
27
27
|
async function update(event: TypeEvent) {
|
|
28
28
|
if (new Date(event.properties.expires) < new Date()) {
|
|
29
|
-
SetEventEmit({
|
|
30
|
-
await RemoveEvent(event, true)
|
|
29
|
+
SetEventEmit({ Event: `onExpiredProduct`, Metadata: event })
|
|
30
|
+
await RemoveEvent({ Event: event, IsTimeBasedExpiration: true })
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
if (!
|
|
34
|
-
if (
|
|
33
|
+
if (!selected) { await Promise.all(events.map(async (event) => { await update(event) })) }
|
|
34
|
+
if (selected) { await update(selected) }
|
|
35
35
|
}
|
|
@@ -11,23 +11,23 @@
|
|
|
11
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
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import {
|
|
22
|
-
import { GetEventNodes } from "
|
|
23
|
-
import { SetEventEmit } from "
|
|
20
|
+
import { TypeEvent } from "StaticTypes/Event"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { GetEventNodes } from "@Building/GetEventNodes"
|
|
23
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
24
24
|
|
|
25
|
-
export const UpdateNode = async (
|
|
26
|
-
const events =
|
|
27
|
-
const ttl =
|
|
25
|
+
export const UpdateNode = async (selected?: TypeEvent): Promise<void> => {
|
|
26
|
+
const events = Bootstrap.Cache.Events.features;
|
|
27
|
+
const ttl = Bootstrap.Settings.GlobalSettings.NodeTTL * 1e3;
|
|
28
28
|
let total = 0;
|
|
29
29
|
|
|
30
|
-
const TTLEvents =
|
|
30
|
+
const TTLEvents = selected ? [selected] : events.filter((evt) => {
|
|
31
31
|
const lastUpdate = evt?.properties?.metadata?.updated ?? null;
|
|
32
32
|
return lastUpdate == null || (Date.now() - lastUpdate) >= ttl;
|
|
33
33
|
});
|
|
@@ -52,10 +52,10 @@ export const UpdateNode = async (selectedEvent?: TypeEvent): Promise<void> => {
|
|
|
52
52
|
|
|
53
53
|
if (total > 0) {
|
|
54
54
|
SetEventEmit({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
Event: `onNodeUpdate`,
|
|
56
|
+
Metadata: {
|
|
57
|
+
Type: `global-update`,
|
|
58
|
+
Updated: total
|
|
59
59
|
},
|
|
60
60
|
})
|
|
61
61
|
}
|
|
@@ -11,58 +11,61 @@
|
|
|
11
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
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeEvent } from "
|
|
21
|
-
import { TypeSettings } from "
|
|
22
|
-
import {
|
|
23
|
-
import { GetEventEnhancedName } from "
|
|
24
|
-
import { GetEventSignature } from "
|
|
25
|
-
import {
|
|
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 "StaticTypes/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> => {
|
|
35
35
|
const tick = performance.now();
|
|
36
36
|
if (events.length === 0) return
|
|
37
|
-
const configurations =
|
|
37
|
+
const configurations = Bootstrap.Settings as TypeSettings
|
|
38
38
|
const sets = {} as Record<string, Set<string>>;
|
|
39
39
|
const bools = {} as Record<string, boolean>;
|
|
40
40
|
const megered = {...configurations.GlobalSettings, ...configurations.GlobalSettings.EventFiltering}
|
|
41
41
|
for (const key in megered) {
|
|
42
|
-
const setting = megered[key]
|
|
43
|
-
if (Array.isArray(setting)) {
|
|
44
|
-
|
|
42
|
+
const setting = megered[key as keyof typeof megered]
|
|
43
|
+
if (Array.isArray(setting)) {
|
|
44
|
+
(sets as Record<string, any>)[key] = new Set(setting.map(item => String(item).toLowerCase()));
|
|
45
|
+
}
|
|
46
|
+
if (typeof setting === 'boolean') {
|
|
47
|
+
(bools as Record<string, any>)[key] = setting;
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
|
-
|
|
47
50
|
const isFiltered = (define: TypeEvent): boolean => {
|
|
48
51
|
const properties = define.properties;
|
|
49
52
|
const zones = properties.geocode.ugc;
|
|
50
53
|
const icao = properties.geocode.office.office
|
|
51
54
|
|
|
52
55
|
if (properties.status_metadata.is_test) {
|
|
53
|
-
SetEventEmit({
|
|
56
|
+
SetEventEmit({ Event: `onTestProduct`, Metadata: define })
|
|
54
57
|
if (bools?.IgnoreTestProducts) return true;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
if (properties.status_metadata.is_expired) {
|
|
58
|
-
SetEventEmit({
|
|
59
|
-
RemoveEvent(define, false)
|
|
61
|
+
SetEventEmit({ Event: `onExpiredProduct`, Metadata: define })
|
|
62
|
+
RemoveEvent({ Event: define, IsTimeBasedExpiration: false })
|
|
60
63
|
return true;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
if (properties.metadata?.vtec?.
|
|
64
|
-
const isSPC = properties.metadata?.vtec?.
|
|
65
|
-
SetEventEmit({
|
|
66
|
+
if (properties.metadata?.vtec?.Watch && properties.metadata.source != `events.api`) {
|
|
67
|
+
const isSPC = properties.metadata?.vtec?.PredictionCenter;
|
|
68
|
+
SetEventEmit({ Event: isSPC ? `onStormPredictionWatch` : `onNonStormPredictionWatch`, Metadata: define })
|
|
66
69
|
if (bools?.SPCWatchesOnly && !isSPC) {
|
|
67
70
|
return true;
|
|
68
71
|
}
|
|
@@ -74,45 +77,45 @@ export const ValidateEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
74
77
|
for (const key in sets) {
|
|
75
78
|
const setting = sets[key]
|
|
76
79
|
const values = [...setting];
|
|
77
|
-
if (key === 'ListeningEvents' && setting.size > 0 && !GetMatched(values, define.properties.event)) {
|
|
80
|
+
if (key === 'ListeningEvents' && setting.size > 0 && !GetMatched({ Strings: values, String: define.properties.event })) {
|
|
78
81
|
SetEventEmit({
|
|
79
|
-
|
|
80
|
-
|
|
82
|
+
Event: `onFilteredEvent`,
|
|
83
|
+
Metadata: define
|
|
81
84
|
});
|
|
82
85
|
return true
|
|
83
86
|
}
|
|
84
|
-
if (key === 'IgnoredEvents' && setting.size > 0 && GetMatched(values, define.properties.event)) {
|
|
87
|
+
if (key === 'IgnoredEvents' && setting.size > 0 && GetMatched({ Strings: values, String: define.properties.event })) {
|
|
85
88
|
SetEventEmit({
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
Event: `onIgnoredEvent`,
|
|
90
|
+
Metadata: define
|
|
88
91
|
});
|
|
89
92
|
return true
|
|
90
93
|
}
|
|
91
94
|
if (key === 'ListeningICAO' && setting.size > 0 && icao != null && !setting.has(icao.toLowerCase())) {
|
|
92
95
|
SetEventEmit({
|
|
93
|
-
|
|
94
|
-
|
|
96
|
+
Event: `onFilteredICAO`,
|
|
97
|
+
Metadata: define
|
|
95
98
|
});
|
|
96
99
|
return true
|
|
97
100
|
}
|
|
98
101
|
if (key === 'IgnoredICAO' && setting.size > 0 && icao != null && setting.has(icao.toLowerCase())) {
|
|
99
102
|
SetEventEmit({
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
Event: `onIgnoredICAO`,
|
|
104
|
+
Metadata: define
|
|
102
105
|
});
|
|
103
106
|
return true
|
|
104
107
|
}
|
|
105
108
|
if (key === 'ListeningUGC' && setting.size > 0 && zones.length > 0 && !zones.some((ugc: string) => setting.has(ugc.toLowerCase()))) {
|
|
106
109
|
SetEventEmit({
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
Event: `onFilteredUGC`,
|
|
111
|
+
Metadata: define
|
|
109
112
|
});
|
|
110
113
|
return true
|
|
111
114
|
}
|
|
112
115
|
if (key === 'ListeningStates' && setting.size > 0 && zones.length > 0 && !zones.some((ugc: string) => setting.has(ugc.substring(0, 2).toLowerCase()))) {
|
|
113
116
|
SetEventEmit({
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
Event: `onFilteredState`,
|
|
118
|
+
Metadata: define
|
|
116
119
|
});
|
|
117
120
|
return true
|
|
118
121
|
}
|
|
@@ -121,34 +124,21 @@ export const ValidateEvents = async (events: TypeEvent[]): Promise<void> => {
|
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
const filtering = events.filter((event: TypeEvent) => {
|
|
124
|
-
|
|
127
|
+
Bootstrap.Cache.Parsed = Bootstrap.Cache.Parsed.filter((e) => e !== event);
|
|
125
128
|
const define = GetEventSignature(event) as TypeEvent;
|
|
126
129
|
const pre = {...define,properties: {...define.properties, metadata: {...define.properties.metadata }}};
|
|
127
130
|
const properties = define.properties; delete pre.properties.metadata.ms; delete pre.properties.metadata.header;
|
|
128
131
|
const enhanced = properties.event = GetEventEnhancedName(event)
|
|
129
132
|
const filtered = isFiltered(define)
|
|
130
133
|
if (!filtered) {
|
|
131
|
-
event.geometry = !bools?.DisableGeometryParsing ? GetEventGeometry(event) : null;
|
|
134
|
+
event.geometry = !bools?.DisableGeometryParsing ? GetEventGeometry({ Event: event }) : null;
|
|
132
135
|
properties.metadata.attachments = GetEventAttachments(event)
|
|
133
136
|
}
|
|
134
137
|
properties.metadata.hash = createHash("sha256").update(JSON.stringify(pre)).digest("hex")
|
|
135
|
-
SetEventEmit({
|
|
138
|
+
SetEventEmit({ Event: `onProductType${enhanced.replace(/\s+/g, '')}`, Metadata: define });
|
|
136
139
|
return !filtered
|
|
137
140
|
})
|
|
138
141
|
|
|
139
|
-
SetDebug({
|
|
140
|
-
|
|
141
|
-
if (filtering.length > 0) {
|
|
142
|
-
for (const event of filtering) {
|
|
143
|
-
await MakeEvent(event)
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
SetEventEmit({
|
|
148
|
-
event: `onEventCache`,
|
|
149
|
-
metadata: bootstrap.cache.events,
|
|
150
|
-
limited: true
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
SetDebug({ title: `ValidateEvents (${filtering.length}/${events.length})`, message: `${Math.round(performance.now() - tick)}ms` })
|
|
142
|
+
SetDebug({ Title: `ValidateEvents (${filtering.length}/${events.length})`, Message: `${Math.round(performance.now() - tick)}ms` })
|
|
143
|
+
await MakeEvents(filtering)
|
|
154
144
|
}
|
|
@@ -11,17 +11,17 @@
|
|
|
11
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
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { TypeHVTEC } from "
|
|
21
|
-
import { EnumCauses } from "
|
|
22
|
-
import { EnumRecords } from "
|
|
23
|
-
import { EnumExpressions } from "
|
|
24
|
-
import { EnumSeverity } from "
|
|
20
|
+
import { TypeHVTEC } from "Types/HVTEC"
|
|
21
|
+
import { EnumCauses } from "@Enums/Causes"
|
|
22
|
+
import { EnumRecords } from "@Enums/Records"
|
|
23
|
+
import { EnumExpressions } from "@Enums/Expressions"
|
|
24
|
+
import { EnumSeverity } from "@Enums/Severity"
|
|
25
25
|
|
|
26
26
|
export const HVExtract = (message: string): TypeHVTEC[] | null => {
|
|
27
27
|
const getHVTECs = message.match(EnumExpressions.hvtec) ?? [];
|
|
@@ -30,10 +30,10 @@ export const HVExtract = (message: string): TypeHVTEC[] | null => {
|
|
|
30
30
|
const sub = vtec.split(`.`);
|
|
31
31
|
if (sub.length < 7) continue;
|
|
32
32
|
vtecs.push({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
HVTEC: vtec,
|
|
34
|
+
Severity: EnumSeverity[sub[1]],
|
|
35
|
+
Cause: EnumCauses[sub[2]],
|
|
36
|
+
Record: EnumRecords[sub[6]]
|
|
37
37
|
})
|
|
38
38
|
}
|
|
39
39
|
return vtecs.length > 0 ? vtecs : null;
|
|
@@ -11,21 +11,20 @@
|
|
|
11
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
|
-
Documentation:
|
|
14
|
+
Documentation: https://atmosphericx.scriptkitty.cafe/documentation
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Independent Package: @atmosx/event-product-parser
|
|
17
17
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
import { EnumExpressions } from "
|
|
20
|
+
import { EnumExpressions } from "@Enums/Expressions"
|
|
21
21
|
|
|
22
22
|
interface GetDescriptionFromProductOptions {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Message: string
|
|
24
|
+
Handle?: string
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export const GetDescriptionFromProduct = (
|
|
28
|
-
let message = options.message;
|
|
27
|
+
export const GetDescriptionFromProduct = ({ Message, Handle }: GetDescriptionFromProductOptions): string => {
|
|
29
28
|
const predefinedEndMarkers = ['&&', 'LAT...'];
|
|
30
29
|
const getEndIndex = (text: string, fromIndex = 0): number => {
|
|
31
30
|
const indices = predefinedEndMarkers
|
|
@@ -33,28 +32,28 @@ export const GetDescriptionFromProduct = (options: GetDescriptionFromProductOpti
|
|
|
33
32
|
.filter((idx) => idx !== -1);
|
|
34
33
|
return indices.length ? Math.min(...indices) : -1;
|
|
35
34
|
};
|
|
36
|
-
const dates = Array.from(
|
|
35
|
+
const dates = Array.from(Message.matchAll(EnumExpressions.dateline));
|
|
37
36
|
if (dates.length) {
|
|
38
37
|
const lastMatch = dates[dates.length - 1][0];
|
|
39
|
-
const sIndx =
|
|
38
|
+
const sIndx = Message.lastIndexOf(lastMatch);
|
|
40
39
|
if (sIndx !== -1) {
|
|
41
|
-
const endIndx = getEndIndex(
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
const handleIdx =
|
|
46
|
-
|
|
47
|
-
if (
|
|
40
|
+
const endIndx = getEndIndex(Message, sIndx);
|
|
41
|
+
Message = Message.substring(sIndx + lastMatch.length, endIndx !== -1 ? endIndx : undefined).trimStart();
|
|
42
|
+
if (Message.startsWith('/')) Message = Message.slice(1).trimStart();
|
|
43
|
+
if (Handle && Message.includes(Handle)) {
|
|
44
|
+
const handleIdx = Message.indexOf(Handle);
|
|
45
|
+
Message = Message.substring(handleIdx + Handle.length).trimStart();
|
|
46
|
+
if (Message.startsWith('/')) Message = Message.slice(1).trimStart();
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
|
-
} else if (
|
|
51
|
-
const handleIndx =
|
|
49
|
+
} else if (Handle) {
|
|
50
|
+
const handleIndx = Message.indexOf(Handle);
|
|
52
51
|
if (handleIndx !== -1) {
|
|
53
|
-
let afterHandle =
|
|
52
|
+
let afterHandle = Message.substring(handleIndx + Handle.length).trimStart();
|
|
54
53
|
if (afterHandle.startsWith('/')) afterHandle = afterHandle.slice(1).trimStart();
|
|
55
54
|
const latEnd = getEndIndex(afterHandle);
|
|
56
|
-
|
|
55
|
+
Message = latEnd !== -1 ? afterHandle.substring(0, latEnd).trim() : afterHandle.trim();
|
|
57
56
|
}
|
|
58
57
|
}
|
|
59
|
-
return
|
|
58
|
+
return Message.trim();
|
|
60
59
|
}
|