@mostlyrightmd/core 1.1.3 → 1.2.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.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/dist/discovery/index.cjs +44 -7
  3. package/dist/discovery/index.cjs.map +1 -1
  4. package/dist/discovery/index.d.cts +34 -6
  5. package/dist/discovery/index.d.ts +34 -6
  6. package/dist/discovery/index.mjs +44 -7
  7. package/dist/discovery/index.mjs.map +1 -1
  8. package/dist/index.cjs +39 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +16 -2
  11. package/dist/index.d.ts +16 -2
  12. package/dist/index.global.js +37 -1
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.mjs +37 -1
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/internal/cache/index.browser.cjs +77 -4
  17. package/dist/internal/cache/index.browser.cjs.map +1 -1
  18. package/dist/internal/cache/index.browser.d.cts +8 -2
  19. package/dist/internal/cache/index.browser.d.ts +8 -2
  20. package/dist/internal/cache/index.browser.mjs +10 -5
  21. package/dist/internal/cache/index.browser.mjs.map +1 -1
  22. package/dist/internal/cache/index.cjs +79 -2
  23. package/dist/internal/cache/index.cjs.map +1 -1
  24. package/dist/internal/cache/index.d.cts +12 -6
  25. package/dist/internal/cache/index.d.ts +12 -6
  26. package/dist/internal/cache/index.mjs +12 -3
  27. package/dist/internal/cache/index.mjs.map +1 -1
  28. package/dist/internal/{chunk-PKJXHY27.mjs → chunk-IPC4XUYW.mjs} +70 -1
  29. package/dist/internal/chunk-IPC4XUYW.mjs.map +1 -0
  30. package/dist/internal/{keys-B7C8C88N.d.cts → versionedCacheStore-DyHDqFIC.d.cts} +23 -1
  31. package/dist/internal/{keys-B7C8C88N.d.ts → versionedCacheStore-DyHDqFIC.d.ts} +23 -1
  32. package/dist/preprocessing/index.cjs +150 -0
  33. package/dist/preprocessing/index.cjs.map +1 -0
  34. package/dist/preprocessing/index.d.cts +111 -0
  35. package/dist/preprocessing/index.d.ts +111 -0
  36. package/dist/preprocessing/index.mjs +121 -0
  37. package/dist/preprocessing/index.mjs.map +1 -0
  38. package/dist/temporal/index.cjs.map +1 -1
  39. package/dist/temporal/index.mjs.map +1 -1
  40. package/dist/validator.cjs.map +1 -1
  41. package/dist/validator.mjs.map +1 -1
  42. package/package.json +25 -2
  43. package/dist/internal/chunk-PKJXHY27.mjs.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mostlyrightmd/core
2
2
 
3
- Core types, schemas, and primitives for the [mostlyright](https://github.com/mostlyrightmd/mostlyright-sdk) TypeScript SDK: the `research()` join, snapshot primitives, mode-2 source-pinned selectors, transforms, QC, discovery, temporal-safety, validators, formats, merge logic, and the full exception hierarchy. Mirrors the Python `mostlyrightmd` distribution.
3
+ The TypeScript core of the [mostlyright](https://github.com/mostlyrightmd/mostlyright-sdk) SDK — for quants, ML pipelines, and AI agents working with public weather data + prediction-market settlements. Provides core types, schemas, validators, temporal-safety primitives, the `research()` join, snapshot primitives, mode-2 source-pinned selectors, transforms, QC, discovery, formats, merge logic, and the full exception hierarchy. Mirrors the Python `mostlyrightmd` distribution.
4
4
 
5
5
  ## Install
6
6
 
@@ -1100,6 +1100,40 @@ var TradewindsError = class extends Error {
1100
1100
  return safe;
1101
1101
  }
1102
1102
  };
1103
+ var DATA_AVAILABILITY_REASONS = [
1104
+ "model_unavailable",
1105
+ "out_of_window",
1106
+ "cache_miss",
1107
+ "source_404",
1108
+ "source_5xx",
1109
+ "rate_limited"
1110
+ ];
1111
+ var DataAvailabilityError = class extends TradewindsError {
1112
+ static defaultErrorCode = "DATA_AVAILABILITY";
1113
+ reason;
1114
+ hint;
1115
+ constructor(options) {
1116
+ if (!DATA_AVAILABILITY_REASONS.includes(options.reason)) {
1117
+ throw new RangeError(
1118
+ `DataAvailabilityError: unknown reason "${String(options.reason)}". Valid reasons: ${DATA_AVAILABILITY_REASONS.join(", ")}`
1119
+ );
1120
+ }
1121
+ if (typeof options.hint !== "string" || options.hint.length === 0) {
1122
+ throw new TypeError("DataAvailabilityError: hint is required and must be a non-empty string");
1123
+ }
1124
+ const message = `[${options.reason}] ${options.hint}`;
1125
+ super(message, options);
1126
+ this.reason = options.reason;
1127
+ this.hint = options.hint;
1128
+ }
1129
+ payload() {
1130
+ return {
1131
+ ...super.payload(),
1132
+ reason: this.reason,
1133
+ hint: this.hint
1134
+ };
1135
+ }
1136
+ };
1103
1137
 
1104
1138
  // src/formats/toon.ts
1105
1139
  var SAFE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_.]*$/;
@@ -1617,17 +1651,20 @@ var FEATURE_NAMES = Object.freeze([
1617
1651
  function featureCatalog() {
1618
1652
  return FEATURE_NAMES;
1619
1653
  }
1654
+ var CLIMATE_GAPS_HINT = "climateGaps() is server-only in v1.x. Architectural reason: GHCNh CSVs are 10+ MB per station-year; browser fetch doesn't slice (no HTTP Range) and IndexedDB quotas don't fit the working set. Use the Python SDK (mostlyright.discover.climate_gaps) for v1.x, or wait for the hosted climate-gap-precompute API (target: post-v1.x). See https://mostlyright.md/docs/sdk/typescript/climate-gaps for details.";
1620
1655
  function climateGaps(_station, _fromDate, _toDate) {
1621
- throw new ClimateGapsNotImplementedError(
1622
- "climateGaps is Python-only in v0.1.0; the TS climate cache lands in v0.2"
1623
- );
1656
+ throw new ClimateGapsNotImplementedError();
1624
1657
  }
1625
- var ClimateGapsNotImplementedError = class extends TradewindsError {
1626
- constructor(message) {
1627
- super(message);
1658
+ var ClimateGapsNotImplementedError = class extends DataAvailabilityError {
1659
+ static defaultErrorCode = "DATA_AVAILABILITY";
1660
+ constructor() {
1661
+ super({
1662
+ reason: "model_unavailable",
1663
+ source: "climate-cache-browser",
1664
+ hint: CLIMATE_GAPS_HINT
1665
+ });
1628
1666
  this.name = "ClimateGapsNotImplementedError";
1629
1667
  }
1630
- static defaultErrorCode = "NOT_IMPLEMENTED";
1631
1668
  };
1632
1669
  // Annotate the CommonJS export names for ESM import in node:
1633
1670
  0 && (module.exports = {