@atmosx/event-product-parser 2.0.16 → 3.0.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.
Files changed (116) hide show
  1. package/README.md +4 -237
  2. package/dist/cjs/index.cjs +2233 -3105
  3. package/dist/esm/index.mjs +2233 -3108
  4. package/package.json +3 -2
  5. package/src/@building/building.clean.ts +30 -0
  6. package/src/@building/building.create.ts +42 -0
  7. package/src/@building/building.enhance.ts +56 -0
  8. package/src/@building/building.geometry.ts +42 -0
  9. package/src/@building/building.headers.ts +37 -0
  10. package/src/@building/building.office.ts +43 -0
  11. package/src/@building/building.polygon.ts +71 -0
  12. package/src/@building/building.properties.ts +89 -0
  13. package/src/@building/building.signature.ts +78 -0
  14. package/src/@building/building.tags.ts +24 -0
  15. package/src/@building/building.tracking.ts +68 -0
  16. package/src/@building/building.validate.ts +132 -0
  17. package/src/@core/core.callback.ts +39 -0
  18. package/src/@core/core.getEvents.ts +25 -0
  19. package/src/@core/core.getNodes.ts +25 -0
  20. package/src/@core/core.listener.ts +24 -0
  21. package/src/@core/core.setNode.ts +81 -0
  22. package/src/@core/core.start.ts +54 -0
  23. package/src/@core/core.stop.ts +32 -0
  24. package/src/@dictionaries/dictionaries.betterEventNames.ts +85 -0
  25. package/src/@dictionaries/dictionaries.eventActions.ts +28 -0
  26. package/src/@dictionaries/{awips.ts → dictionaries.eventAwipAbreviations.ts} +12 -6
  27. package/src/@dictionaries/dictionaries.eventCancelMessages.ts +29 -0
  28. package/src/@dictionaries/dictionaries.eventCauses.ts +36 -0
  29. package/src/@dictionaries/dictionaries.eventProducts.ts +25 -0
  30. package/src/@dictionaries/dictionaries.eventRecords.ts +25 -0
  31. package/src/@dictionaries/dictionaries.eventSeverity.ts +27 -0
  32. package/src/@dictionaries/dictionaries.eventStatus.ts +31 -0
  33. package/src/@dictionaries/{signatures.ts → dictionaries.eventTags.ts} +13 -68
  34. package/src/@dictionaries/dictionaries.eventTypes.ts +82 -0
  35. package/src/@dictionaries/dictionaries.eventsOffshore.ts +31 -0
  36. package/src/@dictionaries/dictionaries.hailStrings.ts +31 -0
  37. package/src/@dictionaries/{icao.ts → dictionaries.officeICAOs.ts} +13 -6
  38. package/src/@dictionaries/dictionaries.regExp.ts +28 -0
  39. package/src/@dictionaries/dictionaries.shapefileLinks.ts +36 -0
  40. package/src/@dictionaries/dictionaries.statusCorrelationText.ts +40 -0
  41. package/src/@dictionaries/dictionaries.test_signatures.ts +23 -0
  42. package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +68 -0
  43. package/src/@events/events.api.ts +113 -0
  44. package/src/@events/events.text.ts +79 -0
  45. package/src/@events/events.ugc.ts +83 -0
  46. package/src/@events/events.vtec.ts +87 -0
  47. package/src/@manager/manager.mkEvent.ts +79 -0
  48. package/src/@manager/manager.rmEvent.ts +44 -0
  49. package/src/@manager/manager.setHash.ts +37 -0
  50. package/src/@manager/manager.updateNodes.ts +51 -0
  51. package/src/@modules/@database/database.cache.ts +48 -0
  52. package/src/@modules/@database/database.init.ts +45 -0
  53. package/src/@modules/@database/database.shapefiles.ts +97 -0
  54. package/src/@modules/@database/database.stanza.ts +47 -0
  55. package/src/@modules/@stanza/stanza.getAwipsType.ts +46 -0
  56. package/src/@modules/@stanza/stanza.validate.ts +50 -0
  57. package/src/@modules/@utilities/utilities.createHttp.ts +75 -0
  58. package/src/@modules/@utilities/utilities.getFormattedTime.ts +43 -0
  59. package/src/@modules/@utilities/utilities.getSettings.ts +25 -0
  60. package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +114 -0
  61. package/src/@modules/@utilities/utilities.setCronSchedule.ts +38 -0
  62. package/src/@modules/@utilities/utilities.setEventEmit.ts +41 -0
  63. package/src/@modules/@utilities/utilities.setListener.ts +30 -0
  64. package/src/@modules/@utilities/utilities.setSettings.ts +42 -0
  65. package/src/@modules/@utilities/utilities.setSleep.ts +33 -0
  66. package/src/@modules/@utilities/utilities.setTimeoutAction.ts +59 -0
  67. package/src/@modules/@utilities/utilities.setWarning.ts +34 -0
  68. package/src/@modules/@xmpp/xmpp.xDeploy.ts +58 -0
  69. package/src/@modules/@xmpp/xmpp.xError.ts +38 -0
  70. package/src/@modules/@xmpp/xmpp.xOffline.ts +38 -0
  71. package/src/@modules/@xmpp/xmpp.xOnline.ts +61 -0
  72. package/src/@modules/@xmpp/xmpp.xReconnect.ts +59 -0
  73. package/src/@modules/@xmpp/xmpp.xStanza.ts +63 -0
  74. package/src/@parsers/@hvtec/hvtec.extract.ts +40 -0
  75. package/src/@parsers/@pvtec/pvtec.expires.ts +26 -0
  76. package/src/@parsers/@pvtec/pvtec.extract.ts +50 -0
  77. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +53 -0
  78. package/src/@parsers/@text/text.getPolygonFromProduct.ts +32 -0
  79. package/src/@parsers/@text/text.getTextFromProduct.ts +43 -0
  80. package/src/@parsers/@text/text.getXML.ts +61 -0
  81. package/src/@parsers/@ugc/ugc.coordinates.ts +110 -0
  82. package/src/@parsers/@ugc/ugc.expiry.ts +32 -0
  83. package/src/@parsers/@ugc/ugc.extract.ts +37 -0
  84. package/src/@parsers/@ugc/ugc.header.ts +30 -0
  85. package/src/@parsers/@ugc/ugc.locations.ts +29 -0
  86. package/src/@parsers/@ugc/ugc.zones.ts +52 -0
  87. package/src/@types/type.event.ts +67 -0
  88. package/src/@types/type.properties.ts +75 -0
  89. package/src/@types/types.attributes.ts +28 -0
  90. package/src/@types/types.compiled.ts +35 -0
  91. package/src/@types/types.hash.ts +24 -0
  92. package/src/@types/types.hvtec.ts +25 -0
  93. package/src/@types/types.pvtec.ts +29 -0
  94. package/src/@types/types.settings.ts +71 -0
  95. package/src/@types/types.stanza.ts +37 -0
  96. package/src/@types/types.ugc.ts +24 -0
  97. package/src/bootstrap.ts +82 -163
  98. package/src/index.ts +48 -216
  99. package/test.js +65 -49
  100. package/src/@dictionaries/events.ts +0 -168
  101. package/src/@parsers/@events/api.ts +0 -146
  102. package/src/@parsers/@events/cap.ts +0 -123
  103. package/src/@parsers/@events/text.ts +0 -104
  104. package/src/@parsers/@events/ugc.ts +0 -107
  105. package/src/@parsers/@events/vtec.ts +0 -76
  106. package/src/@parsers/events.ts +0 -392
  107. package/src/@parsers/hvtec.ts +0 -46
  108. package/src/@parsers/pvtec.ts +0 -72
  109. package/src/@parsers/stanza.ts +0 -97
  110. package/src/@parsers/text.ts +0 -165
  111. package/src/@parsers/ugc.ts +0 -247
  112. package/src/@submodules/database.ts +0 -201
  113. package/src/@submodules/eas.ts +0 -490
  114. package/src/@submodules/utils.ts +0 -191
  115. package/src/@submodules/xmpp.ts +0 -142
  116. package/src/types.ts +0 -259
