@zodiacs/engine 0.1.1-rc.15 → 1.0.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 (54) hide show
  1. package/CHANGELOG.md +891 -0
  2. package/LICENSING.md +192 -12
  3. package/NOTICE +96 -2
  4. package/README.md +296 -66
  5. package/dist/{api-CoB_kqE3.d.ts → api-WbxJ4Wj-.d.ts} +15 -10
  6. package/dist/ayanamsa--YQ46fET.d.ts +134 -0
  7. package/dist/calc.d.ts +390 -0
  8. package/dist/calc.js +1039 -0
  9. package/dist/chunk-47ERTK5X.js +27 -0
  10. package/dist/chunk-7TRLIFFI.js +56 -0
  11. package/dist/chunk-A3U2ZS2W.js +29 -0
  12. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  13. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  14. package/dist/{chunk-OYGRVGXD.js → chunk-CHSYDKBL.js} +3 -3
  15. package/dist/{chunk-ZHVI3KWJ.js → chunk-DMGHYCDI.js} +4 -4
  16. package/dist/{chunk-CWI4YUDL.js → chunk-FTX3JDJA.js} +21 -18
  17. package/dist/{chunk-MFF3VKO3.js → chunk-OG4OYTJJ.js} +47 -42
  18. package/dist/{chunk-ZZPITHQS.js → chunk-SRXBTP5H.js} +199 -65
  19. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  20. package/dist/chunk-WS3TDSP3.js +474 -0
  21. package/dist/chunk-YIITY7Q7.js +483 -0
  22. package/dist/crossings.d.ts +8 -7
  23. package/dist/crossings.js +1 -1
  24. package/dist/deltat.d.ts +28 -3
  25. package/dist/deltat.js +1 -1
  26. package/dist/geo.d.ts +33 -12
  27. package/dist/geo.js +17 -458
  28. package/dist/{internal-math-BbktkHCc.d.ts → houses-CFERsAlK.d.ts} +14 -160
  29. package/dist/houses-extra.d.ts +95 -0
  30. package/dist/houses-extra.js +339 -0
  31. package/dist/index.d.ts +34 -48
  32. package/dist/index.js +31 -23
  33. package/dist/internal-math-DJJ8BYex.d.ts +174 -0
  34. package/dist/internal-math.d.ts +3 -2
  35. package/dist/internal-math.js +2 -2
  36. package/dist/internal.d.ts +1 -1
  37. package/dist/internal.js +5 -5
  38. package/dist/receipt.d.ts +2 -243
  39. package/dist/receipt.js +78 -37
  40. package/dist/reference-span-CILpclrz.d.ts +40 -0
  41. package/dist/rulers-Dla6h_Sm.d.ts +15 -0
  42. package/dist/sky.d.ts +173 -0
  43. package/dist/sky.js +379 -0
  44. package/dist/techniques.d.ts +453 -0
  45. package/dist/techniques.js +823 -0
  46. package/dist/timing.d.ts +113 -17
  47. package/dist/timing.js +98 -64
  48. package/dist/{types-BsWaqwU_.d.ts → types-B-yb_tGL.d.ts} +23 -11
  49. package/dist/vedic.d.ts +42 -124
  50. package/dist/vedic.js +44 -458
  51. package/dist/window.d.ts +180 -0
  52. package/dist/window.js +960 -0
  53. package/dist/zone-history-ghdyO0Sc.d.ts +268 -0
  54. package/package.json +25 -3
