@atmosx/event-product-parser 3.0.48 → 3.0.52

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 (141) hide show
  1. package/.vscode/settings.json +3 -3
  2. package/CODE_OF_CONDUCT.md +9 -9
  3. package/CONTRIBUTING.md +29 -29
  4. package/LICENSE +17 -17
  5. package/README.md +443 -417
  6. package/SECURITY.md +20 -20
  7. package/SUPPORTED_EVENTS.md +369 -368
  8. package/dist/cjs/index.cjs +1925 -1885
  9. package/dist/esm/index.mjs +1927 -1887
  10. package/package.json +52 -52
  11. package/src/@building/building.attachments.ts +82 -82
  12. package/src/@building/building.clean.ts +29 -29
  13. package/src/@building/building.create.ts +55 -41
  14. package/src/@building/building.enhance.ts +59 -59
  15. package/src/@building/building.geometry.ts +47 -47
  16. package/src/@building/building.headers.ts +36 -36
  17. package/src/@building/building.office.ts +42 -42
  18. package/src/@building/building.polygon.ts +69 -70
  19. package/src/@building/building.properties.ts +95 -95
  20. package/src/@building/building.signature.ts +60 -61
  21. package/src/@building/building.tags.ts +23 -23
  22. package/src/@building/building.tracking.ts +67 -67
  23. package/src/@building/building.validate.ts +152 -146
  24. package/src/@core/core.clearEvents.ts +30 -31
  25. package/src/@core/core.createListener.ts +23 -23
  26. package/src/@core/core.getEvents.ts +23 -24
  27. package/src/@core/core.getNodes.ts +23 -24
  28. package/src/@core/core.getRandomEvent.ts +23 -24
  29. package/src/@core/core.getVersion.ts +23 -24
  30. package/src/@core/core.manualEvent.ts +38 -0
  31. package/src/@core/core.query.ts +38 -38
  32. package/src/@core/core.setNode.ts +80 -80
  33. package/src/@core/core.start.ts +60 -60
  34. package/src/@core/core.stop.ts +31 -31
  35. package/src/@dictionaries/dictionaries.actions.ts +27 -27
  36. package/src/@dictionaries/dictionaries.awips.ts +363 -363
  37. package/src/@dictionaries/dictionaries.cancellation.ts +30 -30
  38. package/src/@dictionaries/dictionaries.causes.ts +35 -35
  39. package/src/@dictionaries/dictionaries.correlations.ts +42 -42
  40. package/src/@dictionaries/dictionaries.enhanced.ts +66 -109
  41. package/src/@dictionaries/dictionaries.events.ts +82 -82
  42. package/src/@dictionaries/dictionaries.expressions.ts +28 -28
  43. package/src/@dictionaries/dictionaries.global.ts +24 -0
  44. package/src/@dictionaries/dictionaries.hail.ts +35 -35
  45. package/src/@dictionaries/dictionaries.icao.ts +258 -258
  46. package/src/@dictionaries/dictionaries.matches.ts +54 -35
  47. package/src/@dictionaries/dictionaries.products.ts +24 -24
  48. package/src/@dictionaries/dictionaries.records.ts +25 -25
  49. package/src/@dictionaries/dictionaries.severity.ts +27 -27
  50. package/src/@dictionaries/dictionaries.shapefiles.ts +35 -35
  51. package/src/@dictionaries/dictionaries.states.ts +71 -71
  52. package/src/@dictionaries/dictionaries.status.ts +30 -30
  53. package/src/@dictionaries/dictionaries.tags.ts +92 -92
  54. package/src/@dictionaries/dictionaries.testing.ts +24 -24
  55. package/src/@events/events.api.ts +116 -118
  56. package/src/@events/events.text.ts +84 -81
  57. package/src/@events/events.ugc.ts +89 -85
  58. package/src/@events/events.vtec.ts +86 -87
  59. package/src/@manager/manager.mkEvent.ts +97 -88
  60. package/src/@manager/manager.rmEvent.ts +56 -49
  61. package/src/@manager/manager.setHash.ts +35 -36
  62. package/src/@manager/manager.updateEvents.ts +32 -34
  63. package/src/@manager/manager.updateListener.ts +154 -159
  64. package/src/@manager/manager.updateNodes.ts +53 -54
  65. package/src/@modules/@database/database.broadcastify.ts +66 -66
  66. package/src/@modules/@database/database.cache.ts +49 -47
  67. package/src/@modules/@database/database.init.ts +58 -57
  68. package/src/@modules/@database/database.shapefiles.ts +92 -92
  69. package/src/@modules/@database/database.stanza.ts +46 -47
  70. package/src/@modules/@eas/eas.getCleanDescription.ts +91 -91
  71. package/src/@modules/@eas/eas.getFloatPCM16.ts +29 -29
  72. package/src/@modules/@eas/eas.getMergedPCM16.ts +32 -32
  73. package/src/@modules/@eas/eas.getPCM16.ts +52 -52
  74. package/src/@modules/@eas/eas.getPCMToFloat.ts +26 -26
  75. package/src/@modules/@eas/eas.getSampledPCM16.ts +36 -36
  76. package/src/@modules/@eas/eas.getTTS.ts +54 -54
  77. package/src/@modules/@eas/eas.getWavPCM16.ts +52 -52
  78. package/src/@modules/@eas/eas.setAFSK.ts +51 -52
  79. package/src/@modules/@eas/eas.setAsciiToBits.ts +31 -32
  80. package/src/@modules/@eas/eas.setAttentionTone.ts +40 -40
  81. package/src/@modules/@eas/eas.setEasTone.ts +151 -147
  82. package/src/@modules/@eas/eas.setNoise.ts +32 -31
  83. package/src/@modules/@eas/eas.setRadioEffect.ts +50 -49
  84. package/src/@modules/@eas/eas.setSameHeader.ts +44 -45
  85. package/src/@modules/@stanza/stanza.getAwipsType.ts +45 -45
  86. package/src/@modules/@stanza/stanza.validate.ts +49 -49
  87. package/src/@modules/@utilities/utilities.createHttp.ts +70 -70
  88. package/src/@modules/@utilities/utilities.getFormattedTime.ts +43 -43
  89. package/src/@modules/@utilities/utilities.getLatestIssuance.ts +32 -32
  90. package/src/@modules/@utilities/utilities.getMatched.ts +33 -0
  91. package/src/@modules/@utilities/utilities.getSettings.ts +25 -25
  92. package/src/@modules/@utilities/utilities.getShapeNearestPoint.ts +114 -114
  93. package/src/@modules/@utilities/utilities.setCronSchedule.ts +94 -94
  94. package/src/@modules/@utilities/utilities.setDebug.ts +38 -0
  95. package/src/@modules/@utilities/utilities.setEventEmit.ts +41 -41
  96. package/src/@modules/@utilities/utilities.setListener.ts +30 -30
  97. package/src/@modules/@utilities/utilities.setSettings.ts +42 -42
  98. package/src/@modules/@utilities/utilities.setSleep.ts +33 -33
  99. package/src/@modules/@utilities/utilities.setTimeoutAction.ts +62 -58
  100. package/src/@modules/@utilities/utilities.setWarning.ts +34 -34
  101. package/src/@modules/@xmpp/xmpp.xDeploy.ts +57 -58
  102. package/src/@modules/@xmpp/xmpp.xError.ts +26 -28
  103. package/src/@modules/@xmpp/xmpp.xOffline.ts +36 -37
  104. package/src/@modules/@xmpp/xmpp.xOnline.ts +45 -44
  105. package/src/@modules/@xmpp/xmpp.xReconnect.ts +64 -64
  106. package/src/@modules/@xmpp/xmpp.xStanza.ts +62 -62
  107. package/src/@parsers/@hvtec/hvtec.extract.ts +39 -39
  108. package/src/@parsers/@pvtec/pvtec.expires.ts +25 -25
  109. package/src/@parsers/@pvtec/pvtec.extract.ts +48 -48
  110. package/src/@parsers/@text/text.getDescriptionFromProduct.ts +52 -52
  111. package/src/@parsers/@text/text.getEmbed.ts +55 -57
  112. package/src/@parsers/@text/text.getPolygonFromProduct.ts +53 -32
  113. package/src/@parsers/@text/text.getTextFromProduct.ts +42 -42
  114. package/src/@parsers/@text/text.getXML.ts +60 -60
  115. package/src/@parsers/@ugc/ugc.coordinates.ts +110 -109
  116. package/src/@parsers/@ugc/ugc.expiry.ts +31 -31
  117. package/src/@parsers/@ugc/ugc.extract.ts +36 -36
  118. package/src/@parsers/@ugc/ugc.getCache.ts +24 -0
  119. package/src/@parsers/@ugc/ugc.header.ts +29 -29
  120. package/src/@parsers/@ugc/ugc.locations.ts +57 -29
  121. package/src/@parsers/@ugc/ugc.setCache.ts +28 -0
  122. package/src/@parsers/@ugc/ugc.zones.ts +51 -51
  123. package/src/@types/type.attributes.ts +28 -28
  124. package/src/@types/type.compiled.ts +34 -34
  125. package/src/@types/type.event.ts +69 -69
  126. package/src/@types/type.hash.ts +24 -24
  127. package/src/@types/type.hvtec.ts +25 -25
  128. package/src/@types/type.listener.ts +32 -32
  129. package/src/@types/type.properties.ts +77 -77
  130. package/src/@types/type.pvtec.ts +30 -30
  131. package/src/@types/type.settings.ts +84 -83
  132. package/src/@types/type.stanza.ts +37 -37
  133. package/src/@types/type.ugc.ts +24 -24
  134. package/src/bootstrap.ts +115 -112
  135. package/src/index.ts +74 -74
  136. package/test.js +92 -98
  137. package/tsconfig.json +13 -13
  138. package/tsup.config.ts +15 -15
  139. package/dist/index.d.mts +0 -299
  140. package/dist/index.d.ts +0 -299
  141. package/src/@core/core.createEvent.ts +0 -83
