@zodiacs/engine 0.1.1-rc.16 → 1.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +1478 -0
  2. package/LICENSING.md +184 -30
  3. package/NOTICE +81 -14
  4. package/README.md +345 -67
  5. package/dist/{api-VOW6Umy5.d.ts → api-ChL1N2Sr.d.ts} +44 -7
  6. package/dist/ayanamsa-ClFzkKmV.d.ts +135 -0
  7. package/dist/calc.d.ts +218 -21
  8. package/dist/calc.js +580 -160
  9. package/dist/chunk-2PZYJQV5.js +83 -0
  10. package/dist/chunk-47ERTK5X.js +27 -0
  11. package/dist/{chunk-O3NJRGJ2.js → chunk-4XOYTBLS.js} +1 -1
  12. package/dist/chunk-767FTO7O.js +48 -0
  13. package/dist/{chunk-N4B5JNMA.js → chunk-7Y2F2IWN.js} +40 -28
  14. package/dist/chunk-B4M2Y7FT.js +96 -0
  15. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  16. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  17. package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
  18. package/dist/chunk-I3L4POY7.js +18 -0
  19. package/dist/{chunk-I7O5EGFV.js → chunk-LNGURVNH.js} +3 -3
  20. package/dist/{chunk-4NV4ZEFZ.js → chunk-NNOSOOWS.js} +4 -4
  21. package/dist/chunk-OVXQQEXL.js +41 -0
  22. package/dist/{chunk-WOU7JVD3.js → chunk-QLIEEICB.js} +205 -194
  23. package/dist/chunk-RMBWKZI2.js +130 -0
  24. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  25. package/dist/{chunk-L6ZHWJZ6.js → chunk-TZVPZHZM.js} +51 -29
  26. package/dist/chunk-WBTWY2OB.js +478 -0
  27. package/dist/chunk-Y4E3WJU5.js +87 -0
  28. package/dist/chunk-YPU3MDNI.js +852 -0
  29. package/dist/conventions.d.ts +70 -0
  30. package/dist/conventions.js +26 -0
  31. package/dist/crossings.d.ts +22 -10
  32. package/dist/crossings.js +1 -1
  33. package/dist/de440-pack.d.ts +43 -0
  34. package/dist/de440-pack.js +16 -0
  35. package/dist/de440.d.ts +113 -0
  36. package/dist/de440.js +19 -0
  37. package/dist/deltat.d.ts +28 -3
  38. package/dist/deltat.js +1 -1
  39. package/dist/ephemeris-exTSqBgb.d.ts +60 -0
  40. package/dist/geo.d.ts +46 -13
  41. package/dist/geo.js +4 -2
  42. package/dist/{houses-q1O2GGp4.d.ts → houses-Bh7GCnPi.d.ts} +14 -4
  43. package/dist/houses-extra.d.ts +22 -7
  44. package/dist/houses-extra.js +4 -2
  45. package/dist/index.d.ts +36 -49
  46. package/dist/index.js +54 -34
  47. package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-CxenuGfm.d.ts} +41 -27
  48. package/dist/internal-math.d.ts +4 -3
  49. package/dist/internal-math.js +14 -12
  50. package/dist/internal.d.ts +16 -7
  51. package/dist/internal.js +27 -6
  52. package/dist/lite-composite.js +114 -0
  53. package/dist/lite-declinations.js +253 -0
  54. package/dist/lite-dignities.js +333 -0
  55. package/dist/lite-sect.js +72 -0
  56. package/dist/lite.d.ts +82 -0
  57. package/dist/lite.js +4 -0
  58. package/dist/receipt.d.ts +3 -268
  59. package/dist/receipt.js +202 -89
  60. package/dist/reference-span-CILpclrz.d.ts +40 -0
  61. package/dist/{rulers-9wljfVaO.d.ts → rulers-CSSWtiWF.d.ts} +7 -2
  62. package/dist/sky.d.ts +26 -10
  63. package/dist/sky.js +23 -14
  64. package/dist/techniques.d.ts +160 -21
  65. package/dist/techniques.js +157 -89
  66. package/dist/time-bands-CZA9AlLg.d.ts +36 -0
  67. package/dist/time-scale-DIFNa0gz.d.ts +47 -0
  68. package/dist/time.d.ts +81 -0
  69. package/dist/time.js +74 -0
  70. package/dist/timing.d.ts +55 -17
  71. package/dist/timing.js +33 -45
  72. package/dist/types-DpPdtXgO.d.ts +335 -0
  73. package/dist/vedic.d.ts +150 -123
  74. package/dist/vedic.js +398 -440
  75. package/dist/window.d.ts +102 -80
  76. package/dist/window.js +108 -51
  77. package/dist/zone-history-BxmDCcTK.d.ts +290 -0
  78. package/package.json +26 -3
  79. package/dist/chunk-2OWGBT3O.js +0 -219
  80. package/dist/types-B4MCoCCS.d.ts +0 -228
