@essrt/physics 4.7.0 → 4.9.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 (52) hide show
  1. package/README.md +4 -0
  2. package/package.json +40 -38
  3. package/src/chain-cycles/index.cjs +24 -1
  4. package/src/constants/coefficients.d.ts +772 -0
  5. package/src/constants/generated.d.ts +38 -38
  6. package/src/earth/year-lengths.cjs +1 -1
  7. package/src/model.js +28 -3
  8. package/types/cardinal/index.d.cts +80 -0
  9. package/types/cardinal/one-source-structure.d.cts +35 -0
  10. package/types/chain-cycles/index.d.cts +33 -0
  11. package/types/climate/l1-orbital.d.cts +32 -0
  12. package/types/constants/coefficients.d.ts +772 -0
  13. package/types/constants/generated.d.ts +753 -0
  14. package/types/constants/index.d.ts +2 -0
  15. package/types/deltat/cycles.d.cts +72 -0
  16. package/types/deltat/deep-time.d.cts +122 -0
  17. package/types/deltat/historical.d.cts +8 -0
  18. package/types/deltat/recession-history.d.cts +80 -0
  19. package/types/earth/deep-orbital-history.d.cts +77 -0
  20. package/types/earth/sidereal-channel-artifact.d.cts +12 -0
  21. package/types/earth/sidereal-year-channel.d.cts +38 -0
  22. package/types/earth/year-lengths.d.cts +57 -0
  23. package/types/eclipse/besselian.d.cts +101 -0
  24. package/types/eclipse/finders.d.cts +116 -0
  25. package/types/eclipse/sun-planetary-completion.d.cts +39 -0
  26. package/types/index.d.ts +77 -0
  27. package/types/layer0/derive-params.d.ts +36 -0
  28. package/types/layer0/index.d.ts +49 -0
  29. package/types/layer1/index.d.ts +10 -0
  30. package/types/model.d.ts +156 -0
  31. package/types/moon/apparent.d.cts +78 -0
  32. package/types/moon/arguments.d.cts +138 -0
  33. package/types/moon/deep-ecc-channel.d.cts +25 -0
  34. package/types/moon/deep-modes-artifact.d.cts +140 -0
  35. package/types/moon/ecc-channel.d.cts +30 -0
  36. package/types/moon/month-chain.d.cts +79 -0
  37. package/types/moon/series-extension.d.cts +11 -0
  38. package/types/moon/series.d.cts +91 -0
  39. package/types/phase/index.d.cts +38 -0
  40. package/types/planets/asc-node-integrator.d.cts +30 -0
  41. package/types/planets/chain-artifact.d.ts +15 -0
  42. package/types/planets/ecc-channel.d.cts +20 -0
  43. package/types/planets/fibonacci-laws.d.cts +90 -0
  44. package/types/planets/geometry.d.cts +60 -0
  45. package/types/planets/inv-plane-frame.d.cts +36 -0
  46. package/types/planets/keplerian-chain.d.cts +173 -0
  47. package/types/planets/model.d.cts +116 -0
  48. package/types/planets/orbit-chain.d.cts +12 -0
  49. package/types/planets/orientation.d.cts +67 -0
  50. package/types/planets/predict.d.cts +88 -0
  51. package/types/planets/secular-series.d.cts +73 -0
  52. package/types/sun/longitude-correction.d.cts +41 -0
package/README.md CHANGED
@@ -34,6 +34,10 @@ const { createEclipseFinders } = require('@essrt/physics/eclipse/finders');
34
34
  const { createPredictivePrecession } = require('@essrt/physics/planets/predict');
