@atmosx/event-product-parser 3.0.41 → 3.0.44

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 (61) hide show
  1. package/README.md +22 -0
  2. package/dist/cjs/index.cjs +1791 -1646
  3. package/dist/esm/index.mjs +1026 -882
  4. package/dist/index.d.mts +34 -3
  5. package/dist/index.d.ts +34 -3
  6. package/package.json +1 -1
  7. package/src/@building/building.create.ts +2 -2
  8. package/src/@building/building.enhance.ts +1 -1
  9. package/src/@building/building.geometry.ts +1 -1
  10. package/src/@building/building.headers.ts +1 -1
  11. package/src/@building/building.office.ts +3 -3
  12. package/src/@building/building.outlooks.ts +36 -0
  13. package/src/@building/building.properties.ts +11 -5
  14. package/src/@building/building.tracking.ts +7 -7
  15. package/src/@building/building.validate.ts +4 -2
  16. package/src/@core/core.query.ts +39 -0
  17. package/src/@core/core.setNode.ts +2 -2
  18. package/src/@core/core.start.ts +1 -1
  19. package/src/@events/events.api.ts +4 -1
  20. package/src/@events/events.text.ts +3 -2
  21. package/src/@events/events.ugc.ts +3 -2
  22. package/src/@events/events.vtec.ts +5 -4
  23. package/src/@manager/manager.createWebhook.ts +93 -81
  24. package/src/@manager/manager.mkEvent.ts +3 -2
  25. package/src/@manager/manager.setHash.ts +1 -1
  26. package/src/@manager/manager.updateWebhooks.ts +1 -2
  27. package/src/@modules/@database/database.cache.ts +1 -1
  28. package/src/@modules/@database/database.init.ts +1 -1
  29. package/src/@modules/@database/database.shapefiles.ts +1 -1
  30. package/src/@modules/@database/database.stanza.ts +2 -2
  31. package/src/@modules/@eas/eas.getCleanDescription.ts +89 -0
  32. package/src/@modules/@eas/eas.getTTS.ts +43 -0
  33. package/src/@modules/@eas/eas.setEasTone.ts +29 -24
  34. package/src/@modules/@stanza/stanza.getAwipsType.ts +1 -1
  35. package/src/@modules/@stanza/stanza.validate.ts +2 -2
  36. package/src/@modules/@utilities/utilities.getLatestIssuance.ts +32 -0
  37. package/src/@modules/@utilities/utilities.getSettings.ts +1 -1
  38. package/src/@modules/@utilities/utilities.isImageReady.ts +27 -0
  39. package/src/@modules/@utilities/utilities.setCronSchedule.ts +28 -2
  40. package/src/@modules/@utilities/utilities.setSettings.ts +1 -1
  41. package/src/@modules/@utilities/utilities.setWarning.ts +1 -1
  42. package/src/@modules/@xmpp/xmpp.xDeploy.ts +1 -1
  43. package/src/@modules/@xmpp/xmpp.xReconnect.ts +1 -1
  44. package/src/@modules/@xmpp/xmpp.xStanza.ts +1 -1
  45. package/src/@parsers/@hvtec/hvtec.extract.ts +1 -1
  46. package/src/@parsers/@pvtec/pvtec.extract.ts +1 -1
  47. package/src/@parsers/@ugc/ugc.extract.ts +1 -1
  48. package/src/@types/{types.compiled.ts → type.compiled.ts} +1 -1
  49. package/src/@types/type.event.ts +4 -2
  50. package/src/@types/type.properties.ts +3 -1
  51. package/src/@types/{types.settings.ts → type.settings.ts} +3 -2
  52. package/src/@types/{types.webhook.ts → type.webhook.ts} +1 -0
  53. package/src/bootstrap.ts +2 -1
  54. package/src/index.ts +3 -2
  55. package/src/@dictionaries/dictionaries.transcribedMessageReplacements.ts +0 -68
  56. /package/src/@types/{types.attributes.ts → type.attributes.ts} +0 -0
  57. /package/src/@types/{types.hash.ts → type.hash.ts} +0 -0
  58. /package/src/@types/{types.hvtec.ts → type.hvtec.ts} +0 -0
  59. /package/src/@types/{types.pvtec.ts → type.pvtec.ts} +0 -0
  60. /package/src/@types/{types.stanza.ts → type.stanza.ts} +0 -0
  61. /package/src/@types/{types.ugc.ts → type.ugc.ts} +0 -0