@@ -0,0 +1,290 @@
1
+ import { a as TimeScaleName } from './time-scale-DIFNa0gz.js';
2
+ import { B as BodyName, f as AspectType, Z as ZodiacSign, H as HouseSystem, g as ChartFlag, d as Chart, h as BirthInput } from './types-DpPdtXgO.js';
3
+ import { DeltaTSegment } from './deltat.js';
4
+
5
+ /**
6
+ * The schema ids of the natal record, its receipt and its redacted diagnostic.
7
+ * Zodiacs-owned vocabulary, not an industry interoperability standard. The
8
+ * `draft-v1` in each is part of the id, kept byte for byte since 0.1.1-rc.3
9
+ * because stored records carry it: within an id, the conventions set a
10
+ * receipt names says which shape its fields have (docs/versioning.md).
11
+ */
12
+ declare const NATAL_ENVELOPE_SCHEMA = "zodiacs.natal-envelope.draft-v1";
13
+ declare const NATAL_RECEIPT_SCHEMA = "zodiacs.calculation-receipt.draft-v1";
14
+ declare const NATAL_DIAGNOSTIC_SCHEMA = "zodiacs.natal-diagnostic.draft-v1";
15
+ declare const NATAL_ENVELOPE_LIMITS: Readonly<{
16
+ bytes: 65536;
17
+ depth: 12;
18
+ nodes: 4096;
19
+ }>;
20
+ type NatalEnvelopeErrorCode = "invalid_json" | "invalid_shape" | "invalid_value" | "inconsistent_result" | "invalid_context" | "size_limit" | "complexity_limit" | "unsupported_version" | "unsupported_feature";
21
+ declare class NatalEnvelopeError extends Error {
22
+ readonly code: NatalEnvelopeErrorCode;
23
+ constructor(code: NatalEnvelopeErrorCode);
24
+ }
25
+ type NatalJsonValue = null | boolean | number | string | NatalJsonValue[] | NatalJsonObject;
26
+ interface NatalJsonObject {
27
+ [key: string]: NatalJsonValue;
28
+ }
29
+ type NatalReference = "supplied-instant" | "utc-noon" | "local-noon";
30
+ /** A clock change a local resolution records. */
31
+ interface NatalZoneTransition {
32
+ at: string;
33
+ offsetBeforeMinutes: number;
34
+ offsetAfterMinutes: number;
35
+ cause: TransitionCause;
36
+ }
37
+ /**
38
+ * Captured assertions, checked arithmetically without consulting today's
39
+ * Intl/tzdb. The fields after `policy` are optional from the time-basis
40
+ * conventions set on, so a record in rc.14's shape is accepted, and absent
41
+ * before it; each one given is checked. `resolveLocalToUtc` returns the whole
42
+ * object as `localResolution` (docs/time.md).
43
+ */
44
+ interface NatalLocalResolution {
45
+ /** The proleptic Gregorian date resolved. */
46
+ date: string;
47
+ time: string;
48
+ timeZone: string;
49
+ /** Offset at the resolved instant, minutes east of UTC; may be fractional. */
50
+ offsetMinutes: number;
51
+ /** Forward wall-clock shift; positive only for a reported gap. */
52
+ gapShiftMinutes: number;
53
+ /**
54
+ * How a repeated or skipped wall time was read. `fold` is the pass taken:
55
+ * "later" only where the caller chose it and `inputFlags` has `dst-fold`,
56
+ * "earlier" otherwise. An engine from before the choice existed refuses a
57
+ * record with "later" as `unsupported_feature`.
58
+ */
59
+ policy: {
60
+ fold: "earlier" | "later";
61
+ gap: "shift-forward";
62
+ };
63
+ calendar?: "gregorian" | "julian";
64
+ writtenDate?: string;
65
+ tzdbVersion?: string | null;
66
+ dataForm?: "main+backzone" | "main" | "host";
67
+ clock?: "local-mean-time" | "legal";
68
+ transition?: NatalZoneTransition | null;
69
+ localMeanTime?: {
70
+ longitude: number;
71
+ zoneOffsetMinutes: number;
72
+ } | null;
73
+ }
74
+ /** Supplied facts are claims, including hashes. This codec authenticates none of them. */
75
+ interface NatalProvenanceClaims {
76
+ source?: {
77
+ repository: string;
78
+ commit: string;
79
+ };
80
+ artifact?: {
81
+ sha256: string;
82
+ packageVersion: string;
83
+ distributionRepository?: string;
84
+ distributionCommit?: string;
85
+ };
86
+ runtime?: {
87
+ name: string;
88
+ version?: string;
89
+ icuVersion?: string;
90
+ tzdbVersion?: string;
91
+ };
92
+ /** The receipt's own ephemeris: astronomy-engine, or with a DE440 chart its pack (jpl-de440 and the pack's SHA-256). */
93
+ ephemeris?: {
94
+ name: "astronomy-engine" | "jpl-de440";
95
+ version: string;
96
+ };
97
+ }
98
+ interface NatalEnvelopeContext {
99
+ /** Omission never infers noon, including when timeKnown is false. */
100
+ reference?: NatalReference;
101
+ /** Original validated ISO spelling when captured; no zone/offset meaning is inferred. */
102
+ sourceInstant?: string | null;
103
+ localResolution?: NatalLocalResolution | null;
104
+ provenance?: NatalProvenanceClaims;
105
+ /** Optional JSON data only. Never executed, rendered, fetched or used for replay. */
106
+ extensions?: NatalJsonObject;
107
+ }
108
+ /**
109
+ * A conventions set: what a receipt's numbers mean, as named ids, one for each
110
+ * part of the calculation (`zodiac`, `nutation`, `angles` and so on). A
111
+ * receipt carries exactly one of NATAL_RECEIPT_CONVENTION_SETS.
112
+ */
113
+ type NatalConventionSet = Readonly<Record<string, string>>;
114
+ /**
115
+ * Every conventions set a receipt may carry: index 0 is the set this release
116
+ * writes for a chart from astronomy-engine; then the earlier sets, newest
117
+ * first; and last the set it writes for a chart from a DE440 pack (from
118
+ * 1.1.0-rc.3), placed there so that no earlier set's index moved. The codec
119
+ * reads every set here. A minor release may add a set at the front, so take a
120
+ * set by its content, not by an index other than 0.
121
+ */
122
+ declare const NATAL_RECEIPT_CONVENTION_SETS: readonly NatalConventionSet[];
123
+ /** What a receipt says its numbers were checked against, as named statements. */
124
+ type NatalCoverage = Readonly<Record<string, string>>;
125
+ interface NatalReceipt {
126
+ schema: typeof NATAL_RECEIPT_SCHEMA;
127
+ /** On the scale `timeScale` names; UTC before the time-basis set. */
128
+ instant: string;
129
+ timeScale?: TimeScaleName;
130
+ sourceInstant: string | null;
131
+ /** Caller declaration, not verification of a human birth time's precision. */
132
+ timeKnown: boolean;
133
+ reference: NatalReference;
134
+ localResolution: NatalLocalResolution | null;
135
+ coordinates: {
136
+ latitude: number;
137
+ longitude: number;
138
+ } | null;
139
+ houses: {
140
+ requested: HouseSystem;
141
+ actual: HouseSystem | null;
142
+ absenceReason: "unknown-time" | "missing-location" | null;
143
+ };
144
+ /** Only time-resolution assertions may be supplied to this draft's creator. */
145
+ inputFlags: ChartFlag[];
146
+ resultFlags: ChartFlag[];
147
+ /** From the rc.8 conventions set on, the engine also names its ephemeris. */
148
+ engine: {
149
+ name: "@zodiacs/engine";
150
+ version: string;
151
+ /** astronomy-engine and its version, or `jpl-de440` and the SHA-256 of the pack. */
152
+ ephemeris?: {
153
+ name: "astronomy-engine" | "jpl-de440";
154
+ version: string;
155
+ };
156
+ };
157
+ provenance: (NatalProvenanceClaims & {
158
+ status: "claimed";
159
+ }) | null;
160
+ conventions: NatalConventionSet;
161
+ coverage: NatalCoverage;
162
+ /**
163
+ * From 1.1.0-rc.1's set on: the ids, in the Zodiacs conventions registry's
164
+ * syntax, that this receipt and its result name, as natalConventionIds
165
+ * (./conventions) gives them.
166
+ */
167
+ conventionIds?: string[];
168
+ }
169
+ /** A body as a natal record holds it. Its shape changes only with a new conventions set. */
170
+ interface NatalBodyRecord {
171
+ body: BodyName;
172
+ lon: number;
173
+ lat: number;
174
+ speed: number;
175
+ retrograde: boolean;
176
+ sign: ZodiacSign;
177
+ degree: number;
178
+ }
179
+ /** The four angles as a natal record holds them. */
180
+ interface NatalAnglesRecord {
181
+ asc: number;
182
+ mc: number;
183
+ dsc: number;
184
+ ic: number;
185
+ }
186
+ /** The houses as a natal record holds them: the system computed and twelve cusps, first house first. */
187
+ interface NatalHousesRecord {
188
+ system: HouseSystem;
189
+ cusps: number[];
190
+ }
191
+ /** An aspect as a natal record holds it. */
192
+ interface NatalAspectRecord {
193
+ a: BodyName;
194
+ b: BodyName;
195
+ type: AspectType;
196
+ orb: number;
197
+ applying: boolean;
198
+ }
199
+ /** ΔT as a natal record holds it, from the rc.8 conventions set on. */
200
+ interface NatalDeltaTRecord {
201
+ seconds: number;
202
+ sigma: number | null;
203
+ model: "zodiacs-deltat/1" | "iers-utc/1" | "pinned";
204
+ table: string | null;
205
+ tableDigest: string | null;
206
+ segment: DeltaTSegment;
207
+ }
208
+ /** How the instant became UT1 and TT, as a natal record holds it, from the time-basis conventions set on. */
209
+ interface NatalTimeScaleRecord {
210
+ input: TimeScaleName;
211
+ basis: "iers" | "delta-t" | "pinned";
212
+ ut1MinusUtc: {
213
+ seconds: number;
214
+ sigma: number;
215
+ source: "observed" | "predicted" | "fallback";
216
+ } | null;
217
+ leapSeconds: {
218
+ taiMinusUtc: number;
219
+ listed: boolean;
220
+ } | null;
221
+ }
222
+ /**
223
+ * The result a natal record holds: the chart's bodies, angles, houses and
224
+ * aspects, and from later conventions sets its ΔT and time scale. These are
225
+ * the record's own types, not the chart's: a chart may gain a field in a minor
226
+ * release, and the record keeps the fields its conventions set names.
227
+ */
228
+ interface NatalRecordedResult {
229
+ bodies: NatalBodyRecord[];
230
+ angles: NatalAnglesRecord | null;
231
+ houses: NatalHousesRecord | null;
232
+ aspects: NatalAspectRecord[];
233
+ /** From the rc.8 set on. */
234
+ deltaT?: NatalDeltaTRecord;
235
+ /** From the time-basis set on. */
236
+ timeScale?: NatalTimeScaleRecord;
237
+ }
238
+ interface NatalEnvelope {
239
+ schema: typeof NATAL_ENVELOPE_SCHEMA;
240
+ /**
241
+ * `convention-ids` with the conventions set from 1.1.0-rc.1 on, so that an
242
+ * earlier engine refuses the record as `unsupported_feature`, and none with
243
+ * an earlier set; `convention-ids` then `ephemeris-jpl-de440` with the DE440
244
+ * set. Unknown features fail closed.
245
+ */
246
+ requiredFeatures: string[];
247
+ receipt: NatalReceipt;
248
+ /** `deltaT` from the rc.8 set on, `timeScale` from the time-basis set on. */
249
+ result: NatalRecordedResult;
250
+ extensions?: NatalJsonObject;
251
+ }
252
+ type NatalEnvelopeParseResult = {
253
+ ok: true;
254
+ envelope: NatalEnvelope;
255
+ } | {
256
+ ok: false;
257
+ code: NatalEnvelopeErrorCode;
258
+ };
259
+ interface NatalDiagnostic {
260
+ schema: typeof NATAL_DIAGNOSTIC_SCHEMA;
261
+ status: "redacted-not-anonymous";
262
+ timeKnown: boolean;
263
+ houses: NatalReceipt["houses"];
264
+ inputFlags: ChartFlag[];
265
+ resultFlags: ChartFlag[];
266
+ }
267
+ /**
268
+ * Capture a fresh full Chart, not a legacy summary. Checks declared consistency,
269
+ * not ephemeris accuracy, historical timezone truth, origin, or authenticity.
270
+ * Optional properties must be omitted rather than set to undefined.
271
+ *
272
+ * The record keeps the fields its conventions set names and leaves out any
273
+ * other field of the chart's result, so a field a later release adds to a
274
+ * chart does not change the records it writes. The chart's `input` is read
275
+ * strictly: an input field the receipt cannot describe is refused, because it
276
+ * may have changed the numbers.
277
+ */
278
+ declare function createNatalEnvelope(chart: Chart, context?: NatalEnvelopeContext): NatalEnvelope;
279
+ /** Bounded JSON entry point. Unknown versions/features never become calculation input. */
280
+ declare function parseNatalEnvelope(json: string): NatalEnvelopeParseResult;
281
+ declare function serializeNatalEnvelope(envelope: NatalEnvelope): string;
282
+ /** Replay the recorded request/instant, never a fallback house system or today's tzdb. */
283
+ declare function natalReplayInput(envelope: NatalEnvelope): BirthInput;
284
+ /** A fresh fixed allowlist: no claimed identifiers, versions, hashes, or input/result values. */
285
+ declare function redactNatalEnvelope(envelope: NatalEnvelope): NatalDiagnostic;
286
+
287
+ /** What changed at a transition, from the tzdb record. */
288
+ type TransitionCause = "dst" | "legal-change" | "date-line";
289
+
290
+ export { createNatalEnvelope as A, natalReplayInput as B, parseNatalEnvelope as C, redactNatalEnvelope as D, serializeNatalEnvelope as E, type NatalLocalResolution as N, type TransitionCause as T, NATAL_DIAGNOSTIC_SCHEMA as a, NATAL_ENVELOPE_LIMITS as b, NATAL_ENVELOPE_SCHEMA as c, NATAL_RECEIPT_CONVENTION_SETS as d, NATAL_RECEIPT_SCHEMA as e, type NatalAnglesRecord as f, type NatalAspectRecord as g, type NatalBodyRecord as h, type NatalConventionSet as i, type NatalCoverage as j, type NatalDeltaTRecord as k, type NatalDiagnostic as l, type NatalEnvelope as m, type NatalEnvelopeContext as n, NatalEnvelopeError as o, type NatalEnvelopeErrorCode as p, type NatalEnvelopeParseResult as q, type NatalHousesRecord as r, type NatalJsonObject as s, type NatalJsonValue as t, type NatalProvenanceClaims as u, type NatalReceipt as v, type NatalRecordedResult as w, type NatalReference as x, type NatalTimeScaleRecord as y, type NatalZoneTransition as z };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zodiacs/engine",
3
- "version": "0.1.1-rc.16",
4
- "description": "Browser-first astrology calculations used by Zodiacs.org: tropical charts; one calculation API with bounds and receipts in ./calc; birth-time windows in ./window; returns, relationship charts, the void-of-course Moon, patterns and dignities in ./techniques; house positions and cusp speeds in ./houses; rise, set, transit and planetary hours in ./sky; Hellenistic timing techniques and planetary returns in ./timing; and the sidereal zodiac and Jyotish techniques in ./vedic.",
3
+ "version": "1.1.0",
4
+ "description": "Browser-first astrology calculations used by Zodiacs.org: tropical charts; one calculation API with bounds and receipts in ./calc; birth-time windows in ./window; returns, relationship charts, the void-of-course Moon, patterns and dignities in ./techniques; house positions and cusp speeds in ./houses; rise, set, transit and planetary hours in ./sky; Hellenistic timing techniques and planetary returns in ./timing; the time basis and the frame of date, without the ephemeris, in ./time; declination parallels, sect, composite midpoints and dignities, without the ephemeris, in ./lite; positions from JPL's DE440 by default, from a pack it ships (./de440/pack), or from a caller's pack in ./de440; and the sidereal zodiac and Jyotish techniques in ./vedic.",
5
5
  "license": "MIT AND CC-BY-4.0",
