@zodiacs/engine 2.0.0-rc.3 → 2.1.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/README.md CHANGED
@@ -16,26 +16,35 @@ import-time side effects, and performs no network request from its core
16
16
  entry point. Its one runtime side effect is the ΔT it installs in
17
17
  astronomy-engine (see Time below).
18
18
 
19
- **2.0.0-rc.3**, the third candidate for 2.0.0, a major release
20
- (CHANGELOG.md). It is a draft for the owner's review and is not published to
21
- npm. Over 2.0.0-rc.2, a candidate never tagged or published, it refuses
22
- common near-miss names for a birth field, such as `lat`, `lng`, `houses` and
23
- `scale`, which were ignored (a breaking change, *Birth settings* below);
19
+ **2.1.0-rc.1** adds `searchStations()` and `searchLunations()` to
20
+ `@zodiacs/engine/calc`. They find planetary reversals and lunar phases in TT
21
+ windows. Each event gives its ephemeris, fallback flags, timing estimate and
22
+ clock bands. Existing `events()` calls keep their signature and results.
23
+ [Search windows, budgets and measured coverage](docs/calc.md#station-and-lunation-search)
24
+
25
+ **2.0.0**, a major release: 2.0.0-rc.6 with the version changed
26
+ (CHANGELOG.md). Callers moving from 1.1.0 should read
27
+ [docs/migrating-to-2.md](docs/migrating-to-2.md). Over 1.1.0 (through
28
+ candidates 2.0.0-rc.1 to 2.0.0-rc.6), it refuses a birth given as a calendar
29
+ date with no time unless `timeKnown` is `false` (*Resolved instant inputs*
30
+ below); refuses common near-miss names for a birth field, such as `lat`,
31
+ `lng`, `houses` and `scale`, which were ignored (*Birth settings* below);
24
32
  reads UTC after the IERS UT1 table, which ends on 2027-10-02, on the
25
33
  continuous-UTC rule, TT = UTC + 69.184 s (*Time*); reads wall times before
26
34
  1970 on tzdata 2026f's zone histories, America/Yellowknife held at tzdata
27
- 2025c by the owner's decision; flags a wall time where the device's time
28
- zone data differs from tzdata 2026f (`host-zone-data-differs`); adds Julian
29
- Day Numbers and local mean time from a longitude to `@zodiacs/engine/geo`;
30
- and adds `@zodiacs/engine/core`, the root's functions without the DE440
31
- pack (*Bundle size in a web page*). Over 1.1.0, as 2.0.0-rc.1 and rc.2 did,
32
- it refuses a birth given as a calendar date with no time,
33
- unless `timeKnown` is `false` (the breaking change, *Resolved instant
34
- inputs* below); flags a chart whose angles are inside the polar circle
35
- (`polar-angles`); flags a local date that a calendar changeover may have
36
- skipped, given with no country (`calendar-unknown`, [docs/time.md](docs/time.md));
37
- and gives each `positions()` row the flags `natalChart()` gives at the same
38
- instant.
35
+ 2025c by the owner's decision; flags a wall time where the device's time zone
36
+ data differs from tzdata 2026f (`host-zone-data-differs`, probing both
37
+ tzdata 2021a and 2025c baselines across 705 spans in 77 names), flags a chart
38
+ whose angles are inside the polar circle (`polar-angles`), flags a local date
39
+ that a calendar changeover may have skipped when given with no country
40
+ (`calendar-unknown`, [docs/time.md](docs/time.md)), and gives each
41
+ `positions()` row the flags `natalChart()` gives at the same instant; adds
42
+ `@zodiacs/engine/core`, the root's functions without the DE440 pack (*Bundle
43
+ size in a web page*), and adds Julian Day Numbers and local mean time from a
44
+ longitude to `@zodiacs/engine/geo`; throws `ERR_ZODIACS_ESM_ONLY` on
45
+ `require()` of any entry point; and throws `RangeError` for an unknown body
46
+ name on every source including root crossing searches. Nothing deprecated is
47
+ removed.
39
48
 
40
49
  **1.1.0**, the release before it, a minor release: 1.1.0-rc.13 with the
41
50
  version changed (CHANGELOG.md). It ships a sealed
