@chrtco/sdk 0.10.3 → 0.10.4
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 +55 -0
- package/dist/index.cjs +84 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +265 -1
- package/dist/index.d.ts +265 -1
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -448,6 +448,79 @@ var CellsEndpoint = class {
|
|
|
448
448
|
}
|
|
449
449
|
};
|
|
450
450
|
|
|
451
|
+
// src/endpoints/weather.ts
|
|
452
|
+
var WeatherEndpoint = class {
|
|
453
|
+
constructor(http) {
|
|
454
|
+
this.http = http;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Observed conditions from the nearest reporting NOAA NDBC station.
|
|
458
|
+
*
|
|
459
|
+
* A **measurement, not a forecast**, and not live — most buoys report hourly
|
|
460
|
+
* and the median observation is around 40 minutes old. `observed.ageMinutes`
|
|
461
|
+
* is on every response and should be displayed: a readout that looks current
|
|
462
|
+
* but is 90 minutes stale is worse than one that says so.
|
|
463
|
+
*
|
|
464
|
+
* `unavailable` names every field the station did not report, so absence is
|
|
465
|
+
* stated rather than inferred from a missing key.
|
|
466
|
+
*/
|
|
467
|
+
async conditions(options) {
|
|
468
|
+
return this.http.request(
|
|
469
|
+
"/weather/conditions",
|
|
470
|
+
{
|
|
471
|
+
lat: options.lat,
|
|
472
|
+
lon: options.lon,
|
|
473
|
+
units: options.units,
|
|
474
|
+
station: options.station
|
|
475
|
+
},
|
|
476
|
+
options.signal
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Active NWS marine warnings for the zone — Small Craft Advisory, Gale,
|
|
481
|
+
* Storm, Hurricane Force Wind, Special Marine Warning. Most severe first.
|
|
482
|
+
*
|
|
483
|
+
* Its own call, so warnings can be re-checked cheaply (~60 s) without pulling
|
|
484
|
+
* a forecast you already have.
|
|
485
|
+
*
|
|
486
|
+
* **`expires` and `ends` are different.** `expires` is when the *bulletin*
|
|
487
|
+
* lapses — alerts are usually re-issued before then. `ends` is when the
|
|
488
|
+
* *hazard* is expected to be over. They are routinely hours apart, so
|
|
489
|
+
* describe the hazard with `ends` and use `expires` only to decide when to
|
|
490
|
+
* re-fetch.
|
|
491
|
+
*
|
|
492
|
+
* Display `instruction` verbatim: it is NWS's own advice to mariners.
|
|
493
|
+
*/
|
|
494
|
+
async alerts(options) {
|
|
495
|
+
return this.http.request(
|
|
496
|
+
"/weather/marine-alerts",
|
|
497
|
+
{ lat: options.lat, lon: options.lon, zone: options.zone },
|
|
498
|
+
options.signal
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* The NWS marine zone forecast — U.S. coastal and Great Lakes waters.
|
|
503
|
+
*
|
|
504
|
+
* Periods are NWS's own and are **neither hourly nor uniform**: `OVERNIGHT`,
|
|
505
|
+
* `TUE NIGHT`, `WED NIGHT THROUGH THU NIGHT`. A single period can span days.
|
|
506
|
+
* Flattening them into an hourly series invents resolution the data does not
|
|
507
|
+
* have.
|
|
508
|
+
*
|
|
509
|
+
* `expires` is the forecast's **own** stated validity, taken from the
|
|
510
|
+
* bulletin, not a TTL CHRT invented. `source.productId` identifies the
|
|
511
|
+
* upstream NWS product, so you can verify CHRT against NOAA directly.
|
|
512
|
+
*
|
|
513
|
+
* Offshore zones are not yet supported and fail with `501`.
|
|
514
|
+
*/
|
|
515
|
+
async forecast(options) {
|
|
516
|
+
return this.http.request(
|
|
517
|
+
"/weather/marine-forecast",
|
|
518
|
+
{ lat: options.lat, lon: options.lon, zone: options.zone },
|
|
519
|
+
options.signal
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
|
|
451
524
|
// src/endpoints/coverage.ts
|
|
452
525
|
var METRES_PER_NAUTICAL_MILE = 1852;
|
|
453
526
|
var CoverageEndpoint = class {
|
|
@@ -28383,6 +28456,14 @@ var Chrt = class {
|
|
|
28383
28456
|
cells;
|
|
28384
28457
|
/** Coverage data — list available chart sources */
|
|
28385
28458
|
coverage;
|
|
28459
|
+
/**
|
|
28460
|
+
* CHRTweather — NOAA-backed marine weather: observed conditions, active
|
|
28461
|
+
* warnings, and the NWS zone forecast. U.S. waters only, and requires the
|
|
28462
|
+
* `weather:read` scope on your key — a chart key does not carry it.
|
|
28463
|
+
*
|
|
28464
|
+
* An empty result from any of these never means calm water.
|
|
28465
|
+
*/
|
|
28466
|
+
weather;
|
|
28386
28467
|
/**
|
|
28387
28468
|
* CHRToffline — download MBTiles bundles for offline use.
|
|
28388
28469
|
* Requires `deviceId` in config. Manifest-based budget enforcement
|
|
@@ -28414,6 +28495,7 @@ var Chrt = class {
|
|
|
28414
28495
|
this.tiles = new TilesEndpoint(this.http, this.tileAuth, tileOpts);
|
|
28415
28496
|
this.cells = new CellsEndpoint(this.http);
|
|
28416
28497
|
this.coverage = new CoverageEndpoint(this.http);
|
|
28498
|
+
this.weather = new WeatherEndpoint(this.http);
|
|
28417
28499
|
this.featuresEp = new FeaturesEndpoint(this.http);
|
|
28418
28500
|
this.queryEp = new QueryEndpoint(this.http);
|
|
28419
28501
|
this.offline = new OfflineEndpoint(this.http, config.deviceId, config.manifestPath);
|
|
@@ -28749,6 +28831,7 @@ export {
|
|
|
28749
28831
|
TileAuth,
|
|
28750
28832
|
TileTokenError,
|
|
28751
28833
|
WATER_BODY_LAYER_GROUPS,
|
|
28834
|
+
WeatherEndpoint,
|
|
28752
28835
|
applyChrtSymbolSet,
|
|
28753
28836
|
applyColorTheme,
|
|
28754
28837
|
applyCustomStyleSettings,
|