6
6
  "keywords": [
7
7
  "astrology",
@@ -33,6 +33,10 @@
33
33
  "types": "./dist/calc.d.ts",
34
34
  "import": "./dist/calc.js"
35
35
  },
36
+ "./conventions": {
37
+ "types": "./dist/conventions.d.ts",
38
+ "import": "./dist/conventions.js"
39
+ },
36
40
  "./crossings": {
37
41
  "types": "./dist/crossings.d.ts",
38
42
  "import": "./dist/crossings.js"
@@ -57,6 +61,10 @@
57
61
  "types": "./dist/internal-math.d.ts",
58
62
  "import": "./dist/internal-math.js"
59
63
  },
64
+ "./lite": {
65
+ "types": "./dist/lite.d.ts",
66
+ "import": "./dist/lite.js"
67
+ },
60
68
  "./receipt": {
61
69
  "types": "./dist/receipt.d.ts",
62
70
  "import": "./dist/receipt.js"
@@ -69,6 +77,18 @@
69
77
  "types": "./dist/techniques.d.ts",
70
78
  "import": "./dist/techniques.js"
71
79
  },
80
+ "./time": {
81
+ "types": "./dist/time.d.ts",
82
+ "import": "./dist/time.js"
83
+ },
84
+ "./de440": {
85
+ "types": "./dist/de440.d.ts",
86
+ "import": "./dist/de440.js"
87
+ },
88
+ "./de440/pack": {
89
+ "types": "./dist/de440-pack.d.ts",
90
+ "import": "./dist/de440-pack.js"
91
+ },
72
92
  "./timing": {
73
93
  "types": "./dist/timing.d.ts",
74
94
  "import": "./dist/timing.js"
@@ -98,12 +118,14 @@
98
118
  "access": "public"
99
119
  },
