@atmosx/event-product-parser 3.0.0 → 3.0.2

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 (121) hide show
  1. package/README.md +307 -5
  2. package/dist/cjs/index.cjs +10253 -262
  3. package/dist/esm/index.mjs +10250 -262
  4. package/dist/index.d.mts +238 -0
  5. package/dist/index.d.ts +238 -0
  6. package/package.json +4 -3
  7. package/src/@building/building.clean.ts +1 -1
  8. package/src/@building/building.create.ts +1 -1
  9. package/src/@building/building.enhance.ts +1 -1
  10. package/src/@building/building.geometry.ts +7 -1
  11. package/src/@building/building.headers.ts +1 -1
  12. package/src/@building/building.office.ts +1 -1
  13. package/src/@building/building.polygon.ts +1 -1
  14. package/src/@building/building.properties.ts +1 -1
  15. package/src/@building/building.signature.ts +11 -27
  16. package/src/@building/building.tags.ts +1 -1
  17. package/src/@building/building.tracking.ts +1 -1
  18. package/src/@building/building.validate.ts +19 -4
  19. package/src/@core/{core.callback.ts → core.clearEvents.ts} +9 -16
  20. package/src/@core/{core.listener.ts → core.createListener.ts} +2 -2
  21. package/src/@core/core.getEvents.ts +1 -1
  22. package/src/@core/core.getNodes.ts +1 -1
  23. package/src/@core/core.getRandomEvent.ts +25 -0
  24. package/src/@core/core.getVersion.ts +25 -0
  25. package/src/@core/core.setNode.ts +2 -2
  26. package/src/@core/core.start.ts +12 -5
  27. package/src/@core/core.stop.ts +1 -1
  28. package/src/@dictionaries/dictionaries.betterEventNames.ts +5 -1
  29. package/src/@dictionaries/dictionaries.eventActions.ts +1 -1
  30. package/src/@dictionaries/dictionaries.eventAwipAbreviations.ts +2 -2
  31. package/src/@dictionaries/dictionaries.eventCancelMessages.ts +2 -1
  32. package/src/@dictionaries/dictionaries.eventCauses.ts +1 -1
  33. package/src/@dictionaries/dictionaries.eventProducts.ts +1 -1
  34. package/src/@dictionaries/dictionaries.eventRecords.ts +1 -1
  35. package/src/@dictionaries/dictionaries.eventSeverity.ts +1 -1
  36. package/src/@dictionaries/dictionaries.eventStatus.ts +1 -1
  37. package/src/@dictionaries/dictionaries.eventTags.ts +1 -1
  38. package/src/@dictionaries/dictionaries.eventTypes.ts +1 -1
  39. package/src/@dictionaries/dictionaries.eventsOffshore.ts +1 -1
  40. package/src/@dictionaries/dictionaries.hailStrings.ts +3 -1
  41. package/src/@dictionaries/dictionaries.officeICAOs.ts +1 -1
  42. package/src/@dictionaries/dictionaries.regExp.ts +1 -1
  43. package/src/@dictionaries/dictionaries.shapefileLinks.ts +1 -1
  44. package/src/@dictionaries/dictionaries.statusCorrelationText.ts +14 -12
  45. package/src/@dictionaries/{dictionaries.test_signatures.ts → dictionaries.testSignatures.ts} +3 -2
  46. package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +1 -1
  47. package/src/@events/events.api.ts +1 -1
  48. package/src/@events/events.text.ts +5 -3
  49. package/src/@events/events.ugc.ts +3 -3
  50. package/src/@events/events.vtec.ts +5 -5
  51. package/src/@manager/manager.mkEvent.ts +54 -38
  52. package/src/@manager/manager.rmEvent.ts +6 -1
  53. package/src/@manager/manager.setHash.ts +2 -2
  54. package/src/@manager/manager.updateEvents.ts +35 -0
  55. package/src/@manager/manager.updateNodes.ts +10 -6
  56. package/src/@manager/manager.updateWebhooks.ts +50 -0
  57. package/src/@modules/@database/database.cache.ts +1 -1
  58. package/src/@modules/@database/database.init.ts +1 -1
  59. package/src/@modules/@database/database.shapefiles.ts +2 -3
  60. package/src/@modules/@database/database.stanza.ts +2 -1
  61. package/src/@modules/@eas/eas.getFloatPCM16.ts +29 -0
  62. package/src/@modules/@eas/eas.getMergedPCM16.ts +32 -0
  63. package/src/@modules/@eas/eas.getPCM16.ts +52 -0
  64. package/src/@modules/@eas/eas.getPCMToFloat.ts +26 -0
  65. package/src/@modules/@eas/eas.getSampledPCM16.ts +36 -0
  66. package/src/@modules/@eas/eas.getWavPCM16.ts +52 -0
  67. package/src/@modules/@eas/eas.setAFSK.ts +52 -0
  68. package/src/@modules/@eas/eas.setAsciiToBits.ts +32 -0
  69. package/src/@modules/@eas/eas.setAttentionTone.ts +40 -0
  70. package/src/@modules/@eas/eas.setEasTone.ts +137 -0
  71. package/src/@modules/@eas/eas.setNoise.ts +31 -0
  72. package/src/@modules/@eas/eas.setRadioEffect.ts +49 -0
  73. package/src/@modules/@eas/eas.setSameHeader.ts +45 -0
  74. package/src/@modules/@stanza/stanza.getAwipsType.ts +1 -1
  75. package/src/@modules/@stanza/stanza.validate.ts +1 -1
  76. package/src/@modules/@utilities/utilities.createHttp.ts +17 -7
  77. package/src/@modules/@utilities/utilities.createWebhook.ts +100 -0
  78. package/src/@modules/@utilities/utilities.getFormattedTime.ts +1 -1
  79. package/src/@modules/@utilities/utilities.getSettings.ts +1 -1
  80. package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +1 -1
  81. package/src/@modules/@utilities/utilities.setCronSchedule.ts +31 -4
  82. package/src/@modules/@utilities/utilities.setEventEmit.ts +1 -1
  83. package/src/@modules/@utilities/utilities.setListener.ts +3 -3
  84. package/src/@modules/@utilities/utilities.setSettings.ts +1 -1
  85. package/src/@modules/@utilities/utilities.setSleep.ts +3 -3
  86. package/src/@modules/@utilities/utilities.setTimeoutAction.ts +4 -4
  87. package/src/@modules/@utilities/utilities.setWarning.ts +3 -3
  88. package/src/@modules/@xmpp/xmpp.xDeploy.ts +2 -2
  89. package/src/@modules/@xmpp/xmpp.xError.ts +1 -10
  90. package/src/@modules/@xmpp/xmpp.xOffline.ts +2 -2
  91. package/src/@modules/@xmpp/xmpp.xOnline.ts +3 -19
  92. package/src/@modules/@xmpp/xmpp.xReconnect.ts +7 -2
  93. package/src/@modules/@xmpp/xmpp.xStanza.ts +3 -3
  94. package/src/@parsers/@hvtec/hvtec.extract.ts +1 -1
  95. package/src/@parsers/@pvtec/pvtec.expires.ts +1 -1
  96. package/src/@parsers/@pvtec/pvtec.extract.ts +3 -4
  97. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +1 -1
  98. package/src/@parsers/@text/text.getPolygonFromProduct.ts +1 -1
  99. package/src/@parsers/@text/text.getTextFromProduct.ts +1 -1
  100. package/src/@parsers/@text/text.getXML.ts +1 -1
  101. package/src/@parsers/@ugc/ugc.coordinates.ts +1 -1
  102. package/src/@parsers/@ugc/ugc.expiry.ts +1 -1
  103. package/src/@parsers/@ugc/ugc.extract.ts +1 -1
  104. package/src/@parsers/@ugc/ugc.header.ts +1 -1
  105. package/src/@parsers/@ugc/ugc.locations.ts +1 -1
  106. package/src/@parsers/@ugc/ugc.zones.ts +1 -1
  107. package/src/@types/type.event.ts +13 -12
  108. package/src/@types/type.properties.ts +1 -1
  109. package/src/@types/types.attributes.ts +1 -1
  110. package/src/@types/types.compiled.ts +1 -1
  111. package/src/@types/types.hash.ts +1 -1
  112. package/src/@types/types.hvtec.ts +1 -1
  113. package/src/@types/types.pvtec.ts +2 -1
  114. package/src/@types/types.settings.ts +10 -5
  115. package/src/@types/types.stanza.ts +1 -1
  116. package/src/@types/types.ugc.ts +1 -1
  117. package/src/@types/types.webhook.ts +26 -0
  118. package/src/bootstrap.ts +7 -4
  119. package/src/index.ts +14 -14
  120. package/test.js +29 -18
  121. package/tsup.config.ts +1 -0