package/dist/index.d.mts DELETED
@@ -1,299 +0,0 @@
1
- type TypeListener = {
2
- events: string[];
3
- webhook?: {
4
- enabled: boolean;
5
- destination: string;
6
- ratelimit: number;
7
- title: string;
8
- message: string;
9
- };
10
- uploads?: {
11
- file?: boolean;
12
- eas?: boolean;
13
- event?: boolean;
14
- };
15
- };
16
-
17
- type TypeSettings = {
18
- Database: string;
19
- EnableWireService: boolean;
20
- EnableJournal: boolean;
21
- NOAAWeatherWireServiceSettings: {
22
- ReconnectionSettings: {
23
- Enabled: boolean;
24
- ReconnectionInterval: number;
25
- };
26
- CredentialSettings: {
27
- Username: string | void;
28
- Password: string | void;
29
- Nickname: string | void;
30
- };
31
- CacheSettings: {
32
- Enabled: boolean;
33
- MaxDatabaseHistory: number;
34
- MaxRetentionHistory: number;
35
- };
36
- StanzaSettings: {
37
- DisableUGC: boolean;
38
- DisableVTEC: boolean;
39
- DisableText: boolean;
40
- };
41
- };
42
- NationalWeatherServiceSettings: {
43
- CallbackInterval: number;
44
- EventsEndpoint: string;
45
- };
46
- BroadcastifySettings: {
47
- BroadcastifyAttachments: boolean;
48
- BroadcastifyDatabase: string;
49
- BroadcastifyTags: string[];
50
- };
51
- GlobalSettings: {
52
- EventManagement: boolean;
53
- BetterEventNames: boolean;
54
- DisableGeometryParsing: boolean;
55
- UseShapefileCoordinates: boolean;
56
- SPCWatchesOnly: boolean;
57
- ShapefileSkipPoints: number;
58
- NodeTTL: number;
59
- NodeMinDistance: number;
60
- ListenerSettings?: TypeListener[];
61
- EventFiltering: {
62
- ListeningEvents: string[];
63
- ListeningICAO: string[];
64
- ListeningUGC: string[];
65
- ListeningStates: string[];
66
- IgnoredICAO: string[];
67
- IgnoredEvents: string[];
68
- NodeLocationFiltering: boolean;
69
- IgnoreTestProducts: boolean;
70
- };
71
- ArchiveSettings: {
72
- TTL: number;
73
- EventDirectory: string;
74
- TextDirectory: string;
75
- EasDirectory: string;
76
- EasToneout: string;
77
- };
78
- };
79
- };
80
-
81
- declare const setSettings: (newSettings: TypeSettings) => TypeSettings;
82
-
83
- type TypeAttributes = {
84
- xmlns: string;
85
- id: string;
86
- issue: string;
87
- ttaaii: string;
88
- cccc: string;
89
- awipsid: string;
90
- };
91
-
92
- type TypeEventProperties = {
93
- locations: string;
94
- locations_array: string[];
95
- description: string;
96
- attributes?: TypeAttributes;
97
- geocode: {
98
- office: {
99
- name: string;
100
- office: string;
101
- };
102
- organization: string;
103
- ugc: string[];
104
- polygon: string;
105
- polygon_generated: boolean;
106
- };
107
- parameters?: {
108
- tags: string[];
109
- instructions: string;
110
- source: string;
111
- hazards: string;
112
- impacts: string;
113
- estimated_hail_size: string;
114
- estimated_wind_gusts: string;
115
- damage_threat: string;
116
- tornado_threat: string;
117
- flood_threat: string;
118
- wind_threat: string;
119
- hail_threat: string;
120
- max_hail_inches?: string;
121
- max_wind_gusts_surface_knots?: string;
122
- max_tops_x100feet?: string;
123
- mean_storm_motion_vector?: string;
124
- particularly_dangerous_situation?: string;
125
- };
126
- watch_parameters?: {
127
- watch_number: string;
128
- watch_type: string;
129
- additional_tornadoes_probability: string;
130
- strong_tornadoes_probability: string;
131
- severe_wind_probability: string;
132
- severe_hail_probability: string;
133
- hail_2in_probability: string;
134
- combined_hail_wind_probability: string;
135
- max_hail_in: string;
136
- max_wind_surface: string;
137
- max_tops_x100feet: string;
138
- pds_watch: boolean;
139
- };
140
- discussion_parameters?: {
141
- discussion_number: string;
142
- discussion_concerning: string;
143
- discussion_max_tornado: string;
144
- discussion_max_hail: string;
145
- discussion_max_wind: string;
146
- discussion_watch_issuance: string;
147
- };
148
- };
149
-
150
- type TypeHVTEC = {
151
- hvtec: string;
152
- severity: string;
153
- cause: string;
154
- record: string;
155
- };
156
-
157
- type TypePVTEC = {
158
- vtec: string;
159
- product: string;
160
- tracking: string;
161
- event: string;
162
- status: string;
163
- organization: string;
164
- expires: string;
165
- is_watch: boolean;
166
- prediction_center: boolean;
167
- };
168
-
169
- type TypeEvent = {
170
- type: string;
171
- geometry: {
172
- type: string;
173
- coordinates: number[][];
174
- };
175
- properties: {
176
- event: string;
177
- parent: string;
178
- status: string;
179
- issued: string;
180
- expires: string;
181
- status_metadata?: {
182
- is_issued?: boolean;
183
- is_updated?: boolean;
184
- is_expired?: boolean;
185
- is_test?: boolean;
186
- is_statement?: boolean;
187
- };
188
- metadata: {
189
- ms: number;
190
- source: string;
191
- tracking: string;
192
- hash?: string;
193
- header: string;
194
- vtec?: TypePVTEC | null;
195
- hvtec?: TypeHVTEC[] | null;
196
- nodes?: {
197
- id?: string | number;
198
- coordinates: [number, number];
199
- nearest: [number, number];
200
- miles: number | null;
201
- kilometers: number | null;
202
- proximity: boolean;
203
- }[];
204
- filtered_proximity?: boolean;
205
- updated?: number;
206
- history: {
207
- description: string;
208
- issued: string;
209
- status: string;
210
- }[];
211
- attachments?: {
212
- name: string;
213
- link: string;
214
- }[];
215
- raw: string;
216
- };
217
- } & TypeEventProperties;
218
- };
219
-
220
- interface GetGeometryResponse {
221
- type: `Polygon` | `MultiPolygon`;
222
- coordinates: any[];
223
- }
224
- declare const getEventGeometry: (event: TypeEvent) => Promise<GetGeometryResponse>;
225
-
226
- declare const getCleanedEvent: <T extends Record<string, any>>(event: T) => T;
227
-
228
- declare const startService: (configurations: TypeSettings) => Promise<void>;
229
-
230
- declare const stopService: () => Promise<void>;
231
-
232
- interface GenerateEASOptions {
233
- message: string;
234
- header: string;
235
- title: string;
236
- }
237
- declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
238
-
239
- interface GetNodeOptions {
240
- identifier: string;
241
- delete?: boolean;
242
- coordinates: {
243
- longitude: number;
244
- latitude: number;
245
- };
246
- }
247
- declare const setNode: (options: GetNodeOptions) => void;
248
-
249
- declare const getEvents: () => any;
250
-
251
- declare const getNodes: () => any;
252
-
253
- interface CreateEventOptions {
254
- event: string;
255
- status: string;
256
- issued: Date;
257
- expires: Date;
258
- locations: string;
259
- description: string;
260
- coordinates: number[][];
261
- }
262
- declare const createEvent: (options: CreateEventOptions) => void;
263
-
264
- declare const getRandomEvent: () => any;
265
-
266
- type TypeStanza = {
267
- getChild(arg0: string): unknown;
268
- is(arg0: string): unknown;
269
- name: string;
270
- parent: TypeStanza | null;
271
- children: any;
272
- attrs: {
273
- xmlns: string;
274
- id: string;
275
- issue: string;
276
- ttaaii: string;
277
- cccc: string;
278
- awipsid: string;
279
- from: string;
280
- to: string;
281
- type: string;
282
- };
283
- };
284
-
285
- interface QueryOptions {
286
- search: string;
287
- max?: number;
288
- }
289
- declare const query: (options: QueryOptions) => Promise<TypeStanza[]>;
290
-
291
- declare const clearEvents: () => void;
292
-
293
- declare class Manager {
294
- constructor(settings: TypeSettings);
295
- on(event: string, callback: () => void): void;
296
- trycatch(): void;
297
- }
298
-
299
- export { Manager, type TypeEvent, clearEvents, createEvent, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, query, setEasTone, setNode, setSettings, startService, stopService };
package/dist/index.d.ts DELETED
@@ -1,299 +0,0 @@
1
- type TypeListener = {
2
- events: string[];
3
- webhook?: {
4
- enabled: boolean;
5
- destination: string;
6
- ratelimit: number;
7
- title: string;
8
- message: string;
9
- };
10
- uploads?: {
11
- file?: boolean;
12
- eas?: boolean;
13
- event?: boolean;
14
- };
15
- };
16
-
17
- type TypeSettings = {
18
- Database: string;
19
- EnableWireService: boolean;
20
- EnableJournal: boolean;
21
- NOAAWeatherWireServiceSettings: {
22
- ReconnectionSettings: {
23
- Enabled: boolean;
24
- ReconnectionInterval: number;
25
- };
26
- CredentialSettings: {
27
- Username: string | void;
28
- Password: string | void;
29
- Nickname: string | void;
30
- };
31
- CacheSettings: {
32
- Enabled: boolean;
33
- MaxDatabaseHistory: number;
34
- MaxRetentionHistory: number;
35
- };
36
- StanzaSettings: {
37
- DisableUGC: boolean;
38
- DisableVTEC: boolean;
39
- DisableText: boolean;
40
- };
41
- };
42
- NationalWeatherServiceSettings: {
43
- CallbackInterval: number;
44
- EventsEndpoint: string;
45
- };
46
- BroadcastifySettings: {
47
- BroadcastifyAttachments: boolean;
48
- BroadcastifyDatabase: string;
49
- BroadcastifyTags: string[];
50
- };
51
- GlobalSettings: {
52
- EventManagement: boolean;
53
- BetterEventNames: boolean;
54
- DisableGeometryParsing: boolean;
55
- UseShapefileCoordinates: boolean;
56
- SPCWatchesOnly: boolean;
57
- ShapefileSkipPoints: number;
58
- NodeTTL: number;
59
- NodeMinDistance: number;
60
- ListenerSettings?: TypeListener[];
61
- EventFiltering: {
62
- ListeningEvents: string[];
63
- ListeningICAO: string[];
64
- ListeningUGC: string[];
65
- ListeningStates: string[];
66
- IgnoredICAO: string[];
67
- IgnoredEvents: string[];
68
- NodeLocationFiltering: boolean;
69
- IgnoreTestProducts: boolean;
70
- };
71
- ArchiveSettings: {
72
- TTL: number;
73
- EventDirectory: string;
74
- TextDirectory: string;
75
- EasDirectory: string;
76
- EasToneout: string;
77
- };
78
- };
79
- };
80
-
81
- declare const setSettings: (newSettings: TypeSettings) => TypeSettings;
82
-
83
- type TypeAttributes = {
84
- xmlns: string;
85
- id: string;
86
- issue: string;
87
- ttaaii: string;
88
- cccc: string;
89
- awipsid: string;
90
- };
91
-
92
- type TypeEventProperties = {
93
- locations: string;
94
- locations_array: string[];
95
- description: string;
96
- attributes?: TypeAttributes;
97
- geocode: {
98
- office: {
99
- name: string;
100
- office: string;
101
- };
102
- organization: string;
103
- ugc: string[];
104
- polygon: string;
105
- polygon_generated: boolean;
106
- };
107
- parameters?: {
108
- tags: string[];
109
- instructions: string;
110
- source: string;
111
- hazards: string;
112
- impacts: string;
113
- estimated_hail_size: string;
114
- estimated_wind_gusts: string;
115
- damage_threat: string;
116
- tornado_threat: string;
117
- flood_threat: string;
118
- wind_threat: string;
119
- hail_threat: string;
120
- max_hail_inches?: string;
121
- max_wind_gusts_surface_knots?: string;
122
- max_tops_x100feet?: string;
123
- mean_storm_motion_vector?: string;
124
- particularly_dangerous_situation?: string;
125
- };
126
- watch_parameters?: {
127
- watch_number: string;
128
- watch_type: string;
129
- additional_tornadoes_probability: string;
130
- strong_tornadoes_probability: string;
131
- severe_wind_probability: string;
132
- severe_hail_probability: string;
133
- hail_2in_probability: string;
134
- combined_hail_wind_probability: string;
135
- max_hail_in: string;
136
- max_wind_surface: string;
137
- max_tops_x100feet: string;
138
- pds_watch: boolean;
139
- };
140
- discussion_parameters?: {
141
- discussion_number: string;
142
- discussion_concerning: string;
143
- discussion_max_tornado: string;
144
- discussion_max_hail: string;
145
- discussion_max_wind: string;
146
- discussion_watch_issuance: string;
147
- };
148
- };
149
-
150
- type TypeHVTEC = {
151
- hvtec: string;
152
- severity: string;
153
- cause: string;
154
- record: string;
155
- };
156
-
157
- type TypePVTEC = {
158
- vtec: string;
159
- product: string;
160
- tracking: string;
161
- event: string;
162
- status: string;
163
- organization: string;
164
- expires: string;
165
- is_watch: boolean;
166
- prediction_center: boolean;
167
- };
168
-
169
- type TypeEvent = {
170
- type: string;
171
- geometry: {
172
- type: string;
173
- coordinates: number[][];
174
- };
175
- properties: {
176
- event: string;
177
- parent: string;
178
- status: string;
179
- issued: string;
180
- expires: string;
181
- status_metadata?: {
182
- is_issued?: boolean;
183
- is_updated?: boolean;
184
- is_expired?: boolean;
185
- is_test?: boolean;
186
- is_statement?: boolean;
187
- };
188
- metadata: {
189
- ms: number;
190
- source: string;
191
- tracking: string;
192
- hash?: string;
193
- header: string;
194
- vtec?: TypePVTEC | null;
195
- hvtec?: TypeHVTEC[] | null;
196
- nodes?: {
197
- id?: string | number;
198
- coordinates: [number, number];
199
- nearest: [number, number];
200
- miles: number | null;
201
- kilometers: number | null;
202
- proximity: boolean;
203
- }[];
204
- filtered_proximity?: boolean;
205
- updated?: number;
206
- history: {
207
- description: string;
208
- issued: string;
209
- status: string;
210
- }[];
211
- attachments?: {
212
- name: string;
213
- link: string;
214
- }[];
215
- raw: string;
216
- };
217
- } & TypeEventProperties;
218
- };
219
-
220
- interface GetGeometryResponse {
221
- type: `Polygon` | `MultiPolygon`;
222
- coordinates: any[];
223
- }
224
- declare const getEventGeometry: (event: TypeEvent) => Promise<GetGeometryResponse>;
225
-
226
- declare const getCleanedEvent: <T extends Record<string, any>>(event: T) => T;
227
-
228
- declare const startService: (configurations: TypeSettings) => Promise<void>;
229
-
230
- declare const stopService: () => Promise<void>;
231
-
232
- interface GenerateEASOptions {
233
- message: string;
234
- header: string;
235
- title: string;
236
- }
237
- declare const setEasTone: (options: GenerateEASOptions) => Promise<string>;
238
-
239
- interface GetNodeOptions {
240
- identifier: string;
241
- delete?: boolean;
242
- coordinates: {
243
- longitude: number;
244
- latitude: number;
245
- };
246
- }
247
- declare const setNode: (options: GetNodeOptions) => void;
248
-
249
- declare const getEvents: () => any;
250
-
251
- declare const getNodes: () => any;
252
-
253
- interface CreateEventOptions {
254
- event: string;
255
- status: string;
256
- issued: Date;
257
- expires: Date;
258
- locations: string;
259
- description: string;
260
- coordinates: number[][];
261
- }
262
- declare const createEvent: (options: CreateEventOptions) => void;
263
-
264
- declare const getRandomEvent: () => any;
265
-
266
- type TypeStanza = {
267
- getChild(arg0: string): unknown;
268
- is(arg0: string): unknown;
269
- name: string;
270
- parent: TypeStanza | null;
271
- children: any;
272
- attrs: {
273
- xmlns: string;
274
- id: string;
275
- issue: string;
276
- ttaaii: string;
277
- cccc: string;
278
- awipsid: string;
279
- from: string;
280
- to: string;
281
- type: string;
282
- };
283
- };
284
-
285
- interface QueryOptions {
286
- search: string;
287
- max?: number;
288
- }
289
- declare const query: (options: QueryOptions) => Promise<TypeStanza[]>;
290
-
291
- declare const clearEvents: () => void;
292
-
293
- declare class Manager {
294
- constructor(settings: TypeSettings);
295
- on(event: string, callback: () => void): void;
296
- trycatch(): void;
297
- }
298
-
299
- export { Manager, type TypeEvent, clearEvents, createEvent, Manager as default, getCleanedEvent, getEventGeometry, getEvents, getNodes, getRandomEvent, query, setEasTone, setNode, setSettings, startService, stopService };
@@ -1,83 +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
- import { validateEvents } from "../@building/building.validate";
21
- import { dict_correlations } from "../@dictionaries/dictionaries.correlations";
22
-
23
- interface CreateEventOptions {
24
- event: string
25
- status: string
26
- issued: Date
27
- expires: Date
28
- locations: string
29
- description: string
30
- coordinates: number[][]
31
- }
32
-
33
- export const createEvent = (options: CreateEventOptions): void => {
34
- const tick = performance.now()
35
- validateEvents([{
36
- type: `Feature`,
37
- geometry: {
38
- type: `Point`,
39
- coordinates: options.coordinates
40
- },
41
- properties: {
42
- event: options.event,
43
- parent: options.event,
44
- status: options.status,
45
- issued: options.issued.toISOString(),
46
- expires: options.expires.toISOString(),
47
- locations: options.locations,
48
- locations_array: options.locations ? options.locations.split(';') : [],
49
- description: options.description,
50
- geocode: {
51
- office: {
52
- office: `ATMX`,
53
- name: `AtmosphericX Manual Event`,
54
- },
55
- organization: `AtmosphericX`,
56
- ugc: [],
57
- polygon: options.coordinates.length > 0 ? Buffer.from(JSON.stringify([options.coordinates[0]])).toString('base64') : null,
58
- polygon_generated: options.coordinates.length > 0 ? true : false,
59
- },
60
- status_metadata: {
61
- is_issued: options.status == `Issued`,
62
- is_updated: options.status == `Updated`,
63
- is_expired: options.status == `Expired`,
64
- is_test: options.status == `Test`,
65
- is_statement: options.status == `Statement`
66
- },
67
- metadata: {
68
- ms: performance.now() - tick,
69
- source: `events.manual`,
70
- tracking: `ATMX-M-W-01`,
71
- header: `ZCZC-ATMOSX-ATMX-M-W-01`,
72
- raw: options.description,
73
- history: [
74
- {
75
- description: options.description,
76
- issued: options.issued.toISOString(),
77
- status: options.status ?? null,
78
- }
79
- ]
80
- }
81
- }
82
- }])
83
- }