@@ -14,19 +14,45 @@
14
14
  Documentation: http://localhost/documentation | https://atmosphericx.scriptkitty.cafe/documentation
15
15
 
16
16
  Internal Package: @atmosx/event-product-parser
17
-
17
+
18
18
 
19
19
  */
20
20
 
21
- import { TypeSettings } from "../../@types/types.settings";
21
+ import { TypeSettings } from "../../@types/type.settings";
22
22
  import { xReconnect } from "../@xmpp/xmpp.xReconnect"
23
23
  import { bootstrap } from "../../bootstrap";
24
24
  import { createHttp } from "./utilities.createHttp";
25
25
  import { createEvent } from "../../@building/building.create";
26
26
  import { setEventEmit } from "./utilities.setEventEmit";
27
+ import { readdirSync, unlinkSync, statSync, existsSync } from "fs";
28
+ import { join } from "path";
27
29
 
28
30
  export const setCronSchedule = async (): Promise<void> => {
29
31
  const settings = bootstrap.settings as TypeSettings;
32
+
33
+ const TTL = settings.GlobalSettings.EASSettings.ArchiveTTL
34
+ const TTLCUT = Date.now() - TTL * 1000;
35
+ const walk = (dir: string): void => {
36
+ if (existsSync(dir)) {
37
+ const entries = readdirSync(dir, { withFileTypes: true });
38
+ for (const entry of entries) {
39
+ const fullPath = join(dir, entry.name);
40
+ if (entry.isDirectory()) { walk(fullPath); continue; }
41
+ const stats = statSync(fullPath);
42
+ if (stats.mtime.getTime() < TTLCUT) {
43
+ try {
44
+ unlinkSync(fullPath);
45
+ } catch (err) {
46
+ console.error(`Failed to delete ${fullPath}:`, err);
47
+ }
48
+ }
49
+ }
50
+ }
51
+ };
52
+ walk(settings.GlobalSettings.EASSettings.ArchiveDirectory)
53
+
54
+
55
+
30
56
  if (settings.EnableWireService) {
31
57
  if (settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.Enabled) {
32
58
  void xReconnect(settings.NOAAWeatherWireServiceSettings.ReconnectionSettings.ReconnectionInterval)
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeSettings } from '../../@types/types.settings'
20
+ import { TypeSettings } from '../../@types/type.settings'
21
21
  import { bootstrap } from "../../bootstrap"
22
22
 
23
23
  export const setSettings = (newSettings: TypeSettings): TypeSettings => {
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import { bootstrap } from "../../bootstrap"
21
- import { TypeSettings } from "../../@types/types.settings";
21
+ import { TypeSettings } from "../../@types/type.settings";
22
22
 
23
23
  interface SetWarningOptions {
24
24
  title?: string
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import { client } from '@xmpp/client';
21
- import { TypeSettings } from "../../@types/types.settings";
21
+ import { TypeSettings } from "../../@types/type.settings";
22
22
  import { bootstrap } from "../../bootstrap"
23
23
  import { setWarning } from "../@utilities/utilities.setWarning";
24
24
  import { xOnline } from "./xmpp.xOnline";
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeSettings } from "../../@types/types.settings";
20
+ import { TypeSettings } from "../../@types/type.settings";
21
21
  import { bootstrap } from "../../bootstrap"
22
22
  import { setEventEmit } from "../@utilities/utilities.setEventEmit";
23
23
  import { setWarning } from "../@utilities/utilities.setWarning";
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeStanza } from "../../@types/types.stanza";
20
+ import { TypeStanza } from "../../@types/type.stanza";
21
21
  import { bootstrap } from "../../bootstrap";
22
22
  import { validate } from "../@stanza/stanza.validate";
23
23
  import { createEvent } from "../../@building/building.create";
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeHVTEC } from "../../@types/types.hvtec";
20
+ import { TypeHVTEC } from "../../@types/type.hvtec";
21
21
  import { eventCauses } from "../../@dictionaries/dictionaries.eventCauses";
22
22
  import { eventRecords } from "../../@dictionaries/dictionaries.eventRecords";
23
23
  import { regExp } from "../../@dictionaries/dictionaries.regExp";
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypePVTEC } from "../../@types/types.pvtec";
20
+ import { TypePVTEC } from "../../@types/type.pvtec";
21
21
  import { regExp } from "../../@dictionaries/dictionaries.regExp";
22
22
  import { eventProducts } from "../../@dictionaries/dictionaries.eventProducts";
