@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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/discovery/index.cjs +471 -169
  3. package/dist/discovery/index.cjs.map +1 -1
  4. package/dist/discovery/index.d.cts +39 -11
  5. package/dist/discovery/index.d.ts +39 -11
  6. package/dist/discovery/index.mjs +471 -169
  7. package/dist/discovery/index.mjs.map +1 -1
  8. package/dist/index.cjs +618 -174
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +326 -29
  11. package/dist/index.d.ts +326 -29
  12. package/dist/index.global.js +610 -173
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.mjs +610 -173
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/internal/cache/index.browser.cjs +501 -163
  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 +503 -161
  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-QDQSYUFW.mjs} +494 -160
  29. package/dist/internal/chunk-QDQSYUFW.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 +56 -4
  39. package/dist/temporal/index.cjs.map +1 -1
  40. package/dist/temporal/index.d.cts +24 -1
  41. package/dist/temporal/index.d.ts +24 -1
  42. package/dist/temporal/index.mjs +55 -4
  43. package/dist/temporal/index.mjs.map +1 -1
  44. package/dist/validator.cjs +694 -109
  45. package/dist/validator.cjs.map +1 -1
  46. package/dist/validator.mjs +694 -109
  47. package/dist/validator.mjs.map +1 -1
  48. package/package.json +25 -2
  49. package/dist/internal/chunk-PKJXHY27.mjs.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import {
2
+ CACHE_SCHEMA_VERSION,
2
3
  DB_NAME,
3
4
  IndexedDBStore,
4
5
  MemoryStore,
@@ -10,11 +11,16 @@ import {
10
11
  isWritableYear,
11
12
  lockKeyFor,
12
13
  shouldSkipCacheForCurrentLstMonth,
13
- shouldSkipCacheForCurrentLstYear
14
- } from "../chunk-PKJXHY27.mjs";
14
+ shouldSkipCacheForCurrentLstYear,
15
+ versionedCacheStore
16
+ } from "../chunk-QDQSYUFW.mjs";
15
17
 
16
18
  // src/internal/cache/default.ts
