@atmosx/event-product-parser 3.0.622 → 3.1.0
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/CHANGELOGS.md +52 -0
- package/.github/CODE_OF_CONDUCT.md +24 -1
- package/.github/CONTRIBUTING.md +22 -3
- package/.github/FUNDING.yaml +3 -0
- package/.github/LICENSE +24 -1
- package/.github/SECURITY.md +25 -6
- package/.github/docs/chapters/general-configurations.md +109 -0
- package/.github/docs/chapters/sources-and-attributes.md +219 -0
- package/README.md +56 -148
- package/dist/{cjs/index.cjs → index.cjs} +4486 -1471
- package/package.json +13 -8
- package/pnpm-workspace.yaml +1 -0
- package/src/bootstrap.ts +66 -51
- 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 +15 -8
- 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/components/database/CreateQuery.ts +39 -0
- package/src/components/database/InitializeDatabase.ts +71 -0
- package/src/components/database/imports/Boundaires.ts +168 -0
- package/src/{@modules/@database/ImportBroadcastify.ts → components/database/imports/Broadcastify.ts} +15 -25
- package/src/components/database/imports/Census.ts +87 -0
- package/src/{@modules/@database/ImportShapefiles.ts → components/database/imports/Shapefiles.ts} +18 -21
- package/src/{@modules/@database/ImportStanza.ts → components/database/imports/Stanza.ts} +15 -19
- package/src/components/events/CreateEvents.ts +88 -0
- package/src/components/events/FilterEvents.ts +149 -0
- package/src/{@building/CreateEvent.ts → components/events/ProcessStanza.ts} +22 -22
- package/src/components/events/RemoveEvents.ts +74 -0
- package/src/{@building → components/events/components}/GetCleanedEvent.ts +2 -2
- package/src/{@building → components/events/components}/GetEventAttachments.ts +14 -12
- package/src/components/events/components/GetEventDirection.ts +28 -0
- package/src/{@building → components/events/components}/GetEventEnhancedName.ts +5 -6
- package/src/{@building → components/events/components}/GetEventGeometry.ts +19 -13
- package/src/{@building → components/events/components}/GetEventHeader.ts +13 -13
- package/src/components/events/components/GetEventMerged.ts +51 -0
- package/src/{@building → components/events/components}/GetEventNodes.ts +20 -18
- package/src/{@building → components/events/components}/GetEventOffice.ts +13 -13
- package/src/components/events/components/GetEventPopulation.ts +58 -0
- package/src/components/events/components/GetEventProperties.ts +106 -0
- package/src/{@building → components/events/components}/GetEventSignature.ts +9 -9
- package/src/{@building → components/events/components}/GetEventTags.ts +3 -3
- package/src/{@core/CreateListener.ts → components/events/components/GetEventTheme.ts} +8 -6
- package/src/components/events/components/GetEventTracking.ts +64 -0
- package/src/{@modules/@database → components/events/utilities}/GetCachedEvents.ts +18 -14
- package/src/{@manager → components/events/utilities}/SetHash.ts +18 -13
- package/src/{@manager → components/events/utilities}/UpdateEvents.ts +12 -12
- package/src/{@manager → components/events/utilities}/UpdateNode.ts +14 -14
- package/src/{@parsers/@text → components/formatting}/GetEmbededText.ts +12 -6
- package/src/{@parsers/@text → components/formatting}/GetStringText.ts +13 -9
- package/src/{@modules/@utilities → components/geometry}/GetShapeNearestPoint.ts +24 -19
- package/src/components/geometry/GetUnionPolygon.ts +36 -0
- package/src/components/images/GenerateGraphic.ts +242 -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/components/utilities/EmitThread.ts +97 -0
- 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}/QueueManager.ts +7 -8
- package/src/{@modules/@utilities → components/utilities}/SetDebug.ts +13 -13
- 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/{@modules/@xmpp → components/xmpp}/ErrorXMPP.ts +6 -6
- 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 +26 -26
- 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 +4 -3
- 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 +8 -3
- package/src/{@enums → enums}/Testing.ts +2 -2
- package/src/enums/Themes.ts +70 -0
- package/src/events/ParseAPI.ts +133 -0
- package/src/{@events → events}/ParseText.ts +24 -22
- package/src/{@events → events}/ParseUGC.ts +27 -26
- package/src/{@events → events}/ParseVTEC.ts +37 -36
- package/src/{@core → exports}/ClearEvents.ts +9 -9
- package/src/{@core → exports}/GetEvents.ts +4 -4
- package/src/exports/GetNearestCity.ts +45 -0
- package/src/{@core → exports}/GetNodes.ts +4 -4
- package/src/{@core → exports}/GetRandomEvent.ts +4 -4
- package/src/{@core → exports}/GetVersion.ts +4 -4
- package/src/{@core → exports}/ManualEvent.ts +24 -24
- package/src/{@core → exports}/QueryStanza.ts +12 -11
- package/src/exports/SetNode.ts +100 -0
- package/src/{@core → exports}/StartService.ts +22 -21
- package/src/{@core → exports}/StopService.ts +10 -10
- package/src/index.ts +55 -37
- package/src/{@parsers/@hvtec → parsers/hvtec}/HVExtract.ts +7 -7
- package/src/{@parsers/@text → parsers/text}/GetDescriptionFromProduct.ts +20 -21
- package/src/parsers/text/GetPolygonFromProduct.ts +71 -0
- 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/@pvtec → parsers/vtec}/VTECExtract.ts +17 -17
- package/src/tasks/CreateTasks.ts +116 -0
- package/src/{@tasks → tasks}/TaskGenerateJSON.ts +10 -11
- package/src/{@tasks → tasks}/TaskGenerateText.ts +11 -12
- package/src/tasks/TaskSendNTFY.ts +96 -0
- package/src/tasks/TaskSendWebhook.ts +107 -0
- package/src/{@types → types/event}/Attributes.ts +2 -3
- package/src/{@types → types/event}/Event.ts +8 -7
- package/src/{@types → types/event}/HVTEC.ts +2 -2
- package/src/{@types → types/event}/Properties.ts +17 -4
- package/src/{@types → types/event}/Stanza.ts +2 -2
- package/src/{@types → types/event}/VTEC.ts +8 -8
- package/src/{@types → types/standard}/Actions.ts +3 -3
- package/src/{@types → types/standard}/Hash.ts +5 -5
- package/src/{@modules/@utilities/GetSettings.ts → types/standard/Nodes.ts} +15 -7
- package/src/{@types → types/standard}/Settings.ts +19 -12
- package/src/{@types → types/standard}/StanzaCompiled.ts +15 -15
- package/src/{@types → types/standard}/UGC.ts +5 -5
- package/tools/build.js +2 -15
- package/tsconfig.json +29 -17
- package/.github/SUPPORTED_EVENTS.md +0 -370
- package/.github/docs/docs-functions.md +0 -30
- package/.github/docs/docs-general-configurations.md +0 -209
- package/.github/docs/docs-integrations.md +0 -37
- package/.github/docs/docs-listeners.md +0 -28
- package/.github/docs/docs-source-configuration.md +0 -218
- package/.github/docs/docs-technical.md +0 -50
- package/.github/logo.png +0 -0
- package/.github/samples/SAMPLE_EAS_GENERATION.wav +0 -0
- package/.github/samples/SAMPLE_GEOJSON.json +0 -204
- package/.github/samples/SAMPLE_TEXT_PRODUCT.txt +0 -119
- package/dist/esm/index.mjs +0 -22298
- package/src/@building/GetEventProperties.ts +0 -101
- package/src/@building/GetEventTracking.ts +0 -68
- package/src/@core/SetNode.ts +0 -87
- package/src/@events/ParseAPI.ts +0 -122
- package/src/@manager/MakeEvents.ts +0 -109
- package/src/@manager/RemoveEvent.ts +0 -70
- package/src/@manager/ValidateEvents.ts +0 -141
- package/src/@modules/@database/InitializeDatabase.ts +0 -59
- package/src/@modules/@eas/GenerateEASMessage.ts +0 -152
- package/src/@modules/@utilities/GetFormattedTime.ts +0 -43
- package/src/@modules/@utilities/SetCronSchedule.ts +0 -94
- 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/@utilities/SetWarning.ts +0 -34
- package/src/@modules/@xmpp/ReconnectXMPP.ts +0 -64
- 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/@tasks/CreateTasks.ts +0 -110
- package/src/@tasks/TaskGenerateAudio.ts +0 -35
- package/src/@tasks/TaskSendNTFY.ts +0 -93
- package/src/@tasks/TaskSendWebhook.ts +0 -101
|
@@ -11,34 +11,34 @@
|
|
|
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
20
|
interface CreateHttpOptions {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
URL: string
|
|
22
|
+
Headers?: any
|
|
23
|
+
Timeout?: number
|
|
24
|
+
Auth?: {
|
|
25
|
+
Username: string
|
|
26
|
+
Password: string
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
Method?: `GET` | `POST` | `PUT` | `DELETE`
|
|
29
|
+
Body?: any;
|
|
30
|
+
Form?: any;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const CreateHttp = async (
|
|
33
|
+
export const CreateHttp = async ({ URL, Headers, Timeout, Auth, Method, Body, Form }: CreateHttpOptions): Promise<any> => {
|
|
34
34
|
const requestOptions: RequestInit = {
|
|
35
|
-
method:
|
|
36
|
-
headers:
|
|
35
|
+
method: Method ?? "GET",
|
|
36
|
+
headers: Headers ?? {
|
|
37
37
|
"User-Agent": "AtmosphericX",
|
|
38
38
|
"Accept": "application/geo+json, text/plain, */*; q=0.9",
|
|
39
39
|
"Accept-Language": "en-US,en;q=0.9",
|
|
40
40
|
},
|
|
41
|
-
signal: AbortSignal.timeout(
|
|
41
|
+
signal: AbortSignal.timeout(Timeout ?? 10_000),
|
|
42
42
|
redirect: "follow"
|
|
43
43
|
};
|
|
44
44
|
|
|
@@ -47,8 +47,8 @@ export const CreateHttp = async (options: CreateHttpOptions): Promise<any> => {
|
|
|
47
47
|
return { error: error, options: requestOptions, status, message };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (
|
|
51
|
-
const authString = `${
|
|
50
|
+
if (Auth) {
|
|
51
|
+
const authString = `${Auth.Username}:${Auth.Password}`;
|
|
52
52
|
const encodedAuth = Buffer.from(authString).toString("base64");
|
|
53
53
|
requestOptions.headers = {
|
|
54
54
|
...requestOptions.headers,
|
|
@@ -56,20 +56,20 @@ export const CreateHttp = async (options: CreateHttpOptions): Promise<any> => {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
if (
|
|
60
|
-
requestOptions.body =
|
|
61
|
-
} else if (
|
|
59
|
+
if (Form) {
|
|
60
|
+
requestOptions.body = Form;
|
|
61
|
+
} else if (Body != undefined) {
|
|
62
62
|
requestOptions.body =
|
|
63
|
-
|
|
64
|
-
?
|
|
65
|
-
: typeof
|
|
66
|
-
?
|
|
67
|
-
: JSON.stringify(
|
|
63
|
+
Body instanceof FormData
|
|
64
|
+
? Body
|
|
65
|
+
: typeof Body === "string"
|
|
66
|
+
? Body
|
|
67
|
+
: JSON.stringify(Body);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
try {
|
|
71
71
|
const response = await fetch(
|
|
72
|
-
|
|
72
|
+
URL ?? `https://api.weather.gov/alerts/active`,
|
|
73
73
|
requestOptions
|
|
74
74
|
)
|
|
75
75
|
const body = await response.text();
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
|
|
21
|
+
import { TypeSettings } from "TypesStandard/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 { ProcessStanza } from "@Builder/ProcessStanza"
|
|
27
|
+
import { readdirSync, unlinkSync, statSync, rmdirSync, existsSync } from "fs"
|
|
28
|
+
import { join } from "path"
|
|
29
|
+
|
|
30
|
+
export const EmitThread = async (): Promise<void> => {
|
|
31
|
+
const settings = Bootstrap.Settings as TypeSettings;
|
|
32
|
+
const TTL = settings.GlobalSettings.ArchiveSettings.TTL
|
|
33
|
+
const TTLCUT = Date.now() - TTL * 1000;
|
|
34
|
+
|
|
35
|
+
const walk = (dir: string, deleteFolder = false): void => {
|
|
36
|
+
if (!existsSync(dir)) return;
|
|
37
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
38
|
+
for (const entry of entries) {
|
|
39
|
+
const fullPath = join(dir, entry.name);
|
|
40
|
+
if (entry.isDirectory()) {
|
|
41
|
+
walk(fullPath, deleteFolder);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const stats = statSync(fullPath);
|
|
45
|
+
if (stats.mtime.getTime() < TTLCUT) {
|
|
46
|
+
try { unlinkSync(fullPath); } catch (err) {}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (deleteFolder) {
|
|
50
|
+
try {
|
|
51
|
+
if (readdirSync(dir).length === 0 && statSync(dir).mtime.getTime() < (Date.now() - 3600000)) { rmdirSync(dir); }
|
|
52
|
+
if (readdirSync(dir).length === 0 && statSync(dir).mtime.getTime() < TTLCUT) { rmdirSync(dir); }
|
|
53
|
+
} catch (err) {}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
walk(settings.GlobalSettings.ArchiveSettings.TextDirectory, true)
|
|
58
|
+
walk(settings.GlobalSettings.ArchiveSettings.AudioDirectory, true)
|
|
59
|
+
walk(settings.GlobalSettings.ArchiveSettings.JSONDirectory, true)
|
|
60
|
+
walk(settings.GlobalSettings.ArchiveSettings.ImageDirectory, true)
|
|
61
|
+
|
|
62
|
+
if (settings.EnableWireService) {
|
|
63
|
+
if (settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.Enabled) {
|
|
64
|
+
void ReconnectXMPP(settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval)
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
const response = await CreateHttp({
|
|
68
|
+
URL: settings.NationalWeatherServiceSettings.EventsEndpoint,
|
|
69
|
+
Headers: {
|
|
70
|
+
"User-Agent": "@atmosx/event-product-parser"
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
if (response.error) {
|
|
74
|
+
return SetEventEmit({
|
|
75
|
+
Event: `onServiceStatus`,
|
|
76
|
+
Metadata: {
|
|
77
|
+
type: "fetch-api",
|
|
78
|
+
message: `Failed to fetch latest events from National Weather Service API - ${response.message}`,
|
|
79
|
+
data: {},
|
|
80
|
+
error: true
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
SetEventEmit({
|
|
85
|
+
Event: `onServiceStatus`,
|
|
86
|
+
Metadata: {
|
|
87
|
+
Message: `Fetched latest events from National Weather Service API`,
|
|
88
|
+
Data: {},
|
|
89
|
+
Type: "fetch-api",
|
|
90
|
+
Error: false
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
await ProcessStanza({ Message: response.message, NWWS: false })
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
@@ -11,9 +11,9 @@
|
|
|
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
|
*/
|
|
@@ -11,17 +11,22 @@
|
|
|
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
|
-
|
|
21
|
-
|
|
20
|
+
interface GetMatchedOptions {
|
|
21
|
+
Strings: string[]
|
|
22
|
+
String: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const GetMatched = ({ Strings, String }: GetMatchedOptions): boolean => {
|
|
26
|
+
const isMatched = Strings.some(pattern => {
|
|
22
27
|
if (!pattern) return false;
|
|
23
28
|
const lowerP = pattern.toLowerCase();
|
|
24
|
-
const lowerS =
|
|
29
|
+
const lowerS = String.toLowerCase()
|
|
25
30
|
if (lowerP === "*" || lowerP === lowerS) return true;
|
|
26
31
|
if (lowerP.includes("*")) {
|
|
27
32
|
const regex = "^" + lowerP.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*") + "$";
|
|
@@ -11,16 +11,16 @@
|
|
|
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
|
export type QueueTask = () => Promise<void>;
|
|
20
20
|
|
|
21
21
|
export interface QueueManagerOptions {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Concurrency?: number;
|
|
23
|
+
Error?: (error: unknown) => void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export class QueueManager {
|
|
@@ -31,10 +31,9 @@ export class QueueManager {
|
|
|
31
31
|
private running = 0;
|
|
32
32
|
private draining = false;
|
|
33
33
|
|
|
34
|
-
public constructor(
|
|
35
|
-
|
|
36
|
-
this.
|
|
37
|
-
this.onError = options.onError ?? ((error) => {
|
|
34
|
+
public constructor({ Concurrency, Error }: QueueManagerOptions = {}) {
|
|
35
|
+
this.concurrency = Concurrency ?? 1;
|
|
36
|
+
this.onError = Error ?? ((error) => {
|
|
38
37
|
console.error("[QueueManager] Task failed:", error);
|
|
39
38
|
});
|
|
40
39
|
}
|
|
@@ -11,27 +11,27 @@
|
|
|
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 { TypeSettings } from "
|
|
21
|
-
import {
|
|
20
|
+
import { TypeSettings } from "TypesStandard/Settings"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
22
|
|
|
23
23
|
interface SetDebugOptions {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Title?: string
|
|
25
|
+
Message: string
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export const SetDebug = (
|
|
29
|
-
const settings =
|
|
30
|
-
|
|
31
|
-
message:
|
|
32
|
-
function:
|
|
28
|
+
export const SetDebug = ({ Title, Message }: SetDebugOptions): void => {
|
|
29
|
+
const settings = Bootstrap.Settings as TypeSettings;
|
|
30
|
+
Bootstrap.Listener.emit(`debug`, {
|
|
31
|
+
message: Message,
|
|
32
|
+
function: Title ?? `debug`,
|
|
33
33
|
})
|
|
34
|
-
if (settings.
|
|
35
|
-
console.log(`[${
|
|
34
|
+
if (settings.DeveloperMode) {
|
|
35
|
+
console.log(`[${Bootstrap.Colors.Blue}${Title ?? `debug`}${Bootstrap.Colors.Reset}] ${Message}`)
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { SetTimeoutAction } from "@Utilities/SetTimeoutAction"
|
|
22
|
+
import { SetWarning } from "@Utilities/SetWarning"
|
|
23
|
+
|
|
24
|
+
interface SetEventEmitOptions {
|
|
25
|
+
Event: string
|
|
26
|
+
Metadata: any
|
|
27
|
+
Message?: string
|
|
28
|
+
Limited?: boolean
|
|
29
|
+
Tree?: string[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const SetEventEmit = ({ Event, Metadata, Message, Limited, Tree }: SetEventEmitOptions): void => {
|
|
33
|
+
if (Limited) {
|
|
34
|
+
const isTimeout = SetTimeoutAction({ Identifier: `event.${Event}`, AddTime: true, Max: 1, Interval: 1 })
|
|
35
|
+
if (isTimeout.Limited) return;
|
|
36
|
+
}
|
|
37
|
+
Bootstrap.Listener.emit(Event, Metadata)
|
|
38
|
+
if (Event != `log`) { Bootstrap.Listener.emit(`*`, {event: Event, data: Metadata}) }
|
|
39
|
+
if (Message) {
|
|
40
|
+
SetWarning({ Message: Message, Tree: Tree })
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -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 { TypeSettings } from "
|
|
21
|
-
import {
|
|
20
|
+
import { TypeSettings } from "TypesStandard/Settings"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
22
|
|
|
23
|
-
export const SetSettings = (
|
|
24
|
-
const settings =
|
|
23
|
+
export const SetSettings = (imported: TypeSettings): TypeSettings => {
|
|
24
|
+
const settings = Bootstrap.Settings as Record<string, unknown>;
|
|
25
25
|
const merge = (target: Record<string, unknown>, source: Record<string, unknown>) => {
|
|
26
26
|
for (const key in source) {
|
|
27
27
|
if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
|
|
@@ -37,6 +37,6 @@ export const SetSettings = (newSettings: TypeSettings): TypeSettings => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
merge(settings,
|
|
40
|
+
merge(settings, imported as Record<string, unknown>);
|
|
41
41
|
return settings as TypeSettings;
|
|
42
42
|
}
|
|
@@ -11,22 +11,22 @@
|
|
|
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
20
|
|
|
21
21
|
interface SetSleepOptions {
|
|
22
|
-
|
|
22
|
+
Timeout: number
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export const SetSleep = async (
|
|
25
|
+
export const SetSleep = async ({ Timeout }: SetSleepOptions): Promise<void> => {
|
|
26
26
|
return new Promise((resolve) => {
|
|
27
27
|
setTimeout(() => {
|
|
28
28
|
resolve();
|
|
29
|
-
},
|
|
29
|
+
}, Timeout);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { Bootstrap } from "@Bootstrap"
|
|
21
|
+
|
|
22
|
+
interface SetTimeoutActionOptions {
|
|
23
|
+
Identifier: string
|
|
24
|
+
AddTime?: boolean
|
|
25
|
+
Max?: number
|
|
26
|
+
Interval?: number
|
|
27
|
+
Expire?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type SetTimeoutActionResponse = {
|
|
31
|
+
Limited: boolean
|
|
32
|
+
Remaining?: number
|
|
33
|
+
Response?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const SetTimeoutAction = ({ Identifier, AddTime, Max, Interval, Expire }: SetTimeoutActionOptions): SetTimeoutActionResponse => {
|
|
37
|
+
let target = Bootstrap?.Ratelimits?.[Identifier];
|
|
38
|
+
if (!target) {
|
|
39
|
+
Bootstrap.Ratelimits[Identifier] = [];
|
|
40
|
+
target = Bootstrap.Ratelimits[Identifier];
|
|
41
|
+
}
|
|
42
|
+
if (Expire) {
|
|
43
|
+
delete Bootstrap.Ratelimits[Identifier];
|
|
44
|
+
return { Limited: false };
|
|
45
|
+
}
|
|
46
|
+
if (target?.length > 0) {
|
|
47
|
+
Bootstrap.Ratelimits[Identifier] = target.filter((ts: number) => Date.now() - ts < Interval * 1000);
|
|
48
|
+
target = Bootstrap.Ratelimits[Identifier];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const oldestTimestamp = target?.[0];
|
|
52
|
+
const getWait = oldestTimestamp ? Math.ceil((Interval * 1000) - (Date.now() - oldestTimestamp)) : 0;
|
|
53
|
+
const max = Max ?? 1;
|
|
54
|
+
|
|
55
|
+
if (target?.length >= max && getWait > 0) {
|
|
56
|
+
return {
|
|
57
|
+
Limited: true,
|
|
58
|
+
Remaining: getWait,
|
|
59
|
+
Response: `You are being rate limited, please wait ${(getWait / 1e3).toFixed(1)} second(s) before performing this action again.`
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
Bootstrap.Ratelimits[Identifier].push(Date.now());
|
|
63
|
+
return { Limited: false };
|
|
64
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { TypeSettings } from "TypesStandard/Settings"
|
|
22
|
+
|
|
23
|
+
interface SetWarningOptions {
|
|
24
|
+
Title?: string
|
|
25
|
+
Message: string
|
|
26
|
+
Tree?: string[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const SetWarning = ({ Title, Message, Tree }: SetWarningOptions): void => {
|
|
30
|
+
const settings = Bootstrap.Settings as TypeSettings;
|
|
31
|
+
const title = Title ?? (`[${Bootstrap.Colors.Yellow}@atmosx/event-product-parser${Bootstrap.Colors.Reset}]`);
|
|
32
|
+
const log = (message: string): void => {
|
|
33
|
+
Bootstrap.Listener.emit(`log`, message);
|
|
34
|
+
if (settings.EnableJournal) { console.log(message); }
|
|
35
|
+
};
|
|
36
|
+
log(`${title} ${Message}`);
|
|
37
|
+
|
|
38
|
+
if (!Tree?.length) return;
|
|
39
|
+
|
|
40
|
+
const cleanTitle = title.replace(/\x1b\[[0-9;]*m/g, ``);
|
|
41
|
+
const padding = ` `.repeat(cleanTitle.length + 1);
|
|
42
|
+
const entries = Tree.filter((entry): entry is NonNullable<typeof entry> => entry !== undefined && entry !== null);
|
|
43
|
+
entries.forEach((entry, index) => {
|
|
44
|
+
const prefix = index === entries.length - 1 ? `└─` : `├─`;
|
|
45
|
+
log(`${padding}${prefix} ${entry}`);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
@@ -11,31 +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 { TypeSettings } from "
|
|
21
|
-
import {
|
|
22
|
-
import { OnlineXMPP } from "@
|
|
23
|
-
import { OfflineXMPP } from "@
|
|
24
|
-
import { ErrorXMPP } from "@
|
|
25
|
-
import { StanzaXMPP } from "@
|
|
26
|
-
import { SetEventEmit } from "@
|
|
27
|
-
import { client } from "@
|
|
20
|
+
import { TypeSettings } from "TypesStandard/Settings"
|
|
21
|
+
import { Bootstrap } from "@Bootstrap"
|
|
22
|
+
import { OnlineXMPP } from "@XMPP/OnlineXMPP"
|
|
23
|
+
import { OfflineXMPP } from "@XMPP/OfflineXMPP"
|
|
24
|
+
import { ErrorXMPP } from "@XMPP/ErrorXMPP"
|
|
25
|
+
import { StanzaXMPP } from "@XMPP/StanzaXMPP"
|
|
26
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
27
|
+
import { client } from "@XMPP/client"
|
|
28
28
|
|
|
29
29
|
export const DeployXMPP = async (): Promise<void> => {
|
|
30
30
|
let session;
|
|
31
|
-
const settings =
|
|
31
|
+
const settings = Bootstrap.Settings as TypeSettings
|
|
32
32
|
settings.NOAAWeatherWireServiceSettings.CredentialSettings.Nickname
|
|
33
33
|
??= settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username;
|
|
34
|
-
session =
|
|
34
|
+
session = Bootstrap.Session = client({
|
|
35
35
|
service: 'xmpp://nwws-oi.weather.gov',
|
|
36
36
|
domain: 'nwws-oi.weather.gov',
|
|
37
|
-
username: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username,
|
|
38
|
-
password: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Password
|
|
37
|
+
username: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Username as string,
|
|
38
|
+
password: settings.NOAAWeatherWireServiceSettings.CredentialSettings.Password as string
|
|
39
39
|
})
|
|
40
40
|
try {
|
|
41
41
|
await OfflineXMPP();
|
|
@@ -45,12 +45,12 @@ export const DeployXMPP = async (): Promise<void> => {
|
|
|
45
45
|
await session.start()
|
|
46
46
|
} catch (error) {
|
|
47
47
|
SetEventEmit({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
Event: `onServiceStatus`,
|
|
49
|
+
Metadata: {
|
|
50
|
+
Message: `Error occured while starting XMPP Session: ${error}`,
|
|
51
|
+
Data: {},
|
|
52
|
+
Type: `error`,
|
|
53
|
+
Error: true
|
|
54
54
|
},
|
|
55
55
|
})
|
|
56
56
|
}
|
|
@@ -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 {
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
21
|
|
|
22
22
|
export const ErrorXMPP = () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
Bootstrap.Session.on(`error`, async () => {
|
|
24
|
+
Bootstrap.Cache.Connected = false;
|
|
25
|
+
Bootstrap.Cache.Hault = true;
|
|
26
26
|
})
|
|
27
27
|
}
|
|
@@ -11,26 +11,26 @@
|
|
|
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 {
|
|
21
|
-
import { SetEventEmit } from "@
|
|
20
|
+
import { Bootstrap } from "@Bootstrap"
|
|
21
|
+
import { SetEventEmit } from "@Utilities/SetEventEmit"
|
|
22
22
|
|
|
23
23
|
export const OfflineXMPP = () => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
Bootstrap.Session.on(`offline`, async () => {
|
|
25
|
+
Bootstrap.Cache.Connected = false;
|
|
26
|
+
Bootstrap.Cache.Hault = true;
|
|
27
27
|
SetEventEmit({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
Event: `onServiceStatus`,
|
|
29
|
+
Metadata: {
|
|
30
|
+
Message: `Client has gone offline`,
|
|
31
|
+
Data: {},
|
|
32
|
+
Type: `offline`,
|
|
33
|
+
Error: true
|
|
34
34
|
},
|
|
35
35
|
})
|
|
36
36
|
})
|