@@ -8,7 +8,7 @@
8
8
  | |
9
9
  |_|
10
10
 
11
- Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
14
  Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
@@ -17,6 +17,8 @@
17
17
 
18
18
  */
19
19
 
20
+ import { TypeWebhook } from "./types.webhook"
21
+
20
22
  export type TypeSettings = {
21
23
  Database: string
22
24
  EnableWireService: boolean
@@ -47,25 +49,28 @@ export type TypeSettings = {
47
49
  EventsEndpoint: string
48
50
  }
49
51
  GlobalSettings: {
52
+ EventManagement: boolean
50
53
  BetterEventNames: boolean
51
54
  DisableGeometryParsing: boolean
52
55
  UseShapefileCoordinates: boolean
56
+ SPCWatchesOnly: boolean
53
57
  ShapefileSkipPoints: number
54
58
  NodeTTL: number
55
59
  NodeMinDistance: number
60
+ WebhookSettings?: TypeWebhook
56
61
  EventFiltering: {
57
62
  ListeningEvents: string[]
58
63
  ListeningICAO: string[]
59
- IgnoredICAO: string[]
60
- IgnoredEvents: string[]
61
64
  ListeningUGC: string[]
62
65
  ListeningStates: string[]
66
+ IgnoredICAO: string[]
67
+ IgnoredEvents: string[]
63
68
  NodeLocationFiltering: boolean
64
69
  IgnoreTestProducts: boolean
65
70
  },
66
71
  EASSettings: {
67
- ArchiveDirectory: string | void,
68
- IntroWavFile: string | void,
72
+ ArchiveDirectory: string,
73
+ IntroWavFile: string,
69
74
  }
70
75
  }
71
76
  }