@@ -0,0 +1,268 @@
1
+ import { B as BodyName, f as AspectType, Z as ZodiacSign, T as TimeScaleName, H as HouseSystem, g as ChartFlag, d as Chart, h as BirthInput } from './types-B-yb_tGL.js';
2
+ import { DeltaTSegment } from './deltat.js';
3
+
4
+ /**
5
+ * The schema ids of the natal record, its receipt and its redacted diagnostic.
6
+ * Zodiacs-owned vocabulary, not an industry interoperability standard. The
7
+ * `draft-v1` in each is part of the id, kept byte for byte since 0.1.1-rc.3
8
+ * because stored records carry it: within an id, the conventions set a
9
+ * receipt names says which shape its fields have (docs/versioning.md).
10
+ */
11
+ declare const NATAL_ENVELOPE_SCHEMA = "zodiacs.natal-envelope.draft-v1";
12
+ declare const NATAL_RECEIPT_SCHEMA = "zodiacs.calculation-receipt.draft-v1";
13
+ declare const NATAL_DIAGNOSTIC_SCHEMA = "zodiacs.natal-diagnostic.draft-v1";
14
+ declare const NATAL_ENVELOPE_LIMITS: Readonly<{
15
+ bytes: 65536;
16
+ depth: 12;
17
+ nodes: 4096;
18
+ }>;
19
+ type NatalEnvelopeErrorCode = "invalid_json" | "invalid_shape" | "invalid_value" | "inconsistent_result" | "invalid_context" | "size_limit" | "complexity_limit" | "unsupported_version" | "unsupported_feature";
20
+ declare class NatalEnvelopeError extends Error {
21
+ readonly code: NatalEnvelopeErrorCode;
22
+ constructor(code: NatalEnvelopeErrorCode);
23
+ }
24
+ type NatalJsonValue = null | boolean | number | string | NatalJsonValue[] | NatalJsonObject;
25
+ interface NatalJsonObject {
26
+ [key: string]: NatalJsonValue;
27
+ }
28
+ type NatalReference = "supplied-instant" | "utc-noon" | "local-noon";
29
+ /** A clock change a local resolution records. */
30
+ interface NatalZoneTransition {
31
+ at: string;
32
+ offsetBeforeMinutes: number;
33
+ offsetAfterMinutes: number;
34
+ cause: TransitionCause;
35
+ }
36
+ /**
37
+ * Captured assertions, checked arithmetically without consulting today's
38
+ * Intl/tzdb. The fields after `policy` are optional from the time-basis
39
+ * conventions set on, so a record in rc.14's shape is accepted, and absent
40
+ * before it; each one given is checked. `resolveLocalToUtc` returns the whole
41
+ * object as `localResolution` (docs/time.md).
42
+ */
43
+ interface NatalLocalResolution {
44
+ /** The proleptic Gregorian date resolved. */
45
+ date: string;
46
+ time: string;
47
+ timeZone: string;
48
+ /** Offset at the resolved instant, minutes east of UTC; may be fractional. */
49
+ offsetMinutes: number;
50
+ /** Forward wall-clock shift; positive only for a reported gap. */
51
+ gapShiftMinutes: number;
52
+ policy: {
53
+ fold: "earlier";
54
+ gap: "shift-forward";
55
+ };
56
+ calendar?: "gregorian" | "julian";
57
+ writtenDate?: string;
58
+ tzdbVersion?: string | null;
59
+ dataForm?: "main+backzone" | "main" | "host";
60
+ clock?: "local-mean-time" | "legal";
61
+ transition?: NatalZoneTransition | null;
62
+ localMeanTime?: {
63
+ longitude: number;
64
+ zoneOffsetMinutes: number;
65
+ } | null;
66
+ }
67
+ /** Supplied facts are claims, including hashes. This codec authenticates none of them. */
68
+ interface NatalProvenanceClaims {
69
+ source?: {
70
+ repository: string;
71
+ commit: string;
72
+ };
73
+ artifact?: {
74
+ sha256: string;
75
+ packageVersion: string;
76
+ distributionRepository?: string;
77
+ distributionCommit?: string;
78
+ };
79
+ runtime?: {
80
+ name: string;
81
+ version?: string;
82
+ icuVersion?: string;
83
+ tzdbVersion?: string;
84
+ };
85
+ ephemeris?: {
86
+ name: "astronomy-engine";
87
+ version: string;
88
+ };
89
+ }
90
+ interface NatalEnvelopeContext {
91
+ /** Omission never infers noon, including when timeKnown is false. */
92
+ reference?: NatalReference;
93
+ /** Original validated ISO spelling when captured; no zone/offset meaning is inferred. */
94
+ sourceInstant?: string | null;
95
+ localResolution?: NatalLocalResolution | null;
96
+ provenance?: NatalProvenanceClaims;
97
+ /** Optional JSON data only. Never executed, rendered, fetched or used for replay. */
98
+ extensions?: NatalJsonObject;
99
+ }
100
+ /**
101
+ * A conventions set: what a receipt's numbers mean, as named ids, one for each
102
+ * part of the calculation (`zodiac`, `nutation`, `angles` and so on). A
103
+ * receipt carries exactly one of NATAL_RECEIPT_CONVENTION_SETS.
104
+ */
105
+ type NatalConventionSet = Readonly<Record<string, string>>;
106
+ /**
107
+ * Every conventions set a receipt may carry, newest first: index 0 is the set
108
+ * this release writes, and the codec reads every set here. A minor release may
109
+ * add a set at the front, so take a set by its content, not by an index other
110
+ * than 0.
111
+ */
112
+ declare const NATAL_RECEIPT_CONVENTION_SETS: readonly NatalConventionSet[];
113
+ /** What a receipt says its numbers were checked against, as named statements. */
114
+ type NatalCoverage = Readonly<Record<string, string>>;
115
+ interface NatalReceipt {
116
+ schema: typeof NATAL_RECEIPT_SCHEMA;
117
+ /** On the scale `timeScale` names; UTC before the time-basis set. */
118
+ instant: string;
119
+ timeScale?: TimeScaleName;
120
+ sourceInstant: string | null;
121
+ /** Caller declaration, not verification of a human birth time's precision. */
122
+ timeKnown: boolean;
123
+ reference: NatalReference;
124
+ localResolution: NatalLocalResolution | null;
125
+ coordinates: {
126
+ latitude: number;
127
+ longitude: number;
128
+ } | null;
129
+ houses: {
130
+ requested: HouseSystem;
131
+ actual: HouseSystem | null;
132
+ absenceReason: "unknown-time" | "missing-location" | null;
133
+ };
134
+ /** Only time-resolution assertions may be supplied to this draft's creator. */
135
+ inputFlags: ChartFlag[];
136
+ resultFlags: ChartFlag[];
137
+ /** From the current conventions set on, the engine also names its ephemeris. */
138
+ engine: {
139
+ name: "@zodiacs/engine";
140
+ version: string;
141
+ ephemeris?: {
142
+ name: "astronomy-engine";
143
+ version: string;
144
+ };
145
+ };
146
+ provenance: (NatalProvenanceClaims & {
147
+ status: "claimed";
148
+ }) | null;
149
+ conventions: NatalConventionSet;
150
+ coverage: NatalCoverage;
151
+ }
152
+ /** A body as a natal record holds it. Its shape changes only with a new conventions set. */
153
+ interface NatalBodyRecord {
154
+ body: BodyName;
155
+ lon: number;
156
+ lat: number;
157
+ speed: number;
158
+ retrograde: boolean;
159
+ sign: ZodiacSign;
160
+ degree: number;
161
+ }
162
+ /** The four angles as a natal record holds them. */
163
+ interface NatalAnglesRecord {
164
+ asc: number;
165
+ mc: number;
166
+ dsc: number;
167
+ ic: number;
168
+ }
169
+ /** The houses as a natal record holds them: the system computed and twelve cusps, first house first. */
170
+ interface NatalHousesRecord {
171
+ system: HouseSystem;
172
+ cusps: number[];
173
+ }
174
+ /** An aspect as a natal record holds it. */
175
+ interface NatalAspectRecord {
176
+ a: BodyName;
177
+ b: BodyName;
178
+ type: AspectType;
179
+ orb: number;
180
+ applying: boolean;
181
+ }
182
+ /** ΔT as a natal record holds it, from the rc.8 conventions set on. */
183
+ interface NatalDeltaTRecord {
184
+ seconds: number;
185
+ sigma: number | null;
186
+ model: "zodiacs-deltat/1" | "iers-utc/1" | "pinned";
187
+ table: string | null;
188
+ tableDigest: string | null;
189
+ segment: DeltaTSegment;
190
+ }
191
+ /** How the instant became UT1 and TT, as a natal record holds it, from the time-basis conventions set on. */
192
+ interface NatalTimeScaleRecord {
193
+ input: TimeScaleName;
194
+ basis: "iers" | "delta-t" | "pinned";
195
+ ut1MinusUtc: {
196
+ seconds: number;
197
+ sigma: number;
198
+ source: "observed" | "predicted" | "fallback";
199
+ } | null;
200
+ leapSeconds: {
201
+ taiMinusUtc: number;
202
+ listed: boolean;
203
+ } | null;
204
+ }
205
+ /**
206
+ * The result a natal record holds: the chart's bodies, angles, houses and
207
+ * aspects, and from later conventions sets its ΔT and time scale. These are
208
+ * the record's own types, not the chart's: a chart may gain a field in a minor
209
+ * release, and the record keeps the fields its conventions set names.
210
+ */
211
+ interface NatalRecordedResult {
212
+ bodies: NatalBodyRecord[];
213
+ angles: NatalAnglesRecord | null;
214
+ houses: NatalHousesRecord | null;
215
+ aspects: NatalAspectRecord[];
216
+ /** From the rc.8 set on. */
217
+ deltaT?: NatalDeltaTRecord;
218
+ /** From the time-basis set on. */
219
+ timeScale?: NatalTimeScaleRecord;
220
+ }
221
+ interface NatalEnvelope {
222
+ schema: typeof NATAL_ENVELOPE_SCHEMA;
223
+ /** This draft implements no optional required features; unknown ones fail closed. */
224
+ requiredFeatures: string[];
225
+ receipt: NatalReceipt;
226
+ /** `deltaT` from the rc.8 set on, `timeScale` from the time-basis set on. */
227
+ result: NatalRecordedResult;
228
+ extensions?: NatalJsonObject;
229
+ }
230
+ type NatalEnvelopeParseResult = {
231
+ ok: true;
232
+ envelope: NatalEnvelope;
233
+ } | {
234
+ ok: false;
235
+ code: NatalEnvelopeErrorCode;
236
+ };
237
+ interface NatalDiagnostic {
238
+ schema: typeof NATAL_DIAGNOSTIC_SCHEMA;
239
+ status: "redacted-not-anonymous";
240
+ timeKnown: boolean;
241
+ houses: NatalReceipt["houses"];
242
+ inputFlags: ChartFlag[];
243
+ resultFlags: ChartFlag[];
244
+ }
245
+ /**
246
+ * Capture a fresh full Chart, not a legacy summary. Checks declared consistency,
247
+ * not ephemeris accuracy, historical timezone truth, origin, or authenticity.
248
+ * Optional properties must be omitted rather than set to undefined.
249
+ *
250
+ * The record keeps the fields its conventions set names and leaves out any
251
+ * other field of the chart's result, so a field a later release adds to a
252
+ * chart does not change the records it writes. The chart's `input` is read
253
+ * strictly: an input field the receipt cannot describe is refused, because it
254
+ * may have changed the numbers.
255
+ */
256
+ declare function createNatalEnvelope(chart: Chart, context?: NatalEnvelopeContext): NatalEnvelope;
257
+ /** Bounded JSON entry point. Unknown versions/features never become calculation input. */
258
+ declare function parseNatalEnvelope(json: string): NatalEnvelopeParseResult;
259
+ declare function serializeNatalEnvelope(envelope: NatalEnvelope): string;
260
+ /** Replay the recorded request/instant, never a fallback house system or today's tzdb. */
261
+ declare function natalReplayInput(envelope: NatalEnvelope): BirthInput;
262
+ /** A fresh fixed allowlist: no claimed identifiers, versions, hashes, or input/result values. */
263
+ declare function redactNatalEnvelope(envelope: NatalEnvelope): NatalDiagnostic;
264
+
265
+ /** What changed at a transition, from the tzdb record. */
266
+ type TransitionCause = "dst" | "legal-change" | "date-line";
267
+
268
+ 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.15",
4
- "description": "Browser-first astrology calculations used by Zodiacs.org: tropical charts, Hellenistic timing techniques in ./timing, and the sidereal zodiac and Jyotish techniques in ./vedic.",
3
+ "version": "1.0.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; and the sidereal zodiac and Jyotish techniques in ./vedic.",
5
5
  "license": "MIT AND CC-BY-4.0",