@@ -102,8 +111,9 @@ later pass (`fold: "later"` in `@zodiacs/engine/geo`; see
102
111
  1.1.0-rc.3 added
103
112
  `@zodiacs/engine/de440`, positions from JPL's DE440 through a pack the caller
104
113
  supplies, which the root's `withEphemeris` puts in place of the default
105
- source; with `@zodiacs/engine/de440/pack` there are seventeen public entry
106
- points (see [docs/de440.md](docs/de440.md)). Over
114
+ source; with `@zodiacs/engine/de440/pack` and 2.0.0-rc.3's
115
+ `@zodiacs/engine/core` there are eighteen public entry points (see
116
+ [docs/de440.md](docs/de440.md)). Over
107
117
  1.0.0, natal receipts name their conventions as ids of the Zodiacs
108
118
  conventions registry, which a new entry, `@zodiacs/engine/conventions`,
109
119
  gives (from 1.1.0-rc.1; see *Draft natal receipts*). 1.1.0-rc.2 added two
@@ -121,9 +131,9 @@ Install it from npm:
121
131
  npm install @zodiacs/engine
122
132
  ```
123
133
 
124
- That installs npm's `latest`, 1.1.0, not this candidate:
125
- `artifacts/zodiacs-engine-2.0.0-rc.3.tgz` in the repository, with its
126
- SHA-256 receipt, is this candidate's exact archive. 1.0.0, npm's `latest`
134
+ `artifacts/zodiacs-engine-2.0.0.tgz` in the repository, with its SHA-256
135
+ receipt, is this release's exact archive (`artifacts/README.md` records its
136
+ publication status). 1.1.0 is the previous release; 1.0.0, npm's `latest`
127
137
  before 1.1.0, has no `./conventions`, `./time`, `./lite`, `./de440` or DE440
128
138
  pack, computes on astronomy-engine and writes no ids.
129
139
 
@@ -137,7 +147,7 @@ until 1.0.0, reads 0.1.1-rc.16's too.
137
147
  The package runs in browsers through a bundler, and in Node.js 20.19.0 or a
138
148
  later 20.x, or 22.7.0 or later (`"engines": { "node": "^20.19.0 || >=22.7.0" }`).
139
149
  Node.js 20 reached its end of life on 2026-04-30: the package is still tested
140
- there, but a 1.x minor release may drop it (docs/versioning.md, *Runtimes*).
150
+ there, but a 2.x minor release may drop it (docs/versioning.md, *Runtimes*).
141
151
  Its dependency, astronomy-engine 2.1.19, ships ES modules in a package that does
142
152
  not declare `"type": "module"`. Earlier Node versions load that file as
143
153
  CommonJS, so a plain Node import of this package fails there with "Named export
@@ -146,14 +156,31 @@ loads it with a harmless `MODULE_TYPELESS_PACKAGE_JSON` warning, which 22.22.2
146
156
  no longer prints. Bundlers resolve the dependency's `import` condition
147
157
  themselves and are not affected.
148
158
 
159
+ In the six-runtime conformance check on 2.0.0
160
+ (`docs/evidence/runtime-conformance-2.0.0-20261121/`, suite 0.3.0), all 569
161
+ supported verdicts on both the root and `@zodiacs/engine/core` agreed with
162
+ Node 22.22.2 in Bun 1.4.4, Deno 2.9.6, Chromium 156.0.8078.4, Firefox 157.0
163
+ and WebKit 27.2 (with 71 unsupported vectors: 1 leap-second instant, 30
164
+ stations and 40 lunations). Outputs are not identical to the last bit across
165
+ all runtimes (on the root, 458 of 569 were bit-identical to Node in Bun, Deno,
166
+ Chromium and WebKit, and 569 of 569 in Firefox; on core, 468 in Bun and
167
+ WebKit, 485 in Deno and Chromium, and 540 in Firefox), and synthetic receipt
168
+ digests differ from Node's where outputs differ.
169
+
170
+ The package is ES modules only and has no CommonJS build. `require()` of
171
+ `@zodiacs/engine` or of any of its entry points throws an `Error` with code
172
+ `ERR_ZODIACS_ESM_ONLY` whose message says to use `import`; from CommonJS,
173
+ load it with `await import("@zodiacs/engine")`.
174
+
149
175
  From a source checkout, run `npm ci` and `npm run build`, then
150
176
  `npm pack --ignore-scripts`. Test the packed file in a clean consumer using
151
- `npm run consumer:smoke -- /absolute/path/to/zodiacs-engine-2.0.0-rc.3.tgz`.
177
+ `npm run consumer:smoke -- /absolute/path/to/zodiacs-engine-2.0.0.tgz`.
152
178
  The smoke check
153
179
  downloads the artifact's public dependencies and TypeScript 5.9.3; its output
154
180
  records the artifact hash and runtime, and it removes its temporary consumer
155
181
  directory, which must have no `node_modules` above it (set `TMPDIR` if
156
- needed). A packed candidate is not a published release.
182
+ needed). A carried archive is published only by the owner via the Release
183
+ workflow.
157
184
 
158
185
  `artifacts/archives.json` records every carried archive: its digest, size, file
159
186
  count and the commit it was packed from. On the history it is given, CI checks
@@ -213,8 +240,8 @@ DE440 pack inside its years and astronomy-engine 2.1.19 elsewhere; where this
213
240
  document speaks of the ephemeris's accuracy or of its error limits without
214
241
  naming DE440, it speaks of astronomy-engine, the fallback and the ephemeris
215
242
  of what the pack does not give. See CHANGELOG.md for the release history and
216
- `docs/evidence/2.0.0-rc.3-20261117/` for this candidate's checks
217
- (2.0.0-rc.2's are in `docs/evidence/2.0.0-rc.2-20261116/`, 2.0.0-rc.1's in `docs/evidence/2.0.0-rc.1-20261116/`, 1.1.0's in `docs/evidence/1.1.0-20261116/`, 1.1.0-rc.13's in `docs/evidence/1.1.0-rc.13-20261115/`, 1.1.0-rc.12's in
243
+ `docs/evidence/2.0.0-rc.4-20261120/` for 2.0.0-rc.4's checks (this candidate's package, archive-binding and packed-consumer gates run in CI)
244
+ (2.0.0-rc.3's are in `docs/evidence/2.0.0-rc.3-20261117/`, 2.0.0-rc.2's in `docs/evidence/2.0.0-rc.2-20261116/`, 2.0.0-rc.1's in `docs/evidence/2.0.0-rc.1-20261116/`, 1.1.0's in `docs/evidence/1.1.0-20261116/`, 1.1.0-rc.13's in `docs/evidence/1.1.0-rc.13-20261115/`, 1.1.0-rc.12's in
218
245
  `docs/evidence/1.1.0-rc.12-20261115/`, 1.1.0-rc.11's and 1.1.0-rc.10's in
219
246
  their own dated folders there, 1.1.0-rc.9's, its superseded draft's, are in
220
247
  `docs/evidence/1.1.0-rc.9-20261114/`)
@@ -568,8 +595,9 @@ unrounded result. See `docs/evidence/rc12-20260928/sources.md`.
568
595
  ### Configurable aspects
569
596
 
570
597
  ```ts
571
- import { createAspectPolicy, findConfiguredAspects } from "@zodiacs/engine";
598
+ import { createAspectPolicy, findConfiguredAspects, natalChart } from "@zodiacs/engine";
572
599
 
600
+ const chart = natalChart({ utc: "1990-06-15T12:30:00Z" });
573
601
  const policy = createAspectPolicy({
574
602
  aspects: [
575
603
  { type: "conjunction", orb: 8, luminaryOrb: 10 },
@@ -647,8 +675,9 @@ boundary decisions can differ from the configured API's at roundoff scale.
647
675
  ### Declinations and parallels
648
676
 
649
677
  ```ts
650
- import { chartDeclinations, findDeclinationAspects } from "@zodiacs/engine";
678
+ import { chartDeclinations, findDeclinationAspects, natalChart } from "@zodiacs/engine";
651
679
 
680
+ const chart = natalChart({ utc: "1990-06-15T12:30:00Z" });
652
681
  const equatorial = chartDeclinations(chart);
653
682
  console.log(equatorial.utc, equatorial.deltaT, equatorial.trueObliquity);
654
683
  console.log(equatorial.rows); // lon, lat, ra, dec, outOfBounds, boundMarginArcsec
@@ -1160,8 +1189,10 @@ given. On UTC input with the engine's ΔT the last instant `natalChart`
1160
1189
  accepts is 3998-09-03T05:58:50.816Z, and the last calc computes is
1161
1190
  2199-12-31T23:58:50.815Z (from 2.0.0-rc.3, on the continuous-UTC rule; up to
1162
1191
  2.0.0-rc.2 they were 3998-09-03T02:01:41.309Z and
1163
- 2199-12-31T23:57:53.752Z), measured to the millisecond on this candidate's
1164
- build (`docs/evidence/2.0.0-rc.3-20261117/results/span-ends.json`). astronomy-engine reports any other failure by throwing a string, which
1192
+ 2199-12-31T23:57:53.752Z), measured to the millisecond on 2.0.0-rc.4's
1193
+ build (`docs/evidence/2.0.0-rc.4-20261120/results/span-ends.json`; the same
1194
+ on 2.0.0-rc.3's, `docs/evidence/2.0.0-rc.3-20261117/results/span-ends.json`);
1195
+ they were not measured again for this candidate. astronomy-engine reports any other failure by throwing a string, which
1165
1196
  reaches the caller as a `RangeError` whose `cause` is the original value.
1166
1197
 
1167
1198
  Inside the span, results are computed but not verified: accuracy was compared
@@ -1242,8 +1273,9 @@ tzdata 2025c's history by the owner's decision, because tzdata 2026f's
1242
1273
  change to it has no NEWS entry; before 1970 its results equal 2.0.0-rc.2's,
1243
1274
  but for the `tzdbVersion` they name, "2026f", the package's pinned release,
1244
1275
  though the zone's data is 2025c's. From 1970 the host's Intl answers, and from
1245
- 2.0.0-rc.3, near a span in which tzdata 2021a and 2026f give different
1246
- offsets, the engine asks the host for its offset there and flags the result
1276
+ 2.0.0-rc.3 (with 2025c added in 2.0.0-rc.6), near a span in which tzdata 2021a
1277
+ or 2025c gives a different offset from 2026f, the engine asks the host for its
1278
+ offset there and flags the result
1247
1279
  `host-zone-data-differs` where it differs from 2026f's
1248
1280
  ([docs/time.md](docs/time.md), *Host time zone data*); the instant stays the
1249
1281
  host's. A `longitude` reads a time in a
@@ -1301,8 +1333,9 @@ copies into `dist/core.js`) are CC BY 4.0, attributed in [NOTICE](NOTICE).
1301
1333
 
1302
1334
  The npm package contains no place database. It carries the DE440 pack
1303
1335
  (2,489,664 bytes), tzdb 2026f's zone histories before 1970
1304
- (America/Yellowknife's from tzdb 2025c), a table of where tzdb 2021a's offsets
1305
- from 1970 differ from 2026f's, the IERS leap-second list, an IERS UT1 − UTC
1336
+ (America/Yellowknife's from tzdb 2025c), a table of where tzdb 2021a's and
1337
+ 2025c's offsets from 1970 differ from 2026f's, the IERS leap-second list, an
1338
+ IERS UT1 − UTC
1306
1339
  table, a table of Gregorian adoption dates from public-domain sources, 22
1307
1340
  catalogue values for the stars of the Vedic ayanamsas, and the IAU 2000B
1308
1341
  nutation series from NOVAS C 3.1, a US Government work; [NOTICE](NOTICE)
package/dist/calc.d.ts CHANGED
@@ -417,6 +417,67 @@ interface EventsResult {
417
417
  * longitudes, under an optional budget of evaluations.
418
418
  */
419
419
  declare function events(request: EventsRequest): EventsResult | CalcRefusal;
420
+ declare const STATION_BODIES: readonly ["Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"];
421
+ type StationBody = (typeof STATION_BODIES)[number];
422
+ type LunationAngle = 0 | 90 | 180 | 270;
423
+ interface SearchWindow {
424
+ /**
425
+ * Both endpoints are rounded to TT milliseconds. Adjacent (from, to] windows partition the
426
+ * reported grid when they use the same ephemeris. Each search selects one source for its padded window.
427
+ */
428
+ readonly from: CalcTime;
429
+ readonly to: CalcTime;
430
+ /** Budget of scalar evaluations, including the two timing probes per event. Defaults to Infinity. */
431
+ readonly maxSamples?: number;
432
+ }
433
+ interface StationSearchRequest extends SearchWindow {
434
+ readonly body: StationBody;
435
+ }
436
+ interface LunationSearchRequest extends SearchWindow {
437
+ /**
438
+ * Moon minus Sun apparent longitude for new, first quarter, full or last quarter.
439
+ * The offset rises through zero at the requested angle and jumps down at (angle + 180) modulo 360.
440
+ */
441
+ readonly phaseDegrees: LunationAngle;
442
+ }
443
+ interface TimedEvent {
444
+ /** UTC calendar label on the engine's time basis, rounded to milliseconds. */
445
+ readonly at: string;
446
+ readonly jdTt: number;
447
+ readonly jdUt1: number;
448
+ readonly band: CalcEvent["band"];
449
+ readonly ephemeris: CalcReceipt<unknown>["engine"]["ephemeris"];
450
+ readonly flags: readonly ChartFlag[];
451
+ /** Width of the numerical TT bracket, seconds. */
452
+ readonly bracketSeconds: number;
453
+ /** Estimated TT timing resolution for the local angular allowance, including the bracket. */
454
+ readonly bounds: {
455
+ readonly timing: CalcBound;
456
+ };
457
+ readonly angularAllowanceArcsec: number;
458
+ }
459
+ interface StationEvent extends TimedEvent {
460
+ readonly body: StationBody;
461
+ /** Sense of motion after the station. */
462
+ readonly direction: "direct" | "retrograde";
463
+ readonly curvatureDegPerDay2: number;
464
+ }
465
+ interface LunationEvent extends TimedEvent {
466
+ readonly phaseDegrees: LunationAngle;
467
+ readonly relativeSpeedDegPerDay: number;
468
+ }
469
+ interface TimedSearchResult<Request, Event> {
470
+ readonly status: "ok";
471
+ readonly events: readonly Event[];
472
+ readonly samples: number;
473
+ readonly ephemeris: TimedEvent["ephemeris"];
474
+ readonly flags: readonly ChartFlag[];
475
+ readonly receipt: CalcReceipt<Request>;
476
+ }
477
+ /** Find every detected reversal of a planet's apparent geocentric longitude in (from, to]. */
478
+ declare function searchStations(request: StationSearchRequest): TimedSearchResult<StationSearchRequest, StationEvent> | CalcRefusal;
479
+ /** Find the requested lunar phase in (from, to] on the apparent geocentric true ecliptic of date. */
480
+ declare function searchLunations(request: LunationSearchRequest): TimedSearchResult<LunationSearchRequest, LunationEvent> | CalcRefusal;
420
481
  interface ChartRequest {
421
482
  /** A calendar date with no time, such as "1990-05-03", is refused with a RangeError unless `timeKnown` is false. */
422
483
  readonly time: CalcTime;
@@ -474,4 +535,4 @@ interface CalcSiderealChart {
474
535
  /** A natal chart from the calc vocabulary: natalChart()'s chart, with a receipt. */
475
536
  declare function chart(request: ChartRequest): ChartResult | CalcRefusal;
476
537
 
477
- export { Angles, CALC_AYANAMSAS, CALC_BODIES, CALC_FRAMES, CALC_RECEIPT_SCHEMA, CALC_SPAN, type CalcAyanamsa, type CalcAyanamsaModel, type CalcAyanamsaValue, type CalcBody, type CalcBound, type CalcBounds, type CalcCenter, type CalcCorrection, type CalcEvent, type CalcFlags, type CalcFrame, type CalcInstant, type CalcLocation, type CalcPlace, type CalcPosition, type CalcReceipt, type CalcRefusal, type CalcRequest, type CalcScale, type CalcSiderealChart, type CalcSpan, type CalcTime, type CalcTimeBand, type CalcUserAyanamsa, type CalcZodiac, Chart, ChartFlag, type ChartRequest, type ChartResult, DeltaT, type EventsRequest, type EventsResult, HouseSystem, type HousesRequest, type HousesResult, TimeBands, TimeScale, calc, chart, events, houses };
538
+ export { Angles, CALC_AYANAMSAS, CALC_BODIES, CALC_FRAMES, CALC_RECEIPT_SCHEMA, CALC_SPAN, type CalcAyanamsa, type CalcAyanamsaModel, type CalcAyanamsaValue, type CalcBody, type CalcBound, type CalcBounds, type CalcCenter, type CalcCorrection, type CalcEvent, type CalcFlags, type CalcFrame, type CalcInstant, type CalcLocation, type CalcPlace, type CalcPosition, type CalcReceipt, type CalcRefusal, type CalcRequest, type CalcScale, type CalcSiderealChart, type CalcSpan, type CalcTime, type CalcTimeBand, type CalcUserAyanamsa, type CalcZodiac, Chart, ChartFlag, type ChartRequest, type ChartResult, DeltaT, type EventsRequest, type EventsResult, HouseSystem, type HousesRequest, type HousesResult, type LunationAngle, type LunationEvent, type LunationSearchRequest, type StationBody, type StationEvent, type StationSearchRequest, TimeBands, TimeScale, type TimedSearchResult, calc, chart, events, houses, searchLunations, searchStations };