100
120
  "scripts": {
101
- "build": "tsup src/index.ts src/crossings.ts src/deltat.ts src/geo.ts src/receipt.ts src/techniques.ts src/timing.ts src/vedic.ts src/internal.ts src/internal-math.ts src/calc.ts src/window.ts src/houses-extra.ts src/sky.ts --format esm --dts --clean --splitting --metafile --tsconfig tsconfig.build.json",
121
+ "build": "tsup src/index.ts src/crossings.ts src/deltat.ts src/geo.ts src/receipt.ts src/techniques.ts src/timing.ts src/vedic.ts src/internal.ts src/internal-math.ts src/calc.ts src/window.ts src/houses-extra.ts src/sky.ts src/conventions.ts src/time.ts src/de440.ts src/de440-pack.ts --format esm --dts --clean --splitting --metafile --tsconfig tsconfig.build.json && node scripts/build-lite.mjs",
102
122
  "docs": "typedoc --options typedoc.json",
103
123
  "exports:smoke": "node scripts/module-resolution-smoke.mjs",
104
124
  "consumer:smoke": "node scripts/verify-packed-consumer.mjs",
105
125
  "package:contents": "node scripts/verify-package-contents.mjs",
106
126
  "archive:binding": "node scripts/verify-archive-binding.mjs",
127
+ "api:report": "node scripts/api-report.mjs",
128
+ "api:check": "node scripts/api-report.mjs --check",
107
129
  "pack:dry-run": "npm pack --dry-run",
108
130
  "prepack": "npm run build",
109
131
  "test": "vitest run",
@@ -114,6 +136,7 @@
114
136
  },
