@aguacerowx/javascript-sdk 0.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.
package/dist/events.js ADDED
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EventEmitter = void 0;
7
+ // aguacero-api/src/events.js
8
+
9
+ /**
10
+ * A simple class for emitting and listening to events.
11
+ */
12
+ class EventEmitter {
13
+ constructor() {
14
+ this.callbacks = {};
15
+ }
16
+ on(event, cb) {
17
+ if (!this.callbacks[event]) this.callbacks[event] = [];
18
+ this.callbacks[event].push(cb);
19
+ }
20
+ emit(event, data) {
21
+ let cbs = this.callbacks[event];
22
+ if (cbs) {
23
+ cbs.forEach(cb => cb(data));
24
+ }
25
+ }
26
+ }
27
+ exports.EventEmitter = EventEmitter;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _fzstd = require("fzstd");
4
+ // aguaceroAPI/src/fill-layer-worker.js
5
+
6
+ // Listen for messages from the main thread
7
+ self.onmessage = async e => {
8
+ const {
9
+ compressedData,
10
+ encoding
11
+ } = e.data;
12
+ try {
13
+ // Perform the heavy decompression work
14
+ const decompressedData = (0, _fzstd.decompress)(compressedData);
15
+
16
+ // Send the successful result back to the main thread
17
+ self.postMessage({
18
+ success: true,
19
+ decompressedData,
20
+ encoding
21
+ }, [decompressedData.buffer]); // Transfer the buffer for performance
22
+ } catch (error) {
23
+ // If something goes wrong, send an error message back
24
+ self.postMessage({
25
+ success: false,
26
+ error: error.message
27
+ });
28
+ }
29
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBundleId = void 0;
7
+ // This module acts as a platform-agnostic proxy.
8
+
9
+ let getBundleIdImpl;
10
+ try {
11
+ // This line will ONLY succeed in a React Native environment where the
12
+ // 'react-native-device-info' module is installed.
13
+ const DeviceInfo = require('react-native-device-info');
14
+
15
+ // If the above line doesn't throw an error, we set the implementation
16
+ // to the native version.
17
+ getBundleIdImpl = () => DeviceInfo.getBundleId();
18
+ } catch (e) {
19
+ // If require() fails, we know we are in a non-React Native environment
20
+ // (like the web). We set the implementation to a "dummy" function
21
+ // that does nothing and returns null.
22
+ getBundleIdImpl = () => null;
23
+ }
24
+
25
+ // Export the chosen implementation.
26
+ const getBundleId = exports.getBundleId = getBundleIdImpl;
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defaultLightMapStyles = exports.defaultDarkMapStyles = exports.THEME_CONFIGS = void 0;
7
+ const defaultLightMapStyles = exports.defaultLightMapStyles = {
8
+ landOcean: {
9
+ landColor: '#f0f0f0',
10
+ oceanColor: '#a8d8ea',
11
+ waterDepth: {
12
+ visible: true,
13
+ color: '#97c7d9'
14
+ },
15
+ nationalPark: {
16
+ visible: true,
17
+ color: '#d4e6d4'
18
+ }
19
+ },
20
+ transportation: {
21
+ roads: {
22
+ visible: true,
23
+ color: '#d3d3d3',
24
+ width: 0.7
25
+ },
26
+ airports: {
27
+ visible: true,
28
+ color: '#d3d3d3',
29
+ width: 0.7
30
+ }
31
+ },
32
+ boundaries: {
33
+ countries: {
34
+ visible: true,
35
+ color: '#000000',
36
+ width: 1.5,
37
+ lineType: 'solid'
38
+ },
39
+ states: {
40
+ visible: true,
41
+ color: '#000000',
42
+ width: 1.5,
43
+ lineType: 'solid'
44
+ },
45
+ counties: {
46
+ visible: true,
47
+ color: '#515151',
48
+ width: 1.2,
49
+ lineType: 'solid'
50
+ }
51
+ },
52
+ waterFeatures: {
53
+ waterways: {
54
+ visible: true,
55
+ color: '#a8d8ea',
56
+ width: 0.7
57
+ }
58
+ },
59
+ labels: {
60
+ countries: {
61
+ visible: false,
62
+ fontFamily: 'Open Sans Regular',
63
+ fontSize: 14,
64
+ color: '#000000',
65
+ outlineColor: '#ffffff',
66
+ outlineWidth: 1
67
+ },
68
+ states: {
69
+ visible: false,
70
+ fontFamily: 'Open Sans Regular',
71
+ fontSize: 12,
72
+ color: '#000000',
73
+ outlineColor: '#ffffff',
74
+ outlineWidth: 1
75
+ },
76
+ cities: {
77
+ major: {
78
+ visible: true,
79
+ fontFamily: 'Open Sans Regular',
80
+ fontSize: 12,
81
+ color: '#000000',
82
+ outlineColor: '#ffffff',
83
+ outlineWidth: 1
84
+ },
85
+ minor: {
86
+ visible: true,
87
+ fontFamily: 'Open Sans Regular',
88
+ fontSize: 10,
89
+ color: '#000000',
90
+ outlineColor: '#ffffff',
91
+ outlineWidth: 1
92
+ }
93
+ },
94
+ airports: {
95
+ visible: true,
96
+ fontFamily: 'Open Sans Regular',
97
+ fontSize: 11,
98
+ color: '#000000',
99
+ outlineColor: '#ffffff',
100
+ outlineWidth: 1
101
+ },
102
+ poi: {
103
+ visible: true,
104
+ fontFamily: 'Open Sans Regular',
105
+ fontSize: 10,
106
+ color: '#000000',
107
+ outlineColor: '#ffffff',
108
+ outlineWidth: 1
109
+ },
110
+ continents: {
111
+ visible: true,
112
+ fontFamily: 'Open Sans Regular',
113
+ fontSize: 16,
114
+ color: '#000000',
115
+ outlineColor: '#ffffff',
116
+ outlineWidth: 1.5
117
+ },
118
+ waterLabels: {
119
+ visible: true,
120
+ fontFamily: 'Open Sans Italic',
121
+ fontSize: 10,
122
+ color: '#0077be',
123
+ outlineColor: '#ffffff',
124
+ outlineWidth: 1
125
+ },
126
+ naturalLabels: {
127
+ visible: true,
128
+ fontFamily: 'Open Sans Italic',
129
+ fontSize: 10,
130
+ color: '#2E8B57',
131
+ outlineColor: '#ffffff',
132
+ outlineWidth: 1
133
+ },
134
+ subdivisionLabels: {
135
+ visible: true,
136
+ fontFamily: 'Open Sans Regular',
137
+ fontSize: 11,
138
+ color: '#000000',
139
+ outlineColor: '#ffffff',
140
+ outlineWidth: 1
141
+ }
142
+ },
143
+ terrain: {
144
+ visible: true,
145
+ intensity: 0.15,
146
+ shadowColor: '#b0b0b0',
147
+ highlightColor: '#ffffff',
148
+ accentColor: '#b0b0b0'
149
+ },
150
+ oceanOnTop: false
151
+ };
152
+ const defaultDarkMapStyles = exports.defaultDarkMapStyles = {
153
+ landOcean: {
154
+ landColor: '#242424',
155
+ oceanColor: '#252525',
156
+ waterDepth: {
157
+ visible: true,
158
+ color: '#000000'
159
+ },
160
+ nationalPark: {
161
+ visible: true,
162
+ color: '#202020'
163
+ }
164
+ },
165
+ transportation: {
166
+ roads: {
167
+ visible: true,
168
+ color: '#4f4f4f',
169
+ width: 0.5
170
+ },
171
+ airports: {
172
+ visible: true,
173
+ color: '#4f4f4f',
174
+ width: 0.6
175
+ }
176
+ },
177
+ boundaries: {
178
+ countries: {
179
+ visible: true,
180
+ color: '#ffffff',
181
+ width: 1.5,
182
+ lineType: 'solid'
183
+ },
184
+ states: {
185
+ visible: true,
186
+ color: '#ffffff',
187
+ width: 1.5,
188
+ lineType: 'solid'
189
+ },
190
+ counties: {
191
+ visible: true,
192
+ color: '#a2a2a2',
193
+ width: 1.2,
194
+ lineType: 'solid'
195
+ }
196
+ },
197
+ waterFeatures: {
198
+ waterways: {
199
+ visible: true,
200
+ color: '#333333',
201
+ width: 0.5
202
+ }
203
+ },
204
+ labels: {
205
+ countries: {
206
+ visible: false,
207
+ fontFamily: 'Open Sans Regular',
208
+ fontSize: 14,
209
+ color: '#ffffff',
210
+ outlineColor: '#000000',
211
+ outlineWidth: 1
212
+ },
213
+ states: {
214
+ visible: false,
215
+ fontFamily: 'Open Sans Regular',
216
+ fontSize: 12,
217
+ color: '#ffffff',
218
+ outlineColor: '#000000',
219
+ outlineWidth: 1
220
+ },
221
+ cities: {
222
+ major: {
223
+ visible: true,
224
+ fontFamily: 'Open Sans Regular',
225
+ fontSize: 12,
226
+ color: '#ffffff',
227
+ outlineColor: '#000000',
228
+ outlineWidth: 1
229
+ },
230
+ minor: {
231
+ visible: true,
232
+ fontFamily: 'Open Sans Regular',
233
+ fontSize: 10,
234
+ color: '#ffffff',
235
+ outlineColor: '#000000',
236
+ outlineWidth: 1
237
+ }
238
+ },
239
+ airports: {
240
+ visible: true,
241
+ fontFamily: 'Open Sans Regular',
242
+ fontSize: 11,
243
+ color: '#ffffff',
244
+ outlineColor: '#000000',
245
+ outlineWidth: 1
246
+ },
247
+ poi: {
248
+ visible: true,
249
+ fontFamily: 'Open Sans Regular',
250
+ fontSize: 10,
251
+ color: '#ffffff',
252
+ outlineColor: '#000000',
253
+ outlineWidth: 1
254
+ },
255
+ continents: {
256
+ visible: true,
257
+ fontFamily: 'Open Sans Regular',
258
+ fontSize: 16,
259
+ color: '#ffffff',
260
+ outlineColor: '#000000',
261
+ outlineWidth: 1.5
262
+ },
263
+ waterLabels: {
264
+ visible: true,
265
+ fontFamily: 'Open Sans Italic',
266
+ fontSize: 10,
267
+ color: '#a8d8ea',
268
+ outlineColor: '#000000',
269
+ outlineWidth: 1
270
+ },
271
+ naturalLabels: {
272
+ visible: true,
273
+ fontFamily: 'Open Sans Italic',
274
+ fontSize: 10,
275
+ color: '#90ee90',
276
+ outlineColor: '#000000',
277
+ outlineWidth: 1
278
+ },
279
+ subdivisionLabels: {
280
+ visible: true,
281
+ fontFamily: 'Open Sans Regular',
282
+ fontSize: 11,
283
+ color: '#ffffff',
284
+ outlineColor: '#000000',
285
+ outlineWidth: 1
286
+ }
287
+ },
288
+ terrain: {
289
+ visible: true,
290
+ intensity: 0.2,
291
+ shadowColor: '#000000',
292
+ highlightColor: '#FFFFFF',
293
+ accentColor: '#000000'
294
+ },
295
+ oceanOnTop: false
296
+ };
297
+ const THEME_CONFIGS = exports.THEME_CONFIGS = {
298
+ light: defaultLightMapStyles,
299
+ dark: defaultDarkMapStyles
300
+ };
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getUnitConversionFunction = getUnitConversionFunction;
7
+ exports.unitConversions = void 0;
8
+ /**
9
+ * A utility module for converting between different physical units.
10
+ * Contains a comprehensive object of conversion functions and a helper
11
+ * to retrieve the correct function based on unit names.
12
+ */
13
+
14
+ // The main object containing all the raw conversion functions.
15
+ const unitConversions = exports.unitConversions = {
16
+ kelvin_to_celsius: data => data - 273.15,
17
+ kelvin_to_fahrenheit: data => (data - 273.15) * 9 / 5 + 32,
18
+ kelvin_to_c: data => data - 273.15,
19
+ kelvin_to_f: data => (data - 273.15) * 9 / 5 + 32,
20
+ k_to_celsius: data => data - 273.15,
21
+ k_to_fahrenheit: data => (data - 273.15) * 9 / 5 + 32,
22
+ k_to_c: data => data - 273.15,
23
+ k_to_f: data => (data - 273.15) * 9 / 5 + 32,
24
+ celsius_to_fahrenheit: data => data * 9 / 5 + 32,
25
+ celsius_to_f: data => data * 9 / 5 + 32,
26
+ c_to_fahrenheit: data => data * 9 / 5 + 32,
27
+ c_to_f: data => data * 9 / 5 + 32,
28
+ fahrenheit_to_celsius: data => (data - 32) * 5 / 9,
29
+ fahrenheit_to_c: data => (data - 32) * 5 / 9,
30
+ f_to_celsius: data => (data - 32) * 5 / 9,
31
+ f_to_c: data => (data - 32) * 5 / 9,
32
+ meters_to_feet: data => data * 3.28084,
33
+ meters_to_km: data => data / 1000,
34
+ m_to_feet: data => data * 3.28084,
35
+ m_to_ft: data => data * 3.28084,
36
+ m_to_km: data => data / 1000,
37
+ kts_to_mph: data => data * 1.15078,
38
+ mph_to_kts: data => data / 1.15078,
39
+ kts_to_ms: data => data / 1.94384449,
40
+ mph_to_ms: data => data / 2.23693629,
41
+ ms_to_mph: data => data * 2.23694,
42
+ ms_to_kts: data => data * 1.94384,
43
+ kts_to_kmh: data => data * 1.852,
44
+ mph_to_kmh: data => data * 1.60934,
45
+ ms_to_kmh: data => data * 3.6,
46
+ kmh_to_kts: data => data / 1.852,
47
+ kmh_to_mph: data => data / 1.60934,
48
+ kmh_to_ms: data => data / 3.6,
49
+ inches_to_mm: data => data * 25.4,
50
+ inches_to_cm: data => data * 2.54,
51
+ in_to_mm: data => data * 25.4,
52
+ in_to_cm: data => data * 2.54,
53
+ mm_to_in: data => data / 25.4,
54
+ mm_to_inches: data => data / 25.4,
55
+ cm_to_in: data => data / 2.54,
56
+ cm_to_inches: data => data / 2.54,
57
+ inhr_to_mmhr: data => data * 25.4,
58
+ inhr_to_cmhr: data => data * 2.54,
59
+ in_hr_to_mm_hr: data => data * 25.4,
60
+ in_hr_to_cm_hr: data => data * 2.54,
61
+ mmhr_to_inhr: data => data / 25.4,
62
+ cmhr_to_inhr: data => data / 2.54,
63
+ mm_hr_to_in_hr: data => data / 25.4,
64
+ cm_hr_to_in_hr: data => data / 2.54,
65
+ mmhr_to_cmhr: data => data / 10,
66
+ cmhr_to_mmhr: data => data * 10,
67
+ mm_hr_to_cm_hr: data => data / 10,
68
+ cm_hr_to_mm_hr: data => data * 10
69
+ };
70
+
71
+ /**
72
+ * Finds and returns the correct conversion function based on "from" and "to" unit strings.
73
+ * It normalizes common unit abbreviations to a consistent key.
74
+ * @param {string} fromUnit - The starting unit (e.g., 'kelvin', '°C', 'kts').
75
+ * @param {string} toUnit - The target unit (e.g., 'fahrenheit', '°F', 'mph').
76
+ * @returns {function(number): number | null} The conversion function, or null if not found.
77
+ */
78
+ function getUnitConversionFunction(fromUnit, toUnit) {
79
+ // A map to standardize various unit string formats to a single key format.
80
+ const unitMap = {
81
+ '°c': 'c',
82
+ '°f': 'f',
83
+ '°k': 'k',
84
+ 'celsius': 'c',
85
+ 'fahrenheit': 'f',
86
+ 'kelvin': 'k',
87
+ 'c': 'c',
88
+ 'f': 'f',
89
+ 'k': 'k',
90
+ '°F': 'f',
91
+ '°C': 'c',
92
+ 'kts': 'kts',
93
+ 'm/s': 'ms',
94
+ 'mph': 'mph',
95
+ 'km/h': 'kmh',
96
+ 'knots': 'kts',
97
+ 'ft': 'ft',
98
+ 'feet': 'ft',
99
+ 'km': 'km',
100
+ 'mm': 'mm',
101
+ 'cm': 'cm',
102
+ 'm': 'm',
103
+ 'meters': 'm',
104
+ 'in/hr': 'inhr',
105
+ 'mm/hr': 'mmhr',
106
+ 'cm/hr': 'cmhr',
107
+ 'in': 'in',
108
+ 'inches': 'in'
109
+ };
110
+
111
+ // Cleans and standardizes the input unit string.
112
+ const normalizeUnit = unit => {
113
+ if (!unit) return '';
114
+ const lowerUnit = unit.toLowerCase().trim();
115
+ return unitMap[lowerUnit] || lowerUnit;
116
+ };
117
+ const fromNormalized = normalizeUnit(fromUnit);
118
+ const toNormalized = normalizeUnit(toUnit);
119
+
120
+ // Constructs the key to look up in the `unitConversions` object (e.g., 'k_to_f').
121
+ const conversionKey = `${fromNormalized}_to_${toNormalized}`;
122
+
123
+ // Return the function if it exists, otherwise return null.
124
+ return unitConversions[conversionKey] || null;
125
+ }
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@aguacerowx/javascript-sdk",
3
+ "version": "0.0.0",
4
+ "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "description": "Core SDK for fetching and processing Aguacero weather data.",
9
+ "main": "dist/index.js",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "babel src -d dist"
15
+ },
16
+ "author": "Your Name",
17
+ "license": "MIT",
18
+ "dependencies": {
19
+ "fzstd": "^0.1.1",
20
+ "proj4": "^2.11.0"
21
+ },
22
+ "peerDependencies": {
23
+ "react": "*",
24
+ "react-native": "*",
25
+ "react-native-device-info": ">=10.0.0"
26
+ },
27
+ "peerDependenciesMeta": {
28
+ "react": {
29
+ "optional": true
30
+ },
31
+ "react-native": {
32
+ "optional": true
33
+ },
34
+ "react-native-device-info": {
35
+ "optional": true
36
+ }
37
+ },
38
+ "gitHead": "663adc461119282cdf39fc0e264929d5648345cb"
39
+ }