@atmosx/event-product-parser 3.0.62 → 3.0.622

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 (92) hide show
  1. package/README.md +6 -4
  2. package/dist/cjs/index.cjs +21171 -6858
  3. package/dist/esm/index.mjs +21270 -6957
  4. package/package.json +49 -47
  5. package/pnpm-workspace.yaml +3 -0
  6. package/src/@building/CreateEvent.ts +10 -12
  7. package/src/@building/GetEventAttachments.ts +5 -5
  8. package/src/@building/GetEventEnhancedName.ts +2 -4
  9. package/src/@building/GetEventGeometry.ts +4 -4
  10. package/src/@building/GetEventHeader.ts +2 -2
  11. package/src/@building/GetEventNodes.ts +8 -8
  12. package/src/@building/GetEventOffice.ts +3 -3
  13. package/src/@building/GetEventProperties.ts +16 -11
  14. package/src/@building/GetEventSignature.ts +6 -6
  15. package/src/@building/GetEventTags.ts +1 -1
  16. package/src/@building/GetEventTracking.ts +4 -4
  17. package/src/@core/ClearEvents.ts +2 -2
  18. package/src/@core/CreateListener.ts +1 -1
  19. package/src/@core/GetEvents.ts +1 -1
  20. package/src/@core/GetNodes.ts +1 -1
  21. package/src/@core/GetRandomEvent.ts +1 -1
  22. package/src/@core/GetVersion.ts +1 -1
  23. package/src/@core/ManualEvent.ts +3 -4
  24. package/src/@core/QueryStanza.ts +2 -2
  25. package/src/@core/SetNode.ts +9 -3
  26. package/src/@core/StartService.ts +11 -11
  27. package/src/@core/StopService.ts +1 -1
  28. package/src/@enums/Tags.ts +1 -1
  29. package/src/@events/ParseAPI.ts +15 -10
  30. package/src/@events/ParseText.ts +8 -8
  31. package/src/@events/ParseUGC.ts +9 -9
  32. package/src/@events/ParseVTEC.ts +12 -12
  33. package/src/@manager/MakeEvents.ts +20 -17
  34. package/src/@manager/RemoveEvent.ts +8 -8
  35. package/src/@manager/SetHash.ts +3 -3
  36. package/src/@manager/UpdateEvents.ts +4 -4
  37. package/src/@manager/UpdateNode.ts +4 -4
  38. package/src/@manager/ValidateEvents.ts +13 -14
  39. package/src/@modules/@database/GetCachedEvents.ts +6 -7
  40. package/src/@modules/@database/ImportBroadcastify.ts +3 -3
  41. package/src/@modules/@database/ImportShapefiles.ts +11 -11
  42. package/src/@modules/@database/ImportStanza.ts +4 -4
  43. package/src/@modules/@database/InitializeDatabase.ts +6 -6
  44. package/src/@modules/@eas/GenerateEASMessage.ts +26 -18
  45. package/src/@modules/@eas/GetTTS.ts +2 -2
  46. package/src/@modules/@eas/SetNoise.ts +2 -2
  47. package/src/@modules/@eas/SetRadioEffect.ts +2 -2
  48. package/src/@modules/@eas/SetSameHeader.ts +3 -3
  49. package/src/@modules/@stanza/GetAwipsType.ts +2 -2
  50. package/src/@modules/@stanza/ValidateStanza.ts +4 -4
  51. package/src/@modules/@utilities/GetSettings.ts +2 -2
  52. package/src/@modules/@utilities/QueueManager.ts +71 -0
  53. package/src/@modules/@utilities/SetCronSchedule.ts +8 -8
  54. package/src/@modules/@utilities/SetDebug.ts +2 -2
  55. package/src/@modules/@utilities/SetEventEmit.ts +3 -3
  56. package/src/@modules/@utilities/SetListener.ts +1 -1
  57. package/src/@modules/@utilities/SetSettings.ts +2 -2
  58. package/src/@modules/@utilities/SetTimeoutAction.ts +1 -1
  59. package/src/@modules/@utilities/SetWarning.ts +2 -2
  60. package/src/@modules/@xmpp/DeployXMPP.ts +8 -8
  61. package/src/@modules/@xmpp/ErrorXMPP.ts +1 -1
  62. package/src/@modules/@xmpp/OfflineXMPP.ts +2 -2
  63. package/src/@modules/@xmpp/OnlineXMPP.ts +3 -3
  64. package/src/@modules/@xmpp/ReconnectXMPP.ts +4 -4
  65. package/src/@modules/@xmpp/StanzaXMPP.ts +6 -6
  66. package/src/@parsers/@hvtec/HVExtract.ts +5 -5
  67. package/src/@parsers/@pvtec/VTECExtract.ts +7 -7
  68. package/src/@parsers/@text/GetDescriptionFromProduct.ts +1 -1
  69. package/src/@parsers/@text/GetEmbededText.ts +3 -3
  70. package/src/@parsers/@text/GetStringText.ts +5 -5
  71. package/src/@parsers/@ugc/GetCache.ts +1 -1
  72. package/src/@parsers/@ugc/GetLocations.ts +3 -3
  73. package/src/@parsers/@ugc/GetUGCHeader.ts +1 -1
  74. package/src/@parsers/@ugc/GetZonePolygon.ts +2 -2
  75. package/src/@parsers/@ugc/SetCache.ts +1 -1
  76. package/src/@parsers/@ugc/UGCExtract.ts +5 -5
  77. package/src/@tasks/CreateTasks.ts +110 -0
  78. package/src/@tasks/TaskGenerateAudio.ts +35 -0
  79. package/src/@tasks/TaskGenerateJSON.ts +35 -0
  80. package/src/@tasks/TaskGenerateText.ts +35 -0
  81. package/src/@tasks/TaskSendNTFY.ts +93 -0
  82. package/src/@tasks/TaskSendWebhook.ts +101 -0
  83. package/src/@types/Event.ts +3 -3
  84. package/src/@types/Properties.ts +2 -1
  85. package/src/@types/Settings.ts +1 -1
  86. package/src/@types/StanzaCompiled.ts +1 -1
  87. package/src/bootstrap.ts +3 -3
  88. package/src/index.ts +21 -19
  89. package/tools/build.js +45 -0
  90. package/tsconfig.json +20 -1
  91. package/src/@manager/Tasks.ts +0 -246
  92. package/tsup.config.ts +0 -16