@@ -8,7 +8,7 @@
8
8
  | |
9
9
  |_|
10
10
 
11
- Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
14
  Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
@@ -8,7 +8,7 @@
8
8
  | |
9
9
  |_|
10
10
 
11
- Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
14
  Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
@@ -0,0 +1,26 @@
1
+ /*
2
+ _ _ _ __ __
3
+ /\ | | | | (_) \ \ / /
4
+ / \ | |_ _ __ ___ ___ ___ _ __ | |__ ___ _ __ _ ___ \ V /
5
+ / /\ \| __| '_ ` _ \ / _ \/ __| '_ \| '_ \ / _ \ '__| |/ __| > <
6
+ / ____ \ |_| | | | | | (_) \__ \ |_) | | | | __/ | | | (__ / . \
7
+ /_/ \_\__|_| |_| |_|\___/|___/ .__/|_| |_|\___|_| |_|\___/_/ \_\
8
+ | |
9
+ |_|
10
+
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
+ Discord: https://atmosphericx-discord.scriptkitty.cafe
13
+ Ko-Fi: https://ko-fi.com/k3yomi
14
+ Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
+
16
+ Internal Package: @atmosx/event-product-parser
17
+
18
+ */
19
+
20
+ export type TypeWebhook = {
21
+ webhook: string
22
+ title: string
23
+ message: string
24
+ rate: number
25
+ events: string[]
26
+ }
package/src/bootstrap.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  | |
9
9
  |_|
10
10
 
11
- Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
14
  Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
@@ -21,6 +21,7 @@ import path from 'path'
21
21
  import { EventEmitter } from 'node:events';
22
22
 