@@ -0,0 +1,35 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & 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 { TypeAttributes } from "./types.attributes"
21
+
22
+ export type TypeStanzaCompiled = {
23
+ message?: string
24
+ attributes?: TypeAttributes
25
+ isCapEvent?: boolean
26
+ isVTEC?: boolean
27
+ isUGC?: boolean
28
+ isCapAreaDescription?: boolean
29
+ isIgnored?: boolean
30
+ isNWWS?: boolean
31
+ getType?: {
32
+ type: string
33
+ prefix: string
34
+ }
35
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeHash = {
21
+ tracking: string
22
+ hashes: string[]
23
+ expires: string
24
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeHVTEC = {
21
+ hvtec: string
22
+ severity: string
23
+ cause: string
24
+ record: string
25
+ }
@@ -0,0 +1,29 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypePVTEC = {
21
+ vtec: string
22
+ product: string
23
+ tracking: string
24
+ event: string
25
+ status: string
26
+ organization: string
27
+ expires: string
28
+ prediction_center: boolean
29
+ }
@@ -0,0 +1,71 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeSettings = {
21
+ Database: string
22
+ EnableWireService: boolean
23
+ EnableJournal: boolean
24
+ NOAAWeatherWireServiceSettings: {
25
+ ReconnectionSettings: {
26
+ Enabled: boolean
27
+ ReconnectionInterval: number
28
+ }
29
+ CredentialSettings: {
30
+ Username: string | void
31
+ Password: string | void
32
+ Nickname: string | void
33
+ }
34
+ CacheSettings: {
35
+ Enabled: boolean
36
+ MaxDatabaseHistory: number
37
+ MaxRetentionHistory: number
38
+ }
39
+ StanzaSettings: {
40
+ DisableUGC: boolean
41
+ DisableVTEC: boolean
42
+ DisableText: boolean
43
+ }
44
+ }
45
+ NationalWeatherServiceSettings: {
46
+ CallbackInterval: number
47
+ EventsEndpoint: string
48
+ }
49
+ GlobalSettings: {
50
+ BetterEventNames: boolean
51
+ DisableGeometryParsing: boolean
52
+ UseShapefileCoordinates: boolean
53
+ ShapefileSkipPoints: number
54
+ NodeTTL: number
55
+ NodeMinDistance: number
56
+ EventFiltering: {
57
+ ListeningEvents: string[]
58
+ ListeningICAO: string[]
59
+ IgnoredICAO: string[]
60
+ IgnoredEvents: string[]
61
+ ListeningUGC: string[]
62
+ ListeningStates: string[]
63
+ NodeLocationFiltering: boolean
64
+ IgnoreTestProducts: boolean
65
+ },
66
+ EASSettings: {
67
+ ArchiveDirectory: string | void,
68
+ IntroWavFile: string | void,
69
+ }
70
+ }
71
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeStanza = {
21
+ getChild(arg0: string): unknown
22
+ is(arg0: string): unknown
23
+ name: string
24
+ parent: TypeStanza | null
25
+ children: any
26
+ attrs: {
27
+ xmlns: string
28
+ id: string
29
+ issue: string
30
+ ttaaii: string
31
+ cccc: string
32
+ awipsid: string
33
+ from: string
34
+ to: string
35
+ type: string
36
+ }
37
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeUGC = {
21
+ zones: string[]
22
+ locations: string[]
23
+ expires: string
24
+ }
package/src/bootstrap.ts CHANGED
@@ -1,182 +1,101 @@
1
1
  /*
2
- _ _ __ __
2
+ _ _ _ __ __
3
3
  /\ | | | | (_) \ \ / /
4
4
  / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
5
  / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
6
  / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
7
  /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
- | |
8
+ | |
9
9
  |_|
10
-
11
- Written by: k3yomi@GitHub
12
- */
13
-
14
- import * as fs from 'fs';
15
- import * as path from 'path';
16
- import * as events from 'events';
17
- import * as xmpp from '@xmpp/client';
18
- import * as shapefile from 'shapefile';
19
- import * as xml2js from 'xml2js';
20
- import * as jobs from 'croner';
21
- import * as polygonClipping from 'polygon-clipping';
22
- import sqlite3 from 'better-sqlite3';
23
- import crypto from 'crypto';
24
- import os from 'os';
25
- import say from 'say';
26
- import child from 'child_process';
27
- import jszip from 'jszip';
28
-
29
10
 
30
- import * as dictEvents from './@dictionaries/events';
31
- import * as dictAwips from './@dictionaries/awips';
32
- import * as dictSignatures from './@dictionaries/signatures';
33
- import * as dictICAOs from './@dictionaries/icao';
11
+ Created with by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & 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
34
15
 
16
+ Internal Package: @atmosx/event-product-parser
35
17
 
18
+ */
36
19
 
37
- export const packages = {
38
- fs, path, events, xmpp,
39
- shapefile, xml2js, sqlite3, jobs,
40
- crypto, os, say, child, polygonClipping, jszip
41
- };
20
+ import path from 'path'
21
+ import { EventEmitter } from 'node:events';
42
22
 
43
- export const cache = {
23
+ export const bootstrap = {
44
24
  isReady: true,
45
- sigHalt: false,
46
- isConnected: false,
47
- attemptingReconnect: false,
48
- totalReconnects: 0,
49
- lastStanza: null,
50
- session: null,
51
- lastConnect: null,
52
- db: null,
53
- lastWarn: null,
54
- totalLocationWarns: 0,
55
- events: new events.EventEmitter(),
56
- isProcessingAudioQueue: false,
57
- audioQueue: [],
58
- };
59
-
60
- export const settings = {
61
- database: path.join(process.cwd(), 'shapefiles.db'),
62
- is_wire: true,
63
- journal: true,
64
- noaa_weather_wire_service_settings: {
65
- reconnection_settings: {
66
- enabled: true,
67
- interval: 60,
68
- },
69
- credentials: {
70
- username: null,
71
- password: null,
72
- nickname: "AtmosphericX Standalone Parser",
73
- },
74
- cache: {
75
- enabled: true,
76
- max_db_history: 5000,
77
- max_db_cache_size: 1000,
78
- },
79
- preferences: {
80
- disable_ugc: false,
81
- disable_vtec: false,
82
- disable_text: false,
83
- cap_only: false,
84
- }
25
+ ratelimits: {},
26
+ session_xmpp: null,
27
+ database: null,
28
+ cron: null,
29
+ listener: new EventEmitter(),
30
+ ansi_colors: {
31
+ RED: `\x1b[31m`, GREEN: `\x1b[32m`, YELLOW: `\x1b[33m`,
32
+ BLUE: `\x1b[34m`, MAGENTA: `\x1b[35m`, CYAN: `\x1b[36m`,
33
+ WHITE: `\x1b[37m`, RESET: `\x1b[0m`
85
34
  },
86
- national_weather_service_settings: {
87
- interval: 15,
88
- endpoint: `https://api.weather.gov/alerts/active`,
35
+ cache: {
36
+ lastStanza: null,
37
+ lastConnect: null,
38
+ isConnected: false,
39
+ isReconnecting: false,
40
+ tReconnects: 0,
41
+ sigHault: false,
42
+ events: {type: "FeatureCollection", features: []},
43
+ nodes: {type: "FeatureCollection", features: []},
44
+ hashes: [],
89
45
  },
90
- global_settings: {
91
- parent_events_only: true,
92
- better_event_parsing: true,
93
- ignore_geometry_parsing: false,
94
- shapefile_coordinates: false,
95
- shapefile_skip: 15,
96
- filtering: {
97
- events: [],
98
- filtered_icao: [],
99
- ignored_icao: [],
100
- ignored_events: [`Xx`, `Test Message`],
101
- ugc_filter: [],
102
- state_filter: [],
103
- check_expired: true,
104
- ignore_test_products: true,
46
+ settings: {
47
+ Database: path.join(process.cwd(), 'shapefiles.db'),
48
+ EnableWireService: true,
49
+ EnableJournal: true,
50
+ NOAAWeatherWireServiceSettings: {
51
+ ReconnectionSettings: {
52
+ Enabled: true,
53
+ ReconnectionInterval: 60,
54
+ },
55
+ CredentialSettings: {
56
+ Username: null,
57
+ Password: null,
58
+ Nickname: "@atmosx/event-product-parser/3.0",
59
+ },
60
+ CacheSettings: {
61
+ Enabled: true,
62
+ MaxDatabaseHistory: 5000,
63
+ MaxRetentionHistory: 1000,
64
+ },
65
+ StanzaSettings: {
66
+ DisableUGC: false,
67
+ DisableVTEC: false,
68
+ DisableText: false,
69
+ }
70
+ },
71
+ NationalWeatherServiceSettings: {
72
+ CallbackInterval: 15,
73
+ EventsEndpoint: `https://api.weather.gov/alerts/active`,
105
74
  },
106
- eas_settings: {
107
- directory: null,
108
- intro_wav: null,
75
+ GlobalSettings: {
76
+ BetterEventNames: true,
77
+ DisableGeometryParsing: false,
78
+ UseShapefileCoordinates: false,
79
+ ShapefileSkipPoints: 15,
80
+ NodeTTL: 60,
81
+ NodeMinDistance: 120,
82
+ EventFiltering: {
83
+ ListeningEvents: [],
84
+ ListeningICAO: [],
85
+ IgnoredICAO: [],
86
+ IgnoredEvents: [`Xx`, `Test Message`],
87
+ ListeningUGC: [],
88
+ ListeningStates: [],
89
+ NodeLocationFiltering: false,
90
+ IgnoreTestProducts: true,
91
+ },
92
+ EASSettings: {
93
+ ArchiveDirectory: null,
94
+ IntroWavFile: null,
95
+ }
109
96
  }
110
- }
111
- };
97
+ },
98
+ }
99
+
112
100
 
113
101
 
114
- export const definitions = {
115
- events: dictEvents.events,
116
- actions: dictEvents.actions,
117
- status: dictEvents.status,
118
- productTypes: dictEvents.types,
119
- correlations: dictEvents.status_correlations,
120
- offshore: dictEvents.offshore,
121
- awips: dictAwips.awips,
122
- causes: dictEvents.causes,
123
- records: dictEvents.records,
124
- severity: dictEvents.severity,
125
- cancelSignatures: dictSignatures.cancel_signatures,
126
- messageSignatures: dictSignatures.message_signatures,
127
- tags: dictSignatures.tags,
128
- ICAO: dictICAOs.icaos,
129
- enhancedEvents: [
130
- {"Tornado Warning": {
131
- "Tornado Emergency": { description: "tornado emergency", condition: (tornadoThreatTag: string) => tornadoThreatTag === 'OBSERVED'},
132
- "PDS Tornado Warning": { description: "particularly dangerous situation", condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE'},
133
- "Confirmed Tornado Warning": { condition: (tornadoThreatTag: string) => tornadoThreatTag === 'OBSERVED'},
134
- "Radar Indicated Tornado Warning": {condition: (tornadoThreatTag: string) => tornadoThreatTag !== 'OBSERVED'},
135
- }},
136
- {"Special Marine Warning": {
137
- "Tornadic Special Marine Warning": {condition: (tornadoThreatTag: string) => tornadoThreatTag === 'POSSIBLE'},
138
- }},
139
- {"Tornado Watch": {
140
- "PDS Tornado Watch": { description: "particularly dangerous situation"}
141
- }},
142
- {"Flash Flood Warning": {
143
- "Flash Flood Emergency": { description: "flash flood emergency", },
144
- "Considerable Flash Flood Warning": { condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE' },
145
- }},
146
- {"Severe Thunderstorm Warning": {
147
- "EDS Severe Thunderstorm Warning": {description: "extremely dangerous situation"},
148
- "Destructive Severe Thunderstorm Warning": {condition: (damageThreatTag: string) => damageThreatTag === 'DESTRUCTIVE'},
149
- "Considerable Severe Thunderstorm Warning": {condition: (damageThreatTag: string) => damageThreatTag === 'CONSIDERABLE'},
150
- }},
151
- ],
152
- shapefiles_directory: [
153
- {name: "us_counties", id: "C", link: "https://www.weather.gov/source/gis/Shapefiles/County/c_16ap26.zip"},
154
- {name: "us_states_territories", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/County/s_16ap26.zip"},
155
- {name: "fire_weather_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/fz16ap26.zip"},
156
- {name: "costal_marine_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/mz16ap26.zip"},
157
- {name: "offshore_marine_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/oz16ap26.zip"},
158
- {name: "public_forecast_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/z_16ap26.zip"},
159
- {name: "county_warning_areas", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/w_16ap26.zip"},
160
- {name: "river_forecast_boundaries", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/Misc/rf05mr24.zip"},
161
- {name: "high_seas_marine_zones", id: "Z", link: "https://www.weather.gov/source/gis/Shapefiles/WSOM/hz17fe26.zip"}
162
- ],
163
- regular_expressions: {
164
- pvtec: new RegExp(`[OTEX].(NEW|CON|EXT|EXA|EXB|UPG|CAN|EXP|COR|ROU).[A-Z]{4}.[A-Z]{2}.[WAYSFON].[0-9]{4}.[0-9]{6}T[0-9]{4}Z-[0-9]{6}T[0-9]{4}Z`, "g"),
165
- hvtec: new RegExp(`[a-zA-Z0-9]{4}.[A-Z0-9].[A-Z]{2}.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[0-9]{6}T[0-9]{4}Z.[A-Z]{2}`, "imu"),
166
- wmo: new RegExp(`[A-Z0-9]{6}\\s[A-Z]{4}\\s\\d{6}`, "imu"),
167
- ugc1: new RegExp(`(\\w{2}[CZ](\\d{3}((-|>)\\s?(\\n\\n)?))+)`, "imu"),
168
- ugc2: new RegExp(`(\\d{6}(-|>)\\s?(\\n\\n)?)`, "imu"),
169
- ugc3: new RegExp(`(\\d{6})(?=-|$)`, "imu"),
170
- dateline: new RegExp(`\\d{3,4}\\s*(AM|PM)?\\s*[A-Z]{2,4}\\s+[A-Z]{3,}\\s+[A-Z]{3,}\\s+\\d{1,2}\\s+\\d{4}`, "gim"),
171
- },
172
- messages: {
173
- shapefile_creation: `DO NOT EXIT UNTIL THE SHAPEFILES ARE DONE COMPLETING! IF YOU CLOSE YOUR PROJECT, THE SHAPEFILES WILL NOT BE CREATED AND YOU WILL NEED TO DELETE ${settings.database} AND RESTART TO CREATE THEM AGAIN!`,
174
- shapefile_creation_finished: `Shapefiles have finished completing and you can now use the parser.`,
175
- not_ready: `You can not create another instance without shutting down the current one first, please make sure to call the stop() method first!`,
176
- invalid_nickname: `The nickname you provided is invalid, please provide a valid nickname to continue.`,
177
- eas_no_directory: `You have not set a directory for EAS audio files to be saved to, please set the 'directory' setting in the global settings to enable EAS audio generation.`,
178
- reconnect_too_fast: `The client is attempting to reconnect too fast. This may be due to network instability. Reconnection attempt has been halted for safety.`,
179
- dump_cache: `Found {count} cached events and will begin dumping them shortly. This may take a while depending on the number of cached events.`,
180
- dump_cache_complete: `Completed dumping all cached alert files.`,
181
- }
182
- };