package/package.json CHANGED
@@ -1,47 +1,49 @@
1
- {
2
- "name": "@atmosx/event-product-parser",
3
- "version": "3.0.62",
4
- "description": "NOAA Weather Wire & NWS API Parser - Built for standalone and Project AtmosphericX Integration.",
5
- "main": "dist/cjs/index.cjs",
6
- "module": "dist/esm/index.mjs",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/AtmosphericX/event-product-parser",
10
- "branch": "v3-beta-branch"
11
- },
12
- "scripts": {
13
- "start": "cd ./test && node ./index.js",
14
- "build": "tsup && cd ./test && node ./index.js",
15
- "publish": "tsup && npm publish --access public",
16
- "publish-beta-branch": "tsup && npm publish --tag v3-beta-branch --access public"
17
- },
18
- "keywords": [
19
- "NWWS",
20
- "NOAA Weather Wire Service",
21
- "TypeScript",
22
- "XMPP",
23
- "Parser",
24
- "JavaScript",
25
- "CommonJS",
26
- "ESM"
27
- ],
28
- "author": "k3yomi, StarflightWx",
29
- "license": "MIT",
30
- "bugs": {
31
- "url": "https://github.com/AtmosphericX/event-product-parser/issues"
32
- },
33
- "homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
34
- "dependencies": {
35
- "@xmpp/client": "0.14.0",
36
- "better-sqlite3": "12.9.0",
37
- "croner": "10.0.1",
38
- "jszip": "3.10.1",
39
- "polygon-clipping": "0.15.7",
40
- "shapefile": "0.6.6",
41
- "typescript": "5.9.3"
42
- },
43
- "devDependencies": {
44
- "@types/node": "25.2.0",
45
- "tsup": "8.5.1"
46
- }
47
- }
1
+ {
2
+ "name": "@atmosx/event-product-parser",
3
+ "version": "3.0.622",
4
+ "description": "NOAA Weather Wire & NWS API Parser - Built for standalone and Project AtmosphericX Integration.",
5
+ "main": "dist/cjs/index.cjs",
6
+ "module": "dist/esm/index.mjs",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/AtmosphericX/event-product-parser",
10
+ "branch": "v3-beta-branch"
11
+ },
12
+ "scripts": {
13
+ "start": "cd ./test && node ./index.js",
14
+ "build": "node ./tools/build.js && cd ./test && node index.js",
15
+ "watch": "node ./tools/build.js --watch",
16
+ "publish": "node ./tools/build.js && npm publish --access public",
17
+ "publish-beta-branch": "node ./tools/build.js && npm publish --tag v3-beta-branch --access public"
18
+ },
19
+ "keywords": [
20
+ "NWWS",
21
+ "NOAA Weather Wire Service",
22
+ "TypeScript",
23
+ "XMPP",
24
+ "Parser",
25
+ "JavaScript",
26
+ "CommonJS",
27
+ "ESM"
28
+ ],
29
+ "author": "k3yomi, StarflightWx",
30
+ "license": "MIT",
31
+ "bugs": {
32
+ "url": "https://github.com/AtmosphericX/event-product-parser/issues"
33
+ },
34
+ "homepage": "https://github.com/AtmosphericX/event-product-parser#readme",
35
+ "dependencies": {
36
+ "@xmpp/client": "0.14.0",
37
+ "better-sqlite3": "12.9.0",
38
+ "croner": "10.0.1",
39
+ "esbuild": "^0.28.1",
40
+ "fast-glob": "^3.3.3",
41
+ "jszip": "3.10.1",
42
+ "polygon-clipping": "0.15.7",
43
+ "shapefile": "0.6.6",
44
+ "typescript": "5.9.3"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "25.2.0"
48
+ }
49
+ }
@@ -0,0 +1,3 @@
1
+ allowBuilds:
2
+ better-sqlite3: true
3
+ esbuild: true
@@ -17,16 +17,16 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled"
21
- import { TypeSettings } from "../@types/Settings"
22
- import { bootstrap } from "../bootstrap"
23
- import { ParseText } from "../@events/ParseText"
24
- import { ParseUGC } from "../@events/ParseUGC"
25
- import { ParseVTEC } from "../@events/ParseVTEC"
26
- import { ParseAPI } from "../@events/ParseAPI"
27
- import { ValidateEvents } from "../@manager/ValidateEvents"
20
+ import { TypeStanzaCompiled } from "types/StanzaCompiled"
21
+ import { TypeSettings } from "types/Settings"
22
+ import { bootstrap } from "@bootstrap"
23
+ import { ParseText } from "@events/ParseText"
24
+ import { ParseUGC } from "@events/ParseUGC"
25
+ import { ParseVTEC } from "@events/ParseVTEC"
26
+ import { ParseAPI } from "@events/ParseAPI"
27
+ import { ValidateEvents } from "@manager/ValidateEvents"
28
28
 