6
6
  "keywords": [
7
7
  "astrology",
@@ -29,6 +29,10 @@
29
29
  "types": "./dist/index.d.ts",
30
30
  "import": "./dist/index.js"
31
31
  },
32
+ "./calc": {
33
+ "types": "./dist/calc.d.ts",
34
+ "import": "./dist/calc.js"
35
+ },
32
36
  "./crossings": {
33
37
  "types": "./dist/crossings.d.ts",
34
38
  "import": "./dist/crossings.js"
@@ -41,6 +45,10 @@
41
45
  "types": "./dist/geo.d.ts",
42
46
  "import": "./dist/geo.js"
43
47
  },
48
+ "./houses": {
49
+ "types": "./dist/houses-extra.d.ts",
50
+ "import": "./dist/houses-extra.js"
51
+ },
44
52
  "./internal": {
45
53
  "types": "./dist/internal.d.ts",
46
54
  "import": "./dist/internal.js"
@@ -53,6 +61,14 @@
53
61
  "types": "./dist/receipt.d.ts",
54
62
  "import": "./dist/receipt.js"
55
63
  },
64
+ "./sky": {
65
+ "types": "./dist/sky.d.ts",
66
+ "import": "./dist/sky.js"
67
+ },
68
+ "./techniques": {
69
+ "types": "./dist/techniques.d.ts",
70
+ "import": "./dist/techniques.js"
71
+ },
56
72
  "./timing": {
57
73
  "types": "./dist/timing.d.ts",
58
74
  "import": "./dist/timing.js"
@@ -60,6 +76,10 @@
60
76
  "./vedic": {
61
77
  "types": "./dist/vedic.d.ts",
62
78
  "import": "./dist/vedic.js"
79
+ },
80
+ "./window": {
81
+ "types": "./dist/window.d.ts",
82
+ "import": "./dist/window.js"
63
83
  }
64
84
  },
65
85
  "files": [
@@ -78,12 +98,14 @@
78
98
  "access": "public"
79
99
  },
80
100
  "scripts": {
81
- "build": "tsup src/index.ts src/crossings.ts src/deltat.ts src/geo.ts src/receipt.ts src/timing.ts src/vedic.ts src/internal.ts src/internal-math.ts --format esm --dts --clean --splitting --metafile --tsconfig tsconfig.build.json",
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",
82
102
  "docs": "typedoc --options typedoc.json",
83
103
  "exports:smoke": "node scripts/module-resolution-smoke.mjs",
84
104
  "consumer:smoke": "node scripts/verify-packed-consumer.mjs",
85
105
  "package:contents": "node scripts/verify-package-contents.mjs",
86
106
  "archive:binding": "node scripts/verify-archive-binding.mjs",
107
+ "api:report": "node scripts/api-report.mjs",
108
+ "api:check": "node scripts/api-report.mjs --check",
87
109
  "pack:dry-run": "npm pack --dry-run",
88
110
  "prepack": "npm run build",
89
111
  "test": "vitest run",