@mostlyrightmd/core 1.1.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/discovery/index.cjs +471 -169
- package/dist/discovery/index.cjs.map +1 -1
- package/dist/discovery/index.d.cts +39 -11
- package/dist/discovery/index.d.ts +39 -11
- package/dist/discovery/index.mjs +471 -169
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/index.cjs +618 -174
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +326 -29
- package/dist/index.d.ts +326 -29
- package/dist/index.global.js +610 -173
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +610 -173
- package/dist/index.mjs.map +1 -1
- package/dist/internal/cache/index.browser.cjs +501 -163
- package/dist/internal/cache/index.browser.cjs.map +1 -1
- package/dist/internal/cache/index.browser.d.cts +8 -2
- package/dist/internal/cache/index.browser.d.ts +8 -2
- package/dist/internal/cache/index.browser.mjs +10 -5
- package/dist/internal/cache/index.browser.mjs.map +1 -1
- package/dist/internal/cache/index.cjs +503 -161
- package/dist/internal/cache/index.cjs.map +1 -1
- package/dist/internal/cache/index.d.cts +12 -6
- package/dist/internal/cache/index.d.ts +12 -6
- package/dist/internal/cache/index.mjs +12 -3
- package/dist/internal/cache/index.mjs.map +1 -1
- package/dist/internal/{chunk-PKJXHY27.mjs → chunk-QDQSYUFW.mjs} +494 -160
- package/dist/internal/chunk-QDQSYUFW.mjs.map +1 -0
- package/dist/internal/{keys-B7C8C88N.d.cts → versionedCacheStore-DyHDqFIC.d.cts} +23 -1
- package/dist/internal/{keys-B7C8C88N.d.ts → versionedCacheStore-DyHDqFIC.d.ts} +23 -1
- package/dist/preprocessing/index.cjs +150 -0
- package/dist/preprocessing/index.cjs.map +1 -0
- package/dist/preprocessing/index.d.cts +111 -0
- package/dist/preprocessing/index.d.ts +111 -0
- package/dist/preprocessing/index.mjs +121 -0
- package/dist/preprocessing/index.mjs.map +1 -0
- package/dist/temporal/index.cjs +56 -4
- package/dist/temporal/index.cjs.map +1 -1
- package/dist/temporal/index.d.cts +24 -1
- package/dist/temporal/index.d.ts +24 -1
- package/dist/temporal/index.mjs +55 -4
- package/dist/temporal/index.mjs.map +1 -1
- package/dist/validator.cjs +694 -109
- package/dist/validator.cjs.map +1 -1
- package/dist/validator.mjs +694 -109
- package/dist/validator.mjs.map +1 -1
- package/package.json +25 -2
- package/dist/internal/chunk-PKJXHY27.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -82,43 +82,207 @@ interface ObservationV1 {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
interface ForecastIemMosV1 {
|
|
85
|
+
/**
|
|
86
|
+
* units: celsius
|
|
87
|
+
*/
|
|
88
|
+
apparent_temp_c?: null | number;
|
|
89
|
+
/**
|
|
90
|
+
* units: J/kg
|
|
91
|
+
*/
|
|
92
|
+
cape_jkg?: null | number;
|
|
93
|
+
/**
|
|
94
|
+
* units: percent
|
|
95
|
+
*/
|
|
96
|
+
cloud_cover_pct?: number | null;
|
|
97
|
+
/**
|
|
98
|
+
* units: celsius
|
|
99
|
+
*/
|
|
100
|
+
dew_point_c?: null | number;
|
|
101
|
+
/**
|
|
102
|
+
* units: W/m^2
|
|
103
|
+
*/
|
|
104
|
+
direct_radiation_wm2?: null | number;
|
|
105
|
+
/**
|
|
106
|
+
* units: hours — (valid_at - issued_at).total_seconds() / 3600
|
|
107
|
+
*/
|
|
108
|
+
forecast_hour: number;
|
|
109
|
+
/**
|
|
110
|
+
* units: meters
|
|
111
|
+
*/
|
|
112
|
+
freezing_level_m?: number | null;
|
|
113
|
+
/**
|
|
114
|
+
* model run time (knowledge_time). Nullable to accommodate Phase 20 open_meteo.seamless rows whose cycle is unrecoverable from the response. LeakageDetector + assert_issued_at_populated() are the runtime gates that reject null issued_at in training-data paths.
|
|
115
|
+
*/
|
|
116
|
+
issued_at?: null | string;
|
|
117
|
+
/**
|
|
118
|
+
* e.g. NBE, GFS, LAV, MET, gfs_global, ecmwf_ifs025
|
|
119
|
+
*/
|
|
120
|
+
model: string;
|
|
121
|
+
/**
|
|
122
|
+
* units: probability — bounded [0, 1]
|
|
123
|
+
*/
|
|
124
|
+
precip_probability?: null | number;
|
|
125
|
+
/**
|
|
126
|
+
* units: mm
|
|
127
|
+
*/
|
|
128
|
+
precipitation_mm?: null | number;
|
|
129
|
+
/**
|
|
130
|
+
* units: hPa
|
|
131
|
+
*/
|
|
132
|
+
pressure_msl_hpa?: null | number;
|
|
133
|
+
/**
|
|
134
|
+
* wall-clock time the row was fetched from upstream
|
|
135
|
+
*/
|
|
136
|
+
retrieved_at: string;
|
|
137
|
+
/**
|
|
138
|
+
* units: W/m^2
|
|
139
|
+
*/
|
|
140
|
+
shortwave_radiation_wm2?: null | number;
|
|
141
|
+
/**
|
|
142
|
+
* units: percent — bounded [0, 100]
|
|
143
|
+
*/
|
|
144
|
+
sky_cover_pct?: number | null;
|
|
145
|
+
/**
|
|
146
|
+
* units: meters
|
|
147
|
+
*/
|
|
148
|
+
snow_depth_m?: null | number;
|
|
149
|
+
/**
|
|
150
|
+
* iem.archive | open_meteo.previous_runs | open_meteo.single_run | open_meteo.live
|
|
151
|
+
*/
|
|
152
|
+
source: string;
|
|
153
|
+
station: string;
|
|
154
|
+
/**
|
|
155
|
+
* units: hPa
|
|
156
|
+
*/
|
|
157
|
+
surface_pressure_hpa?: null | number;
|
|
158
|
+
/**
|
|
159
|
+
* units: celsius
|
|
160
|
+
*/
|
|
161
|
+
temp_c?: null | number;
|
|
162
|
+
/**
|
|
163
|
+
* forecast target time (event_time)
|
|
164
|
+
*/
|
|
165
|
+
valid_at: string;
|
|
166
|
+
/**
|
|
167
|
+
* units: meters
|
|
168
|
+
*/
|
|
169
|
+
visibility_m?: number | null;
|
|
170
|
+
/**
|
|
171
|
+
* units: WMO 4677 — WMO weather code (clear, fog, rain, snow, etc.)
|
|
172
|
+
*/
|
|
173
|
+
weather_code?: number | null;
|
|
174
|
+
/**
|
|
175
|
+
* units: degrees
|
|
176
|
+
*/
|
|
177
|
+
wind_dir_deg?: number | null;
|
|
178
|
+
/**
|
|
179
|
+
* units: m/s
|
|
180
|
+
*/
|
|
181
|
+
wind_gusts_ms?: null | number;
|
|
182
|
+
/**
|
|
183
|
+
* units: m/s
|
|
184
|
+
*/
|
|
185
|
+
wind_speed_ms?: null | number;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
interface ForecastStationV1 {
|
|
189
|
+
/**
|
|
190
|
+
* units: celsius
|
|
191
|
+
*/
|
|
192
|
+
apparent_temp_c?: null | number;
|
|
193
|
+
/**
|
|
194
|
+
* units: J/kg
|
|
195
|
+
*/
|
|
196
|
+
cape_jkg?: null | number;
|
|
197
|
+
/**
|
|
198
|
+
* units: percent
|
|
199
|
+
*/
|
|
200
|
+
cloud_cover_pct?: number | null;
|
|
85
201
|
/**
|
|
86
202
|
* units: celsius
|
|
87
203
|
*/
|
|
88
204
|
dew_point_c?: null | number;
|
|
205
|
+
/**
|
|
206
|
+
* units: W/m^2
|
|
207
|
+
*/
|
|
208
|
+
direct_radiation_wm2?: null | number;
|
|
89
209
|
/**
|
|
90
210
|
* units: hours — (valid_at - issued_at).total_seconds() / 3600
|
|
91
211
|
*/
|
|
92
212
|
forecast_hour: number;
|
|
93
213
|
/**
|
|
94
|
-
*
|
|
214
|
+
* units: meters
|
|
95
215
|
*/
|
|
96
|
-
|
|
216
|
+
freezing_level_m?: number | null;
|
|
97
217
|
/**
|
|
98
|
-
*
|
|
218
|
+
* model run time (knowledge_time). Nullable to accommodate Phase 20 open_meteo.seamless rows whose cycle is unrecoverable from the response. LeakageDetector + assert_issued_at_populated() are the runtime gates that reject null issued_at in training-data paths.
|
|
219
|
+
*/
|
|
220
|
+
issued_at?: null | string;
|
|
221
|
+
/**
|
|
222
|
+
* e.g. NBE, GFS, LAV, MET, gfs_global, ecmwf_ifs025
|
|
99
223
|
*/
|
|
100
224
|
model: string;
|
|
101
225
|
/**
|
|
102
226
|
* units: probability — bounded [0, 1]
|
|
103
227
|
*/
|
|
104
228
|
precip_probability?: null | number;
|
|
229
|
+
/**
|
|
230
|
+
* units: mm
|
|
231
|
+
*/
|
|
232
|
+
precipitation_mm?: null | number;
|
|
233
|
+
/**
|
|
234
|
+
* units: hPa
|
|
235
|
+
*/
|
|
236
|
+
pressure_msl_hpa?: null | number;
|
|
237
|
+
/**
|
|
238
|
+
* wall-clock time the row was fetched from upstream
|
|
239
|
+
*/
|
|
240
|
+
retrieved_at: string;
|
|
241
|
+
/**
|
|
242
|
+
* units: W/m^2
|
|
243
|
+
*/
|
|
244
|
+
shortwave_radiation_wm2?: null | number;
|
|
105
245
|
/**
|
|
106
246
|
* units: percent — bounded [0, 100]
|
|
107
247
|
*/
|
|
108
248
|
sky_cover_pct?: number | null;
|
|
249
|
+
/**
|
|
250
|
+
* units: meters
|
|
251
|
+
*/
|
|
252
|
+
snow_depth_m?: null | number;
|
|
253
|
+
/**
|
|
254
|
+
* iem.archive | open_meteo.previous_runs | open_meteo.single_run | open_meteo.live
|
|
255
|
+
*/
|
|
256
|
+
source: string;
|
|
109
257
|
station: string;
|
|
258
|
+
/**
|
|
259
|
+
* units: hPa
|
|
260
|
+
*/
|
|
261
|
+
surface_pressure_hpa?: null | number;
|
|
110
262
|
/**
|
|
111
263
|
* units: celsius
|
|
112
264
|
*/
|
|
113
265
|
temp_c?: null | number;
|
|
114
266
|
/**
|
|
115
|
-
* forecast target time (
|
|
267
|
+
* forecast target time (event_time)
|
|
116
268
|
*/
|
|
117
269
|
valid_at: string;
|
|
270
|
+
/**
|
|
271
|
+
* units: meters
|
|
272
|
+
*/
|
|
273
|
+
visibility_m?: number | null;
|
|
274
|
+
/**
|
|
275
|
+
* units: WMO 4677 — WMO weather code (clear, fog, rain, snow, etc.)
|
|
276
|
+
*/
|
|
277
|
+
weather_code?: number | null;
|
|
118
278
|
/**
|
|
119
279
|
* units: degrees
|
|
120
280
|
*/
|
|
121
281
|
wind_dir_deg?: number | null;
|
|
282
|
+
/**
|
|
283
|
+
* units: m/s
|
|
284
|
+
*/
|
|
285
|
+
wind_gusts_ms?: null | number;
|
|
122
286
|
/**
|
|
123
287
|
* units: m/s
|
|
124
288
|
*/
|
|
@@ -237,6 +401,7 @@ interface StationInfo {
|
|
|
237
401
|
latitude: number | null;
|
|
238
402
|
longitude: number | null;
|
|
239
403
|
country: string | null;
|
|
404
|
+
venues: ReadonlyArray<string>;
|
|
240
405
|
}
|
|
241
406
|
declare const STATIONS: ReadonlyArray<StationInfo>;
|
|
242
407
|
declare const STATION_BY_CODE: ReadonlyMap<string, StationInfo>;
|
|
@@ -272,7 +437,7 @@ declare const QC_ALPHA_RULES_BY_ID: ReadonlyMap<string, QcAlphaRule>;
|
|
|
272
437
|
* `{ _repr_only: true, value: String(value) }`.
|
|
273
438
|
*/
|
|
274
439
|
declare function toJsonSafe(value: unknown, seen?: WeakSet<object>): unknown;
|
|
275
|
-
interface
|
|
440
|
+
interface MostlyRightErrorOptions {
|
|
276
441
|
errorCode?: string;
|
|
277
442
|
source?: string | null;
|
|
278
443
|
requestId?: string | null;
|
|
@@ -285,13 +450,13 @@ interface TradewindsErrorOptions {
|
|
|
285
450
|
* involved (e.g. "iem.archive") when applicable, and `requestId` correlates a
|
|
286
451
|
* JSON-RPC / MCP request id when applicable.
|
|
287
452
|
*/
|
|
288
|
-
declare class
|
|
453
|
+
declare class MostlyRightError extends Error {
|
|
289
454
|
/** Subclass override — the stable string enum surfaced via `errorCode`. */
|
|
290
455
|
static defaultErrorCode: string;
|
|
291
456
|
readonly errorCode: string;
|
|
292
457
|
readonly source: string | null;
|
|
293
458
|
readonly requestId: string | null;
|
|
294
|
-
constructor(message?: string, options?:
|
|
459
|
+
constructor(message?: string, options?: MostlyRightErrorOptions);
|
|
295
460
|
/**
|
|
296
461
|
* Subclass hook returning the structured attributes for `toDict`.
|
|
297
462
|
* Values are passed through `toJsonSafe` by `toDict()`, so subclasses
|
|
@@ -301,14 +466,14 @@ declare class TradewindsError extends Error {
|
|
|
301
466
|
/** Return a JSON-safe dict suitable for MCP `error.data`. */
|
|
302
467
|
toDict(): Record<string, unknown>;
|
|
303
468
|
}
|
|
304
|
-
interface SourceUnavailableErrorOptions extends
|
|
469
|
+
interface SourceUnavailableErrorOptions extends MostlyRightErrorOptions {
|
|
305
470
|
httpStatus?: number | null;
|
|
306
471
|
retryable?: boolean;
|
|
307
472
|
retryAfterS?: number | null;
|
|
308
473
|
underlying?: string;
|
|
309
474
|
url?: string | null;
|
|
310
475
|
}
|
|
311
|
-
declare class SourceUnavailableError extends
|
|
476
|
+
declare class SourceUnavailableError extends MostlyRightError {
|
|
312
477
|
static defaultErrorCode: string;
|
|
313
478
|
readonly httpStatus: number | null;
|
|
314
479
|
readonly retryable: boolean;
|
|
@@ -318,13 +483,71 @@ declare class SourceUnavailableError extends TradewindsError {
|
|
|
318
483
|
constructor(message?: string, options?: SourceUnavailableErrorOptions);
|
|
319
484
|
protected payload(): Record<string, unknown>;
|
|
320
485
|
}
|
|
321
|
-
|
|
486
|
+
/** Shared reason enum — MUST match Python EXACTLY (Phase 21 D-04). */
|
|
487
|
+
declare const DATA_AVAILABILITY_REASONS: readonly ["model_unavailable", "out_of_window", "cache_miss", "source_404", "source_5xx", "rate_limited"];
|
|
488
|
+
type DataAvailabilityReason = (typeof DATA_AVAILABILITY_REASONS)[number];
|
|
489
|
+
interface DataAvailabilityErrorOptions extends MostlyRightErrorOptions {
|
|
490
|
+
reason: DataAvailabilityReason;
|
|
491
|
+
hint: string;
|
|
492
|
+
}
|
|
493
|
+
declare class DataAvailabilityError extends MostlyRightError {
|
|
494
|
+
static defaultErrorCode: string;
|
|
495
|
+
readonly reason: DataAvailabilityReason;
|
|
496
|
+
readonly hint: string;
|
|
497
|
+
constructor(options: DataAvailabilityErrorOptions);
|
|
498
|
+
protected payload(): Record<string, unknown>;
|
|
499
|
+
}
|
|
500
|
+
interface NwpNotAvailableErrorOptions extends MostlyRightErrorOptions {
|
|
501
|
+
/** Station the caller asked for (echoed back for log/error attribution). */
|
|
502
|
+
station: string;
|
|
503
|
+
/** NWP model the caller asked for (e.g. `"gfs"`, `"hrrr"`). */
|
|
504
|
+
model: string;
|
|
505
|
+
/** Operator-actionable hint. Required (matches DataAvailabilityError contract). */
|
|
506
|
+
hint: string;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Raised when the TS `forecastNwp()` stub is called.
|
|
510
|
+
*
|
|
511
|
+
* **Why this exists:** no production-ready browser GRIB2 decoder ships in
|
|
512
|
+
* v1.x (eccodes / cfgrib are C/Python only; WASM compile-time + bundle
|
|
513
|
+
* size make a browser port impractical today). The function signature is
|
|
514
|
+
* stable so callers can write code today; v2.0+ lands the execution body.
|
|
515
|
+
*
|
|
516
|
+
* **Recommended catch pattern:**
|
|
517
|
+
*
|
|
518
|
+
* ```ts
|
|
519
|
+
* import { forecastNwp } from '@mostlyrightmd/weather';
|
|
520
|
+
* import { NwpNotAvailableError } from '@mostlyrightmd/core';
|
|
521
|
+
*
|
|
522
|
+
* try {
|
|
523
|
+
* const grid = await forecastNwp('KNYC', 'gfs');
|
|
524
|
+
* } catch (e) {
|
|
525
|
+
* if (e instanceof NwpNotAvailableError) {
|
|
526
|
+
* console.warn(`NWP deferred to v2.0+; ${e.hint}`);
|
|
527
|
+
* // Fall back to iemMosForecasts() when available, else Python SDK.
|
|
528
|
+
* } else {
|
|
529
|
+
* throw e;
|
|
530
|
+
* }
|
|
531
|
+
* }
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* See [docs/nwp-forecasts.md](https://mostlyright.md/docs/sdk/typescript/nwp-forecasts/)
|
|
535
|
+
* for the full architectural rationale and the v2.0+ roadmap.
|
|
536
|
+
*/
|
|
537
|
+
declare class NwpNotAvailableError extends DataAvailabilityError {
|
|
538
|
+
static defaultErrorCode: string;
|
|
539
|
+
readonly station: string;
|
|
540
|
+
readonly model: string;
|
|
541
|
+
constructor(options: NwpNotAvailableErrorOptions);
|
|
542
|
+
protected payload(): Record<string, unknown>;
|
|
543
|
+
}
|
|
544
|
+
interface SchemaValidationErrorOptions extends MostlyRightErrorOptions {
|
|
322
545
|
schemaId: string;
|
|
323
546
|
violations?: Array<Record<string, unknown>>;
|
|
324
547
|
quarantineCount?: number;
|
|
325
548
|
sampleViolations?: Array<Record<string, unknown>>;
|
|
326
549
|
}
|
|
327
|
-
declare class SchemaValidationError extends
|
|
550
|
+
declare class SchemaValidationError extends MostlyRightError {
|
|
328
551
|
static defaultErrorCode: string;
|
|
329
552
|
readonly schemaId: string;
|
|
330
553
|
readonly violations: Array<Record<string, unknown>>;
|
|
@@ -334,13 +557,13 @@ declare class SchemaValidationError extends TradewindsError {
|
|
|
334
557
|
protected payload(): Record<string, unknown>;
|
|
335
558
|
}
|
|
336
559
|
type SourceMismatchRole = "observations" | "forecasts" | "settlement";
|
|
337
|
-
interface SourceMismatchErrorOptions extends
|
|
560
|
+
interface SourceMismatchErrorOptions extends MostlyRightErrorOptions {
|
|
338
561
|
schemaSource: string;
|
|
339
562
|
dataSource: string;
|
|
340
563
|
role?: SourceMismatchRole | null;
|
|
341
564
|
catalogWarning?: string | null;
|
|
342
565
|
}
|
|
343
|
-
declare class SourceMismatchError extends
|
|
566
|
+
declare class SourceMismatchError extends MostlyRightError {
|
|
344
567
|
static defaultErrorCode: string;
|
|
345
568
|
/** Canonical role-name vocabulary (design.md §R). */
|
|
346
569
|
static readonly VALID_ROLES: ReadonlySet<SourceMismatchRole>;
|
|
@@ -351,12 +574,12 @@ declare class SourceMismatchError extends TradewindsError {
|
|
|
351
574
|
constructor(message: string, options: SourceMismatchErrorOptions);
|
|
352
575
|
protected payload(): Record<string, unknown>;
|
|
353
576
|
}
|
|
354
|
-
interface LeakageErrorOptions extends
|
|
577
|
+
interface LeakageErrorOptions extends MostlyRightErrorOptions {
|
|
355
578
|
asOf: string;
|
|
356
579
|
violatingCount: number;
|
|
357
580
|
sampleViolations?: Array<Record<string, unknown>>;
|
|
358
581
|
}
|
|
359
|
-
declare class LeakageError extends
|
|
582
|
+
declare class LeakageError extends MostlyRightError {
|
|
360
583
|
static defaultErrorCode: string;
|
|
361
584
|
readonly asOf: string;
|
|
362
585
|
readonly violatingCount: number;
|
|
@@ -364,13 +587,55 @@ declare class LeakageError extends TradewindsError {
|
|
|
364
587
|
constructor(message: string, options: LeakageErrorOptions);
|
|
365
588
|
protected payload(): Record<string, unknown>;
|
|
366
589
|
}
|
|
367
|
-
interface
|
|
590
|
+
interface IssuedAtMissingErrorOptions extends MostlyRightErrorOptions {
|
|
591
|
+
violatingCount?: number;
|
|
592
|
+
sampleViolations?: Array<Record<string, unknown>>;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* A forecast row would land with `issuedAt = null`.
|
|
596
|
+
*
|
|
597
|
+
* Phase 20 OM-04. Origin: Tarabcak/mostlyright#70 — the legacy
|
|
598
|
+
* seamless-feed bug where `/forecast_series` proxied Open-Meteo's
|
|
599
|
+
* seamless endpoint without preserving `issued_at`, silently using
|
|
600
|
+
* post-snapshot model runs in training data.
|
|
601
|
+
*/
|
|
602
|
+
declare class IssuedAtMissingError extends SchemaValidationError {
|
|
603
|
+
static defaultErrorCode: string;
|
|
604
|
+
readonly violatingCountRows: number;
|
|
605
|
+
constructor(message: string, options?: IssuedAtMissingErrorOptions);
|
|
606
|
+
protected payload(): Record<string, unknown>;
|
|
607
|
+
}
|
|
608
|
+
interface OpenMeteoSeamlessLeakageErrorOptions extends MostlyRightErrorOptions {
|
|
609
|
+
model: string;
|
|
610
|
+
endpointUrl: string;
|
|
611
|
+
asOf?: string | null;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* The Open-Meteo Historical Forecast (seamless) endpoint was used
|
|
615
|
+
* without `allowLeakage: true`.
|
|
616
|
+
*
|
|
617
|
+
* Phase 20 D-01 (locked decision): the seamless endpoint silently
|
|
618
|
+
* stitches forecasts from multiple model cycles into a continuous
|
|
619
|
+
* timeseries; the cycle that produced each value is unrecoverable from
|
|
620
|
+
* the response. `LeakageDetector` rejects rows tagged
|
|
621
|
+
* `source="open_meteo.seamless"` whenever `as_of` is asserted.
|
|
622
|
+
*
|
|
623
|
+
* Origin: Tarabcak/mostlyright#70.
|
|
624
|
+
*/
|
|
625
|
+
declare class OpenMeteoSeamlessLeakageError extends LeakageError {
|
|
626
|
+
static defaultErrorCode: string;
|
|
627
|
+
readonly model: string;
|
|
628
|
+
readonly endpointUrl: string;
|
|
629
|
+
constructor(message: string, options: OpenMeteoSeamlessLeakageErrorOptions);
|
|
630
|
+
protected payload(): Record<string, unknown>;
|
|
631
|
+
}
|
|
632
|
+
interface TemporalDriftErrorOptions extends MostlyRightErrorOptions {
|
|
368
633
|
schemaId: string;
|
|
369
634
|
assertedRange: [string, string];
|
|
370
635
|
violatingRows: number;
|
|
371
636
|
sampleViolations?: Array<Record<string, unknown>>;
|
|
372
637
|
}
|
|
373
|
-
declare class TemporalDriftError extends
|
|
638
|
+
declare class TemporalDriftError extends MostlyRightError {
|
|
374
639
|
static defaultErrorCode: string;
|
|
375
640
|
readonly schemaId: string;
|
|
376
641
|
readonly assertedRange: [string, string];
|
|
@@ -379,12 +644,12 @@ declare class TemporalDriftError extends TradewindsError {
|
|
|
379
644
|
constructor(message: string, options: TemporalDriftErrorOptions);
|
|
380
645
|
protected payload(): Record<string, unknown>;
|
|
381
646
|
}
|
|
382
|
-
interface PayloadTooLargeErrorOptions extends
|
|
647
|
+
interface PayloadTooLargeErrorOptions extends MostlyRightErrorOptions {
|
|
383
648
|
declaredSize: number;
|
|
384
649
|
limit: number;
|
|
385
650
|
acceptedModes?: string[];
|
|
386
651
|
}
|
|
387
|
-
declare class PayloadTooLargeError extends
|
|
652
|
+
declare class PayloadTooLargeError extends MostlyRightError {
|
|
388
653
|
static defaultErrorCode: string;
|
|
389
654
|
readonly declaredSize: number;
|
|
390
655
|
readonly limit: number;
|
|
@@ -392,21 +657,21 @@ declare class PayloadTooLargeError extends TradewindsError {
|
|
|
392
657
|
constructor(message: string, options: PayloadTooLargeErrorOptions);
|
|
393
658
|
protected payload(): Record<string, unknown>;
|
|
394
659
|
}
|
|
395
|
-
declare class DeferredMarketError extends
|
|
660
|
+
declare class DeferredMarketError extends MostlyRightError {
|
|
396
661
|
static defaultErrorCode: string;
|
|
397
662
|
}
|
|
398
|
-
declare class PolymarketEventError extends
|
|
663
|
+
declare class PolymarketEventError extends MostlyRightError {
|
|
399
664
|
static defaultErrorCode: string;
|
|
400
665
|
}
|
|
401
|
-
interface TherminalErrorOptions extends
|
|
666
|
+
interface TherminalErrorOptions extends MostlyRightErrorOptions {
|
|
402
667
|
statusCode?: number | null;
|
|
403
668
|
retryAfter?: number | null;
|
|
404
669
|
}
|
|
405
670
|
/**
|
|
406
|
-
* Base HTTP-layer marker. Subclass of `
|
|
407
|
-
* catch `
|
|
671
|
+
* Base HTTP-layer marker. Subclass of `MostlyRightError` so callers that
|
|
672
|
+
* catch `MostlyRightError` also catch transport errors.
|
|
408
673
|
*/
|
|
409
|
-
declare class TherminalError extends
|
|
674
|
+
declare class TherminalError extends MostlyRightError {
|
|
410
675
|
static defaultErrorCode: string;
|
|
411
676
|
readonly statusCode: number | null;
|
|
412
677
|
constructor(message: string, options?: TherminalErrorOptions);
|
|
@@ -449,10 +714,10 @@ declare class ServerError extends TherminalError {
|
|
|
449
714
|
* `stream()` swallows empty-tick errors and waits for the next polite-floor
|
|
450
715
|
* cycle. Only `latest()` raises `NoLiveDataError` on empty responses.
|
|
451
716
|
*/
|
|
452
|
-
declare class LiveStreamError extends
|
|
717
|
+
declare class LiveStreamError extends MostlyRightError {
|
|
453
718
|
static defaultErrorCode: string;
|
|
454
719
|
}
|
|
455
|
-
interface NoLiveDataErrorOptions extends
|
|
720
|
+
interface NoLiveDataErrorOptions extends MostlyRightErrorOptions {
|
|
456
721
|
station: string;
|
|
457
722
|
source: string;
|
|
458
723
|
}
|
|
@@ -466,7 +731,7 @@ interface NoLiveDataErrorOptions extends TradewindsErrorOptions {
|
|
|
466
731
|
declare class NoLiveDataError extends LiveStreamError {
|
|
467
732
|
static defaultErrorCode: string;
|
|
468
733
|
readonly station: string;
|
|
469
|
-
constructor(message: string
|
|
734
|
+
constructor(message: string, options: NoLiveDataErrorOptions);
|
|
470
735
|
protected payload(): Record<string, unknown>;
|
|
471
736
|
}
|
|
472
737
|
|
|
@@ -516,6 +781,38 @@ declare function cliAvailableAt(dateStr: string, station: string, delayHours?: n
|
|
|
516
781
|
*/
|
|
517
782
|
declare function marketCloseUtc(dateStr: string, station: string, tzOverride?: string): Date;
|
|
518
783
|
|
|
784
|
+
type Station = StationInfo;
|
|
785
|
+
/**
|
|
786
|
+
* Read-only view over the station registry with venue/country filters.
|
|
787
|
+
*
|
|
788
|
+
* Lookups accept either the registry code (3-letter NWS code for US stations,
|
|
789
|
+
* ICAO for international) or the 4-letter ICAO directly, so `get("NYC")`,
|
|
790
|
+
* `get("KNYC")`, and `get("EGLL")` all resolve.
|
|
791
|
+
*/
|
|
792
|
+
declare class StationCatalog {
|
|
793
|
+
private readonly stations;
|
|
794
|
+
private readonly byCode;
|
|
795
|
+
private readonly byIcao;
|
|
796
|
+
constructor(stations?: ReadonlyArray<Station>);
|
|
797
|
+
/**
|
|
798
|
+
* Return the station for `code` (registry code or ICAO).
|
|
799
|
+
* @throws if no station matches.
|
|
800
|
+
*/
|
|
801
|
+
get(code: string): Station;
|
|
802
|
+
/** Stations tagged with `venue` (e.g. "kalshi"), sorted by ICAO. */
|
|
803
|
+
filterByVenue(venue: string): Station[];
|
|
804
|
+
/** Stations whose ISO 3166-1 alpha-2 `country` matches, sorted by ICAO. */
|
|
805
|
+
filterByCountry(country: string): Station[];
|
|
806
|
+
/** Union of all venue tags present in the catalog. */
|
|
807
|
+
venues(): ReadonlySet<string>;
|
|
808
|
+
/** True iff `code` resolves to a station (by registry code or ICAO). */
|
|
809
|
+
has(code: string): boolean;
|
|
810
|
+
get size(): number;
|
|
811
|
+
[Symbol.iterator](): Iterator<Station>;
|
|
812
|
+
}
|
|
813
|
+
/** Process-wide default catalog over the codegen station registry. */
|
|
814
|
+
declare const CATALOG: StationCatalog;
|
|
815
|
+
|
|
519
816
|
interface FetchWithRetryOptions {
|
|
520
817
|
/** Base backoff delay in milliseconds (default 1000). */
|
|
521
818
|
baseDelayMs?: number;
|
|
@@ -567,4 +864,4 @@ declare const version = "0.0.0";
|
|
|
567
864
|
*/
|
|
568
865
|
declare function helloCore(): string;
|
|
569
866
|
|
|
570
|
-
export { AuthenticationError, CLIMATE_REPORT_TYPE_PRIORITY, DeferredMarketError, type FetchWithRetryOptions, ForbiddenError, type ForecastIemMosV1, LIVE_V1_POLICY, LeakageError, type LeakageErrorOptions, LiveStreamError, NoLiveDataError, type NoLiveDataErrorOptions, NotFoundError, OBSERVATION_SOURCE_PRIORITY, type ObservationLedgerV1, type ObservationQcV1, type ObservationV1, PayloadTooLargeError, type PayloadTooLargeErrorOptions, PolymarketEventError, QC_ALPHA_RULES, QC_ALPHA_RULES_BY_ID, type QcAlphaRule, RateLimitError, type RateLimitErrorOptions, STATIONS, STATION_BY_CODE, STATION_BY_ICAO, SchemaValidationError, type SchemaValidationErrorOptions, ServerError, type SettlementCliV1, SourceMismatchError, type SourceMismatchErrorOptions, type SourceMismatchRole, SourceUnavailableError, type SourceUnavailableErrorOptions, type
|
|
867
|
+
export { AuthenticationError, CATALOG, CLIMATE_REPORT_TYPE_PRIORITY, DATA_AVAILABILITY_REASONS, DataAvailabilityError, type DataAvailabilityErrorOptions, type DataAvailabilityReason, DeferredMarketError, type FetchWithRetryOptions, ForbiddenError, type ForecastIemMosV1, type ForecastStationV1, IssuedAtMissingError, type IssuedAtMissingErrorOptions, LIVE_V1_POLICY, LeakageError, type LeakageErrorOptions, LiveStreamError, MostlyRightError, type MostlyRightErrorOptions, NoLiveDataError, type NoLiveDataErrorOptions, NotFoundError, NwpNotAvailableError, type NwpNotAvailableErrorOptions, OBSERVATION_SOURCE_PRIORITY, type ObservationLedgerV1, type ObservationQcV1, type ObservationV1, OpenMeteoSeamlessLeakageError, type OpenMeteoSeamlessLeakageErrorOptions, PayloadTooLargeError, type PayloadTooLargeErrorOptions, PolymarketEventError, QC_ALPHA_RULES, QC_ALPHA_RULES_BY_ID, type QcAlphaRule, RateLimitError, type RateLimitErrorOptions, STATIONS, STATION_BY_CODE, STATION_BY_ICAO, SchemaValidationError, type SchemaValidationErrorOptions, ServerError, type SettlementCliV1, SourceMismatchError, type SourceMismatchErrorOptions, type SourceMismatchRole, SourceUnavailableError, type SourceUnavailableErrorOptions, type Station, StationCatalog, type StationInfo, TemporalDriftError, type TemporalDriftErrorOptions, TherminalError, type TherminalErrorOptions, ValidationError, _CLI_PUBLICATION_DELAY_HOURS, _JAN_REF, _MARKET_CLOSE_HOUR_LST, _MARKET_CLOSE_MINUTE_LST, _STATION_TZ, _lstOffsetHours, _resolveStationTz, cliAvailableAt, fetchWithRetry, helloCore, marketCloseUtc, settlementDateFor, settlementWindowUtc, toJsonSafe, version };
|