29
- export const CreateEvent = async (stanza: TypeStanzaCompiled, ignorePushing?: boolean): Promise<void | string> => {
29
+ export const CreateEvent = async (stanza: TypeStanzaCompiled): Promise<void | string> => {
30
30
  const settings = bootstrap.settings as TypeSettings
31
31
  const StanzaSettings = settings.NOAAWeatherWireServiceSettings.StanzaSettings;
32
32
 
@@ -49,8 +49,6 @@ export const CreateEvent = async (stanza: TypeStanzaCompiled, ignorePushing?: bo
49
49
  await ParseText(stanza)
50
50
  break;
51
51
  }
52
- if (!ignorePushing) {
53
- await ValidateEvents(bootstrap.cache.processed)
54
- }
52
+ await ValidateEvents(bootstrap.cache.processed)
55
53
  return 'nothing picked';
56
54
  }
@@ -17,11 +17,11 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeEvent } from "../@types/Event"
21
- import { bootstrap } from "../bootstrap"
22
- import { EnumStates } from "../@enums/States"
23
- import { EnumExpressions } from "../@enums/Expressions"
24
- import { GetLatestIssuance } from "../@modules/@utilities/GetLatestIssuance";
20
+ import { TypeEvent } from "types/Event"
21
+ import { bootstrap } from "@bootstrap"
22
+ import { EnumStates } from "@enums/States"
23
+ import { EnumExpressions } from "@enums/Expressions"
24
+ import { GetLatestIssuance } from "@utilities/GetLatestIssuance"
25
25
 
