@mostlyrightmd/core 0.1.0-rc.7
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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/discovery/index.cjs +1646 -0
- package/dist/discovery/index.cjs.map +1 -0
- package/dist/discovery/index.d.cts +313 -0
- package/dist/discovery/index.d.ts +313 -0
- package/dist/discovery/index.mjs +1609 -0
- package/dist/discovery/index.mjs.map +1 -0
- package/dist/formats/index.cjs +498 -0
- package/dist/formats/index.cjs.map +1 -0
- package/dist/formats/index.d.cts +97 -0
- package/dist/formats/index.d.ts +97 -0
- package/dist/formats/index.mjs +465 -0
- package/dist/formats/index.mjs.map +1 -0
- package/dist/index.cjs +1624 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +559 -0
- package/dist/index.global.js +1582 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.mjs +1557 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/bounds.cjs +125 -0
- package/dist/internal/bounds.cjs.map +1 -0
- package/dist/internal/bounds.d.cts +36 -0
- package/dist/internal/bounds.d.ts +36 -0
- package/dist/internal/bounds.mjs +81 -0
- package/dist/internal/bounds.mjs.map +1 -0
- package/dist/internal/cache/fs.cjs +217 -0
- package/dist/internal/cache/fs.cjs.map +1 -0
- package/dist/internal/cache/fs.d.cts +57 -0
- package/dist/internal/cache/fs.d.ts +57 -0
- package/dist/internal/cache/fs.mjs +179 -0
- package/dist/internal/cache/fs.mjs.map +1 -0
- package/dist/internal/cache/index.browser.cjs +1184 -0
- package/dist/internal/cache/index.browser.cjs.map +1 -0
- package/dist/internal/cache/index.browser.d.cts +20 -0
- package/dist/internal/cache/index.browser.d.ts +20 -0
- package/dist/internal/cache/index.browser.mjs +36 -0
- package/dist/internal/cache/index.browser.mjs.map +1 -0
- package/dist/internal/cache/index.cjs +1389 -0
- package/dist/internal/cache/index.cjs.map +1 -0
- package/dist/internal/cache/index.d.cts +16 -0
- package/dist/internal/cache/index.d.ts +16 -0
- package/dist/internal/cache/index.mjs +40 -0
- package/dist/internal/cache/index.mjs.map +1 -0
- package/dist/internal/chunk-PKJXHY27.mjs +1137 -0
- package/dist/internal/chunk-PKJXHY27.mjs.map +1 -0
- package/dist/internal/convert.cjs +161 -0
- package/dist/internal/convert.cjs.map +1 -0
- package/dist/internal/convert.d.cts +44 -0
- package/dist/internal/convert.d.ts +44 -0
- package/dist/internal/convert.mjs +117 -0
- package/dist/internal/convert.mjs.map +1 -0
- package/dist/internal/fs-O6XR4WWW.mjs +183 -0
- package/dist/internal/fs-O6XR4WWW.mjs.map +1 -0
- package/dist/internal/keys-B7C8C88N.d.cts +191 -0
- package/dist/internal/keys-B7C8C88N.d.ts +191 -0
- package/dist/internal/merge/index.cjs +75 -0
- package/dist/internal/merge/index.cjs.map +1 -0
- package/dist/internal/merge/index.d.cts +74 -0
- package/dist/internal/merge/index.d.ts +74 -0
- package/dist/internal/merge/index.mjs +46 -0
- package/dist/internal/merge/index.mjs.map +1 -0
- package/dist/internal/pairs.cjs +328 -0
- package/dist/internal/pairs.cjs.map +1 -0
- package/dist/internal/pairs.d.cts +105 -0
- package/dist/internal/pairs.d.ts +105 -0
- package/dist/internal/pairs.mjs +298 -0
- package/dist/internal/pairs.mjs.map +1 -0
- package/dist/qc/index.cjs +247 -0
- package/dist/qc/index.cjs.map +1 -0
- package/dist/qc/index.d.cts +140 -0
- package/dist/qc/index.d.ts +140 -0
- package/dist/qc/index.mjs +212 -0
- package/dist/qc/index.mjs.map +1 -0
- package/dist/temporal/index.cjs +504 -0
- package/dist/temporal/index.cjs.map +1 -0
- package/dist/temporal/index.d.cts +121 -0
- package/dist/temporal/index.d.ts +121 -0
- package/dist/temporal/index.mjs +474 -0
- package/dist/temporal/index.mjs.map +1 -0
- package/dist/transforms/index.cjs +399 -0
- package/dist/transforms/index.cjs.map +1 -0
- package/dist/transforms/index.d.cts +193 -0
- package/dist/transforms/index.d.ts +193 -0
- package/dist/transforms/index.mjs +362 -0
- package/dist/transforms/index.mjs.map +1 -0
- package/dist/validator.cjs +1870 -0
- package/dist/validator.cjs.map +1 -0
- package/dist/validator.d.cts +30 -0
- package/dist/validator.d.ts +30 -0
- package/dist/validator.mjs +1843 -0
- package/dist/validator.mjs.map +1 -0
- package/package.json +115 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1624 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AuthenticationError: () => AuthenticationError,
|
|
24
|
+
CLIMATE_REPORT_TYPE_PRIORITY: () => CLIMATE_REPORT_TYPE_PRIORITY,
|
|
25
|
+
DeferredMarketError: () => DeferredMarketError,
|
|
26
|
+
ForbiddenError: () => ForbiddenError,
|
|
27
|
+
LIVE_V1_POLICY: () => LIVE_V1_POLICY,
|
|
28
|
+
LeakageError: () => LeakageError,
|
|
29
|
+
LiveStreamError: () => LiveStreamError,
|
|
30
|
+
NoLiveDataError: () => NoLiveDataError,
|
|
31
|
+
NotFoundError: () => NotFoundError,
|
|
32
|
+
OBSERVATION_SOURCE_PRIORITY: () => OBSERVATION_SOURCE_PRIORITY,
|
|
33
|
+
PayloadTooLargeError: () => PayloadTooLargeError,
|
|
34
|
+
PolymarketEventError: () => PolymarketEventError,
|
|
35
|
+
QC_ALPHA_RULES: () => QC_ALPHA_RULES,
|
|
36
|
+
QC_ALPHA_RULES_BY_ID: () => QC_ALPHA_RULES_BY_ID,
|
|
37
|
+
RateLimitError: () => RateLimitError,
|
|
38
|
+
STATIONS: () => STATIONS,
|
|
39
|
+
STATION_BY_CODE: () => STATION_BY_CODE,
|
|
40
|
+
STATION_BY_ICAO: () => STATION_BY_ICAO,
|
|
41
|
+
SchemaValidationError: () => SchemaValidationError,
|
|
42
|
+
ServerError: () => ServerError,
|
|
43
|
+
SourceMismatchError: () => SourceMismatchError,
|
|
44
|
+
SourceUnavailableError: () => SourceUnavailableError,
|
|
45
|
+
TemporalDriftError: () => TemporalDriftError,
|
|
46
|
+
TherminalError: () => TherminalError,
|
|
47
|
+
TradewindsError: () => TradewindsError,
|
|
48
|
+
ValidationError: () => ValidationError,
|
|
49
|
+
_CLI_PUBLICATION_DELAY_HOURS: () => _CLI_PUBLICATION_DELAY_HOURS,
|
|
50
|
+
_JAN_REF: () => _JAN_REF,
|
|
51
|
+
_MARKET_CLOSE_HOUR_LST: () => _MARKET_CLOSE_HOUR_LST,
|
|
52
|
+
_MARKET_CLOSE_MINUTE_LST: () => _MARKET_CLOSE_MINUTE_LST,
|
|
53
|
+
_STATION_TZ: () => _STATION_TZ,
|
|
54
|
+
_lstOffsetHours: () => _lstOffsetHours,
|
|
55
|
+
_resolveStationTz: () => _resolveStationTz,
|
|
56
|
+
cliAvailableAt: () => cliAvailableAt,
|
|
57
|
+
fetchWithRetry: () => fetchWithRetry,
|
|
58
|
+
helloCore: () => helloCore,
|
|
59
|
+
marketCloseUtc: () => marketCloseUtc,
|
|
60
|
+
settlementDateFor: () => settlementDateFor,
|
|
61
|
+
settlementWindowUtc: () => settlementWindowUtc,
|
|
62
|
+
toJsonSafe: () => toJsonSafe,
|
|
63
|
+
version: () => version
|
|
64
|
+
});
|
|
65
|
+
module.exports = __toCommonJS(index_exports);
|
|
66
|
+
|
|
67
|
+
// src/data/generated/stations.ts
|
|
68
|
+
var STATIONS = [
|
|
69
|
+
{
|
|
70
|
+
code: "EDDB",
|
|
71
|
+
country: "DE",
|
|
72
|
+
ghcnh_id: null,
|
|
73
|
+
icao: "EDDB",
|
|
74
|
+
latitude: 52.3667,
|
|
75
|
+
longitude: 13.5033,
|
|
76
|
+
name: "Berlin Brandenburg",
|
|
77
|
+
tz: "Europe/Berlin"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
code: "EDDF",
|
|
81
|
+
country: "DE",
|
|
82
|
+
ghcnh_id: null,
|
|
83
|
+
icao: "EDDF",
|
|
84
|
+
latitude: 50.0379,
|
|
85
|
+
longitude: 8.5622,
|
|
86
|
+
name: "Frankfurt am Main",
|
|
87
|
+
tz: "Europe/Berlin"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
code: "EDDM",
|
|
91
|
+
country: "DE",
|
|
92
|
+
ghcnh_id: null,
|
|
93
|
+
icao: "EDDM",
|
|
94
|
+
latitude: 48.3538,
|
|
95
|
+
longitude: 11.7861,
|
|
96
|
+
name: "Munich Franz Josef Strauss",
|
|
97
|
+
tz: "Europe/Berlin"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
code: "EFHK",
|
|
101
|
+
country: "FI",
|
|
102
|
+
ghcnh_id: null,
|
|
103
|
+
icao: "EFHK",
|
|
104
|
+
latitude: 60.3172,
|
|
105
|
+
longitude: 24.9633,
|
|
106
|
+
name: "Helsinki-Vantaa",
|
|
107
|
+
tz: "Europe/Helsinki"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
code: "EGKK",
|
|
111
|
+
country: "GB",
|
|
112
|
+
ghcnh_id: null,
|
|
113
|
+
icao: "EGKK",
|
|
114
|
+
latitude: 51.1481,
|
|
115
|
+
longitude: -0.1903,
|
|
116
|
+
name: "London Gatwick",
|
|
117
|
+
tz: "Europe/London"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
code: "EGLL",
|
|
121
|
+
country: "GB",
|
|
122
|
+
ghcnh_id: null,
|
|
123
|
+
icao: "EGLL",
|
|
124
|
+
latitude: 51.4706,
|
|
125
|
+
longitude: -0.4619,
|
|
126
|
+
name: "London Heathrow",
|
|
127
|
+
tz: "Europe/London"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
code: "EHAM",
|
|
131
|
+
country: "NL",
|
|
132
|
+
ghcnh_id: null,
|
|
133
|
+
icao: "EHAM",
|
|
134
|
+
latitude: 52.3086,
|
|
135
|
+
longitude: 4.7639,
|
|
136
|
+
name: "Amsterdam Schiphol",
|
|
137
|
+
tz: "Europe/Amsterdam"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
code: "EKCH",
|
|
141
|
+
country: "DK",
|
|
142
|
+
ghcnh_id: null,
|
|
143
|
+
icao: "EKCH",
|
|
144
|
+
latitude: 55.6181,
|
|
145
|
+
longitude: 12.6561,
|
|
146
|
+
name: "Copenhagen Kastrup",
|
|
147
|
+
tz: "Europe/Copenhagen"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
code: "EPWA",
|
|
151
|
+
country: "PL",
|
|
152
|
+
ghcnh_id: null,
|
|
153
|
+
icao: "EPWA",
|
|
154
|
+
latitude: 52.1657,
|
|
155
|
+
longitude: 20.9671,
|
|
156
|
+
name: "Warsaw Chopin",
|
|
157
|
+
tz: "Europe/Warsaw"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
code: "ESSA",
|
|
161
|
+
country: "SE",
|
|
162
|
+
ghcnh_id: null,
|
|
163
|
+
icao: "ESSA",
|
|
164
|
+
latitude: 59.6519,
|
|
165
|
+
longitude: 17.9186,
|
|
166
|
+
name: "Stockholm Arlanda",
|
|
167
|
+
tz: "Europe/Stockholm"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
code: "ATL",
|
|
171
|
+
country: "US",
|
|
172
|
+
ghcnh_id: "USW00013874",
|
|
173
|
+
icao: "KATL",
|
|
174
|
+
latitude: 33.6407,
|
|
175
|
+
longitude: -84.4277,
|
|
176
|
+
name: "Hartsfield-Jackson Atlanta International",
|
|
177
|
+
tz: "America/New_York"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
code: "AUS",
|
|
181
|
+
country: "US",
|
|
182
|
+
ghcnh_id: "USW00013904",
|
|
183
|
+
icao: "KAUS",
|
|
184
|
+
latitude: 30.1975,
|
|
185
|
+
longitude: -97.6664,
|
|
186
|
+
name: "Austin-Bergstrom International",
|
|
187
|
+
tz: "America/Chicago"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
code: "BOS",
|
|
191
|
+
country: "US",
|
|
192
|
+
ghcnh_id: "USW00014739",
|
|
193
|
+
icao: "KBOS",
|
|
194
|
+
latitude: 42.3656,
|
|
195
|
+
longitude: -71.0096,
|
|
196
|
+
name: "Boston Logan International",
|
|
197
|
+
tz: "America/New_York"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
code: "DCA",
|
|
201
|
+
country: "US",
|
|
202
|
+
ghcnh_id: "USW00013743",
|
|
203
|
+
icao: "KDCA",
|
|
204
|
+
latitude: 38.8512,
|
|
205
|
+
longitude: -77.0402,
|
|
206
|
+
name: "Washington Reagan National",
|
|
207
|
+
tz: "America/New_York"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
code: "DEN",
|
|
211
|
+
country: "US",
|
|
212
|
+
ghcnh_id: "USW00003017",
|
|
213
|
+
icao: "KDEN",
|
|
214
|
+
latitude: 39.8561,
|
|
215
|
+
longitude: -104.6737,
|
|
216
|
+
name: "Denver International",
|
|
217
|
+
tz: "America/Denver"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
code: "DFW",
|
|
221
|
+
country: "US",
|
|
222
|
+
ghcnh_id: "USW00003927",
|
|
223
|
+
icao: "KDFW",
|
|
224
|
+
latitude: 32.8998,
|
|
225
|
+
longitude: -97.0403,
|
|
226
|
+
name: "Dallas-Fort Worth International",
|
|
227
|
+
tz: "America/Chicago"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
code: "HOU",
|
|
231
|
+
country: "US",
|
|
232
|
+
ghcnh_id: "USW00012918",
|
|
233
|
+
icao: "KHOU",
|
|
234
|
+
latitude: 29.6454,
|
|
235
|
+
longitude: -95.2789,
|
|
236
|
+
name: "Houston Hobby",
|
|
237
|
+
tz: "America/Chicago"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
code: "LAS",
|
|
241
|
+
country: "US",
|
|
242
|
+
ghcnh_id: "USW00023169",
|
|
243
|
+
icao: "KLAS",
|
|
244
|
+
latitude: 36.084,
|
|
245
|
+
longitude: -115.1537,
|
|
246
|
+
name: "Harry Reid (McCarran) International",
|
|
247
|
+
tz: "America/Los_Angeles"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
code: "LAX",
|
|
251
|
+
country: "US",
|
|
252
|
+
ghcnh_id: "USW00023174",
|
|
253
|
+
icao: "KLAX",
|
|
254
|
+
latitude: 33.9425,
|
|
255
|
+
longitude: -118.4081,
|
|
256
|
+
name: "Los Angeles International",
|
|
257
|
+
tz: "America/Los_Angeles"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
code: "MDW",
|
|
261
|
+
country: "US",
|
|
262
|
+
ghcnh_id: "USW00014819",
|
|
263
|
+
icao: "KMDW",
|
|
264
|
+
latitude: 41.7868,
|
|
265
|
+
longitude: -87.7522,
|
|
266
|
+
name: "Chicago Midway International",
|
|
267
|
+
tz: "America/Chicago"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
code: "MIA",
|
|
271
|
+
country: "US",
|
|
272
|
+
ghcnh_id: "USW00012839",
|
|
273
|
+
icao: "KMIA",
|
|
274
|
+
latitude: 25.7959,
|
|
275
|
+
longitude: -80.287,
|
|
276
|
+
name: "Miami International",
|
|
277
|
+
tz: "America/New_York"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
code: "MSP",
|
|
281
|
+
country: "US",
|
|
282
|
+
ghcnh_id: "USW00014922",
|
|
283
|
+
icao: "KMSP",
|
|
284
|
+
latitude: 44.8848,
|
|
285
|
+
longitude: -93.2223,
|
|
286
|
+
name: "Minneapolis-St Paul International",
|
|
287
|
+
tz: "America/Chicago"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
code: "MSY",
|
|
291
|
+
country: "US",
|
|
292
|
+
ghcnh_id: "USW00012916",
|
|
293
|
+
icao: "KMSY",
|
|
294
|
+
latitude: 29.9934,
|
|
295
|
+
longitude: -90.258,
|
|
296
|
+
name: "New Orleans Louis Armstrong International",
|
|
297
|
+
tz: "America/Chicago"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
code: "NYC",
|
|
301
|
+
country: "US",
|
|
302
|
+
ghcnh_id: "USW00094728",
|
|
303
|
+
icao: "KNYC",
|
|
304
|
+
latitude: 40.7789,
|
|
305
|
+
longitude: -73.9692,
|
|
306
|
+
name: "Central Park, New York",
|
|
307
|
+
tz: "America/New_York"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
code: "OKC",
|
|
311
|
+
country: "US",
|
|
312
|
+
ghcnh_id: "USW00013967",
|
|
313
|
+
icao: "KOKC",
|
|
314
|
+
latitude: 35.3931,
|
|
315
|
+
longitude: -97.6007,
|
|
316
|
+
name: "Oklahoma City Will Rogers World",
|
|
317
|
+
tz: "America/Chicago"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
code: "PHL",
|
|
321
|
+
country: "US",
|
|
322
|
+
ghcnh_id: "USW00013739",
|
|
323
|
+
icao: "KPHL",
|
|
324
|
+
latitude: 39.8721,
|
|
325
|
+
longitude: -75.2411,
|
|
326
|
+
name: "Philadelphia International",
|
|
327
|
+
tz: "America/New_York"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
code: "PHX",
|
|
331
|
+
country: "US",
|
|
332
|
+
ghcnh_id: "USW00023183",
|
|
333
|
+
icao: "KPHX",
|
|
334
|
+
latitude: 33.4373,
|
|
335
|
+
longitude: -112.0078,
|
|
336
|
+
name: "Phoenix Sky Harbor International",
|
|
337
|
+
tz: "America/Phoenix"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
code: "SAT",
|
|
341
|
+
country: "US",
|
|
342
|
+
ghcnh_id: "USW00012921",
|
|
343
|
+
icao: "KSAT",
|
|
344
|
+
latitude: 29.5337,
|
|
345
|
+
longitude: -98.4698,
|
|
346
|
+
name: "San Antonio International",
|
|
347
|
+
tz: "America/Chicago"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
code: "SEA",
|
|
351
|
+
country: "US",
|
|
352
|
+
ghcnh_id: "USW00024233",
|
|
353
|
+
icao: "KSEA",
|
|
354
|
+
latitude: 47.4502,
|
|
355
|
+
longitude: -122.3088,
|
|
356
|
+
name: "Seattle-Tacoma International",
|
|
357
|
+
tz: "America/Los_Angeles"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
code: "SFO",
|
|
361
|
+
country: "US",
|
|
362
|
+
ghcnh_id: "USW00023234",
|
|
363
|
+
icao: "KSFO",
|
|
364
|
+
latitude: 37.6213,
|
|
365
|
+
longitude: -122.379,
|
|
366
|
+
name: "San Francisco International",
|
|
367
|
+
tz: "America/Los_Angeles"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
code: "LEBL",
|
|
371
|
+
country: "ES",
|
|
372
|
+
ghcnh_id: null,
|
|
373
|
+
icao: "LEBL",
|
|
374
|
+
latitude: 41.2974,
|
|
375
|
+
longitude: 2.0833,
|
|
376
|
+
name: "Barcelona El Prat",
|
|
377
|
+
tz: "Europe/Madrid"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
code: "LEMD",
|
|
381
|
+
country: "ES",
|
|
382
|
+
ghcnh_id: null,
|
|
383
|
+
icao: "LEMD",
|
|
384
|
+
latitude: 40.4719,
|
|
385
|
+
longitude: -3.5626,
|
|
386
|
+
name: "Madrid Barajas",
|
|
387
|
+
tz: "Europe/Madrid"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
code: "LFPB",
|
|
391
|
+
country: "FR",
|
|
392
|
+
ghcnh_id: null,
|
|
393
|
+
icao: "LFPB",
|
|
394
|
+
latitude: 48.9694,
|
|
395
|
+
longitude: 2.4414,
|
|
396
|
+
name: "Paris Le Bourget",
|
|
397
|
+
tz: "Europe/Paris"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
code: "LFPG",
|
|
401
|
+
country: "FR",
|
|
402
|
+
ghcnh_id: null,
|
|
403
|
+
icao: "LFPG",
|
|
404
|
+
latitude: 49.0097,
|
|
405
|
+
longitude: 2.5479,
|
|
406
|
+
name: "Paris Charles de Gaulle",
|
|
407
|
+
tz: "Europe/Paris"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
code: "LFPO",
|
|
411
|
+
country: "FR",
|
|
412
|
+
ghcnh_id: null,
|
|
413
|
+
icao: "LFPO",
|
|
414
|
+
latitude: 48.7233,
|
|
415
|
+
longitude: 2.3794,
|
|
416
|
+
name: "Paris Orly",
|
|
417
|
+
tz: "Europe/Paris"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
code: "LIMC",
|
|
421
|
+
country: "IT",
|
|
422
|
+
ghcnh_id: null,
|
|
423
|
+
icao: "LIMC",
|
|
424
|
+
latitude: 45.6306,
|
|
425
|
+
longitude: 8.7281,
|
|
426
|
+
name: "Milan Malpensa",
|
|
427
|
+
tz: "Europe/Rome"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
code: "LIRF",
|
|
431
|
+
country: "IT",
|
|
432
|
+
ghcnh_id: null,
|
|
433
|
+
icao: "LIRF",
|
|
434
|
+
latitude: 41.8003,
|
|
435
|
+
longitude: 12.2389,
|
|
436
|
+
name: "Rome Fiumicino",
|
|
437
|
+
tz: "Europe/Rome"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
code: "LOWW",
|
|
441
|
+
country: "AT",
|
|
442
|
+
ghcnh_id: null,
|
|
443
|
+
icao: "LOWW",
|
|
444
|
+
latitude: 48.1103,
|
|
445
|
+
longitude: 16.5697,
|
|
446
|
+
name: "Vienna International",
|
|
447
|
+
tz: "Europe/Vienna"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
code: "LSZH",
|
|
451
|
+
country: "CH",
|
|
452
|
+
ghcnh_id: null,
|
|
453
|
+
icao: "LSZH",
|
|
454
|
+
latitude: 47.4647,
|
|
455
|
+
longitude: 8.5492,
|
|
456
|
+
name: "Zurich",
|
|
457
|
+
tz: "Europe/Zurich"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
code: "NZAA",
|
|
461
|
+
country: "NZ",
|
|
462
|
+
ghcnh_id: null,
|
|
463
|
+
icao: "NZAA",
|
|
464
|
+
latitude: -37.0081,
|
|
465
|
+
longitude: 174.7917,
|
|
466
|
+
name: "Auckland",
|
|
467
|
+
tz: "Pacific/Auckland"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
code: "NZWN",
|
|
471
|
+
country: "NZ",
|
|
472
|
+
ghcnh_id: null,
|
|
473
|
+
icao: "NZWN",
|
|
474
|
+
latitude: -41.3272,
|
|
475
|
+
longitude: 174.8053,
|
|
476
|
+
name: "Wellington",
|
|
477
|
+
tz: "Pacific/Auckland"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
code: "OERK",
|
|
481
|
+
country: "SA",
|
|
482
|
+
ghcnh_id: null,
|
|
483
|
+
icao: "OERK",
|
|
484
|
+
latitude: 24.9576,
|
|
485
|
+
longitude: 46.6988,
|
|
486
|
+
name: "Riyadh King Khalid International",
|
|
487
|
+
tz: "Asia/Riyadh"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
code: "OMDB",
|
|
491
|
+
country: "AE",
|
|
492
|
+
ghcnh_id: null,
|
|
493
|
+
icao: "OMDB",
|
|
494
|
+
latitude: 25.2532,
|
|
495
|
+
longitude: 55.3657,
|
|
496
|
+
name: "Dubai International",
|
|
497
|
+
tz: "Asia/Dubai"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
code: "OTHH",
|
|
501
|
+
country: "QA",
|
|
502
|
+
ghcnh_id: null,
|
|
503
|
+
icao: "OTHH",
|
|
504
|
+
latitude: 25.2731,
|
|
505
|
+
longitude: 51.608,
|
|
506
|
+
name: "Doha Hamad International",
|
|
507
|
+
tz: "Asia/Qatar"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
code: "RCTP",
|
|
511
|
+
country: "TW",
|
|
512
|
+
ghcnh_id: null,
|
|
513
|
+
icao: "RCTP",
|
|
514
|
+
latitude: 25.0777,
|
|
515
|
+
longitude: 121.2328,
|
|
516
|
+
name: "Taipei Taoyuan",
|
|
517
|
+
tz: "Asia/Taipei"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
code: "RJAA",
|
|
521
|
+
country: "JP",
|
|
522
|
+
ghcnh_id: null,
|
|
523
|
+
icao: "RJAA",
|
|
524
|
+
latitude: 35.7647,
|
|
525
|
+
longitude: 140.3864,
|
|
526
|
+
name: "Tokyo Narita",
|
|
527
|
+
tz: "Asia/Tokyo"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
code: "RJTT",
|
|
531
|
+
country: "JP",
|
|
532
|
+
ghcnh_id: null,
|
|
533
|
+
icao: "RJTT",
|
|
534
|
+
latitude: 35.5522,
|
|
535
|
+
longitude: 139.78,
|
|
536
|
+
name: "Tokyo Haneda",
|
|
537
|
+
tz: "Asia/Tokyo"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
code: "RKSI",
|
|
541
|
+
country: "KR",
|
|
542
|
+
ghcnh_id: null,
|
|
543
|
+
icao: "RKSI",
|
|
544
|
+
latitude: 37.4691,
|
|
545
|
+
longitude: 126.4505,
|
|
546
|
+
name: "Seoul Incheon",
|
|
547
|
+
tz: "Asia/Seoul"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
code: "SAEZ",
|
|
551
|
+
country: "AR",
|
|
552
|
+
ghcnh_id: null,
|
|
553
|
+
icao: "SAEZ",
|
|
554
|
+
latitude: -34.8222,
|
|
555
|
+
longitude: -58.5358,
|
|
556
|
+
name: "Buenos Aires Ezeiza",
|
|
557
|
+
tz: "America/Argentina/Buenos_Aires"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
code: "SBGR",
|
|
561
|
+
country: "BR",
|
|
562
|
+
ghcnh_id: null,
|
|
563
|
+
icao: "SBGR",
|
|
564
|
+
latitude: -23.4356,
|
|
565
|
+
longitude: -46.4731,
|
|
566
|
+
name: "S\xE3o Paulo Guarulhos",
|
|
567
|
+
tz: "America/Sao_Paulo"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
code: "UUEE",
|
|
571
|
+
country: "RU",
|
|
572
|
+
ghcnh_id: null,
|
|
573
|
+
icao: "UUEE",
|
|
574
|
+
latitude: 55.9728,
|
|
575
|
+
longitude: 37.4147,
|
|
576
|
+
name: "Moscow Sheremetyevo",
|
|
577
|
+
tz: "Europe/Moscow"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
code: "VABB",
|
|
581
|
+
country: "IN",
|
|
582
|
+
ghcnh_id: null,
|
|
583
|
+
icao: "VABB",
|
|
584
|
+
latitude: 19.0887,
|
|
585
|
+
longitude: 72.8679,
|
|
586
|
+
name: "Mumbai Chhatrapati Shivaji",
|
|
587
|
+
tz: "Asia/Kolkata"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
code: "VHHH",
|
|
591
|
+
country: "HK",
|
|
592
|
+
ghcnh_id: null,
|
|
593
|
+
icao: "VHHH",
|
|
594
|
+
latitude: 22.308,
|
|
595
|
+
longitude: 113.9185,
|
|
596
|
+
name: "Hong Kong International",
|
|
597
|
+
tz: "Asia/Hong_Kong"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
code: "VIDP",
|
|
601
|
+
country: "IN",
|
|
602
|
+
ghcnh_id: null,
|
|
603
|
+
icao: "VIDP",
|
|
604
|
+
latitude: 28.5562,
|
|
605
|
+
longitude: 77.1,
|
|
606
|
+
name: "Delhi Indira Gandhi",
|
|
607
|
+
tz: "Asia/Kolkata"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
code: "VTBS",
|
|
611
|
+
country: "TH",
|
|
612
|
+
ghcnh_id: null,
|
|
613
|
+
icao: "VTBS",
|
|
614
|
+
latitude: 13.69,
|
|
615
|
+
longitude: 100.7501,
|
|
616
|
+
name: "Bangkok Suvarnabhumi",
|
|
617
|
+
tz: "Asia/Bangkok"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
code: "WSSS",
|
|
621
|
+
country: "SG",
|
|
622
|
+
ghcnh_id: null,
|
|
623
|
+
icao: "WSSS",
|
|
624
|
+
latitude: 1.3644,
|
|
625
|
+
longitude: 103.9915,
|
|
626
|
+
name: "Singapore Changi",
|
|
627
|
+
tz: "Asia/Singapore"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
code: "YBBN",
|
|
631
|
+
country: "AU",
|
|
632
|
+
ghcnh_id: null,
|
|
633
|
+
icao: "YBBN",
|
|
634
|
+
latitude: -27.3842,
|
|
635
|
+
longitude: 153.1175,
|
|
636
|
+
name: "Brisbane",
|
|
637
|
+
tz: "Australia/Brisbane"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
code: "YMML",
|
|
641
|
+
country: "AU",
|
|
642
|
+
ghcnh_id: null,
|
|
643
|
+
icao: "YMML",
|
|
644
|
+
latitude: -37.6733,
|
|
645
|
+
longitude: 144.8433,
|
|
646
|
+
name: "Melbourne Tullamarine",
|
|
647
|
+
tz: "Australia/Melbourne"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
code: "YSSY",
|
|
651
|
+
country: "AU",
|
|
652
|
+
ghcnh_id: null,
|
|
653
|
+
icao: "YSSY",
|
|
654
|
+
latitude: -33.9461,
|
|
655
|
+
longitude: 151.1772,
|
|
656
|
+
name: "Sydney Kingsford Smith",
|
|
657
|
+
tz: "Australia/Sydney"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
code: "ZBAA",
|
|
661
|
+
country: "CN",
|
|
662
|
+
ghcnh_id: null,
|
|
663
|
+
icao: "ZBAA",
|
|
664
|
+
latitude: 40.0801,
|
|
665
|
+
longitude: 116.5846,
|
|
666
|
+
name: "Beijing Capital",
|
|
667
|
+
tz: "Asia/Shanghai"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
code: "ZSPD",
|
|
671
|
+
country: "CN",
|
|
672
|
+
ghcnh_id: null,
|
|
673
|
+
icao: "ZSPD",
|
|
674
|
+
latitude: 31.1443,
|
|
675
|
+
longitude: 121.8083,
|
|
676
|
+
name: "Shanghai Pudong",
|
|
677
|
+
tz: "Asia/Shanghai"
|
|
678
|
+
}
|
|
679
|
+
];
|
|
680
|
+
var STATION_BY_CODE = /* @__PURE__ */ new Map([
|
|
681
|
+
["ATL", STATIONS[10]],
|
|
682
|
+
["AUS", STATIONS[11]],
|
|
683
|
+
["BOS", STATIONS[12]],
|
|
684
|
+
["DCA", STATIONS[13]],
|
|
685
|
+
["DEN", STATIONS[14]],
|
|
686
|
+
["DFW", STATIONS[15]],
|
|
687
|
+
["EDDB", STATIONS[0]],
|
|
688
|
+
["EDDF", STATIONS[1]],
|
|
689
|
+
["EDDM", STATIONS[2]],
|
|
690
|
+
["EFHK", STATIONS[3]],
|
|
691
|
+
["EGKK", STATIONS[4]],
|
|
692
|
+
["EGLL", STATIONS[5]],
|
|
693
|
+
["EHAM", STATIONS[6]],
|
|
694
|
+
["EKCH", STATIONS[7]],
|
|
695
|
+
["EPWA", STATIONS[8]],
|
|
696
|
+
["ESSA", STATIONS[9]],
|
|
697
|
+
["HOU", STATIONS[16]],
|
|
698
|
+
["LAS", STATIONS[17]],
|
|
699
|
+
["LAX", STATIONS[18]],
|
|
700
|
+
["LEBL", STATIONS[30]],
|
|
701
|
+
["LEMD", STATIONS[31]],
|
|
702
|
+
["LFPB", STATIONS[32]],
|
|
703
|
+
["LFPG", STATIONS[33]],
|
|
704
|
+
["LFPO", STATIONS[34]],
|
|
705
|
+
["LIMC", STATIONS[35]],
|
|
706
|
+
["LIRF", STATIONS[36]],
|
|
707
|
+
["LOWW", STATIONS[37]],
|
|
708
|
+
["LSZH", STATIONS[38]],
|
|
709
|
+
["MDW", STATIONS[19]],
|
|
710
|
+
["MIA", STATIONS[20]],
|
|
711
|
+
["MSP", STATIONS[21]],
|
|
712
|
+
["MSY", STATIONS[22]],
|
|
713
|
+
["NYC", STATIONS[23]],
|
|
714
|
+
["NZAA", STATIONS[39]],
|
|
715
|
+
["NZWN", STATIONS[40]],
|
|
716
|
+
["OERK", STATIONS[41]],
|
|
717
|
+
["OKC", STATIONS[24]],
|
|
718
|
+
["OMDB", STATIONS[42]],
|
|
719
|
+
["OTHH", STATIONS[43]],
|
|
720
|
+
["PHL", STATIONS[25]],
|
|
721
|
+
["PHX", STATIONS[26]],
|
|
722
|
+
["RCTP", STATIONS[44]],
|
|
723
|
+
["RJAA", STATIONS[45]],
|
|
724
|
+
["RJTT", STATIONS[46]],
|
|
725
|
+
["RKSI", STATIONS[47]],
|
|
726
|
+
["SAEZ", STATIONS[48]],
|
|
727
|
+
["SAT", STATIONS[27]],
|
|
728
|
+
["SBGR", STATIONS[49]],
|
|
729
|
+
["SEA", STATIONS[28]],
|
|
730
|
+
["SFO", STATIONS[29]],
|
|
731
|
+
["UUEE", STATIONS[50]],
|
|
732
|
+
["VABB", STATIONS[51]],
|
|
733
|
+
["VHHH", STATIONS[52]],
|
|
734
|
+
["VIDP", STATIONS[53]],
|
|
735
|
+
["VTBS", STATIONS[54]],
|
|
736
|
+
["WSSS", STATIONS[55]],
|
|
737
|
+
["YBBN", STATIONS[56]],
|
|
738
|
+
["YMML", STATIONS[57]],
|
|
739
|
+
["YSSY", STATIONS[58]],
|
|
740
|
+
["ZBAA", STATIONS[59]],
|
|
741
|
+
["ZSPD", STATIONS[60]]
|
|
742
|
+
]);
|
|
743
|
+
var STATION_BY_ICAO = /* @__PURE__ */ new Map([
|
|
744
|
+
["EDDB", STATIONS[0]],
|
|
745
|
+
["EDDF", STATIONS[1]],
|
|
746
|
+
["EDDM", STATIONS[2]],
|
|
747
|
+
["EFHK", STATIONS[3]],
|
|
748
|
+
["EGKK", STATIONS[4]],
|
|
749
|
+
["EGLL", STATIONS[5]],
|
|
750
|
+
["EHAM", STATIONS[6]],
|
|
751
|
+
["EKCH", STATIONS[7]],
|
|
752
|
+
["EPWA", STATIONS[8]],
|
|
753
|
+
["ESSA", STATIONS[9]],
|
|
754
|
+
["KATL", STATIONS[10]],
|
|
755
|
+
["KAUS", STATIONS[11]],
|
|
756
|
+
["KBOS", STATIONS[12]],
|
|
757
|
+
["KDCA", STATIONS[13]],
|
|
758
|
+
["KDEN", STATIONS[14]],
|
|
759
|
+
["KDFW", STATIONS[15]],
|
|
760
|
+
["KHOU", STATIONS[16]],
|
|
761
|
+
["KLAS", STATIONS[17]],
|
|
762
|
+
["KLAX", STATIONS[18]],
|
|
763
|
+
["KMDW", STATIONS[19]],
|
|
764
|
+
["KMIA", STATIONS[20]],
|
|
765
|
+
["KMSP", STATIONS[21]],
|
|
766
|
+
["KMSY", STATIONS[22]],
|
|
767
|
+
["KNYC", STATIONS[23]],
|
|
768
|
+
["KOKC", STATIONS[24]],
|
|
769
|
+
["KPHL", STATIONS[25]],
|
|
770
|
+
["KPHX", STATIONS[26]],
|
|
771
|
+
["KSAT", STATIONS[27]],
|
|
772
|
+
["KSEA", STATIONS[28]],
|
|
773
|
+
["KSFO", STATIONS[29]],
|
|
774
|
+
["LEBL", STATIONS[30]],
|
|
775
|
+
["LEMD", STATIONS[31]],
|
|
776
|
+
["LFPB", STATIONS[32]],
|
|
777
|
+
["LFPG", STATIONS[33]],
|
|
778
|
+
["LFPO", STATIONS[34]],
|
|
779
|
+
["LIMC", STATIONS[35]],
|
|
780
|
+
["LIRF", STATIONS[36]],
|
|
781
|
+
["LOWW", STATIONS[37]],
|
|
782
|
+
["LSZH", STATIONS[38]],
|
|
783
|
+
["NZAA", STATIONS[39]],
|
|
784
|
+
["NZWN", STATIONS[40]],
|
|
785
|
+
["OERK", STATIONS[41]],
|
|
786
|
+
["OMDB", STATIONS[42]],
|
|
787
|
+
["OTHH", STATIONS[43]],
|
|
788
|
+
["RCTP", STATIONS[44]],
|
|
789
|
+
["RJAA", STATIONS[45]],
|
|
790
|
+
["RJTT", STATIONS[46]],
|
|
791
|
+
["RKSI", STATIONS[47]],
|
|
792
|
+
["SAEZ", STATIONS[48]],
|
|
793
|
+
["SBGR", STATIONS[49]],
|
|
794
|
+
["UUEE", STATIONS[50]],
|
|
795
|
+
["VABB", STATIONS[51]],
|
|
796
|
+
["VHHH", STATIONS[52]],
|
|
797
|
+
["VIDP", STATIONS[53]],
|
|
798
|
+
["VTBS", STATIONS[54]],
|
|
799
|
+
["WSSS", STATIONS[55]],
|
|
800
|
+
["YBBN", STATIONS[56]],
|
|
801
|
+
["YMML", STATIONS[57]],
|
|
802
|
+
["YSSY", STATIONS[58]],
|
|
803
|
+
["ZBAA", STATIONS[59]],
|
|
804
|
+
["ZSPD", STATIONS[60]]
|
|
805
|
+
]);
|
|
806
|
+
|
|
807
|
+
// src/data/generated/source-priority.ts
|
|
808
|
+
var OBSERVATION_SOURCE_PRIORITY = {
|
|
809
|
+
awc: 3,
|
|
810
|
+
ghcnh: 1,
|
|
811
|
+
iem: 2
|
|
812
|
+
};
|
|
813
|
+
var CLIMATE_REPORT_TYPE_PRIORITY = {
|
|
814
|
+
correction: 2,
|
|
815
|
+
estimated: 0,
|
|
816
|
+
final: 3,
|
|
817
|
+
ncei_final: 2.5,
|
|
818
|
+
preliminary: 1
|
|
819
|
+
};
|
|
820
|
+
var LIVE_V1_POLICY = {
|
|
821
|
+
name: "LIVE_V1",
|
|
822
|
+
secondaryKey: [
|
|
823
|
+
"source_received_at",
|
|
824
|
+
"ingestion_id"
|
|
825
|
+
],
|
|
826
|
+
sourcePriority: {
|
|
827
|
+
awc: 3,
|
|
828
|
+
ghcnh: 1,
|
|
829
|
+
iem: 2,
|
|
830
|
+
ncei: 0
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
// src/data/generated/qc-alpha-rules.ts
|
|
835
|
+
var QC_ALPHA_RULES = [
|
|
836
|
+
{
|
|
837
|
+
bit_position: 0,
|
|
838
|
+
description: "Temperature outside [-89C, 57C] (world-record bounds).",
|
|
839
|
+
field: "temp_c",
|
|
840
|
+
rule_id: "temp_c.out_of_range"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
bit_position: 1,
|
|
844
|
+
description: "Dewpoint greater than temperature (physically impossible).",
|
|
845
|
+
field: "dew_point_c",
|
|
846
|
+
rule_id: "dew_point_c.exceeds_temp"
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
bit_position: 2,
|
|
850
|
+
description: "Wind speed negative.",
|
|
851
|
+
field: "wind_speed_ms",
|
|
852
|
+
rule_id: "wind_speed_ms.negative"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
bit_position: 3,
|
|
856
|
+
description: "Wind direction outside [0, 360].",
|
|
857
|
+
field: "wind_dir_deg",
|
|
858
|
+
rule_id: "wind_dir_deg.out_of_range"
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
bit_position: 4,
|
|
862
|
+
description: "Sea-level pressure outside [870, 1085] mb.",
|
|
863
|
+
field: "slp_hpa",
|
|
864
|
+
rule_id: "slp_hpa.out_of_range"
|
|
865
|
+
}
|
|
866
|
+
];
|
|
867
|
+
var QC_ALPHA_RULES_BY_ID = /* @__PURE__ */ new Map([
|
|
868
|
+
["temp_c.out_of_range", QC_ALPHA_RULES[0]],
|
|
869
|
+
["dew_point_c.exceeds_temp", QC_ALPHA_RULES[1]],
|
|
870
|
+
["wind_speed_ms.negative", QC_ALPHA_RULES[2]],
|
|
871
|
+
["wind_dir_deg.out_of_range", QC_ALPHA_RULES[3]],
|
|
872
|
+
["slp_hpa.out_of_range", QC_ALPHA_RULES[4]]
|
|
873
|
+
]);
|
|
874
|
+
|
|
875
|
+
// src/exceptions/index.ts
|
|
876
|
+
function toJsonSafe(value, seen) {
|
|
877
|
+
const visited = seen ?? /* @__PURE__ */ new WeakSet();
|
|
878
|
+
if (value === null || value === void 0) {
|
|
879
|
+
return null;
|
|
880
|
+
}
|
|
881
|
+
if (typeof value === "boolean") {
|
|
882
|
+
return value;
|
|
883
|
+
}
|
|
884
|
+
if (typeof value === "string") {
|
|
885
|
+
return value;
|
|
886
|
+
}
|
|
887
|
+
if (typeof value === "number") {
|
|
888
|
+
return Number.isFinite(value) ? value : null;
|
|
889
|
+
}
|
|
890
|
+
if (typeof value === "bigint") {
|
|
891
|
+
if (value >= BigInt(Number.MIN_SAFE_INTEGER) && value <= BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
892
|
+
return Number(value);
|
|
893
|
+
}
|
|
894
|
+
return { _repr_only: true, value: value.toString() };
|
|
895
|
+
}
|
|
896
|
+
if (value instanceof Date) {
|
|
897
|
+
if (Number.isNaN(value.getTime())) {
|
|
898
|
+
return null;
|
|
899
|
+
}
|
|
900
|
+
return value.toISOString();
|
|
901
|
+
}
|
|
902
|
+
if (Array.isArray(value)) {
|
|
903
|
+
if (visited.has(value)) {
|
|
904
|
+
return { _cycle: true, value: String(value) };
|
|
905
|
+
}
|
|
906
|
+
visited.add(value);
|
|
907
|
+
try {
|
|
908
|
+
return value.map((item) => toJsonSafe(item, visited));
|
|
909
|
+
} finally {
|
|
910
|
+
visited.delete(value);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
if (typeof value === "object") {
|
|
914
|
+
if (visited.has(value)) {
|
|
915
|
+
return { _cycle: true, value: String(value) };
|
|
916
|
+
}
|
|
917
|
+
visited.add(value);
|
|
918
|
+
try {
|
|
919
|
+
const out = {};
|
|
920
|
+
for (const key of Object.keys(value)) {
|
|
921
|
+
if (typeof key !== "string") {
|
|
922
|
+
throw new TypeError(`toJsonSafe dict keys must be string; got ${typeof key}`);
|
|
923
|
+
}
|
|
924
|
+
out[key] = toJsonSafe(value[key], visited);
|
|
925
|
+
}
|
|
926
|
+
return out;
|
|
927
|
+
} finally {
|
|
928
|
+
visited.delete(value);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return { _repr_only: true, value: String(value) };
|
|
932
|
+
}
|
|
933
|
+
var TradewindsError = class extends Error {
|
|
934
|
+
/** Subclass override — the stable string enum surfaced via `errorCode`. */
|
|
935
|
+
static defaultErrorCode = "TRADEWINDS_ERROR";
|
|
936
|
+
errorCode;
|
|
937
|
+
source;
|
|
938
|
+
requestId;
|
|
939
|
+
constructor(message = "", options = {}) {
|
|
940
|
+
super(message);
|
|
941
|
+
this.name = new.target.name;
|
|
942
|
+
const ctor = this.constructor;
|
|
943
|
+
this.errorCode = options.errorCode ?? ctor.defaultErrorCode;
|
|
944
|
+
this.source = options.source ?? null;
|
|
945
|
+
this.requestId = options.requestId ?? null;
|
|
946
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Subclass hook returning the structured attributes for `toDict`.
|
|
950
|
+
* Values are passed through `toJsonSafe` by `toDict()`, so subclasses
|
|
951
|
+
* don't need to coerce values themselves.
|
|
952
|
+
*/
|
|
953
|
+
payload() {
|
|
954
|
+
return {
|
|
955
|
+
error_code: this.errorCode,
|
|
956
|
+
message: this.message,
|
|
957
|
+
source: this.source,
|
|
958
|
+
request_id: this.requestId
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
/** Return a JSON-safe dict suitable for MCP `error.data`. */
|
|
962
|
+
toDict() {
|
|
963
|
+
const safe = toJsonSafe(this.payload());
|
|
964
|
+
return safe;
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
var SourceUnavailableError = class extends TradewindsError {
|
|
968
|
+
static defaultErrorCode = "SOURCE_UNAVAILABLE";
|
|
969
|
+
httpStatus;
|
|
970
|
+
retryable;
|
|
971
|
+
retryAfterS;
|
|
972
|
+
underlying;
|
|
973
|
+
url;
|
|
974
|
+
constructor(message = "", options = {}) {
|
|
975
|
+
super(message, options);
|
|
976
|
+
this.httpStatus = options.httpStatus ?? null;
|
|
977
|
+
this.retryable = options.retryable ?? false;
|
|
978
|
+
this.retryAfterS = options.retryAfterS ?? null;
|
|
979
|
+
this.underlying = options.underlying ?? "";
|
|
980
|
+
this.url = options.url ?? null;
|
|
981
|
+
}
|
|
982
|
+
payload() {
|
|
983
|
+
return {
|
|
984
|
+
...super.payload(),
|
|
985
|
+
http_status: this.httpStatus,
|
|
986
|
+
retryable: this.retryable,
|
|
987
|
+
retry_after_s: this.retryAfterS,
|
|
988
|
+
underlying: this.underlying,
|
|
989
|
+
url: this.url
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
var SchemaValidationError = class extends TradewindsError {
|
|
994
|
+
static defaultErrorCode = "SCHEMA_VALIDATION_FAILED";
|
|
995
|
+
schemaId;
|
|
996
|
+
violations;
|
|
997
|
+
quarantineCount;
|
|
998
|
+
sampleViolations;
|
|
999
|
+
constructor(message, options) {
|
|
1000
|
+
super(message, options);
|
|
1001
|
+
this.schemaId = options.schemaId;
|
|
1002
|
+
this.violations = [...options.violations ?? []];
|
|
1003
|
+
this.quarantineCount = options.quarantineCount ?? 0;
|
|
1004
|
+
this.sampleViolations = [...options.sampleViolations ?? []];
|
|
1005
|
+
}
|
|
1006
|
+
payload() {
|
|
1007
|
+
return {
|
|
1008
|
+
...super.payload(),
|
|
1009
|
+
schema_id: this.schemaId,
|
|
1010
|
+
violations: this.violations,
|
|
1011
|
+
quarantine_count: this.quarantineCount,
|
|
1012
|
+
sample_violations: this.sampleViolations
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
var SourceMismatchError = class extends TradewindsError {
|
|
1017
|
+
static defaultErrorCode = "SOURCE_MISMATCH";
|
|
1018
|
+
/** Canonical role-name vocabulary (design.md §R). */
|
|
1019
|
+
static VALID_ROLES = /* @__PURE__ */ new Set([
|
|
1020
|
+
"observations",
|
|
1021
|
+
"forecasts",
|
|
1022
|
+
"settlement"
|
|
1023
|
+
]);
|
|
1024
|
+
schemaSource;
|
|
1025
|
+
dataSource;
|
|
1026
|
+
role;
|
|
1027
|
+
catalogWarning;
|
|
1028
|
+
constructor(message, options) {
|
|
1029
|
+
super(message, options);
|
|
1030
|
+
this.schemaSource = options.schemaSource;
|
|
1031
|
+
this.dataSource = options.dataSource;
|
|
1032
|
+
this.role = options.role ?? null;
|
|
1033
|
+
this.catalogWarning = options.catalogWarning ?? null;
|
|
1034
|
+
}
|
|
1035
|
+
payload() {
|
|
1036
|
+
return {
|
|
1037
|
+
...super.payload(),
|
|
1038
|
+
schema_source: this.schemaSource,
|
|
1039
|
+
data_source: this.dataSource,
|
|
1040
|
+
role: this.role,
|
|
1041
|
+
catalog_warning: this.catalogWarning
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
var LeakageError = class extends TradewindsError {
|
|
1046
|
+
static defaultErrorCode = "LEAKAGE_DETECTED";
|
|
1047
|
+
asOf;
|
|
1048
|
+
violatingCount;
|
|
1049
|
+
sampleViolations;
|
|
1050
|
+
constructor(message, options) {
|
|
1051
|
+
super(message, options);
|
|
1052
|
+
this.asOf = options.asOf;
|
|
1053
|
+
this.violatingCount = options.violatingCount;
|
|
1054
|
+
this.sampleViolations = [...options.sampleViolations ?? []];
|
|
1055
|
+
}
|
|
1056
|
+
payload() {
|
|
1057
|
+
return {
|
|
1058
|
+
...super.payload(),
|
|
1059
|
+
as_of: this.asOf,
|
|
1060
|
+
violating_count: this.violatingCount,
|
|
1061
|
+
sample_violations: this.sampleViolations
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
var TemporalDriftError = class extends TradewindsError {
|
|
1066
|
+
static defaultErrorCode = "TEMPORAL_DRIFT";
|
|
1067
|
+
schemaId;
|
|
1068
|
+
assertedRange;
|
|
1069
|
+
violatingRows;
|
|
1070
|
+
sampleViolations;
|
|
1071
|
+
constructor(message, options) {
|
|
1072
|
+
super(message, options);
|
|
1073
|
+
this.schemaId = options.schemaId;
|
|
1074
|
+
this.assertedRange = [options.assertedRange[0], options.assertedRange[1]];
|
|
1075
|
+
this.violatingRows = options.violatingRows;
|
|
1076
|
+
this.sampleViolations = [...options.sampleViolations ?? []];
|
|
1077
|
+
}
|
|
1078
|
+
payload() {
|
|
1079
|
+
return {
|
|
1080
|
+
...super.payload(),
|
|
1081
|
+
schema_id: this.schemaId,
|
|
1082
|
+
asserted_range: [this.assertedRange[0], this.assertedRange[1]],
|
|
1083
|
+
violating_rows: this.violatingRows,
|
|
1084
|
+
sample_violations: this.sampleViolations
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
var PayloadTooLargeError = class extends TradewindsError {
|
|
1089
|
+
static defaultErrorCode = "PAYLOAD_TOO_LARGE";
|
|
1090
|
+
declaredSize;
|
|
1091
|
+
limit;
|
|
1092
|
+
acceptedModes;
|
|
1093
|
+
constructor(message, options) {
|
|
1094
|
+
super(message, options);
|
|
1095
|
+
this.declaredSize = options.declaredSize;
|
|
1096
|
+
this.limit = options.limit;
|
|
1097
|
+
this.acceptedModes = [...options.acceptedModes ?? []];
|
|
1098
|
+
}
|
|
1099
|
+
payload() {
|
|
1100
|
+
return {
|
|
1101
|
+
...super.payload(),
|
|
1102
|
+
declared_size: this.declaredSize,
|
|
1103
|
+
limit: this.limit,
|
|
1104
|
+
accepted_modes: this.acceptedModes
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
};
|
|
1108
|
+
var DeferredMarketError = class extends TradewindsError {
|
|
1109
|
+
static defaultErrorCode = "DEFERRED_MARKET";
|
|
1110
|
+
};
|
|
1111
|
+
var PolymarketEventError = class extends TradewindsError {
|
|
1112
|
+
static defaultErrorCode = "POLYMARKET_EVENT_INVALID";
|
|
1113
|
+
};
|
|
1114
|
+
var TherminalError = class extends TradewindsError {
|
|
1115
|
+
static defaultErrorCode = "HTTP_ERROR";
|
|
1116
|
+
statusCode;
|
|
1117
|
+
constructor(message, options = {}) {
|
|
1118
|
+
super(message, options);
|
|
1119
|
+
this.statusCode = options.statusCode ?? null;
|
|
1120
|
+
}
|
|
1121
|
+
payload() {
|
|
1122
|
+
return {
|
|
1123
|
+
...super.payload(),
|
|
1124
|
+
status_code: this.statusCode
|
|
1125
|
+
};
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
var NotFoundError = class extends TherminalError {
|
|
1129
|
+
static defaultErrorCode = "HTTP_NOT_FOUND";
|
|
1130
|
+
constructor(message = "Resource not found", options = {}) {
|
|
1131
|
+
super(message, { ...options, statusCode: options.statusCode ?? 404 });
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
var RateLimitError = class extends TherminalError {
|
|
1135
|
+
static defaultErrorCode = "HTTP_RATE_LIMITED";
|
|
1136
|
+
retryAfter;
|
|
1137
|
+
constructor(retryAfter = 1, options = {}) {
|
|
1138
|
+
const msg = `Rate limit exceeded. Retry after ${retryAfter ?? "?"}s`;
|
|
1139
|
+
super(msg, { ...options, statusCode: options.statusCode ?? 429 });
|
|
1140
|
+
this.retryAfter = retryAfter;
|
|
1141
|
+
}
|
|
1142
|
+
payload() {
|
|
1143
|
+
return {
|
|
1144
|
+
...super.payload(),
|
|
1145
|
+
retry_after: this.retryAfter
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
};
|
|
1149
|
+
var ValidationError = class extends TherminalError {
|
|
1150
|
+
static defaultErrorCode = "HTTP_BAD_REQUEST";
|
|
1151
|
+
constructor(message = "Invalid request", options = {}) {
|
|
1152
|
+
super(message, { ...options, statusCode: options.statusCode ?? 400 });
|
|
1153
|
+
}
|
|
1154
|
+
};
|
|
1155
|
+
var AuthenticationError = class extends TherminalError {
|
|
1156
|
+
static defaultErrorCode = "HTTP_UNAUTHORIZED";
|
|
1157
|
+
constructor(message = "Authentication required", options = {}) {
|
|
1158
|
+
super(message, { ...options, statusCode: options.statusCode ?? 401 });
|
|
1159
|
+
}
|
|
1160
|
+
};
|
|
1161
|
+
var ForbiddenError = class extends TherminalError {
|
|
1162
|
+
static defaultErrorCode = "HTTP_FORBIDDEN";
|
|
1163
|
+
constructor(message = "Access denied", options = {}) {
|
|
1164
|
+
super(message, { ...options, statusCode: options.statusCode ?? 403 });
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
var ServerError = class extends TherminalError {
|
|
1168
|
+
static defaultErrorCode = "HTTP_SERVER_ERROR";
|
|
1169
|
+
constructor(message = "Server error", options = {}) {
|
|
1170
|
+
super(message, { ...options, statusCode: options.statusCode ?? 500 });
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1173
|
+
var LiveStreamError = class extends TradewindsError {
|
|
1174
|
+
static defaultErrorCode = "LIVE_STREAM_ERROR";
|
|
1175
|
+
};
|
|
1176
|
+
var NoLiveDataError = class extends LiveStreamError {
|
|
1177
|
+
static defaultErrorCode = "NO_LIVE_DATA";
|
|
1178
|
+
station;
|
|
1179
|
+
constructor(message = "", options) {
|
|
1180
|
+
super(message, { ...options, source: options.source });
|
|
1181
|
+
this.station = options.station;
|
|
1182
|
+
}
|
|
1183
|
+
payload() {
|
|
1184
|
+
return {
|
|
1185
|
+
...super.payload(),
|
|
1186
|
+
station: this.station
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
// src/snapshot.ts
|
|
1192
|
+
var _STATION_TZ = Object.freeze({
|
|
1193
|
+
// Eastern (UTC-5 standard / UTC-4 DST)
|
|
1194
|
+
NYC: "America/New_York",
|
|
1195
|
+
JFK: "America/New_York",
|
|
1196
|
+
LGA: "America/New_York",
|
|
1197
|
+
EWR: "America/New_York",
|
|
1198
|
+
ATL: "America/New_York",
|
|
1199
|
+
BOS: "America/New_York",
|
|
1200
|
+
PHL: "America/New_York",
|
|
1201
|
+
DCA: "America/New_York",
|
|
1202
|
+
IAD: "America/New_York",
|
|
1203
|
+
BWI: "America/New_York",
|
|
1204
|
+
MIA: "America/New_York",
|
|
1205
|
+
MCO: "America/New_York",
|
|
1206
|
+
TPA: "America/New_York",
|
|
1207
|
+
CLT: "America/New_York",
|
|
1208
|
+
RDU: "America/New_York",
|
|
1209
|
+
CLE: "America/New_York",
|
|
1210
|
+
PIT: "America/New_York",
|
|
1211
|
+
BUF: "America/New_York",
|
|
1212
|
+
DTW: "America/Detroit",
|
|
1213
|
+
IND: "America/Indiana/Indianapolis",
|
|
1214
|
+
CVG: "America/New_York",
|
|
1215
|
+
CMH: "America/New_York",
|
|
1216
|
+
SYR: "America/New_York",
|
|
1217
|
+
ALB: "America/New_York",
|
|
1218
|
+
BTV: "America/New_York",
|
|
1219
|
+
ORF: "America/New_York",
|
|
1220
|
+
RIC: "America/New_York",
|
|
1221
|
+
GSO: "America/New_York",
|
|
1222
|
+
CHS: "America/New_York",
|
|
1223
|
+
SAV: "America/New_York",
|
|
1224
|
+
JAX: "America/New_York",
|
|
1225
|
+
RSW: "America/New_York",
|
|
1226
|
+
PBI: "America/New_York",
|
|
1227
|
+
FLL: "America/New_York",
|
|
1228
|
+
// Central (UTC-6 standard / UTC-5 DST)
|
|
1229
|
+
ORD: "America/Chicago",
|
|
1230
|
+
MDW: "America/Chicago",
|
|
1231
|
+
DFW: "America/Chicago",
|
|
1232
|
+
DAL: "America/Chicago",
|
|
1233
|
+
IAH: "America/Chicago",
|
|
1234
|
+
HOU: "America/Chicago",
|
|
1235
|
+
MSP: "America/Chicago",
|
|
1236
|
+
STL: "America/Chicago",
|
|
1237
|
+
MCI: "America/Chicago",
|
|
1238
|
+
OMA: "America/Chicago",
|
|
1239
|
+
MKE: "America/Chicago",
|
|
1240
|
+
MSY: "America/Chicago",
|
|
1241
|
+
MEM: "America/Chicago",
|
|
1242
|
+
BNA: "America/Chicago",
|
|
1243
|
+
OKC: "America/Chicago",
|
|
1244
|
+
SAT: "America/Chicago",
|
|
1245
|
+
AUS: "America/Chicago",
|
|
1246
|
+
DSM: "America/Chicago",
|
|
1247
|
+
TUL: "America/Chicago",
|
|
1248
|
+
LIT: "America/Chicago",
|
|
1249
|
+
BIR: "America/Chicago",
|
|
1250
|
+
SDF: "America/Chicago",
|
|
1251
|
+
HSV: "America/Chicago",
|
|
1252
|
+
BHM: "America/Chicago",
|
|
1253
|
+
MOB: "America/Chicago",
|
|
1254
|
+
BTR: "America/Chicago",
|
|
1255
|
+
SHV: "America/Chicago",
|
|
1256
|
+
// Mountain (UTC-7 standard / UTC-6 DST)
|
|
1257
|
+
DEN: "America/Denver",
|
|
1258
|
+
SLC: "America/Denver",
|
|
1259
|
+
ABQ: "America/Denver",
|
|
1260
|
+
BOI: "America/Boise",
|
|
1261
|
+
BZN: "America/Denver",
|
|
1262
|
+
GJT: "America/Denver",
|
|
1263
|
+
// Arizona: no DST (UTC-7 always)
|
|
1264
|
+
PHX: "America/Phoenix",
|
|
1265
|
+
TUS: "America/Phoenix",
|
|
1266
|
+
// Pacific (UTC-8 standard / UTC-7 DST)
|
|
1267
|
+
LAX: "America/Los_Angeles",
|
|
1268
|
+
SFO: "America/Los_Angeles",
|
|
1269
|
+
SEA: "America/Los_Angeles",
|
|
1270
|
+
PDX: "America/Los_Angeles",
|
|
1271
|
+
LAS: "America/Los_Angeles",
|
|
1272
|
+
SAN: "America/Los_Angeles",
|
|
1273
|
+
OAK: "America/Los_Angeles",
|
|
1274
|
+
SJC: "America/Los_Angeles",
|
|
1275
|
+
SMF: "America/Los_Angeles",
|
|
1276
|
+
RNO: "America/Los_Angeles",
|
|
1277
|
+
FAT: "America/Los_Angeles",
|
|
1278
|
+
SNA: "America/Los_Angeles",
|
|
1279
|
+
ONT: "America/Los_Angeles",
|
|
1280
|
+
BUR: "America/Los_Angeles",
|
|
1281
|
+
// Alaska (UTC-9 standard / UTC-8 DST)
|
|
1282
|
+
ANC: "America/Anchorage",
|
|
1283
|
+
FAI: "America/Anchorage",
|
|
1284
|
+
JNU: "America/Juneau",
|
|
1285
|
+
// Hawaii (UTC-10, no DST)
|
|
1286
|
+
HNL: "Pacific/Honolulu",
|
|
1287
|
+
OGG: "Pacific/Honolulu",
|
|
1288
|
+
KOA: "Pacific/Honolulu",
|
|
1289
|
+
// International (iter-6 H12): minimal set required to un-skip the
|
|
1290
|
+
// case-5 RJTT year-wrap cache behavior test. Python's
|
|
1291
|
+
// `mostlyright.snapshot._resolve_tz` falls back to the broader STATIONS
|
|
1292
|
+
// registry for intl ICAOs; the TS port hasn't ported that fallback
|
|
1293
|
+
// yet (tracked as TS-W6 — exhaustive intl-station tz coverage). This
|
|
1294
|
+
// entry closes H12 cleanly without pulling the whole STATIONS map in.
|
|
1295
|
+
// ICAO key (RJTT) — international stations have no 3-letter NWS code.
|
|
1296
|
+
// Tokyo Haneda — UTC+9 LST, no DST.
|
|
1297
|
+
RJTT: "Asia/Tokyo"
|
|
1298
|
+
});
|
|
1299
|
+
var _JAN_REF = new Date(Date.UTC(2024, 0, 15, 12, 0, 0));
|
|
1300
|
+
var _CLI_PUBLICATION_DELAY_HOURS = 10;
|
|
1301
|
+
var _MARKET_CLOSE_HOUR_LST = 16;
|
|
1302
|
+
var _MARKET_CLOSE_MINUTE_LST = 30;
|
|
1303
|
+
var _OFFSET_CACHE = /* @__PURE__ */ new Map();
|
|
1304
|
+
function _lstOffsetHours(stationTz) {
|
|
1305
|
+
const cached = _OFFSET_CACHE.get(stationTz);
|
|
1306
|
+
if (cached !== void 0) return cached;
|
|
1307
|
+
const fmt = new Intl.DateTimeFormat("en-US", {
|
|
1308
|
+
timeZone: stationTz,
|
|
1309
|
+
hour12: false,
|
|
1310
|
+
year: "numeric",
|
|
1311
|
+
month: "2-digit",
|
|
1312
|
+
day: "2-digit",
|
|
1313
|
+
hour: "2-digit",
|
|
1314
|
+
minute: "2-digit",
|
|
1315
|
+
second: "2-digit"
|
|
1316
|
+
});
|
|
1317
|
+
const parts = fmt.formatToParts(_JAN_REF);
|
|
1318
|
+
const get = (type) => {
|
|
1319
|
+
const part = parts.find((p) => p.type === type);
|
|
1320
|
+
if (!part) {
|
|
1321
|
+
throw new Error(`Intl.DateTimeFormat missing ${type} for tz=${stationTz}`);
|
|
1322
|
+
}
|
|
1323
|
+
return Number(part.value);
|
|
1324
|
+
};
|
|
1325
|
+
const year = get("year");
|
|
1326
|
+
const month = get("month");
|
|
1327
|
+
const day = get("day");
|
|
1328
|
+
let hour = get("hour");
|
|
1329
|
+
const minute = get("minute");
|
|
1330
|
+
const second = get("second");
|
|
1331
|
+
if (hour === 24) hour = 0;
|
|
1332
|
+
const localAsUtc = Date.UTC(year, month - 1, day, hour, minute, second);
|
|
1333
|
+
const offsetMs = localAsUtc - _JAN_REF.getTime();
|
|
1334
|
+
const offsetHours = offsetMs / 36e5;
|
|
1335
|
+
_OFFSET_CACHE.set(stationTz, offsetHours);
|
|
1336
|
+
return offsetHours;
|
|
1337
|
+
}
|
|
1338
|
+
function _stationCodeNormalized(station) {
|
|
1339
|
+
const s = station.trim().toUpperCase();
|
|
1340
|
+
if (s.length === 4 && s.startsWith("K")) {
|
|
1341
|
+
return s.substring(1);
|
|
1342
|
+
}
|
|
1343
|
+
return s;
|
|
1344
|
+
}
|
|
1345
|
+
function _resolveStationTz(station, tzOverride) {
|
|
1346
|
+
if (tzOverride) return tzOverride;
|
|
1347
|
+
const code = _stationCodeNormalized(station);
|
|
1348
|
+
const tz = _STATION_TZ[code];
|
|
1349
|
+
if (tz) return tz;
|
|
1350
|
+
throw new Error(
|
|
1351
|
+
`Unknown station timezone: ${JSON.stringify(code)}. Add it to _STATION_TZ or pass tzOverride="America/...".`
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1354
|
+
function _parseAsOf(asOf) {
|
|
1355
|
+
if (asOf instanceof Date) {
|
|
1356
|
+
if (Number.isNaN(asOf.getTime())) {
|
|
1357
|
+
throw new Error("Invalid Date passed as asOf");
|
|
1358
|
+
}
|
|
1359
|
+
return asOf;
|
|
1360
|
+
}
|
|
1361
|
+
let s = asOf.trim();
|
|
1362
|
+
if (s.endsWith("Z")) {
|
|
1363
|
+
} else if (!/[+-]\d{2}:?\d{2}$/.test(s)) {
|
|
1364
|
+
s = `${s}Z`;
|
|
1365
|
+
}
|
|
1366
|
+
const ms = Date.parse(s);
|
|
1367
|
+
if (!Number.isFinite(ms)) {
|
|
1368
|
+
throw new Error(`Invalid as_of string: ${JSON.stringify(asOf)}`);
|
|
1369
|
+
}
|
|
1370
|
+
return new Date(ms);
|
|
1371
|
+
}
|
|
1372
|
+
function _pad2(n) {
|
|
1373
|
+
return n < 10 ? `0${n}` : `${n}`;
|
|
1374
|
+
}
|
|
1375
|
+
function _isoDate(year, month, day) {
|
|
1376
|
+
return `${year}-${_pad2(month)}-${_pad2(day)}`;
|
|
1377
|
+
}
|
|
1378
|
+
function settlementDateFor(asOf, station, tzOverride) {
|
|
1379
|
+
const utcDt = _parseAsOf(asOf);
|
|
1380
|
+
const tz = _resolveStationTz(station, tzOverride);
|
|
1381
|
+
const offsetHours = _lstOffsetHours(tz);
|
|
1382
|
+
const lstMs = utcDt.getTime() + offsetHours * 36e5;
|
|
1383
|
+
const lst = new Date(lstMs);
|
|
1384
|
+
return _isoDate(lst.getUTCFullYear(), lst.getUTCMonth() + 1, lst.getUTCDate());
|
|
1385
|
+
}
|
|
1386
|
+
function settlementWindowUtc(dateStr, station, tzOverride) {
|
|
1387
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateStr);
|
|
1388
|
+
if (!match) {
|
|
1389
|
+
throw new Error(`Invalid ISO date for settlement window: ${JSON.stringify(dateStr)}`);
|
|
1390
|
+
}
|
|
1391
|
+
const [, yStr, mStr, dStr] = match;
|
|
1392
|
+
const year = Number(yStr);
|
|
1393
|
+
const month = Number(mStr);
|
|
1394
|
+
const day = Number(dStr);
|
|
1395
|
+
const tz = _resolveStationTz(station, tzOverride);
|
|
1396
|
+
const offsetHours = _lstOffsetHours(tz);
|
|
1397
|
+
const midnightLstAsUtcMs = Date.UTC(year, month - 1, day, 0, 0, 0);
|
|
1398
|
+
const startMs = midnightLstAsUtcMs - offsetHours * 36e5;
|
|
1399
|
+
const start = new Date(startMs);
|
|
1400
|
+
const end = new Date(startMs + 24 * 36e5);
|
|
1401
|
+
return [start, end];
|
|
1402
|
+
}
|
|
1403
|
+
function cliAvailableAt(dateStr, station, delayHours = _CLI_PUBLICATION_DELAY_HOURS, tzOverride) {
|
|
1404
|
+
const [, windowEnd] = settlementWindowUtc(dateStr, station, tzOverride);
|
|
1405
|
+
return new Date(windowEnd.getTime() + delayHours * 36e5);
|
|
1406
|
+
}
|
|
1407
|
+
function marketCloseUtc(dateStr, station, tzOverride) {
|
|
1408
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateStr);
|
|
1409
|
+
if (!match) {
|
|
1410
|
+
throw new Error(`Invalid ISO date for market close: ${JSON.stringify(dateStr)}`);
|
|
1411
|
+
}
|
|
1412
|
+
const [, yStr, mStr, dStr] = match;
|
|
1413
|
+
const year = Number(yStr);
|
|
1414
|
+
const month = Number(mStr);
|
|
1415
|
+
const day = Number(dStr);
|
|
1416
|
+
const tz = _resolveStationTz(station, tzOverride);
|
|
1417
|
+
const offsetHours = _lstOffsetHours(tz);
|
|
1418
|
+
const marketCloseAsUtcMs = Date.UTC(
|
|
1419
|
+
year,
|
|
1420
|
+
month - 1,
|
|
1421
|
+
day,
|
|
1422
|
+
_MARKET_CLOSE_HOUR_LST,
|
|
1423
|
+
_MARKET_CLOSE_MINUTE_LST,
|
|
1424
|
+
0
|
|
1425
|
+
);
|
|
1426
|
+
return new Date(marketCloseAsUtcMs - offsetHours * 36e5);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// src/internal/http.ts
|
|
1430
|
+
var DEFAULT_BASE_DELAY_MS = 1e3;
|
|
1431
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
1432
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
1433
|
+
var DEFAULT_RETRY_STATUSES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
1434
|
+
var MAX_RETRY_AFTER_MS = 12e4;
|
|
1435
|
+
function sleep(ms, signal) {
|
|
1436
|
+
return new Promise((resolve, reject) => {
|
|
1437
|
+
if (signal?.aborted) {
|
|
1438
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const timer = setTimeout(() => {
|
|
1442
|
+
cleanup();
|
|
1443
|
+
resolve();
|
|
1444
|
+
}, ms);
|
|
1445
|
+
const onAbort = () => {
|
|
1446
|
+
cleanup();
|
|
1447
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
1448
|
+
};
|
|
1449
|
+
const cleanup = () => {
|
|
1450
|
+
clearTimeout(timer);
|
|
1451
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1452
|
+
};
|
|
1453
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
function parseRetryAfter(header) {
|
|
1457
|
+
if (!header) return null;
|
|
1458
|
+
const asInt = Number(header);
|
|
1459
|
+
if (Number.isFinite(asInt) && asInt >= 0) return asInt;
|
|
1460
|
+
const dateMs = Date.parse(header);
|
|
1461
|
+
if (Number.isFinite(dateMs)) {
|
|
1462
|
+
return Math.max(0, Math.round((dateMs - Date.now()) / 1e3));
|
|
1463
|
+
}
|
|
1464
|
+
return null;
|
|
1465
|
+
}
|
|
1466
|
+
function throwForNonRetryableStatus(status, url, retryAfter) {
|
|
1467
|
+
if (status === 404) {
|
|
1468
|
+
throw new NotFoundError(`HTTP 404 for ${url}`);
|
|
1469
|
+
}
|
|
1470
|
+
if (status === 400) {
|
|
1471
|
+
throw new ValidationError(`HTTP 400 for ${url}`);
|
|
1472
|
+
}
|
|
1473
|
+
if (status === 401) {
|
|
1474
|
+
throw new AuthenticationError(`HTTP 401 for ${url}`);
|
|
1475
|
+
}
|
|
1476
|
+
if (status === 403) {
|
|
1477
|
+
throw new ForbiddenError(`HTTP 403 for ${url}`);
|
|
1478
|
+
}
|
|
1479
|
+
if (status === 429) {
|
|
1480
|
+
throw new RateLimitError(retryAfter, { source: url });
|
|
1481
|
+
}
|
|
1482
|
+
if (status >= 500 && status < 600) {
|
|
1483
|
+
throw new ServerError(`HTTP ${status} for ${url}`, { statusCode: status });
|
|
1484
|
+
}
|
|
1485
|
+
throw new TherminalError(`HTTP ${status} for ${url}`, { statusCode: status });
|
|
1486
|
+
}
|
|
1487
|
+
async function fetchWithRetry(url, opts = {}) {
|
|
1488
|
+
const baseDelay = opts.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
|
|
1489
|
+
const maxRetries = opts.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
1490
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1491
|
+
const retryStatuses = opts.retryStatuses ?? DEFAULT_RETRY_STATUSES;
|
|
1492
|
+
const headers = { ...opts.headers ?? {} };
|
|
1493
|
+
if (opts.userAgent && !("user-agent" in lowercaseKeys(headers))) {
|
|
1494
|
+
headers["User-Agent"] = opts.userAgent;
|
|
1495
|
+
}
|
|
1496
|
+
let lastError = null;
|
|
1497
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
1498
|
+
const attemptController = new AbortController();
|
|
1499
|
+
const timeoutHandle = setTimeout(() => attemptController.abort(), timeoutMs);
|
|
1500
|
+
const onParentAbort = () => attemptController.abort();
|
|
1501
|
+
if (opts.signal) {
|
|
1502
|
+
if (opts.signal.aborted) {
|
|
1503
|
+
clearTimeout(timeoutHandle);
|
|
1504
|
+
throw new DOMException("Aborted", "AbortError");
|
|
1505
|
+
}
|
|
1506
|
+
opts.signal.addEventListener("abort", onParentAbort, { once: true });
|
|
1507
|
+
}
|
|
1508
|
+
try {
|
|
1509
|
+
const init = {
|
|
1510
|
+
method: opts.method ?? "GET",
|
|
1511
|
+
headers,
|
|
1512
|
+
signal: attemptController.signal
|
|
1513
|
+
};
|
|
1514
|
+
if (opts.body !== void 0 && opts.body !== null) {
|
|
1515
|
+
init.body = opts.body;
|
|
1516
|
+
}
|
|
1517
|
+
const response = await fetch(url, init);
|
|
1518
|
+
if (response.status === 404) {
|
|
1519
|
+
throw new NotFoundError(`HTTP 404 for ${url}`);
|
|
1520
|
+
}
|
|
1521
|
+
if (retryStatuses.has(response.status)) {
|
|
1522
|
+
const retryAfterHeader = parseRetryAfter(response.headers.get("retry-after"));
|
|
1523
|
+
if (attempt < maxRetries - 1) {
|
|
1524
|
+
const jitter = baseDelay * 2 ** attempt * Math.random() * 0.25;
|
|
1525
|
+
const delayMs = baseDelay * 2 ** attempt + jitter;
|
|
1526
|
+
const sleepMs = retryAfterHeader !== null ? Math.min(retryAfterHeader * 1e3, MAX_RETRY_AFTER_MS) : delayMs;
|
|
1527
|
+
await sleep(sleepMs, opts.signal);
|
|
1528
|
+
continue;
|
|
1529
|
+
}
|
|
1530
|
+
throwForNonRetryableStatus(response.status, url, retryAfterHeader);
|
|
1531
|
+
}
|
|
1532
|
+
if (response.status >= 400) {
|
|
1533
|
+
const retryAfterHeader = parseRetryAfter(response.headers.get("retry-after"));
|
|
1534
|
+
throwForNonRetryableStatus(response.status, url, retryAfterHeader);
|
|
1535
|
+
}
|
|
1536
|
+
return response;
|
|
1537
|
+
} catch (err) {
|
|
1538
|
+
if (err instanceof TherminalError && !(err instanceof ServerError) && !(err instanceof RateLimitError)) {
|
|
1539
|
+
throw err;
|
|
1540
|
+
}
|
|
1541
|
+
if (opts.signal?.aborted) {
|
|
1542
|
+
throw err;
|
|
1543
|
+
}
|
|
1544
|
+
lastError = err;
|
|
1545
|
+
if (attempt < maxRetries - 1) {
|
|
1546
|
+
const jitter = baseDelay * 2 ** attempt * Math.random() * 0.25;
|
|
1547
|
+
const delayMs = baseDelay * 2 ** attempt + jitter;
|
|
1548
|
+
await sleep(delayMs, opts.signal);
|
|
1549
|
+
continue;
|
|
1550
|
+
}
|
|
1551
|
+
if (err instanceof TherminalError) throw err;
|
|
1552
|
+
throw new TherminalError(`fetch failed after ${maxRetries} attempts: ${describeError(err)}`, {
|
|
1553
|
+
source: url
|
|
1554
|
+
});
|
|
1555
|
+
} finally {
|
|
1556
|
+
clearTimeout(timeoutHandle);
|
|
1557
|
+
opts.signal?.removeEventListener("abort", onParentAbort);
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
if (lastError instanceof Error) throw lastError;
|
|
1561
|
+
throw new TherminalError(`fetch failed: ${describeError(lastError)}`, { source: url });
|
|
1562
|
+
}
|
|
1563
|
+
function describeError(err) {
|
|
1564
|
+
if (err instanceof Error) return err.message;
|
|
1565
|
+
return String(err);
|
|
1566
|
+
}
|
|
1567
|
+
function lowercaseKeys(obj) {
|
|
1568
|
+
const out = {};
|
|
1569
|
+
for (const k of Object.keys(obj)) {
|
|
1570
|
+
out[k.toLowerCase()] = obj[k];
|
|
1571
|
+
}
|
|
1572
|
+
return out;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
// src/index.ts
|
|
1576
|
+
var version = "0.0.0";
|
|
1577
|
+
function helloCore() {
|
|
1578
|
+
return "hello @mostlyrightmd/core";
|
|
1579
|
+
}
|
|
1580
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1581
|
+
0 && (module.exports = {
|
|
1582
|
+
AuthenticationError,
|
|
1583
|
+
CLIMATE_REPORT_TYPE_PRIORITY,
|
|
1584
|
+
DeferredMarketError,
|
|
1585
|
+
ForbiddenError,
|
|
1586
|
+
LIVE_V1_POLICY,
|
|
1587
|
+
LeakageError,
|
|
1588
|
+
LiveStreamError,
|
|
1589
|
+
NoLiveDataError,
|
|
1590
|
+
NotFoundError,
|
|
1591
|
+
OBSERVATION_SOURCE_PRIORITY,
|
|
1592
|
+
PayloadTooLargeError,
|
|
1593
|
+
PolymarketEventError,
|
|
1594
|
+
QC_ALPHA_RULES,
|
|
1595
|
+
QC_ALPHA_RULES_BY_ID,
|
|
1596
|
+
RateLimitError,
|
|
1597
|
+
STATIONS,
|
|
1598
|
+
STATION_BY_CODE,
|
|
1599
|
+
STATION_BY_ICAO,
|
|
1600
|
+
SchemaValidationError,
|
|
1601
|
+
ServerError,
|
|
1602
|
+
SourceMismatchError,
|
|
1603
|
+
SourceUnavailableError,
|
|
1604
|
+
TemporalDriftError,
|
|
1605
|
+
TherminalError,
|
|
1606
|
+
TradewindsError,
|
|
1607
|
+
ValidationError,
|
|
1608
|
+
_CLI_PUBLICATION_DELAY_HOURS,
|
|
1609
|
+
_JAN_REF,
|
|
1610
|
+
_MARKET_CLOSE_HOUR_LST,
|
|
1611
|
+
_MARKET_CLOSE_MINUTE_LST,
|
|
1612
|
+
_STATION_TZ,
|
|
1613
|
+
_lstOffsetHours,
|
|
1614
|
+
_resolveStationTz,
|
|
1615
|
+
cliAvailableAt,
|
|
1616
|
+
fetchWithRetry,
|
|
1617
|
+
helloCore,
|
|
1618
|
+
marketCloseUtc,
|
|
1619
|
+
settlementDateFor,
|
|
1620
|
+
settlementWindowUtc,
|
|
1621
|
+
toJsonSafe,
|
|
1622
|
+
version
|
|
1623
|
+
});
|
|
1624
|
+
//# sourceMappingURL=index.cjs.map
|