115
137
  "devDependencies": {
116
138
  "@types/node": "^22.19.19",
139
+ "esbuild": "0.27.7",
117
140
  "tsup": "^8.5.1",
118
141
  "typedoc": "^0.28.20",
119
142
  "typescript": "^5.9.3",
@@ -1,219 +0,0 @@
1
- // src/aspects.ts
2
- var ASPECT_TYPES = [
3
- "conjunction",
4
- "sextile",
5
- "square",
6
- "trine",
7
- "opposition"
8
- ];
9
- var ASPECTS = [
10
- { type: "conjunction", angle: 0, orb: 8, luminaryOrb: 10 },
11
- { type: "sextile", angle: 60, orb: 4, luminaryOrb: 5 },
12
- { type: "square", angle: 90, orb: 7, luminaryOrb: 8 },
13
- { type: "trine", angle: 120, orb: 7, luminaryOrb: 8 },
14
- { type: "opposition", angle: 180, orb: 8, luminaryOrb: 10 }
15
- ];
16
- var LUMINARIES = /* @__PURE__ */ new Set(["Sun", "Moon"]);
17
- var ASPECT_BODIES = /* @__PURE__ */ new Set([
18
- "Sun",
19
- "Moon",
20
- "Mercury",
21
- "Venus",
22
- "Mars",
23
- "Jupiter",
24
- "Saturn",
25
- "Uranus",
26
- "Neptune",
27
- "Pluto"
28
- ]);
29
- var STATIONARY_RELATIVE_SPEED = 1e-9;
30
- function aspectMotion(a, b, angle) {
31
- const relative = a.speed - b.speed;
32
- if (!(Math.abs(relative) >= STATIONARY_RELATIVE_SPEED)) return "stationary";
33
- const wrapped = ((a.lon - b.lon) % 360 + 360) % 360;
34
- const signed = wrapped > 180 ? wrapped - 360 : wrapped;
35
- const deviation = Math.abs(signed) - angle;
36
- if (deviation === 0) return "separating";
37
- return Math.sign(deviation) * Math.sign(signed) * relative < 0 ? "applying" : "separating";
38
- }
39
- function separation(a, b) {
40
- const difference = Math.abs(((a - b) % 360 + 360) % 360);
41
- return difference > 180 ? 360 - difference : difference;
42
- }
43
- function matchAspect(aBody, aLongitude, bBody, bLongitude) {
44
- const distance = separation(aLongitude, bLongitude);
45
- const hasLuminary = LUMINARIES.has(aBody) || LUMINARIES.has(bBody);
46
- let best = null;
47
- for (const definition of ASPECTS) {
48
- const orb = Math.abs(distance - definition.angle);
49
- const maximum = hasLuminary ? definition.luminaryOrb : definition.orb;
50
- if (orb <= maximum && (!best || orb < best.orb)) {
51
- best = { definition, orb };
52
- }
53
- }
54
- return best;
55
- }
56
- function findAspects(bodies) {
57
- const candidates = bodies.filter((body) => ASPECT_BODIES.has(body.body));
58
- const aspects = [];
59
- for (let first = 0; first < candidates.length; first += 1) {
60
- for (let second = first + 1; second < candidates.length; second += 1) {
61
- const a = candidates[first];
62
- const b = candidates[second];
63
- if (!a || !b) continue;
64
- const match = matchAspect(a.body, a.lon, b.body, b.lon);
65
- if (!match) continue;
66
- aspects.push({
67
- a: a.body,
68
- b: b.body,
69
- type: match.definition.type,
70
- orb: match.orb,
71
- applying: aspectMotion(a, b, match.definition.angle) === "applying"
72
- });
73
- }
74
- }
75
- return aspects.sort((a, b) => a.orb - b.orb);
76
- }
77
-
78
- // src/signs.ts
79
- var ELEMENTS = ["fire", "earth", "air", "water"];
80
- var MODALITIES = ["cardinal", "fixed", "mutable"];
81
- var SIGNS = [
82
- {
83
- slug: "aries",
84
- name: "Aries",
85
- element: "fire",
86
- modality: "cardinal",
87
- polarity: "day",
88
- naturalHouse: 1
89
- },
90
- {
91
- slug: "taurus",
92
- name: "Taurus",
93
- element: "earth",
94
- modality: "fixed",
95
- polarity: "night",
96
- naturalHouse: 2
97
- },
98
- {
99
- slug: "gemini",
100
- name: "Gemini",
101
- element: "air",
102
- modality: "mutable",
103
- polarity: "day",
104
- naturalHouse: 3
105
- },
106
- {
107
- slug: "cancer",
108
- name: "Cancer",
109
- element: "water",
110
- modality: "cardinal",
111
- polarity: "night",
112
- naturalHouse: 4
113
- },
114
- {
115
- slug: "leo",
116
- name: "Leo",
117
- element: "fire",
118
- modality: "fixed",
119
- polarity: "day",
120
- naturalHouse: 5
121
- },
122
- {
123
- slug: "virgo",
124
- name: "Virgo",
125
- element: "earth",
126
- modality: "mutable",
127
- polarity: "night",
128
- naturalHouse: 6
129
- },
130
- {
131
- slug: "libra",
132
- name: "Libra",
133
- element: "air",
134
- modality: "cardinal",
135
- polarity: "day",
136
- naturalHouse: 7
137
- },
138
- {
139
- slug: "scorpio",
140
- name: "Scorpio",
141
- element: "water",
142
- modality: "fixed",
143
- polarity: "night",
144
- naturalHouse: 8
145
- },
146
- {
147
- slug: "sagittarius",
148
- name: "Sagittarius",
149
- element: "fire",
150
- modality: "mutable",
151
- polarity: "day",
152
- naturalHouse: 9
153
- },
154
- {
155
- slug: "capricorn",
156
- name: "Capricorn",
157
- element: "earth",
158
- modality: "cardinal",
159
- polarity: "night",
160
- naturalHouse: 10
161
- },
162
- {
163
- slug: "aquarius",
164
- name: "Aquarius",
165
- element: "air",
166
- modality: "fixed",
167
- polarity: "day",
168
- naturalHouse: 11
169
- },
170
- {
171
- slug: "pisces",
172
- name: "Pisces",
173
- element: "water",
174
- modality: "mutable",
175
- polarity: "night",
176
- naturalHouse: 12
177
- }
178
- ];
179
- var SIGN_NAMES = SIGNS.map((sign) => sign.slug);
180
- function normalizeLongitude(lon) {
181
- if (!Number.isFinite(lon)) throw new RangeError("Longitude must be finite.");
182
- return (lon % 360 + 360) % 360;
183
- }
184
- function signIndexForLongitude(lon) {
185
- return Math.floor(normalizeLongitude(lon) / 30);
186
- }
187
- function signForLongitude(lon) {
188
- const sign = SIGNS[signIndexForLongitude(lon)];
189
- if (!sign) throw new RangeError("Could not resolve zodiac sign.");
190
- return sign;
191
- }
192
- function degreeInSign(lon) {
193
- return normalizeLongitude(lon) % 30;
194
- }
195
-
196
- // src/types.ts
197
- var ENGINE_VERSION = "0.1.1-rc.16";
198
- var EPHEMERIS = Object.freeze({ name: "astronomy-engine", version: "2.1.19" });
199
-
200
- export {
201
- ASPECT_TYPES,
202
- ASPECTS,
203
- ASPECT_BODIES,
204
- STATIONARY_RELATIVE_SPEED,
205
- aspectMotion,
206
- separation,
207
- matchAspect,
208
- findAspects,
209
- ELEMENTS,
210
- MODALITIES,
211
- SIGNS,
212
- SIGN_NAMES,
213
- normalizeLongitude,
214
- signIndexForLongitude,
215
- signForLongitude,
216
- degreeInSign,
217
- ENGINE_VERSION,
218
- EPHEMERIS
219
- };