26
26
  interface GetEventAttachmentsResponse {
27
27
  name: string
@@ -17,10 +17,8 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeEvent } from "../@types/Event";
21
- import { TypeSettings } from "../@types/Settings";
22
- import { EnumEnhanced } from "../@enums/Enhanced"
23
- import { bootstrap } from "../bootstrap"
20
+ import { TypeEvent } from "types/Event"
21
+ import { EnumEnhanced } from "@enums/Enhanced"
24
22
 
25
23
  export const GetEventEnhancedName = (event: TypeEvent): string => {
26
24
  let name = event?.properties?.event;
@@ -17,10 +17,10 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeSettings } from "../@types/Settings"
21
- import { TypeEvent } from "../@types/Event"
22
- import { GetSettings } from "../@modules/@utilities/GetSettings";
23
- import { getZonePolygon } from "../@parsers/@ugc/GetZonePolygon";
20
+ import { TypeSettings } from "types/Settings"
21
+ import { TypeEvent } from "types/Event"
22
+ import { GetSettings } from "@utilities/GetSettings"
23
+ import { getZonePolygon } from "@parsers/ugc/GetZonePolygon"
24
24
 
25
25
  interface GetGeometryResponse {
26
26
  type: `Polygon` | `MultiPolygon`
@@ -17,8 +17,8 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypePVTEC } from "../@types/VTEC";
21
- import { TypeEventProperties } from "../@types/Properties";
20
+ import { TypePVTEC } from "types/VTEC"
21
+ import { TypeEventProperties } from "types/Properties"
22
22
 
23
23
  interface GetHeaderOptions {
24
24
  properties: TypeEventProperties
@@ -17,10 +17,10 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeEvent } from "../@types/Event"
21
- import { bootstrap } from "../bootstrap"
22
- import { GetEventGeometry } from "./GetEventGeometry"
23
- import { GetShapeNearestPoint } from "../@modules/@utilities/GetShapeNearestPoint"
20
+ import { TypeEvent } from "types/Event"
21
+ import { bootstrap } from "@bootstrap"
22
+ import { GetEventGeometry } from "@building/GetEventGeometry"
23
+ import { GetShapeNearestPoint } from "@utilities/GetShapeNearestPoint"
24
24
 