23
23
  export const bootstrap = {
24
+ version: `3.0.2`,
24
25
  isReady: true,
25
26
  ratelimits: {},
26
27
  session_xmpp: null,
@@ -34,7 +35,6 @@ export const bootstrap = {
34
35
  },
35
36
  cache: {
36
37
  lastStanza: null,
37
- lastConnect: null,
38
38
  isConnected: false,
39
39
  isReconnecting: false,
40
40
  tReconnects: 0,
@@ -72,20 +72,23 @@ export const bootstrap = {
72
72
  CallbackInterval: 15,
73
73
  EventsEndpoint: `https://api.weather.gov/alerts/active`,
74
74
  },
75
+ WebhookSettings: [],
75
76
  GlobalSettings: {
77
+ EventManagement: true,
76
78
  BetterEventNames: true,
77
79
  DisableGeometryParsing: false,
78
80
  UseShapefileCoordinates: false,
81
+ SPCWatchesOnly: true,
79
82
  ShapefileSkipPoints: 15,
80
83
  NodeTTL: 60,
81
84
  NodeMinDistance: 120,
82
85
  EventFiltering: {
83
86
  ListeningEvents: [],
84
87
  ListeningICAO: [],
85
- IgnoredICAO: [],
86
- IgnoredEvents: [`Xx`, `Test Message`],
87
88
  ListeningUGC: [],
88
89
  ListeningStates: [],
90
+ IgnoredICAO: [],
91
+ IgnoredEvents: [`Test Message`],
89
92
  NodeLocationFiltering: false,
90
93
  IgnoreTestProducts: true,
91
94
  },
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  | |
9
9
  |_|
10
10
 
11
- Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, Everwatch1, & CJ Ziegler)
11
+ Created with ♥ by the AtmosphericX Team (KiyoWx, StarflightWx, & CJ Ziegler)
12
12
  Discord: https://atmosphericx-discord.scriptkitty.cafe
13
13
  Ko-Fi: https://ko-fi.com/k3yomi
14
14
  Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
@@ -23,18 +23,21 @@ import { getEventGeometry } from "./@building/building.geometry";
23
23
  import { getCleanedEvent } from "./@building/building.clean"
24
24
  import { setEventEmit } from './@modules/@utilities/utilities.setEventEmit';
25
25
  import { setWarning } from './@modules/@utilities/utilities.setWarning';
26
- import { listener } from "./@core/core.listener"
26
+ import { createListener } from "./@core/core.createListener"
27
27
  import { startService } from "./@core/core.start"
28
28
  import { stopService } from "./@core/core.stop"
29
+ import { setEasTone } from './@modules/@eas/eas.setEasTone';
29
30
  import { setNode } from "./@core/core.setNode"
30
31
  import { getEvents } from "./@core/core.getEvents"
31
32
  import { getNodes } from "./@core/core.getNodes"
33
+ import { getRandomEvent } from './@core/core.getRandomEvent';
34
+ import { clearEvents } from './@core/core.clearEvents';
32
35
 
33
36
  export class Manager {
34
- constructor(settings: TypeSettings) { this.trycatch();startService(settings) }
37
+ constructor(settings: TypeSettings) { this.trycatch(); startService(settings) }
35
38
 
36
39
  on(event: string, callback: () => void) {
37
- listener(event, callback)
40
+ createListener(event, callback)
38
41
  }
39
42
 
40
43
  trycatch() {
@@ -42,7 +45,7 @@ export class Manager {
42
45
  const ignored = ['ETIMEDOUT', 'ECONNRESET', 'EHOSTUNREACH', 'STARTTLS_FAILURE'];
43
46
  if (ignored.includes(err?.code)) {
44
47
  setEventEmit({
45
- event: `onXMPPStatus`,
48
+ event: `onServiceStatus`,
46
49
  metadata: {
47
50
  message: `XMPP Critical Error: ${err?.code ?? 'Unknown error code'}. This may indicate a connection issue. Attempting to continue...`,
48
51
  data: {},
@@ -58,15 +61,12 @@ export class Manager {
58
61
  }
59
62
 
60
63
  export default Manager;
64
+ export type { TypeEvent } from './@types/type.event';
61
65
  export {
62
- setSettings,
63
- getEventGeometry,
64
- getCleanedEvent,
65
- stopService,
66
- startService,
67
- setNode,
68
- getEvents,
69
- getNodes,
66
+ setSettings, getEventGeometry,
67
+ getCleanedEvent, stopService, clearEvents,
68
+ startService, setNode, getRandomEvent,
69
+ getEvents, getNodes, setEasTone
70
70
  }
71
71
 
72
- export type { TypeSettings } from './@types/types.settings'
72
+
package/test.js CHANGED
@@ -1,23 +1,23 @@
1
1
  const { Manager, setSettings, getSettings, getListener } = require(`../dist/cjs/index.cjs`)
2
2
 
3
3
  const NOAAWeatherWireService = new Manager({
4
- database: `shapefile-manager.db`,
5
- EnableWireService: true,
6
- EnableJournal: false,
4
+ Database: `shapefile-manager.db`,
5
+ EnableWireService: false,
6
+ EnableJournal: true,
7
7
  NOAAWeatherWireServiceSettings: {
8
8
  ReconnectionSettings: {
9
9
  Enabled: true,
10
10
  ReconnectionInterval: 60,
11
11
  },
12
12
  CredentialSettings: {
13
- Username: `username_here`,
14
- Password: `password_here`,
15
- Nickname: "nick_name_here (@atmosx/event-product-parser/3.0)",
13
+ Username: `username`,
14
+ Password: `password`,
15
+ Nickname: "nickname (@atmosx/event-product-parser/3.0)",
16
16
  },
17
17
  CacheSettings: {
18
18
  Enabled: true,
19
- MaxDatabaseHistory: 15000,
20
- MaxRetentionHistory: 500,
19
+ MaxDatabaseHistory: 5000,
20
+ MaxRetentionHistory: 555,
21
21
  },
22
22
  StanzaSettings: {
23
23
  DisableUGC: false,
@@ -26,13 +26,32 @@ const NOAAWeatherWireService = new Manager({
26
26
  }
27
27
  },
28
28
  NationalWeatherServiceSettings: {
29
- CallbackInterval: 15,
29
+ CallbackInterval: 30,
30
30
  EventsEndpoint: `https://api.weather.gov/alerts/active`,
31
31
  },
32
+ WebhookSettings: [
33
+ {
34
+ webhook: "https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
35
+ title: "AtmosphericX - (Severe Weather Events)",
36
+ message: `<@user_id>`,
37
+ events: [`Severe Thunderstorm Warning`, `Radar Indicated Tornado Warning`],
38
+ rate: 1,
39
+ },
40
+ {
41
+ webhook: "https://discord.com/api/webhooks/XXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
42
+ title: "AtmosphericX - (All Events)",
43
+ message: `<@user_id>`,
44
+ events: [],
45
+ rate: 5,
46
+ }
47
+ ],
32
48
  GlobalSettings: {
33
49
  BetterEventNames: true,
34
50
  DisableGeometryParsing: false,
35
51
  UseShapefileCoordinates: true,
52
+ SPCWatchesOnly: true,
53
+ NodeTTL: 60,
54
+ NodeMinDistance: 120,
36
55
  EventFiltering: {
37
56
  ListeningEvents: [
38
57
  "Tornado Emergency", "PDS Tornado Warning", "Tornado Warning",
@@ -59,6 +78,7 @@ const NOAAWeatherWireService = new Manager({
59
78
  IgnoredEvents: [],
60
79
  ListeningUGC: [],
61
80
  ListeningStates: [],
81
+ NodeLocationFiltering: false,
62
82
  IgnoreTestProducts: true,
63
83
  },
64
84
  EASSettings: {
@@ -67,12 +87,3 @@ const NOAAWeatherWireService = new Manager({
67
87
  }
68
88
  }
69
89
  })
70
-
71
-
72
- NOAAWeatherWireService.on(`log`, (data) => {
73
- console.log(data)
74
- })
75
-
76
- NOAAWeatherWireService.on(`onEventStatus`, (data) => {
77
- console.log(`[${data.type}]: ${data.event.properties.event} (${data.event.properties.status}) (${data.event.properties.metadata.tracking})`)
78
- })
package/tsup.config.ts CHANGED
@@ -4,6 +4,7 @@ export default defineConfig({
4
4
  entry: ['src/index.ts'],
5
5
  outDir: 'dist',
6
6
  format: ['esm', 'cjs'],
7
+ dts: true,
7
8
  noExternal: ["@xmpp/client", "@xmpp/sasl", "@xmpp/sasl-plain"],
8
9
  clean: true,
9
10
  outExtension({ format }) {