23
23
  import { eventTypes } from "../../@dictionaries/dictionaries.eventTypes";
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeUGC } from "../../@types/types.ugc";
20
+ import { TypeUGC } from "../../@types/type.ugc";
21
21
  import { getUGCHeader } from "./ugc.header"
22
22
  import { getZones } from "./ugc.zones";
23
23
  import { getExpiry } from './ugc.expiry';
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "./types.attributes"
20
+ import { TypeAttributes } from "./type.attributes"
21
21
 
22
22
  export type TypeStanzaCompiled = {
23
23
  message?: string
@@ -18,8 +18,8 @@
18
18
  */
19
19
 
20
20
  import { TypeEventProperties as BaseTypeEventProperties } from "./type.properties";
21
- import { TypeHVTEC } from "../@types/types.hvtec";
22
- import { TypePVTEC } from "./types.pvtec";
21
+ import { TypeHVTEC } from "./type.hvtec";
22
+ import { TypePVTEC } from "./type.pvtec";
23
23
 
24
24
  export type TypeEvent = {
25
25
  type: string
@@ -63,6 +63,8 @@ export type TypeEvent = {
63
63
  issued: string
64
64
  status: string
65
65
  }[]
66
+ attachments?: string[]
67
+ raw: string
66
68
  }
67
69
  } & BaseTypeEventProperties
68
70
  }
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "./types.attributes";
20
+ import { TypeAttributes } from "./type.attributes";
21
21
 
22
22
  export type TypeEventProperties = {
23
23
  locations: string
@@ -67,6 +67,8 @@ export type TypeEventProperties = {
67
67
  pds_watch: boolean
68
68
  }
69
69
  spc_parameters: {
70
+ spc_number: string
71
+ spc_concerning: string
70
72
  spc_max_tornado: string
71
73
  spc_max_hail: string
72
74
  spc_max_wind: string
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeWebhook } from "./types.webhook"
20
+ import { TypeWebhook } from "./type.webhook"
21
21
 
22
22
  export type TypeSettings = {
23
23
  Database: string
@@ -69,8 +69,9 @@ export type TypeSettings = {
69
69
  IgnoreTestProducts: boolean
70
70
  },
71
71
  EASSettings: {
72
+ ArchiveTTL: number,
72
73
  ArchiveDirectory: string,
73
- IntroWavFile: string,
74
+ IntroWavFile: string
74
75
  }
75
76
  }
76
77
  }
@@ -22,6 +22,7 @@ export type TypeWebhook = {
22
22
  title: string
23
23
  message: string
24
24
  upload: boolean
25
+ eas: boolean
25
26
  rate: number
26
27
  events: string[]
27
28
  }
package/src/bootstrap.ts CHANGED
@@ -21,7 +21,7 @@ import path from 'path'
21
21
  import { EventEmitter } from 'node:events';
22
22
 
23
23
  export const bootstrap = {
24
- version: `3.0.41`,
24
+ version: `3.0.44`,
25
25
  isReady: true,
26
26
  ratelimits: {},
27
27
  session_xmpp: null,
@@ -93,6 +93,7 @@ export const bootstrap = {
93
93
  IgnoreTestProducts: true,
94
94
  },
95
95
  EASSettings: {
96
+ ArchiveTTL: 60,
96
97
  ArchiveDirectory: null,
97
98
  IntroWavFile: null,
98
99
  }
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeSettings } from './@types/types.settings'
20
+ import { TypeSettings } from './@types/type.settings'
21
21
  import { setSettings } from "./@modules/@utilities/utilities.setSettings"
22
22
  import { getEventGeometry } from "./@building/building.geometry";
23
23
  import { getCleanedEvent } from "./@building/building.clean"
@@ -31,6 +31,7 @@ import { setNode } from "./@core/core.setNode"
31
31
  import { getEvents } from "./@core/core.getEvents"
32
32
  import { getNodes } from "./@core/core.getNodes"
33
33
  import { getRandomEvent } from './@core/core.getRandomEvent';
34
+ import { query } from './@core/core.query';
34
35
  import { clearEvents } from './@core/core.clearEvents';
35
36
 