25
25
  interface GetEventNodesResponse {
26
26
  nodes: {
@@ -38,7 +38,7 @@ interface GetEventNodesResponse {
38
38
  export const GetEventNodes = async (event: TypeEvent): Promise<GetEventNodesResponse> => {
39
39
  const nodes = bootstrap.cache.nodes.features;
40
40
  if (!nodes || nodes.length === 0) {
41
- return { nodes: [], filtered: true, updated: Date.now() };
41
+ return { nodes: [], filtered: false, updated: Date.now() };
42
42
  }
43
43
  const metadata = { nodes: [], proximity: false, filtered: false };
44
44
  const geometry = await GetEventGeometry(event);
@@ -59,11 +59,11 @@ export const GetEventNodes = async (event: TypeEvent): Promise<GetEventNodesResp
59
59
  kilometers,
60
60
  proximity: false
61
61
  }
62
- metadata.nodes.push(info)
63
- if (miles != null && (bootstrap.settings.GlobalSettings.EventFiltering.NodeLocationFiltering) && (miles < bootstrap.settings.GlobalSettings.NodeMaxDistance)) {
64
- metadata.proximity = true;
62
+ if (miles != null && (miles < bootstrap.settings.GlobalSettings.NodeMaxDistance)) {
65
63
  info.proximity = true;
64
+ metadata.proximity = true;
66
65
  }
66
+ metadata.nodes.push(info)
67
67
  }
68
68
  return {
69
69
  nodes: metadata.nodes,
@@ -17,9 +17,9 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "../@types/Attributes";
21
- import { TypePVTEC } from "../@types/VTEC";
22
- import { EnumICAO } from "../@enums/ICAO";
20
+ import { TypeAttributes } from "types/Attributes"
21
+ import { TypePVTEC } from "types/VTEC"
22
+ import { EnumICAO } from "@enums/ICAO"
23
23
 
24
24
  interface GetOfficeOptions {
25
25
  attributes: TypeAttributes
@@ -17,17 +17,17 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeEventProperties } from "../@types/Properties";
21
- import { TypeAttributes } from "../@types/Attributes";
22
- import { TypeUGC } from "../@types/UGC";
23
- import { TypePVTEC } from "../@types/VTEC";
24
- import { TypeHVTEC } from "../@types/HVTEC";
25
- import { EnumExpressions } from "../@enums/Expressions";
26
- import { GetDescriptionFromProduct } from "../@parsers/@text/GetDescriptionFromProduct";
27
- import { getPolygonFromProduct } from "../@parsers/@text/GetPolygonFromProduct";
28
- import { GetTextFromProduct } from "../@parsers/@text/GetTextFromProduct";
29
- import { GetEventOffice } from "./GetEventOffice";
30
- import { GetEventTags } from "./GetEventTags";
20
+ import { TypeEventProperties } from "types/Properties"
21
+ import { TypeAttributes } from "types/Attributes"
22
+ import { TypeUGC } from "types/UGC"
23
+ import { TypePVTEC } from "types/VTEC"
24
+ import { TypeHVTEC } from "types/HVTEC"
25
+ import { EnumExpressions } from "@enums/Expressions"
26
+ import { GetDescriptionFromProduct } from "@parsers/text/GetDescriptionFromProduct"
27
+ import { getPolygonFromProduct } from "@parsers/text/GetPolygonFromProduct"
28
+ import { GetTextFromProduct } from "@parsers/text/GetTextFromProduct"
29
+ import { GetEventOffice } from "@building/GetEventOffice"
30
+ import { GetEventTags } from "@building/GetEventTags"
31
31
 
32
32
  interface GetEventPropertiesOptions {
33
33
  message: string
@@ -43,6 +43,11 @@ export const GetEventProperties = (options: GetEventPropertiesOptions): TypeEven
43
43
  const properties = {
44
44
  locations: options?.ugc?.locations?.join(`; `) ?? null,
45
45
  locations_array: options?.ugc?.locations ?? [],
46
+ location_states: [...new Set(
47
+ options?.ugc?.locations
48
+ ?.map((location: string) => location.match(/,\s*([A-Z]{2})\b/)?.[1])
49
+ .filter(Boolean) ?? []
50
+ )],
46
51
  description: GetDescriptionFromProduct({ message: options.message, handle: options?.pVtec?.vtec ?? null }),
47
52
  attributes: options.attributes,
48
53
  geocode: {
@@ -17,12 +17,12 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeEvent } from "../@types/Event";
21
- import { EnumCorrelations } from "../@enums/Correlations";
22
- import { EnumCancellation } from "../@enums/Cancellation";
23
- import { EnumTesting} from "../@enums/Testing"
24
- import { EnumProducts } from "../@enums/Products";
25
- import { EnumHail } from "../@enums/Hail"
20
+ import { TypeEvent } from "types/Event"
21
+ import { EnumCorrelations } from "@enums/Correlations"
22
+ import { EnumCancellation } from "@enums/Cancellation"
23
+ import { EnumTesting} from "@enums/Testing"
24
+ import { EnumProducts } from "@enums/Products"
25
+ import { EnumHail } from "@enums/Hail"
26
26
 
27
27
  export const GetEventSignature = (event: TypeEvent): TypeEvent => {
28
28
  const properties = event?.properties;
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { EnumTags } from "../@enums/Tags";
20
+ import { EnumTags } from "@enums/Tags"
21
21
 
22
22
  export const GetEventTags = (message: string): string[] => {
23
23
  if (!message) return [];
@@ -17,10 +17,10 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "../@types/Attributes";
21
- import { TypeEventProperties } from "../@types/Properties";
22
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled";
23
- import { TypePVTEC } from "../@types/VTEC";
20
+ import { TypeAttributes } from "types/Attributes"
21
+ import { TypeEventProperties } from "types/Properties"
22
+ import { TypeStanzaCompiled } from "types/StanzaCompiled"
23
+ import { TypePVTEC } from "types/VTEC"
24
24
 
25
25
  interface GetTrackingOptions {
26
26
  type: `RAW` | `VTEC` | `API`
@@ -17,8 +17,8 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
21
- import { SetEventEmit } from "../@modules/@utilities/SetEventEmit";
20
+ import { bootstrap } from "@bootstrap"
21
+ import { SetEventEmit } from "@utilities/SetEventEmit"
22
22
 
23
23
  export const ClearEvents = (): void => {
24
24
  bootstrap.cache.events.features = [];
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { SetListener } from "../@modules/@utilities/SetListener";
20
+ import { SetListener } from "@utilities/SetListener"
21
21
 
22
22
  export const CreateListener = (event: string, callback: () => void) => {
23
23
  SetListener({event, callback})
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
20
+ import { bootstrap } from "@bootstrap"
21
21
 
22
22
  export const GetEvents = (): any => {
23
23
  return bootstrap.cache.events
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
20
+ import { bootstrap } from "@bootstrap"
21
21
 
22
22
  export const GetNodes = (): any => {
23
23
  return bootstrap.cache.nodes
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
20
+ import { bootstrap } from "@bootstrap"
21
21
 
22
22
  export const GetRandomEvent = (): any => {
23
23
  return bootstrap.cache.events.features[Math.floor(Math.random() * bootstrap.cache.events.features.length)]
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
20
+ import { bootstrap } from "@bootstrap"
21
21
 
22
22
  export const GetVersion = (): any => {
23
23
  return bootstrap.version
@@ -17,10 +17,9 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "../@types/Attributes";
21
- import { EnumExpressions } from "../@enums/Expressions"
22
- import { GetAwipsType } from "../@modules/@stanza/GetAwipsType";
23
- import { CreateEvent } from "../@building/CreateEvent";
20
+ import { EnumExpressions } from "@enums/Expressions"
21
+ import { GetAwipsType } from "@stanza/GetAwipsType"
22
+ import { CreateEvent } from "@building/CreateEvent"
24
23
 
25
24
  interface CreateEventOptions {
26
25
  message: string
@@ -17,8 +17,8 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeStanza } from "../@types/Stanza";
21
- import { bootstrap } from "../bootstrap";
20
+ import { TypeStanza } from "types/Stanza"
21
+ import { bootstrap } from "@bootstrap"
22
22
 
23
23
  interface QueryStanzaOptions {
24
24
  search: string
@@ -17,9 +17,9 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
21
- import { SetWarning } from "../@modules/@utilities/SetWarning"
22
- import { SetEventEmit } from "../@modules/@utilities/SetEventEmit";
20
+ import { bootstrap } from "@bootstrap"
21
+ import { SetWarning } from "@utilities/SetWarning"
22
+ import { SetEventEmit } from "@utilities/SetEventEmit"
23
23
 
24
24
  interface GetNodeOptions {
25
25
  identifier: string
@@ -34,6 +34,7 @@ export const SetNode = (options: GetNodeOptions) => {
34
34
  if (exists) {
35
35
  const index = nodes.indexOf(exists);
36
36
  nodes.splice(index, 1);
37
+ SetWarning({ message: `Node with identifier '${options.identifier}' deleted.` })
37
38
  return SetEventEmit({
38
39
  event: `onNodeDelete`,
39
40
  metadata: {
@@ -46,6 +47,9 @@ export const SetNode = (options: GetNodeOptions) => {
46
47
  }
47
48
  if (exists) {
48
49
  const index = nodes.indexOf(exists);
50
+ if (exists.geometry.coordinates[0] === options.coordinates.longitude && exists.geometry.coordinates[1] === options.coordinates.latitude) {
51
+ return;
52
+ }
49
53
  nodes[index] = {
50
54
  ...exists,
51
55
  geometry: {
@@ -53,6 +57,7 @@ export const SetNode = (options: GetNodeOptions) => {
53
57
  coordinates: [options.coordinates.longitude, options.coordinates.latitude]
54
58
  }
55
59
  };
60
+ SetWarning({ message: `Node with identifier '${options.identifier}' updated.` })
56
61
  return SetEventEmit({
57
62
  event: `onNodeUpdate`,
58
63
  metadata: {
@@ -71,6 +76,7 @@ export const SetNode = (options: GetNodeOptions) => {
71
76
  identifier: options.identifier
72
77
  }
73
78
  });
79
+ SetWarning({ message: `Node with identifier '${options.identifier}' added.` })
74
80
  return SetEventEmit({
75
81
  event: `onNodeAdd`,
76
82
  metadata: {
@@ -17,17 +17,17 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeSettings } from "../@types/Settings";
21
- import { bootstrap } from "../bootstrap";
22
- import { SetWarning } from "../@modules/@utilities/SetWarning"
23
- import { SetSettings } from "../@modules/@utilities/SetSettings"
24
- import { DeployXMPP } from "../@modules/@xmpp/DeployXMPP"
25
- import { InitializeDatabase } from "../@modules/@database/InitializeDatabase";
26
- import { GetCachedEvents } from "../@modules/@database/GetCachedEvents";
27
- import { SetCronSchedule } from "../@modules/@utilities/SetCronSchedule";
28
- import { UpdateNode } from "../@manager/UpdateNode";
29
- import { UpdateEvents } from "../@manager/UpdateEvents";
30
- import { Cron } from "croner";
20
+ import { TypeSettings } from "types/Settings"
21
+ import { bootstrap } from "@bootstrap"
22
+ import { SetWarning } from "@utilities/SetWarning"
23
+ import { SetSettings } from "@utilities/SetSettings"
24
+ import { SetCronSchedule } from "@utilities/SetCronSchedule"
25
+ import { DeployXMPP } from "@xmpp/DeployXMPP"
26
+ import { InitializeDatabase } from "@database/InitializeDatabase"
27
+ import { GetCachedEvents } from "@database/GetCachedEvents"
28
+ import { UpdateNode } from "@manager/UpdateNode"
29
+ import { UpdateEvents } from "@manager/UpdateEvents"
30
+ import { Cron } from "croner"
31
31
 
32
32
  export const StartService = async (configurations: TypeSettings): Promise<void> => {
33
33
  if (!bootstrap.isReady) {
@@ -17,7 +17,7 @@
17
17
 
18
18
  */
19
19
 
20
- import { bootstrap } from "../bootstrap";
20
+ import { bootstrap } from "@bootstrap"
21
21
 
22
22
  export const StopService = async (): Promise<void> => {
23
23
  if (bootstrap.isReady) {
@@ -148,7 +148,7 @@ export const EnumTags = {
148
148
  { match: /Source\.\.\.Doppler Radar/i, tag: "Confirmed By Radar" },
149
149
  { match: /Source\.\.\.Automated Gauges/i, tag: "Confirmed By Automated Gauges" },
150
150
  { match: /Source\.\.\.Radar Confirmed/i, tag: "Confirmed By Radar" },
151
- { match: /Source\.\.\.Radar Indicated/i, tag: "Indicated By Radar" },
151
+ { match: /Source\.\.\.Radar Indicated/i, tag: "Radar Indicated" },
152
152
  { match: /Source\.\.\.Public/i, tag: "Confirmed By Public" },
153
153
  { match: /Source\.\.\.Amateur Radio/i, tag: "Confirmed By Amateur Radio" },
154
154
  { match: /Source\.\.\.Emergency Management/i, tag: "Confirmed By Emergency Management" },
@@ -17,15 +17,15 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled"
21
- import { TypePVTEC } from "../@types/VTEC";
22
- import { EnumICAO } from "../@enums/ICAO";
23
- import { bootstrap } from "../bootstrap";
24
- import { GetEventTracking } from "../@building/GetEventTracking";
25
- import { VTECExtract } from "../@parsers/@pvtec/VTECExtract"
26
- import { GetEventTags } from "../@building/GetEventTags";
27
- import { GetTextFromProduct } from "../@parsers/@text/GetTextFromProduct";
28
- import { SetDebug } from "../@modules/@utilities/SetDebug";
20
+ import { TypeStanzaCompiled } from "types/StanzaCompiled"
21
+ import { TypePVTEC } from "types/VTEC"
22
+ import { EnumICAO } from "@enums/ICAO"
23
+ import { bootstrap } from "@bootstrap"
24
+ import { GetEventTracking } from "@building/GetEventTracking"
25
+ import { VTECExtract } from "@parsers/pvtec/VTECExtract"
26
+ import { GetEventTags } from "@building/GetEventTags"
27
+ import { GetTextFromProduct } from "@parsers/text/GetTextFromProduct"
28
+ import { SetDebug } from "@utilities/SetDebug"
29
29
 
30
30
  export const ParseAPI = async (stanza: TypeStanzaCompiled): Promise<void> => {
31
31
  const messages = Object.values(JSON.parse(stanza.message).features) as any;
@@ -45,7 +45,12 @@ export const ParseAPI = async (stanza: TypeStanzaCompiled): Promise<void> => {
45
45
  issued: feature?.properties?.sent ? new Date(feature?.properties?.sent).toISOString() : null,
46
46
  expires: feature?.properties?.expires ? new Date(feature?.properties?.expires).toISOString() : null,
47
47
  locations: feature?.properties?.areaDesc ?? null,
48
- locations_array: feature?.properties?.areaDesc ? feature?.properties?.areaDesc.split(';') : [],
48
+ locations_array: feature?.properties?.areaDesc ? feature?.properties?.areaDesc.split('; ') : [],
49
+ location_states: [...new Set(
50
+ feature?.properties?.areaDesc?.split(';')
51
+ ?.map((location: string) => location.match(/,\s*([A-Z]{2})\b/)?.[1])
52
+ .filter(Boolean) ?? []
53
+ )],
49
54
  description: feature?.properties?.description ?? null,
50
55
  attributes: feature?.properties?.attributes ?? {},
51
56
  geocode: {
@@ -17,14 +17,14 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "../@types/Attributes";
21
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled"
22
- import { EnumMatches } from "../@enums/Matches";
23
- import { bootstrap } from "../bootstrap";
24
- import { GetEventProperties } from "../@building/GetEventProperties";
25
- import { GetEventHeader } from "../@building/GetEventHeader";
26
- import { GetEventTracking } from "../@building/GetEventTracking";
27
- import { SetDebug } from "../@modules/@utilities/SetDebug";
20
+ import { TypeAttributes } from "types/Attributes"
21
+ import { TypeStanzaCompiled } from "types/StanzaCompiled"
22
+ import { EnumMatches } from "@enums/Matches"
23
+ import { bootstrap } from "@bootstrap"
24
+ import { GetEventProperties } from "@building/GetEventProperties"
25
+ import { GetEventHeader } from "@building/GetEventHeader"
26
+ import { GetEventTracking } from "@building/GetEventTracking"
27
+ import { SetDebug } from "@utilities/SetDebug"
28
28
 
29
29
  export const ParseText = async (stanza: TypeStanzaCompiled): Promise<void> => {
30
30
  const getMessages = stanza?.message
@@ -17,15 +17,15 @@
17
17
 
18
18
  */
19
19
 
20
- import { TypeAttributes } from "../@types/Attributes";
21
- import { TypeStanzaCompiled } from "../@types/StanzaCompiled"
22
- import { EnumMatches } from "../@enums/Matches";
23
- import { bootstrap } from "../bootstrap";
24
- import { ugcExtract } from "../@parsers/@ugc/UGCExtract";
25
- import { GetEventProperties } from "../@building/GetEventProperties";
26
- import { GetEventHeader } from "../@building/GetEventHeader";
27
- import { GetEventTracking } from "../@building/GetEventTracking";
28
- import { SetDebug } from "../@modules/@utilities/SetDebug";
20
+ import { TypeAttributes } from "types/Attributes"
21
+ import { TypeStanzaCompiled } from "types/StanzaCompiled"
22
+ import { EnumMatches } from "@enums/Matches"
23
+ import { bootstrap } from "@bootstrap"
24
+ import { ugcExtract } from "@parsers/ugc/UGCExtract"
25
+ import { GetEventProperties } from "@building/GetEventProperties"
26
+ import { GetEventHeader } from "@building/GetEventHeader"
27
+ import { GetEventTracking } from "@building/GetEventTracking"
28
+ import { SetDebug } from "@utilities/SetDebug"
29
29
 
30
30
  export const ParseUGC = async (stanza: TypeStanzaCompiled): Promise<void> => {
31
31
  const getMessages = stanza?.message