17
19
  async function defaultCacheStore() {
20
+ const inner = await pickConcreteStore();
21
+ return versionedCacheStore(inner, CACHE_SCHEMA_VERSION);
22
+ }
23
+ async function pickConcreteStore() {
18
24
  if (typeof indexedDB !== "undefined") return new IndexedDBStore();
19
25
  if (typeof process !== "undefined" && typeof process.versions === "object" && process.versions !== null && typeof process.versions.node === "string") {
20
26
  const { FsStore } = await import("../fs-O6XR4WWW.mjs");
@@ -23,9 +29,11 @@ async function defaultCacheStore() {
23
29
  return new MemoryStore();
24
30
  }
25
31
  export {
32
+ CACHE_SCHEMA_VERSION,
26
33
  DB_NAME as INDEXEDDB_DB_NAME,
27
34
  IndexedDBStore,
28
35
  MemoryStore,
36
+ CACHE_SCHEMA_VERSION as VERSIONED_CACHE_SCHEMA_VERSION,
29
37
  cacheKeyForClimate,
30
38
  cacheKeyForObservations,
31
39
  defaultCacheStore,
@@ -35,6 +43,7 @@ export {
35
43
  isWritableYear,
36
44
  lockKeyFor,
37
45
  shouldSkipCacheForCurrentLstMonth,
38
- shouldSkipCacheForCurrentLstYear
46
+ shouldSkipCacheForCurrentLstYear,
47
+ versionedCacheStore
39
48
  };
40
49
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internal/cache/default.ts"],"sourcesContent":["// defaultCacheStore — runtime auto-detection per TS-SDK-DESIGN §5.4.\n//\n// Priority order (fixed, deterministic):\n// 1. `typeof indexedDB !== \"undefined\"` → IndexedDBStore (browser)\n// 2. `typeof process !== \"undefined\" && process.versions?.node` → FsStore\n// (Node, loaded via `await import('./fs.js')`)\n// 3. else → MemoryStore (Workers / edge / unknown)\n//\n// Iter-1 H3: `FsStore` is NO longer statically imported here. It\n// top-level-imports `node:fs/promises`, `node:os`, `node:path`, and\n// `proper-lockfile`, which would pull all four into any MV3 / browser /\n// edge bundle that touches `@mostlyrightmd/core/internal/cache` — even via\n// the IndexedDB code path. The dynamic `await import('./fs.js')` behind\n// a `process.versions?.node` runtime feature-detect ensures bundlers\n// can statically prove the FsStore subgraph is unreachable from the\n// browser entry, eliminating the Node-only-deps edge.\n//\n// Function is async because dynamic import returns a Promise. Callers\n// (research() and friends) already operate inside async code paths.\n\nimport { IndexedDBStore } from \"./indexeddb.js\";\nimport { MemoryStore } from \"./memory.js\";\nimport type { CacheStore } from \"./types.js\";\n\n/**\n * Auto-detect the best CacheStore for the current runtime.\n *\n * Returns a NEW instance per call.\n *\n * @returns a Promise resolving to a fresh CacheStore. The Node-only\n * `FsStore` is loaded via dynamic import behind a runtime feature\n * detect, so browser / MV3 / edge bundles never pull `node:fs/promises`\n * et al. (iter-1 H3 fix).\n */\nexport async function defaultCacheStore(): Promise<CacheStore> {\n if (typeof indexedDB !== \"undefined\") return new IndexedDBStore();\n if (\n typeof process !== \"undefined\" &&\n typeof process.versions === \"object\" &&\n process.versions !== null &&\n typeof process.versions.node === \"string\"\n ) {\n // Dynamic import keeps `./fs.js` (and its `node:fs/promises`,\n // `node:os`, `node:path`, `proper-lockfile` chain) out of the\n // browser bundle. Bundlers that support code-splitting will emit\n // a separate chunk; bundlers targeting `browser` resolution skip\n // the chunk entirely when the feature-detect short-circuits.\n const { FsStore } = await import(\"./fs.js\");\n return new FsStore();\n }\n return new MemoryStore();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,eAAsB,oBAAyC;AAC7D,MAAI,OAAO,cAAc,YAAa,QAAO,IAAI,eAAe;AAChE,MACE,OAAO,YAAY,eACnB,OAAO,QAAQ,aAAa,YAC5B,QAAQ,aAAa,QACrB,OAAO,QAAQ,SAAS,SAAS,UACjC;AAMA,UAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,oBAAS;AAC1C,WAAO,IAAI,QAAQ;AAAA,EACrB;AACA,SAAO,IAAI,YAAY;AACzB;","names":[]}
1
+ {"version":3,"sources":["../../../src/internal/cache/default.ts"],"sourcesContent":["// defaultCacheStore — runtime auto-detection per TS-SDK-DESIGN §5.4.\n//\n// Priority order (fixed, deterministic):\n// 1. `typeof indexedDB !== \"undefined\"` → IndexedDBStore (browser)\n// 2. `typeof process !== \"undefined\" && process.versions?.node` → FsStore\n// (Node, loaded via `await import('./fs.js')`)\n// 3. else → MemoryStore (Workers / edge / unknown)\n//\n// Iter-1 H3: `FsStore` is NO longer statically imported here. It\n// top-level-imports `node:fs/promises`, `node:os`, `node:path`, and\n// `proper-lockfile`, which would pull all four into any MV3 / browser /\n// edge bundle that touches `@mostlyrightmd/core/internal/cache` — even via\n// the IndexedDB code path. The dynamic `await import('./fs.js')` behind\n// a `process.versions?.node` runtime feature-detect ensures bundlers\n// can statically prove the FsStore subgraph is unreachable from the\n// browser entry, eliminating the Node-only-deps edge.\n//\n// Function is async because dynamic import returns a Promise. Callers\n// (research() and friends) already operate inside async code paths.\n\nimport { IndexedDBStore } from \"./indexeddb.js\";\nimport { MemoryStore } from \"./memory.js\";\nimport { CACHE_SCHEMA_VERSION, type CacheStore } from \"./types.js\";\nimport { versionedCacheStore } from \"./versionedCacheStore.js\";\n\n/**\n * Auto-detect the best CacheStore for the current runtime.\n *\n * Returns a NEW instance per call.\n *\n * Phase 21 21-03 (iter-1 fix per codex + ts-architect CRITICAL): the\n * concrete store is wrapped in `versionedCacheStore(CACHE_SCHEMA_VERSION)`\n * so pre-Phase-18 cache entries (no version sidecar, or wrong version)\n * silently miss instead of returning stale `0.06°F`-precision rows. The\n * wrap is transparent — callers see the same `CacheStore` interface.\n *\n * @returns a Promise resolving to a fresh CacheStore (wrapped). The\n * Node-only `FsStore` is loaded via dynamic import behind a runtime\n * feature detect, so browser / MV3 / edge bundles never pull\n * `node:fs/promises` et al. (iter-1 H3 fix).\n */\nexport async function defaultCacheStore(): Promise<CacheStore> {\n const inner = await pickConcreteStore();\n return versionedCacheStore(inner, CACHE_SCHEMA_VERSION);\n}\n\nasync function pickConcreteStore(): Promise<CacheStore> {\n if (typeof indexedDB !== \"undefined\") return new IndexedDBStore();\n if (\n typeof process !== \"undefined\" &&\n typeof process.versions === \"object\" &&\n process.versions !== null &&\n typeof process.versions.node === \"string\"\n ) {\n // Dynamic import keeps `./fs.js` (and its `node:fs/promises`,\n // `node:os`, `node:path`, `proper-lockfile` chain) out of the\n // browser bundle. Bundlers that support code-splitting will emit\n // a separate chunk; bundlers targeting `browser` resolution skip\n // the chunk entirely when the feature-detect short-circuits.\n const { FsStore } = await import(\"./fs.js\");\n return new FsStore();\n }\n return new MemoryStore();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,eAAsB,oBAAyC;AAC7D,QAAM,QAAQ,MAAM,kBAAkB;AACtC,SAAO,oBAAoB,OAAO,oBAAoB;AACxD;AAEA,eAAe,oBAAyC;AACtD,MAAI,OAAO,cAAc,YAAa,QAAO,IAAI,eAAe;AAChE,MACE,OAAO,YAAY,eACnB,OAAO,QAAQ,aAAa,YAC5B,QAAQ,aAAa,QACrB,OAAO,QAAQ,SAAS,SAAS,UACjC;AAMA,UAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,oBAAS;AAC1C,WAAO,IAAI,QAAQ;AAAA,EACrB;AACA,SAAO,IAAI,YAAY;AACzB;","names":[]}