@mostlyrightmd/core 1.2.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/discovery/index.cjs +813 -187
- package/dist/discovery/index.cjs.map +1 -1
- package/dist/discovery/index.d.cts +7 -7
- package/dist/discovery/index.d.ts +7 -7
- package/dist/discovery/index.mjs +813 -187
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/index.cjs +965 -198
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +313 -30
- package/dist/index.d.ts +313 -30
- package/dist/index.global.js +959 -197
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +959 -197
- package/dist/index.mjs.map +1 -1
- package/dist/internal/cache/index.browser.cjs +809 -183
- package/dist/internal/cache/index.browser.cjs.map +1 -1
- package/dist/internal/cache/index.browser.mjs +1 -1
- package/dist/internal/cache/index.cjs +809 -183
- package/dist/internal/cache/index.cjs.map +1 -1
- package/dist/internal/cache/index.mjs +1 -1
- package/dist/internal/{chunk-IPC4XUYW.mjs → chunk-MLNV6B3L.mjs} +810 -184
- package/dist/internal/chunk-MLNV6B3L.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 +1 -1
- package/dist/internal/chunk-IPC4XUYW.mjs.map +0 -1
package/dist/index.d.cts
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;
|
|
85
97
|
/**
|
|
86
98
|
* units: celsius
|
|
87
99
|
*/
|
|
88
100
|
dew_point_c?: null | number;
|
|
101
|
+
/**
|
|
102
|
+
* units: W/m^2
|
|
103
|
+
*/
|
|
104
|
+
direct_radiation_wm2?: null | number;
|
|
89
105
|
/**
|
|
90
106
|
* units: hours — (valid_at - issued_at).total_seconds() / 3600
|
|
91
107
|
*/
|
|
92
108
|
forecast_hour: number;
|
|
93
109
|
/**
|
|
94
|
-
*
|
|
110
|
+
* units: meters
|
|
95
111
|
*/
|
|
96
|
-
|
|
112
|
+
freezing_level_m?: number | null;
|
|
97
113
|
/**
|
|
98
|
-
*
|
|
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
|
|
99
119
|
*/
|
|
100
120
|
model: string;
|
|
101
121
|
/**
|
|
102
122
|
* units: probability — bounded [0, 1]
|
|
103
123
|
*/
|
|
104
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;
|
|
105
141
|
/**
|
|
106
142
|
* units: percent — bounded [0, 100]
|
|
107
143
|
*/
|
|
108
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;
|
|
109
153
|
station: string;
|
|
154
|
+
/**
|
|
155
|
+
* units: hPa
|
|
156
|
+
*/
|
|
157
|
+
surface_pressure_hpa?: null | number;
|
|
110
158
|
/**
|
|
111
159
|
* units: celsius
|
|
112
160
|
*/
|
|
113
161
|
temp_c?: null | number;
|
|
114
162
|
/**
|
|
115
|
-
* forecast target time (
|
|
163
|
+
* forecast target time (event_time)
|
|
116
164
|
*/
|
|
117
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;
|
|
118
174
|
/**
|
|
119
175
|
* units: degrees
|
|
120
176
|
*/
|
|
121
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;
|
|
201
|
+
/**
|
|
202
|
+
* units: celsius
|
|
203
|
+
*/
|
|
204
|
+
dew_point_c?: null | number;
|
|
205
|
+
/**
|
|
206
|
+
* units: W/m^2
|
|
207
|
+
*/
|
|
208
|
+
direct_radiation_wm2?: null | number;
|
|
209
|
+
/**
|
|
210
|
+
* units: hours — (valid_at - issued_at).total_seconds() / 3600
|
|
211
|
+
*/
|
|
212
|
+
forecast_hour: number;
|
|
213
|
+
/**
|
|
214
|
+
* units: meters
|
|
215
|
+
*/
|
|
216
|
+
freezing_level_m?: number | null;
|
|
217
|
+
/**
|
|
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
|
|
223
|
+
*/
|
|
224
|
+
model: string;
|
|
225
|
+
/**
|
|
226
|
+
* units: probability — bounded [0, 1]
|
|
227
|
+
*/
|
|
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;
|
|
245
|
+
/**
|
|
246
|
+
* units: percent — bounded [0, 100]
|
|
247
|
+
*/
|
|
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;
|
|
257
|
+
station: string;
|
|
258
|
+
/**
|
|
259
|
+
* units: hPa
|
|
260
|
+
*/
|
|
261
|
+
surface_pressure_hpa?: null | number;
|
|
262
|
+
/**
|
|
263
|
+
* units: celsius
|
|
264
|
+
*/
|
|
265
|
+
temp_c?: null | number;
|
|
266
|
+
/**
|
|
267
|
+
* forecast target time (event_time)
|
|
268
|
+
*/
|
|
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;
|
|
278
|
+
/**
|
|
279
|
+
* units: degrees
|
|
280
|
+
*/
|
|
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;
|
|
@@ -321,24 +486,68 @@ declare class SourceUnavailableError extends TradewindsError {
|
|
|
321
486
|
/** Shared reason enum — MUST match Python EXACTLY (Phase 21 D-04). */
|
|
322
487
|
declare const DATA_AVAILABILITY_REASONS: readonly ["model_unavailable", "out_of_window", "cache_miss", "source_404", "source_5xx", "rate_limited"];
|
|
323
488
|
type DataAvailabilityReason = (typeof DATA_AVAILABILITY_REASONS)[number];
|
|
324
|
-
interface DataAvailabilityErrorOptions extends
|
|
489
|
+
interface DataAvailabilityErrorOptions extends MostlyRightErrorOptions {
|
|
325
490
|
reason: DataAvailabilityReason;
|
|
326
491
|
hint: string;
|
|
327
492
|
}
|
|
328
|
-
declare class DataAvailabilityError extends
|
|
493
|
+
declare class DataAvailabilityError extends MostlyRightError {
|
|
329
494
|
static defaultErrorCode: string;
|
|
330
495
|
readonly reason: DataAvailabilityReason;
|
|
331
496
|
readonly hint: string;
|
|
332
497
|
constructor(options: DataAvailabilityErrorOptions);
|
|
333
498
|
protected payload(): Record<string, unknown>;
|
|
334
499
|
}
|
|
335
|
-
interface
|
|
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 {
|
|
336
545
|
schemaId: string;
|
|
337
546
|
violations?: Array<Record<string, unknown>>;
|
|
338
547
|
quarantineCount?: number;
|
|
339
548
|
sampleViolations?: Array<Record<string, unknown>>;
|
|
340
549
|
}
|
|
341
|
-
declare class SchemaValidationError extends
|
|
550
|
+
declare class SchemaValidationError extends MostlyRightError {
|
|
342
551
|
static defaultErrorCode: string;
|
|
343
552
|
readonly schemaId: string;
|
|
344
553
|
readonly violations: Array<Record<string, unknown>>;
|
|
@@ -348,13 +557,13 @@ declare class SchemaValidationError extends TradewindsError {
|
|
|
348
557
|
protected payload(): Record<string, unknown>;
|
|
349
558
|
}
|
|
350
559
|
type SourceMismatchRole = "observations" | "forecasts" | "settlement";
|
|
351
|
-
interface SourceMismatchErrorOptions extends
|
|
560
|
+
interface SourceMismatchErrorOptions extends MostlyRightErrorOptions {
|
|
352
561
|
schemaSource: string;
|
|
353
562
|
dataSource: string;
|
|
354
563
|
role?: SourceMismatchRole | null;
|
|
355
564
|
catalogWarning?: string | null;
|
|
356
565
|
}
|
|
357
|
-
declare class SourceMismatchError extends
|
|
566
|
+
declare class SourceMismatchError extends MostlyRightError {
|
|
358
567
|
static defaultErrorCode: string;
|
|
359
568
|
/** Canonical role-name vocabulary (design.md §R). */
|
|
360
569
|
static readonly VALID_ROLES: ReadonlySet<SourceMismatchRole>;
|
|
@@ -365,12 +574,12 @@ declare class SourceMismatchError extends TradewindsError {
|
|
|
365
574
|
constructor(message: string, options: SourceMismatchErrorOptions);
|
|
366
575
|
protected payload(): Record<string, unknown>;
|
|
367
576
|
}
|
|
368
|
-
interface LeakageErrorOptions extends
|
|
577
|
+
interface LeakageErrorOptions extends MostlyRightErrorOptions {
|
|
369
578
|
asOf: string;
|
|
370
579
|
violatingCount: number;
|
|
371
580
|
sampleViolations?: Array<Record<string, unknown>>;
|
|
372
581
|
}
|
|
373
|
-
declare class LeakageError extends
|
|
582
|
+
declare class LeakageError extends MostlyRightError {
|
|
374
583
|
static defaultErrorCode: string;
|
|
375
584
|
readonly asOf: string;
|
|
376
585
|
readonly violatingCount: number;
|
|
@@ -378,13 +587,55 @@ declare class LeakageError extends TradewindsError {
|
|
|
378
587
|
constructor(message: string, options: LeakageErrorOptions);
|
|
379
588
|
protected payload(): Record<string, unknown>;
|
|
380
589
|
}
|
|
381
|
-
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 {
|
|
382
633
|
schemaId: string;
|
|
383
634
|
assertedRange: [string, string];
|
|
384
635
|
violatingRows: number;
|
|
385
636
|
sampleViolations?: Array<Record<string, unknown>>;
|
|
386
637
|
}
|
|
387
|
-
declare class TemporalDriftError extends
|
|
638
|
+
declare class TemporalDriftError extends MostlyRightError {
|
|
388
639
|
static defaultErrorCode: string;
|
|
389
640
|
readonly schemaId: string;
|
|
390
641
|
readonly assertedRange: [string, string];
|
|
@@ -393,12 +644,12 @@ declare class TemporalDriftError extends TradewindsError {
|
|
|
393
644
|
constructor(message: string, options: TemporalDriftErrorOptions);
|
|
394
645
|
protected payload(): Record<string, unknown>;
|
|
395
646
|
}
|
|
396
|
-
interface PayloadTooLargeErrorOptions extends
|
|
647
|
+
interface PayloadTooLargeErrorOptions extends MostlyRightErrorOptions {
|
|
397
648
|
declaredSize: number;
|
|
398
649
|
limit: number;
|
|
399
650
|
acceptedModes?: string[];
|
|
400
651
|
}
|
|
401
|
-
declare class PayloadTooLargeError extends
|
|
652
|
+
declare class PayloadTooLargeError extends MostlyRightError {
|
|
402
653
|
static defaultErrorCode: string;
|
|
403
654
|
readonly declaredSize: number;
|
|
404
655
|
readonly limit: number;
|
|
@@ -406,21 +657,21 @@ declare class PayloadTooLargeError extends TradewindsError {
|
|
|
406
657
|
constructor(message: string, options: PayloadTooLargeErrorOptions);
|
|
407
658
|
protected payload(): Record<string, unknown>;
|
|
408
659
|
}
|
|
409
|
-
declare class DeferredMarketError extends
|
|
660
|
+
declare class DeferredMarketError extends MostlyRightError {
|
|
410
661
|
static defaultErrorCode: string;
|
|
411
662
|
}
|
|
412
|
-
declare class PolymarketEventError extends
|
|
663
|
+
declare class PolymarketEventError extends MostlyRightError {
|
|
413
664
|
static defaultErrorCode: string;
|
|
414
665
|
}
|
|
415
|
-
interface TherminalErrorOptions extends
|
|
666
|
+
interface TherminalErrorOptions extends MostlyRightErrorOptions {
|
|
416
667
|
statusCode?: number | null;
|
|
417
668
|
retryAfter?: number | null;
|
|
418
669
|
}
|
|
419
670
|
/**
|
|
420
|
-
* Base HTTP-layer marker. Subclass of `
|
|
421
|
-
* catch `
|
|
671
|
+
* Base HTTP-layer marker. Subclass of `MostlyRightError` so callers that
|
|
672
|
+
* catch `MostlyRightError` also catch transport errors.
|
|
422
673
|
*/
|
|
423
|
-
declare class TherminalError extends
|
|
674
|
+
declare class TherminalError extends MostlyRightError {
|
|
424
675
|
static defaultErrorCode: string;
|
|
425
676
|
readonly statusCode: number | null;
|
|
426
677
|
constructor(message: string, options?: TherminalErrorOptions);
|
|
@@ -463,10 +714,10 @@ declare class ServerError extends TherminalError {
|
|
|
463
714
|
* `stream()` swallows empty-tick errors and waits for the next polite-floor
|
|
464
715
|
* cycle. Only `latest()` raises `NoLiveDataError` on empty responses.
|
|
465
716
|
*/
|
|
466
|
-
declare class LiveStreamError extends
|
|
717
|
+
declare class LiveStreamError extends MostlyRightError {
|
|
467
718
|
static defaultErrorCode: string;
|
|
468
719
|
}
|
|
469
|
-
interface NoLiveDataErrorOptions extends
|
|
720
|
+
interface NoLiveDataErrorOptions extends MostlyRightErrorOptions {
|
|
470
721
|
station: string;
|
|
471
722
|
source: string;
|
|
472
723
|
}
|
|
@@ -530,6 +781,38 @@ declare function cliAvailableAt(dateStr: string, station: string, delayHours?: n
|
|
|
530
781
|
*/
|
|
531
782
|
declare function marketCloseUtc(dateStr: string, station: string, tzOverride?: string): Date;
|
|
532
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
|
+
|
|
533
816
|
interface FetchWithRetryOptions {
|
|
534
817
|
/** Base backoff delay in milliseconds (default 1000). */
|
|
535
818
|
baseDelayMs?: number;
|
|
@@ -581,4 +864,4 @@ declare const version = "0.0.0";
|
|
|
581
864
|
*/
|
|
582
865
|
declare function helloCore(): string;
|
|
583
866
|
|
|
584
|
-
export { AuthenticationError, CLIMATE_REPORT_TYPE_PRIORITY, DATA_AVAILABILITY_REASONS, DataAvailabilityError, type DataAvailabilityErrorOptions, type DataAvailabilityReason, 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 };
|