35
35
  ```
36
36
 
37
+ **TypeScript**: the package ships declaration files (`types/`, one per
38
+ subpath export) generated from the sources' JSDoc — `import` from
39
+ `@essrt/physics` or any subpath is fully typed; no ambient shim needed.
40
+
37
41
  See the `exports` map in `package.json` for the full surface: moon
38
42
  (arguments/series/apparent/ecc-channel/month-chain), planets (geometry,
39
43
  corrections, predict, model, fibonacci-laws, …), deltat (cycles, deep-time,
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@essrt/physics",
3
- "version": "4.7.0",
4
- "description": "ESSRT (Expanding Solar System Resonance Theory) physics core \u2014 pure, injectable-constants, no I/O, no globals, no DOM. The complete model incl. fitted coefficients; every published version immutably ships one recorded model identity.",
3
+ "version": "4.9.0",
4
+ "description": "ESSRT (Expanding Solar System Resonance Theory) physics core — pure, injectable-constants, no I/O, no globals, no DOM. The complete model incl. fitted coefficients; every published version immutably ships one recorded model identity.",
5
5
  "essrt": {
6
6
  "modelVersion": "v13.0",
7
- "_note": "The model identity this package version ships (IP-unified-architecture \u00a710: package semver tracks the API axis; the model version + CONSTANTS_HASH/COEFFICIENTS_HASH in src/constants/ carry the scientific identity). The version-pinning gate enforces this pairing against public/input/model-version.json."
7
+ "_note": "The model identity this package version ships (IP-unified-architecture §10: package semver tracks the API axis; the model version + CONSTANTS_HASH/COEFFICIENTS_HASH in src/constants/ carry the scientific identity). The version-pinning gate enforces this pairing against public/input/model-version.json."
8
8
  },
9
9
  "type": "module",
10
10
  "main": "src/index.js",
11
+ "types": "types/index.d.ts",
11
12
  "files": [
12
13
  "src",
14
+ "types",
13
15
  "README.md"
14
16
  ],
15
17
  "repository": {
@@ -28,41 +30,41 @@
28
30
  "geocentric-model"
29
31
  ],
30
32
  "exports": {
31
- ".": "./src/index.js",
32
- "./phase": "./src/phase/index.cjs",
33
- "./cardinal": "./src/cardinal/index.cjs",
34
- "./cardinal/one-source-structure": "./src/cardinal/one-source-structure.cjs",
35
- "./moon/ecc-channel": "./src/moon/ecc-channel.cjs",
36
- "./moon/deep-ecc-channel": "./src/moon/deep-ecc-channel.cjs",
37
- "./moon/deep-modes-artifact": "./src/moon/deep-modes-artifact.cjs",
38
- "./earth/deep-orbital-history": "./src/earth/deep-orbital-history.cjs",
39
- "./earth/sidereal-year-channel": "./src/earth/sidereal-year-channel.cjs",
40
- "./earth/year-lengths": "./src/earth/year-lengths.cjs",
41
- "./moon/month-chain": "./src/moon/month-chain.cjs",
42
- "./chain-cycles": "./src/chain-cycles/index.cjs",
43
- "./moon/arguments": "./src/moon/arguments.cjs",
44
- "./moon/series": "./src/moon/series.cjs",
45
- "./moon/series-extension": "./src/moon/series-extension.cjs",
46
- "./moon/apparent": "./src/moon/apparent.cjs",
47
- "./planets/geometry": "./src/planets/geometry.cjs",
48
- "./planets/fibonacci-laws": "./src/planets/fibonacci-laws.cjs",
49
- "./planets/ecc-channel": "./src/planets/ecc-channel.cjs",
50
- "./planets/orientation": "./src/planets/orientation.cjs",
51
- "./planets/asc-node-integrator": "./src/planets/asc-node-integrator.cjs",
52
- "./planets/orbit-chain": "./src/planets/orbit-chain.cjs",
53
- "./planets/keplerian-chain": "./src/planets/keplerian-chain.cjs",
54
- "./planets/inv-plane-frame": "./src/planets/inv-plane-frame.cjs",
55
- "./planets/secular-series": "./src/planets/secular-series.cjs",
56
- "./planets/predict": "./src/planets/predict.cjs",
57
- "./planets/model": "./src/planets/model.cjs",
58
- "./deltat/cycles": "./src/deltat/cycles.cjs",
59
- "./deltat/deep-time": "./src/deltat/deep-time.cjs",
60
- "./deltat/historical": "./src/deltat/historical.cjs",
61
- "./deltat/recession-history": "./src/deltat/recession-history.cjs",
62
- "./climate/l1-orbital": "./src/climate/l1-orbital.cjs",
63
- "./eclipse/finders": "./src/eclipse/finders.cjs",
64
- "./eclipse/sun-planetary-completion": "./src/eclipse/sun-planetary-completion.cjs",
65
- "./sun/longitude-correction": "./src/sun/longitude-correction.cjs"
33
+ ".": { "types": "./types/index.d.ts", "default": "./src/index.js" },
34
+ "./phase": { "types": "./types/phase/index.d.cts", "default": "./src/phase/index.cjs" },
35
+ "./cardinal": { "types": "./types/cardinal/index.d.cts", "default": "./src/cardinal/index.cjs" },
36
+ "./cardinal/one-source-structure": { "types": "./types/cardinal/one-source-structure.d.cts", "default": "./src/cardinal/one-source-structure.cjs" },
37
+ "./moon/ecc-channel": { "types": "./types/moon/ecc-channel.d.cts", "default": "./src/moon/ecc-channel.cjs" },
38
+ "./moon/deep-ecc-channel": { "types": "./types/moon/deep-ecc-channel.d.cts", "default": "./src/moon/deep-ecc-channel.cjs" },
39
+ "./moon/deep-modes-artifact": { "types": "./types/moon/deep-modes-artifact.d.cts", "default": "./src/moon/deep-modes-artifact.cjs" },
40
+ "./earth/deep-orbital-history": { "types": "./types/earth/deep-orbital-history.d.cts", "default": "./src/earth/deep-orbital-history.cjs" },
41
+ "./earth/sidereal-year-channel": { "types": "./types/earth/sidereal-year-channel.d.cts", "default": "./src/earth/sidereal-year-channel.cjs" },
42
+ "./earth/year-lengths": { "types": "./types/earth/year-lengths.d.cts", "default": "./src/earth/year-lengths.cjs" },
43
+ "./moon/month-chain": { "types": "./types/moon/month-chain.d.cts", "default": "./src/moon/month-chain.cjs" },
44
+ "./chain-cycles": { "types": "./types/chain-cycles/index.d.cts", "default": "./src/chain-cycles/index.cjs" },
45
+ "./moon/arguments": { "types": "./types/moon/arguments.d.cts", "default": "./src/moon/arguments.cjs" },
46
+ "./moon/series": { "types": "./types/moon/series.d.cts", "default": "./src/moon/series.cjs" },
47
+ "./moon/series-extension": { "types": "./types/moon/series-extension.d.cts", "default": "./src/moon/series-extension.cjs" },
48
+ "./moon/apparent": { "types": "./types/moon/apparent.d.cts", "default": "./src/moon/apparent.cjs" },
49
+ "./planets/geometry": { "types": "./types/planets/geometry.d.cts", "default": "./src/planets/geometry.cjs" },
50
+ "./planets/fibonacci-laws": { "types": "./types/planets/fibonacci-laws.d.cts", "default": "./src/planets/fibonacci-laws.cjs" },
51
+ "./planets/ecc-channel": { "types": "./types/planets/ecc-channel.d.cts", "default": "./src/planets/ecc-channel.cjs" },
52
+ "./planets/orientation": { "types": "./types/planets/orientation.d.cts", "default": "./src/planets/orientation.cjs" },
53
+ "./planets/asc-node-integrator": { "types": "./types/planets/asc-node-integrator.d.cts", "default": "./src/planets/asc-node-integrator.cjs" },
54
+ "./planets/orbit-chain": { "types": "./types/planets/orbit-chain.d.cts", "default": "./src/planets/orbit-chain.cjs" },
55
+ "./planets/keplerian-chain": { "types": "./types/planets/keplerian-chain.d.cts", "default": "./src/planets/keplerian-chain.cjs" },
56
+ "./planets/inv-plane-frame": { "types": "./types/planets/inv-plane-frame.d.cts", "default": "./src/planets/inv-plane-frame.cjs" },
57
+ "./planets/secular-series": { "types": "./types/planets/secular-series.d.cts", "default": "./src/planets/secular-series.cjs" },
58
+ "./planets/predict": { "types": "./types/planets/predict.d.cts", "default": "./src/planets/predict.cjs" },
59
+ "./planets/model": { "types": "./types/planets/model.d.cts", "default": "./src/planets/model.cjs" },
60
+ "./deltat/cycles": { "types": "./types/deltat/cycles.d.cts", "default": "./src/deltat/cycles.cjs" },
61
+ "./deltat/deep-time": { "types": "./types/deltat/deep-time.d.cts", "default": "./src/deltat/deep-time.cjs" },
62
+ "./deltat/historical": { "types": "./types/deltat/historical.d.cts", "default": "./src/deltat/historical.cjs" },
63
+ "./deltat/recession-history": { "types": "./types/deltat/recession-history.d.cts", "default": "./src/deltat/recession-history.cjs" },
64
+ "./climate/l1-orbital": { "types": "./types/climate/l1-orbital.d.cts", "default": "./src/climate/l1-orbital.cjs" },
65
+ "./eclipse/finders": { "types": "./types/eclipse/finders.d.cts", "default": "./src/eclipse/finders.cjs" },
66
+ "./eclipse/sun-planetary-completion": { "types": "./types/eclipse/sun-planetary-completion.d.cts", "default": "./src/eclipse/sun-planetary-completion.cjs" },
67
+ "./sun/longitude-correction": { "types": "./types/sun/longitude-correction.d.cts", "default": "./src/sun/longitude-correction.cjs" }
66
68
  },
67
69
  "license": "AGPL-3.0-or-later"
68
70
  }
@@ -73,6 +73,29 @@ function createChainCycleIntegrator({
73
73
  /** @type {Map<PeriodSecondsAtAge, Float64Array | null>} */
74
74
  const tables = new Map();
75
75
 
76
+ // Exact-argument memo for the year-length integrand of the out-of-range
77
+ // Simpson fallback. Within one animation frame every integrator node
78
+ // (the six-plus Moon chains + the seven planets) integrates the SAME
79
+ // (anchor, currentYear) pair, so the Simpson sample lattice — and with
80
+ // it every tropicalYearSecondsAtAge(tMa) — repeats across chains, up to
81
+ // 13× per sample. Exact-key reuse returns the bit-identical value: pure
82
+ // dedupe, not a resolution change (the sampler-purity trap class is
83
+ // about grids serving NEARBY arguments; this serves only the same one).
84
+ // Bounded by wholesale clear — one frame's lattice is ≤ ~1025 entries.
85
+ /** @type {Map<number, number | null>} */
86
+ const yearSecondsMemo = new Map();
87
+ const YEAR_SECONDS_MEMO_CAP = 4096;
88
+ /** @param {number} tMa @returns {number | null} */
89
+ function tropicalYearSecondsMemo(tMa) {
90
+ let v = yearSecondsMemo.get(tMa);
91
+ if (v === undefined) {
92
+ v = tropicalYearSecondsAtAge(tMa);
93
+ if (yearSecondsMemo.size >= YEAR_SECONDS_MEMO_CAP) yearSecondsMemo.clear();
94
+ yearSecondsMemo.set(tMa, v);
95
+ }
96
+ return v;
97
+ }
98
+
76
99
  /** Lazy cumulative table for one chain; null when the chain is undefined
77
100
  * anywhere in range (→ Simpson fallback).
78
101
  * @param {PeriodSecondsAtAge} periodFnSeconds
@@ -167,7 +190,7 @@ function createChainCycleIntegrator({
167
190
  const tMa = (ageAnchorYear - y) / 1e6;
168
191
  const tPeriodS = periodFnSeconds(tMa);
169
192
  if (tPeriodS === null) return null;
170
- const tYrS = tropicalYearSecondsAtAge(tMa);
193
+ const tYrS = tropicalYearSecondsMemo(tMa);
171
194
  if (tYrS === null) return null;
172
195
  const integrand = tYrS / tPeriodS; // cycles per SI year
173
196
  const w = (i === 0 || i === n) ? 1 : (i % 2 === 1 ? 4 : 2);