36
37
  export class Manager {
@@ -66,7 +67,7 @@ export {
66
67
  setSettings, getEventGeometry,
67
68
  getCleanedEvent, stopService, clearEvents,
68
69
  startService, setNode, getRandomEvent,
69
- getEvents, getNodes, setEasTone
70
+ getEvents, getNodes, setEasTone, query
70
71
  }
71
72
 
72
73
 
@@ -1,68 +0,0 @@
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 const transcribedMessageReplacements: { regex: RegExp, replacement: string }[] = [
21
- { regex: /\*/g, replacement: "" },
22
- { regex: /\.{3,}/g, replacement: "" },
23
- { regex: /\bUTC\b/g, replacement: 'Coordinated Universal Time' },
24
- { regex: /\bGMT\b/g, replacement: 'Greenwich Mean Time' },
25
- { regex: /\bEST\b(?!\w)/g, replacement: 'Eastern Standard Time' },
26
- { regex: /\bEDT\b(?!\w)/g, replacement: 'Eastern Daylight Time' },
27
- { regex: /\bCST\b(?!\w)/g, replacement: 'Central Standard Time' },
28
- { regex: /\bCDT\b(?!\w)/g, replacement: 'Central Daylight Time' },
29
- { regex: /\bMST\b(?!\w)/g, replacement: 'Mountain Standard Time' },
30
- { regex: /\bMDT\b(?!\w)/g, replacement: 'Mountain Daylight Time' },
31
- { regex: /\bPST\b(?!\w)/g, replacement: 'Pacific Standard Time' },
32
- { regex: /\bPDT\b(?!\w)/g, replacement: 'Pacific Daylight Time' },
33
- { regex: /\bAKST\b(?!\w)/g, replacement: 'Alaska Standard Time' },
34
- { regex: /\bAKDT\b(?!\w)/g, replacement: 'Alaska Daylight Time' },
35
- { regex: /\bHST\b(?!\w)/g, replacement: 'Hawaii Standard Time' },
36
- { regex: /\bHDT\b(?!\w)/g, replacement: 'Hawaii Daylight Time' },
37
- { regex: /\bmph\b(?!\w)/g, replacement: 'miles per hour' },
38
- { regex: /\bkm\/h\b(?!\w)/g, replacement: 'kilometers per hour' },
39
- { regex: /\bkmh\b(?!\w)/g, replacement: 'kilometers per hour' },
40
- { regex: /\bkt\b(?!\w)/g, replacement: 'knots' },
41
- { regex: /\bNE\b(?!\w)/g, replacement: 'northeast' },
42
- { regex: /\bNW\b(?!\w)/g, replacement: 'northwest' },
43
- { regex: /\bSE\b(?!\w)/g, replacement: 'southeast' },
44
- { regex: /\bSW\b(?!\w)/g, replacement: 'southwest' },
45
- { regex: /\bNM\b(?!\w)/g, replacement: 'nautical miles' },
46
- { regex: /\bdeg\b(?!\w)/g, replacement: 'degrees' },
47
- { regex: /\btstm\b(?!\w)/g, replacement: 'thunderstorm' },
48
- { regex: /\bmm\b(?!\w)/g, replacement: 'millimeters' },
49
- { regex: /\bcm\b(?!\w)/g, replacement: 'centimeters' },
50
- { regex: /\bin.\b(?!\w)/g, replacement: 'inches' },
51
- { regex: /\bft\b(?!\w)/g, replacement: 'feet' },
52
- { regex: /\bmi\b(?!\w)/g, replacement: 'miles' },
53
- { regex: /\bhr\b(?!\w)/g, replacement: 'hour' },
54
- { regex: /\bhourly\b(?!\w)/g, replacement: 'per hour' },
55
- { regex: /\bkg\b(?!\w)/g, replacement: 'kilograms' },
56
- { regex: /\bg\/kg\b(?!\w)/g, replacement: 'grams per kilogram' },
57
- { regex: /\bmb\b(?!\w)/g, replacement: 'millibars' },
58
- { regex: /\bhPa\b(?!\w)/g, replacement: 'hectopascals' },
59
- { regex: /\bPa\b(?!\w)/g, replacement: 'pascals' },
60
- { regex: /\bKPa\b(?!\w)/g, replacement: 'kilopascals' },
61
- { regex: /\bC\/hr\b(?!\w)/g, replacement: 'degrees Celsius per hour' },
62
- { regex: /\bF\/hr\b(?!\w)/g, replacement: 'degrees Fahrenheit per hour' },
63
- { regex: /\bC\/min\b(?!\w)/g, replacement: 'degrees Celsius per minute' },
64
- { regex: /\bF\/min\b(?!\w)/g, replacement: 'degrees Fahrenheit per minute' },
65
- { regex: /\bC\b(?!\w)/g, replacement: 'degrees Celsius' },
66
- { regex: /\bF\b(?!\w)/g, replacement: 'degrees Fahrenheit' },
67
- ];
68
-
File without changes
File without changes
File without changes
File without changes
File without changes