@aguacerowx/react-native 0.0.50 → 0.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.
- package/android/src/main/java/com/aguacerowx/reactnative/SatelliteLayerView.java +11 -3
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +315 -275
- package/ios/SatelliteLayerView.swift +11 -4
- package/ios/WeatherFrameProcessorModule.swift +222 -188
- package/lib/commonjs/WeatherLayerManager.js +112 -48
- package/lib/commonjs/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/aguaceroCoreDebugHooks.js +144 -0
- package/lib/commonjs/aguaceroCoreDebugHooks.js.map +1 -0
- package/lib/commonjs/aguaceroRnDebug.js +358 -0
- package/lib/commonjs/aguaceroRnDebug.js.map +1 -0
- package/lib/commonjs/gridCdnAuth.js +64 -0
- package/lib/commonjs/gridCdnAuth.js.map +1 -0
- package/lib/commonjs/index.js +50 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nexrad/nexradAndroidController.js +38 -25
- package/lib/commonjs/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/commonjs/nexrad/nexradDiag.js +31 -25
- package/lib/commonjs/nexrad/nexradDiag.js.map +1 -1
- package/lib/commonjs/satellite/satelliteAndroidController.js +24 -15
- package/lib/commonjs/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/module/WeatherLayerManager.js +112 -48
- package/lib/module/WeatherLayerManager.js.map +1 -1
- package/lib/module/aguaceroCoreDebugHooks.js +136 -0
- package/lib/module/aguaceroCoreDebugHooks.js.map +1 -0
- package/lib/module/aguaceroRnDebug.js +341 -0
- package/lib/module/aguaceroRnDebug.js.map +1 -0
- package/lib/module/gridCdnAuth.js +56 -0
- package/lib/module/gridCdnAuth.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/nexrad/nexradAndroidController.js +38 -25
- package/lib/module/nexrad/nexradAndroidController.js.map +1 -1
- package/lib/module/nexrad/nexradDiag.js +31 -25
- package/lib/module/nexrad/nexradDiag.js.map +1 -1
- package/lib/module/satellite/satelliteAndroidController.js +24 -15
- package/lib/module/satellite/satelliteAndroidController.js.map +1 -1
- package/lib/typescript/WeatherLayerManager.d.ts.map +1 -1
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts +10 -0
- package/lib/typescript/aguaceroCoreDebugHooks.d.ts.map +1 -0
- package/lib/typescript/aguaceroRnDebug.d.ts +97 -0
- package/lib/typescript/aguaceroRnDebug.d.ts.map +1 -0
- package/lib/typescript/gridCdnAuth.d.ts +24 -0
- package/lib/typescript/gridCdnAuth.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/nexrad/nexradAndroidController.d.ts.map +1 -1
- package/lib/typescript/nexrad/nexradDiag.d.ts.map +1 -1
- package/lib/typescript/satellite/satelliteAndroidController.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/WeatherLayerManager.js +2024 -1947
- package/src/aguaceroCoreDebugHooks.js +142 -0
- package/src/aguaceroRnDebug.js +335 -0
- package/src/gridCdnAuth.js +56 -0
- package/src/index.js +19 -7
- package/src/nexrad/nexradAndroidController.js +1078 -1068
- package/src/nexrad/nexradDiag.js +150 -144
- package/src/satellite/satelliteAndroidController.js +245 -236
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.aguaceroDebug = aguaceroDebug;
|
|
7
|
+
exports.aguaceroDebugWarn = aguaceroDebugWarn;
|
|
8
|
+
exports.augmentProcessFrameOptionsForDebug = augmentProcessFrameOptionsForDebug;
|
|
9
|
+
exports.configureAguaceroRnDebug = configureAguaceroRnDebug;
|
|
10
|
+
exports.describeSecret = describeSecret;
|
|
11
|
+
exports.fingerprintSecret = fingerprintSecret;
|
|
12
|
+
exports.getAguaceroAuthDiagnosticSnapshot = getAguaceroAuthDiagnosticSnapshot;
|
|
13
|
+
exports.installGlobalFetchLogger = installGlobalFetchLogger;
|
|
14
|
+
exports.isAguaceroRnDebugEnabled = isAguaceroRnDebugEnabled;
|
|
15
|
+
exports.redactApiKeyFromUrl = redactApiKeyFromUrl;
|
|
16
|
+
exports.setAguaceroRnDebugEnabled = setAguaceroRnDebugEnabled;
|
|
17
|
+
exports.shouldLogAguaceroUrl = shouldLogAguaceroUrl;
|
|
18
|
+
var _reactNative = require("react-native");
|
|
19
|
+
var _gridCdnAuth = require("./gridCdnAuth");
|
|
20
|
+
/**
|
|
21
|
+
* React Native SDK auth / HTTP diagnostics.
|
|
22
|
+
*
|
|
23
|
+
* Enable in your app (pick one):
|
|
24
|
+
*
|
|
25
|
+
* 1. **Recommended** — pass `debug={true}` on {@link WeatherLayerManager}:
|
|
26
|
+
* ```jsx
|
|
27
|
+
* <WeatherLayerManager apiKey={key} debug gridRequestSiteOrigin="https://your-allowed-origin.com" />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* 2. **Global** — before rendering weather (works in release builds):
|
|
31
|
+
* ```js
|
|
32
|
+
* import { configureAguaceroRnDebug } from '@aguacerowx/react-native';
|
|
33
|
+
* configureAguaceroRnDebug({ enabled: true });
|
|
34
|
+
* ```
|
|
35
|
+
* or: `globalThis.__AGUACERO_DEBUG__ = true` in your entry file.
|
|
36
|
+
*
|
|
37
|
+
* Logs use the prefix `[AguaceroRN][debug]` (Metro, Xcode, Logcat).
|
|
38
|
+
* API keys are never printed in full — only length, fingerprint, and whitespace hints.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
const LOG_PREFIX = '[AguaceroRN][debug]';
|
|
42
|
+
|
|
43
|
+
/** @type {boolean | null} */
|
|
44
|
+
let _explicitEnabled = null;
|
|
45
|
+
let _fetchLoggerInstalled = false;
|
|
46
|
+
let _fetchSeq = 0;
|
|
47
|
+
const AGUACERO_URL_MARKERS = ['cloudfront.net', 'lambda-url.us-east-2.on.aws', 'amazonaws.com', 'noaa.gov'];
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {boolean} enabled
|
|
51
|
+
*/
|
|
52
|
+
function setAguaceroRnDebugEnabled(enabled) {
|
|
53
|
+
configureAguaceroRnDebug({
|
|
54
|
+
enabled: Boolean(enabled)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @param {{ enabled?: boolean }} opts
|
|
60
|
+
*/
|
|
61
|
+
function configureAguaceroRnDebug(opts = {}) {
|
|
62
|
+
if (opts && typeof opts.enabled === 'boolean') {
|
|
63
|
+
_explicitEnabled = opts.enabled;
|
|
64
|
+
}
|
|
65
|
+
const on = isAguaceroRnDebugEnabled();
|
|
66
|
+
try {
|
|
67
|
+
if (typeof globalThis !== 'undefined') {
|
|
68
|
+
globalThis.__AGUACERO_DEBUG__ = on;
|
|
69
|
+
globalThis.__AGUACERO_WX_GRID_DEBUG__ = on;
|
|
70
|
+
globalThis.__AGUACERO_NEXRAD_DEBUG__ = on;
|
|
71
|
+
}
|
|
72
|
+
} catch {
|
|
73
|
+
/* ignore */
|
|
74
|
+
}
|
|
75
|
+
if (on) {
|
|
76
|
+
installGlobalFetchLogger();
|
|
77
|
+
aguaceroDebug('debug.enabled', {
|
|
78
|
+
platform: _reactNative.Platform.OS,
|
|
79
|
+
explicitFlag: _explicitEnabled,
|
|
80
|
+
globalFlag: safeGlobalDebugFlag()
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* True when `debug={true}`, {@link configureAguaceroRnDebug}, or `globalThis.__AGUACERO_DEBUG__ === true`.
|
|
87
|
+
* @returns {boolean}
|
|
88
|
+
*/
|
|
89
|
+
function isAguaceroRnDebugEnabled() {
|
|
90
|
+
if (_explicitEnabled === true) return true;
|
|
91
|
+
if (_explicitEnabled === false) {
|
|
92
|
+
try {
|
|
93
|
+
return typeof globalThis !== 'undefined' && globalThis.__AGUACERO_DEBUG__ === true;
|
|
94
|
+
} catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) return false;
|
|
100
|
+
} catch {
|
|
101
|
+
/* ignore */
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
return typeof globalThis !== 'undefined' && globalThis.__AGUACERO_DEBUG__ === true;
|
|
105
|
+
} catch {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function safeGlobalDebugFlag() {
|
|
110
|
+
try {
|
|
111
|
+
return typeof globalThis !== 'undefined' ? globalThis.__AGUACERO_DEBUG__ === true : false;
|
|
112
|
+
} catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @param {string | null | undefined} secret
|
|
119
|
+
* @returns {Record<string, unknown>}
|
|
120
|
+
*/
|
|
121
|
+
function describeSecret(secret) {
|
|
122
|
+
if (secret == null || secret === '') {
|
|
123
|
+
return {
|
|
124
|
+
present: false,
|
|
125
|
+
length: 0
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const s = String(secret);
|
|
129
|
+
const trimmed = s.trim();
|
|
130
|
+
return {
|
|
131
|
+
present: true,
|
|
132
|
+
length: s.length,
|
|
133
|
+
trimmedLength: trimmed.length,
|
|
134
|
+
hasLeadingWhitespace: s.length > 0 && s !== trimmed && /^\s/.test(s),
|
|
135
|
+
hasTrailingWhitespace: s.length > 0 && s !== trimmed && /\s$/.test(s),
|
|
136
|
+
hasInternalWhitespace: /\s/.test(trimmed) && trimmed.indexOf(' ') >= 0,
|
|
137
|
+
fingerprint: fingerprintSecret(trimmed || s),
|
|
138
|
+
looksLikePlaceholder: /^(your[-_]?)?api[-_]?key|xxx+|test+$/i.test(trimmed)
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {string} s
|
|
144
|
+
* @returns {string}
|
|
145
|
+
*/
|
|
146
|
+
function fingerprintSecret(s) {
|
|
147
|
+
if (!s) return '(empty)';
|
|
148
|
+
if (s.length <= 8) return `len${s.length}`;
|
|
149
|
+
return `${s.slice(0, 4)}…${s.slice(-4)} (len=${s.length})`;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @param {string} u
|
|
154
|
+
* @returns {string}
|
|
155
|
+
*/
|
|
156
|
+
function redactApiKeyFromUrl(u) {
|
|
157
|
+
if (!u || typeof u !== 'string') return String(u);
|
|
158
|
+
return u.replace(/([?&])apiKey=[^&]*/gi, '$1apiKey=(redacted)');
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param {string} url
|
|
163
|
+
* @returns {boolean}
|
|
164
|
+
*/
|
|
165
|
+
function shouldLogAguaceroUrl(url) {
|
|
166
|
+
if (!url || typeof url !== 'string') return false;
|
|
167
|
+
const lower = url.toLowerCase();
|
|
168
|
+
return AGUACERO_URL_MARKERS.some(m => lower.includes(m));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @param {string} tag
|
|
173
|
+
* @param {Record<string, unknown> | undefined} detail
|
|
174
|
+
*/
|
|
175
|
+
function aguaceroDebug(tag, detail) {
|
|
176
|
+
if (!isAguaceroRnDebugEnabled()) return;
|
|
177
|
+
if (detail !== undefined) {
|
|
178
|
+
console.warn(`${LOG_PREFIX}[${tag}]`, detail);
|
|
179
|
+
} else {
|
|
180
|
+
console.warn(`${LOG_PREFIX}[${tag}]`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Auth / HTTP failures: logged when debug is on (same prefix).
|
|
186
|
+
* @param {string} tag
|
|
187
|
+
* @param {Record<string, unknown> | undefined} detail
|
|
188
|
+
*/
|
|
189
|
+
function aguaceroDebugWarn(tag, detail) {
|
|
190
|
+
if (!isAguaceroRnDebugEnabled()) return;
|
|
191
|
+
if (detail !== undefined) {
|
|
192
|
+
console.warn(`${LOG_PREFIX}[WARN][${tag}]`, detail);
|
|
193
|
+
} else {
|
|
194
|
+
console.warn(`${LOG_PREFIX}[WARN][${tag}]`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param {import('@aguacerowx/javascript-sdk').AguaceroCore | { apiKey?: string; bundleId?: string | null; gridRequestSiteOrigin?: string | null; baseGridUrl?: string; isReactNative?: boolean }} core
|
|
200
|
+
* @param {Record<string, unknown>} [extra]
|
|
201
|
+
*/
|
|
202
|
+
function getAguaceroAuthDiagnosticSnapshot(core, extra = {}) {
|
|
203
|
+
const apiKey = core?.apiKey;
|
|
204
|
+
const bundleId = core?.bundleId;
|
|
205
|
+
const origin = core?.gridRequestSiteOrigin;
|
|
206
|
+
return {
|
|
207
|
+
platform: _reactNative.Platform.OS,
|
|
208
|
+
isReactNative: Boolean(core?.isReactNative),
|
|
209
|
+
baseGridUrl: core?.baseGridUrl ?? null,
|
|
210
|
+
apiKey: describeSecret(apiKey),
|
|
211
|
+
bundleId: bundleId ? {
|
|
212
|
+
present: true,
|
|
213
|
+
value: String(bundleId),
|
|
214
|
+
length: String(bundleId).length
|
|
215
|
+
} : {
|
|
216
|
+
present: false,
|
|
217
|
+
hint: 'Install react-native-device-info for x-app-identifier on CDN requests'
|
|
218
|
+
},
|
|
219
|
+
gridRequestSiteOrigin: origin ? {
|
|
220
|
+
present: true,
|
|
221
|
+
value: String(origin),
|
|
222
|
+
length: String(origin).length
|
|
223
|
+
} : {
|
|
224
|
+
present: false,
|
|
225
|
+
hint: 'Pass gridRequestSiteOrigin on WeatherLayerManager (RN falls back to https://localhost if omitted)'
|
|
226
|
+
},
|
|
227
|
+
willSendAppIdentifier: Boolean(bundleId && core?.isReactNative),
|
|
228
|
+
willSendOriginHeaders: Boolean(origin && String(origin).trim()),
|
|
229
|
+
...extra
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* @param {Record<string, unknown>} options - {@link buildGridFrameProcessOptions} output
|
|
235
|
+
* @param {import('@aguacerowx/javascript-sdk').AguaceroCore} [core]
|
|
236
|
+
* @returns {Record<string, unknown>}
|
|
237
|
+
*/
|
|
238
|
+
function augmentProcessFrameOptionsForDebug(options, core) {
|
|
239
|
+
const out = {
|
|
240
|
+
...options
|
|
241
|
+
};
|
|
242
|
+
if (!out.gridRequestSiteOrigin && core) {
|
|
243
|
+
const origin = (0, _gridCdnAuth.resolveGridRequestSiteOrigin)(undefined, core);
|
|
244
|
+
if (origin) {
|
|
245
|
+
out.gridRequestSiteOrigin = origin;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (!isAguaceroRnDebugEnabled()) {
|
|
249
|
+
return out;
|
|
250
|
+
}
|
|
251
|
+
out.debug = true;
|
|
252
|
+
aguaceroDebug('processFrame.options', {
|
|
253
|
+
url: redactApiKeyFromUrl(out.url),
|
|
254
|
+
hasApiKeyInQuery: typeof out.url === 'string' && /[?&]apiKey=/i.test(out.url),
|
|
255
|
+
apiKey: describeSecret(out.apiKey),
|
|
256
|
+
bundleId: out.bundleId ? {
|
|
257
|
+
present: true,
|
|
258
|
+
value: String(out.bundleId)
|
|
259
|
+
} : {
|
|
260
|
+
present: false
|
|
261
|
+
},
|
|
262
|
+
gridRequestSiteOrigin: out.gridRequestSiteOrigin ?? null,
|
|
263
|
+
coreSnapshot: core ? getAguaceroAuthDiagnosticSnapshot(core) : undefined
|
|
264
|
+
});
|
|
265
|
+
return out;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @param {string | Request} input
|
|
270
|
+
* @param {RequestInit | undefined} init
|
|
271
|
+
*/
|
|
272
|
+
function summarizeFetchRequest(input, init) {
|
|
273
|
+
const url = typeof input === 'string' ? input : input?.url;
|
|
274
|
+
const headers = new Headers(typeof input !== 'string' && input?.headers || init?.headers || undefined);
|
|
275
|
+
const headerRecord = {};
|
|
276
|
+
headers.forEach((v, k) => {
|
|
277
|
+
const lk = k.toLowerCase();
|
|
278
|
+
if (lk === 'x-api-key' || lk === 'authorization') {
|
|
279
|
+
headerRecord[k] = describeSecret(v);
|
|
280
|
+
} else {
|
|
281
|
+
headerRecord[k] = v;
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
return {
|
|
285
|
+
url: redactApiKeyFromUrl(url || ''),
|
|
286
|
+
method: init?.method || (typeof input !== 'string' ? input?.method : undefined) || 'GET',
|
|
287
|
+
headers: headerRecord,
|
|
288
|
+
hasApiKeyQuery: typeof url === 'string' && /[?&]apiKey=/i.test(url)
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Patches `global.fetch` once to log Aguacero CDN / API traffic when debug is enabled.
|
|
294
|
+
*/
|
|
295
|
+
function installGlobalFetchLogger() {
|
|
296
|
+
if (_fetchLoggerInstalled || !isAguaceroRnDebugEnabled()) return;
|
|
297
|
+
if (typeof globalThis === 'undefined' || typeof globalThis.fetch !== 'function') return;
|
|
298
|
+
const originalFetch = globalThis.fetch.bind(globalThis);
|
|
299
|
+
_fetchLoggerInstalled = true;
|
|
300
|
+
globalThis.fetch = async function aguaceroInstrumentedFetch(input, init) {
|
|
301
|
+
const url = typeof input === 'string' ? input : input?.url;
|
|
302
|
+
const shouldLog = shouldLogAguaceroUrl(url || '');
|
|
303
|
+
const reqId = shouldLog ? `f${++_fetchSeq}` : null;
|
|
304
|
+
const started = Date.now();
|
|
305
|
+
if (shouldLog) {
|
|
306
|
+
aguaceroDebug('fetch.start', {
|
|
307
|
+
reqId,
|
|
308
|
+
...summarizeFetchRequest(input, init)
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
const response = await originalFetch(input, init);
|
|
313
|
+
if (shouldLog) {
|
|
314
|
+
const elapsedMs = Date.now() - started;
|
|
315
|
+
const base = {
|
|
316
|
+
reqId,
|
|
317
|
+
status: response.status,
|
|
318
|
+
statusText: response.statusText,
|
|
319
|
+
ok: response.ok,
|
|
320
|
+
elapsedMs,
|
|
321
|
+
url: redactApiKeyFromUrl(url || '')
|
|
322
|
+
};
|
|
323
|
+
if (!response.ok) {
|
|
324
|
+
let bodySnippet = null;
|
|
325
|
+
try {
|
|
326
|
+
const clone = response.clone();
|
|
327
|
+
const text = await clone.text();
|
|
328
|
+
bodySnippet = text.length > 600 ? `${text.slice(0, 600)}…` : text;
|
|
329
|
+
} catch {
|
|
330
|
+
bodySnippet = '(could not read body)';
|
|
331
|
+
}
|
|
332
|
+
aguaceroDebugWarn('fetch.httpError', {
|
|
333
|
+
...base,
|
|
334
|
+
bodySnippet,
|
|
335
|
+
hint403: response.status === 403 ? '403 usually means: invalid/disabled API key, bundleId not allowlisted (x-app-identifier), or missing/wrong gridRequestSiteOrigin (Origin/Referer). Compare snapshot at core.created / processFrame.options.' : undefined
|
|
336
|
+
});
|
|
337
|
+
} else {
|
|
338
|
+
aguaceroDebug('fetch.ok', base);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return response;
|
|
342
|
+
} catch (err) {
|
|
343
|
+
if (shouldLog) {
|
|
344
|
+
aguaceroDebugWarn('fetch.throw', {
|
|
345
|
+
reqId,
|
|
346
|
+
message: err?.message || String(err),
|
|
347
|
+
elapsedMs: Date.now() - started,
|
|
348
|
+
url: redactApiKeyFromUrl(url || '')
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
throw err;
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
aguaceroDebug('fetch.hookInstalled', {
|
|
355
|
+
platform: _reactNative.Platform.OS
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=aguaceroRnDebug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_gridCdnAuth","LOG_PREFIX","_explicitEnabled","_fetchLoggerInstalled","_fetchSeq","AGUACERO_URL_MARKERS","setAguaceroRnDebugEnabled","enabled","configureAguaceroRnDebug","Boolean","opts","on","isAguaceroRnDebugEnabled","globalThis","__AGUACERO_DEBUG__","__AGUACERO_WX_GRID_DEBUG__","__AGUACERO_NEXRAD_DEBUG__","installGlobalFetchLogger","aguaceroDebug","platform","Platform","OS","explicitFlag","globalFlag","safeGlobalDebugFlag","__DEV__","describeSecret","secret","present","length","s","String","trimmed","trim","trimmedLength","hasLeadingWhitespace","test","hasTrailingWhitespace","hasInternalWhitespace","indexOf","fingerprint","fingerprintSecret","looksLikePlaceholder","slice","redactApiKeyFromUrl","u","replace","shouldLogAguaceroUrl","url","lower","toLowerCase","some","m","includes","tag","detail","undefined","console","warn","aguaceroDebugWarn","getAguaceroAuthDiagnosticSnapshot","core","extra","apiKey","bundleId","origin","gridRequestSiteOrigin","isReactNative","baseGridUrl","value","hint","willSendAppIdentifier","willSendOriginHeaders","augmentProcessFrameOptionsForDebug","options","out","resolveGridRequestSiteOrigin","debug","hasApiKeyInQuery","coreSnapshot","summarizeFetchRequest","input","init","headers","Headers","headerRecord","forEach","v","k","lk","method","hasApiKeyQuery","fetch","originalFetch","bind","aguaceroInstrumentedFetch","shouldLog","reqId","started","Date","now","response","elapsedMs","base","status","statusText","ok","bodySnippet","clone","text","hint403","err","message"],"sourceRoot":"..\\..\\src","sources":["aguaceroRnDebug.js"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAME,UAAU,GAAG,qBAAqB;;AAExC;AACA,IAAIC,gBAAgB,GAAG,IAAI;AAE3B,IAAIC,qBAAqB,GAAG,KAAK;AACjC,IAAIC,SAA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", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN = void 0;
|
|
7
|
+
exports.readGlobalGridRequestSiteOrigin = readGlobalGridRequestSiteOrigin;
|
|
8
|
+
exports.resolveGridRequestSiteOrigin = resolveGridRequestSiteOrigin;
|
|
9
|
+
/**
|
|
10
|
+
* CloudFront grid CDN auth helpers for React Native.
|
|
11
|
+
*
|
|
12
|
+
* The CDN returns HTTP 403 when {@code Origin} is missing (even if {@code x-api-key} and
|
|
13
|
+
* {@code apiKey} query are valid). Browsers set Origin automatically; RN native HTTP does not.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Fallback when no prop/core/global origin is configured (any origin satisfies the CDN). */
|
|
17
|
+
const RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN = exports.RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN = 'https://localhost';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @returns {string}
|
|
21
|
+
*/
|
|
22
|
+
function readGlobalGridRequestSiteOrigin() {
|
|
23
|
+
try {
|
|
24
|
+
const g = globalThis.__AGUACERO_GRID_REQUEST_SITE_ORIGIN__;
|
|
25
|
+
if (typeof g === 'string' && g.trim()) {
|
|
26
|
+
return g.trim().replace(/\/+$/, '');
|
|
27
|
+
}
|
|
28
|
+
} catch {
|
|
29
|
+
/* ignore */
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the site origin used for {@code Origin} / {@code Referer} on grid CDN requests.
|
|
36
|
+
*
|
|
37
|
+
* @param {string | undefined | null} propOrigin - {@link WeatherLayerManager} `gridRequestSiteOrigin` prop
|
|
38
|
+
* @param {{ gridRequestSiteOrigin?: string | null; isReactNative?: boolean } | null | undefined} core
|
|
39
|
+
* @returns {string | null} Normalized origin without trailing slash, or null on web when unset
|
|
40
|
+
*/
|
|
41
|
+
function resolveGridRequestSiteOrigin(propOrigin, core) {
|
|
42
|
+
const normalize = s => {
|
|
43
|
+
let o = String(s).trim();
|
|
44
|
+
while (o.endsWith('/')) {
|
|
45
|
+
o = o.slice(0, -1);
|
|
46
|
+
}
|
|
47
|
+
return o;
|
|
48
|
+
};
|
|
49
|
+
if (typeof propOrigin === 'string' && propOrigin.trim()) {
|
|
50
|
+
return normalize(propOrigin);
|
|
51
|
+
}
|
|
52
|
+
if (typeof core?.gridRequestSiteOrigin === 'string' && core.gridRequestSiteOrigin.trim()) {
|
|
53
|
+
return normalize(core.gridRequestSiteOrigin);
|
|
54
|
+
}
|
|
55
|
+
const fromGlobal = readGlobalGridRequestSiteOrigin();
|
|
56
|
+
if (fromGlobal) {
|
|
57
|
+
return fromGlobal;
|
|
58
|
+
}
|
|
59
|
+
if (core?.isReactNative) {
|
|
60
|
+
return RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=gridCdnAuth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN","exports","readGlobalGridRequestSiteOrigin","g","globalThis","__AGUACERO_GRID_REQUEST_SITE_ORIGIN__","trim","replace","resolveGridRequestSiteOrigin","propOrigin","core","normalize","s","o","String","endsWith","slice","gridRequestSiteOrigin","fromGlobal","isReactNative"],"sourceRoot":"..\\..\\src","sources":["gridCdnAuth.js"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAMA,mCAAmC,GAAAC,OAAA,CAAAD,mCAAA,GAAG,mBAAmB;;AAEtE;AACA;AACA;AACO,SAASE,+BAA+BA,CAAA,EAAG;EAC9C,IAAI;IACA,MAAMC,CAAC,GAAGC,UAAU,CAACC,qCAAqC;IAC1D,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAIA,CAAC,CAACG,IAAI,CAAC,CAAC,EAAE;MACnC,OAAOH,CAAC,CAACG,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IACvC;EACJ,CAAC,CAAC,MAAM;IACJ;EAAA;EAEJ,OAAO,EAAE;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,CAACC,UAAU,EAAEC,IAAI,EAAE;EAC3D,MAAMC,SAAS,GAAIC,CAAC,IAAK;IACrB,IAAIC,CAAC,GAAGC,MAAM,CAACF,CAAC,CAAC,CAACN,IAAI,CAAC,CAAC;IACxB,OAAOO,CAAC,CAACE,QAAQ,CAAC,GAAG,CAAC,EAAE;MACpBF,CAAC,GAAGA,CAAC,CAACG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtB;IACA,OAAOH,CAAC;EACZ,CAAC;EAED,IAAI,OAAOJ,UAAU,KAAK,QAAQ,IAAIA,UAAU,CAACH,IAAI,CAAC,CAAC,EAAE;IACrD,OAAOK,SAAS,CAACF,UAAU,CAAC;EAChC;EACA,IAAI,OAAOC,IAAI,EAAEO,qBAAqB,KAAK,QAAQ,IAAIP,IAAI,CAACO,qBAAqB,CAACX,IAAI,CAAC,CAAC,EAAE;IACtF,OAAOK,SAAS,CAACD,IAAI,CAACO,qBAAqB,CAAC;EAChD;EACA,MAAMC,UAAU,GAAGhB,+BAA+B,CAAC,CAAC;EACpD,IAAIgB,UAAU,EAAE;IACZ,OAAOA,UAAU;EACrB;EACA,IAAIR,IAAI,EAAES,aAAa,EAAE;IACrB,OAAOnB,mCAAmC;EAC9C;EACA,OAAO,IAAI;AACf","ignoreList":[]}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -27,14 +27,64 @@ Object.defineProperty(exports, "MapManager", {
|
|
|
27
27
|
return _MapManager.MapManager;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
+
Object.defineProperty(exports, "RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _gridCdnAuth.RN_DEFAULT_GRID_REQUEST_SITE_ORIGIN;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
30
36
|
Object.defineProperty(exports, "WeatherLayerManager", {
|
|
31
37
|
enumerable: true,
|
|
32
38
|
get: function () {
|
|
33
39
|
return _WeatherLayerManager.WeatherLayerManager;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "aguaceroDebug", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _aguaceroRnDebug.aguaceroDebug;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "aguaceroDebugWarn", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _aguaceroRnDebug.aguaceroDebugWarn;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "configureAguaceroRnDebug", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _aguaceroRnDebug.configureAguaceroRnDebug;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "getAguaceroAuthDiagnosticSnapshot", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "isAguaceroRnDebugEnabled", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _aguaceroRnDebug.isAguaceroRnDebugEnabled;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "resolveGridRequestSiteOrigin", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _gridCdnAuth.resolveGridRequestSiteOrigin;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "setAguaceroRnDebugEnabled", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _aguaceroRnDebug.setAguaceroRnDebugEnabled;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
36
84
|
var _MapManager = require("./MapManager");
|
|
37
85
|
var _WeatherLayerManager = require("./WeatherLayerManager");
|
|
86
|
+
var _aguaceroRnDebug = require("./aguaceroRnDebug");
|
|
87
|
+
var _gridCdnAuth = require("./gridCdnAuth");
|
|
38
88
|
var _GridRenderLayerNativeComponent = _interopRequireDefault(require("./GridRenderLayerNativeComponent"));
|
|
39
89
|
var _nwsAndroidConstants = require("./nws/nwsAndroidConstants");
|
|
40
90
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_MapManager","require","_WeatherLayerManager","_GridRenderLayerNativeComponent","_interopRequireDefault","_nwsAndroidConstants","e","__esModule","default"],"sourceRoot":"..\\..\\src","sources":["index.js"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_MapManager","require","_WeatherLayerManager","_aguaceroRnDebug","_gridCdnAuth","_GridRenderLayerNativeComponent","_interopRequireDefault","_nwsAndroidConstants","e","__esModule","default"],"sourceRoot":"..\\..\\src","sources":["index.js"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AAQA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,+BAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AAGmC,SAAAK,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -13,8 +13,9 @@ var _nexradCrossSectionSampleAtLatLonBundled = require("./nexradCrossSectionSamp
|
|
|
13
13
|
var _nexradLutBuild = require("./nexradLutBuild.js");
|
|
14
14
|
var _reactNative = require("react-native");
|
|
15
15
|
var _nexradDiag = require("./nexradDiag.js");
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
var _aguaceroRnDebug = require("../aguaceroRnDebug");
|
|
17
|
+
/**
|
|
18
|
+
* AguaceroCore NEXRAD → Android native custom layer (parity with mapsgl {@link NexradWeatherController}).
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
(0, _nexradDiag.nexradDiagBootSnapshot)({
|
|
@@ -170,10 +171,10 @@ function rleCompressGateData(gateData) {
|
|
|
170
171
|
return out.subarray(0, outIdx);
|
|
171
172
|
}
|
|
172
173
|
class NexradAndroidController {
|
|
173
|
-
/**
|
|
174
|
-
* @param {*} core - AguaceroCore instance
|
|
175
|
-
* @param {React.MutableRefObject<{ uploadNexradFrame?: (s: string) => void; uploadNexradStyleOnly?: (s: string) => void; clearNexrad?: () => void; activateNexradCachedFrame?: (k: string) => void } | null>} layerRef
|
|
176
|
-
* @param {object} [options]
|
|
174
|
+
/**
|
|
175
|
+
* @param {*} core - AguaceroCore instance
|
|
176
|
+
* @param {React.MutableRefObject<{ uploadNexradFrame?: (s: string) => void; uploadNexradStyleOnly?: (s: string) => void; clearNexrad?: () => void; activateNexradCachedFrame?: (k: string) => void } | null>} layerRef
|
|
177
|
+
* @param {object} [options]
|
|
177
178
|
*/
|
|
178
179
|
constructor(core, layerRef, options = {}) {
|
|
179
180
|
this.core = core;
|
|
@@ -219,7 +220,12 @@ class NexradAndroidController {
|
|
|
219
220
|
(0, _radarArchiveCoreBundled.setNexradSitesJsonUrl)(`${base}/data/nexrad.json`);
|
|
220
221
|
(0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(core.apiKey || '', core.bundleId || '');
|
|
221
222
|
}
|
|
222
|
-
(0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(core.gridRequestSiteOrigin || '');
|
|
223
|
+
(0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(core.gridRequestSiteOrigin || 'https://localhost');
|
|
224
|
+
if ((0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)()) {
|
|
225
|
+
(0, _aguaceroRnDebug.aguaceroDebug)('nexrad.authConfigured', (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(core, {
|
|
226
|
+
phase: 'NexradAndroidController.constructor'
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
223
229
|
}
|
|
224
230
|
_trimNativeGpuReadyKeys(max) {
|
|
225
231
|
while (this._nativeGpuReadyKeys.size > max) {
|
|
@@ -303,10 +309,10 @@ class NexradAndroidController {
|
|
|
303
309
|
};
|
|
304
310
|
}
|
|
305
311
|
|
|
306
|
-
/**
|
|
307
|
-
* LRU for full native JSON payloads (parity with mapsgl gate-texture reuse — avoids base64 + stringify on repeat scrubs).
|
|
308
|
-
* @param {string} syncKey
|
|
309
|
-
* @returns {{ json: string; valueScale: number; valueOffset: number } | null}
|
|
312
|
+
/**
|
|
313
|
+
* LRU for full native JSON payloads (parity with mapsgl gate-texture reuse — avoids base64 + stringify on repeat scrubs).
|
|
314
|
+
* @param {string} syncKey
|
|
315
|
+
* @returns {{ json: string; valueScale: number; valueOffset: number } | null}
|
|
310
316
|
*/
|
|
311
317
|
_nativeUploadJsonLruTouch(syncKey) {
|
|
312
318
|
const ent = this._nativeUploadJsonLru.get(syncKey);
|
|
@@ -327,18 +333,18 @@ class NexradAndroidController {
|
|
|
327
333
|
}
|
|
328
334
|
}
|
|
329
335
|
|
|
330
|
-
/**
|
|
331
|
-
* Full-frame JSON includes LUT + opacity + shader toggles; keep LRU key aligned so scrubbing
|
|
332
|
-
* cannot resurrect an outdated style after the user changes only presentation options.
|
|
336
|
+
/**
|
|
337
|
+
* Full-frame JSON includes LUT + opacity + shader toggles; keep LRU key aligned so scrubbing
|
|
338
|
+
* cannot resurrect an outdated style after the user changes only presentation options.
|
|
333
339
|
*/
|
|
334
340
|
_nativeUploadLruKey(state, syncKey) {
|
|
335
341
|
return `${syncKey}|o:${state.opacity ?? 1}|g:${this._gateSmoothing ? 1 : 0}|i:${this._interpolateColormap ? 1 : 0}`;
|
|
336
342
|
}
|
|
337
343
|
|
|
338
|
-
/**
|
|
339
|
-
* After JS decoded a frame into `_frameCache`, optionally push it through the native bridge.
|
|
340
|
-
* During timeline preload we **only** upload the **currently displayed** unix to Metal; other
|
|
341
|
-
* volumes stay in the JS cache until {@link sync} needs them (avoids 40+ full decodes on load).
|
|
344
|
+
/**
|
|
345
|
+
* After JS decoded a frame into `_frameCache`, optionally push it through the native bridge.
|
|
346
|
+
* During timeline preload we **only** upload the **currently displayed** unix to Metal; other
|
|
347
|
+
* volumes stay in the JS cache until {@link sync} needs them (avoids 40+ full decodes on load).
|
|
342
348
|
*/
|
|
343
349
|
_primeNativeGpuUploadIfNeeded(snapshot, unix, p, frame, abortSignal) {
|
|
344
350
|
if (!frame || !p || abortSignal && abortSignal.aborted) return;
|
|
@@ -360,11 +366,11 @@ class NexradAndroidController {
|
|
|
360
366
|
}
|
|
361
367
|
}
|
|
362
368
|
|
|
363
|
-
/**
|
|
364
|
-
* @param {*} state
|
|
365
|
-
* @param {*} frame - decoded archive frame
|
|
366
|
-
* @param {{ fetchKey: string }} p - from {@link _buildFetchParamsForUnix}
|
|
367
|
-
* @param {number} unix
|
|
369
|
+
/**
|
|
370
|
+
* @param {*} state
|
|
371
|
+
* @param {*} frame - decoded archive frame
|
|
372
|
+
* @param {{ fetchKey: string }} p - from {@link _buildFetchParamsForUnix}
|
|
373
|
+
* @param {number} unix
|
|
368
374
|
*/
|
|
369
375
|
_uploadFrameToNative(state, frame, p, unix) {
|
|
370
376
|
const uploadTotal = (0, _nexradDiag.nexradPerfSpan)(`uploadFrame.total site=${state.nexradSite} unix=${unix} var=${p?.radarVar ?? state.nexradProduct}`);
|
|
@@ -681,8 +687,15 @@ class NexradAndroidController {
|
|
|
681
687
|
|
|
682
688
|
(0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(this.core.apiKey || '');
|
|
683
689
|
(0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(this.core.bundleId || '');
|
|
684
|
-
(0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || '');
|
|
690
|
+
(0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || 'https://localhost');
|
|
685
691
|
(0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(this.core.apiKey || '', this.core.bundleId || '');
|
|
692
|
+
if ((0, _aguaceroRnDebug.isAguaceroRnDebugEnabled)()) {
|
|
693
|
+
(0, _aguaceroRnDebug.aguaceroDebug)('nexrad.authConfigured', (0, _aguaceroRnDebug.getAguaceroAuthDiagnosticSnapshot)(this.core, {
|
|
694
|
+
phase: 'NexradAndroidController.preload',
|
|
695
|
+
site: state.nexradSite,
|
|
696
|
+
product: state.nexradProduct
|
|
697
|
+
}));
|
|
698
|
+
}
|
|
686
699
|
const snapshot = {
|
|
687
700
|
...state
|
|
688
701
|
};
|
|
@@ -804,7 +817,7 @@ class NexradAndroidController {
|
|
|
804
817
|
const tAuth = (0, _nexradDiag.nexradPerfSpan)('sync.setArchiveAuth');
|
|
805
818
|
(0, _radarArchiveCoreBundled.setNexradArchiveApiKey)(this.core.apiKey || '');
|
|
806
819
|
(0, _radarArchiveCoreBundled.setNexradArchiveBundleId)(this.core.bundleId || '');
|
|
807
|
-
(0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || '');
|
|
820
|
+
(0, _radarArchiveCoreBundled.setNexradArchiveSiteOrigin)(this.core.gridRequestSiteOrigin || 'https://localhost');
|
|
808
821
|
(0, _radarArchiveCoreBundled.setNexradSitesFetchAuth)(this.core.apiKey || '', this.core.bundleId || '');
|
|
809
822
|
tAuth.end({});
|
|
810
823
|
const unix = Number(state.nexradTimestamp);
|