@zodiacs/engine 0.1.1-rc.16 → 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.
- package/CHANGELOG.md +458 -0
- package/LICENSING.md +18 -5
- package/NOTICE +3 -2
- package/README.md +67 -33
- package/dist/{api-VOW6Umy5.d.ts → api-WbxJ4Wj-.d.ts} +12 -6
- package/dist/ayanamsa--YQ46fET.d.ts +134 -0
- package/dist/calc.d.ts +131 -20
- package/dist/calc.js +246 -60
- package/dist/chunk-47ERTK5X.js +27 -0
- package/dist/{chunk-O3NJRGJ2.js → chunk-7TRLIFFI.js} +1 -1
- package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
- package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
- package/dist/{chunk-I7O5EGFV.js → chunk-CHSYDKBL.js} +1 -1
- package/dist/{chunk-4NV4ZEFZ.js → chunk-DMGHYCDI.js} +4 -4
- package/dist/{chunk-L6ZHWJZ6.js → chunk-FTX3JDJA.js} +15 -12
- package/dist/{chunk-2OWGBT3O.js → chunk-OG4OYTJJ.js} +47 -42
- package/dist/{chunk-WOU7JVD3.js → chunk-SRXBTP5H.js} +7 -7
- package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
- package/dist/chunk-WS3TDSP3.js +474 -0
- package/dist/{chunk-N4B5JNMA.js → chunk-YIITY7Q7.js} +21 -11
- package/dist/crossings.d.ts +8 -7
- package/dist/crossings.js +1 -1
- package/dist/deltat.d.ts +28 -3
- package/dist/deltat.js +1 -1
- package/dist/geo.d.ts +33 -12
- package/dist/geo.js +3 -1
- package/dist/{houses-q1O2GGp4.d.ts → houses-CFERsAlK.d.ts} +12 -2
- package/dist/houses-extra.d.ts +19 -5
- package/dist/houses-extra.js +4 -2
- package/dist/index.d.ts +34 -49
- package/dist/index.js +21 -13
- package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-DJJ8BYex.d.ts} +41 -27
- package/dist/internal-math.d.ts +3 -3
- package/dist/internal-math.js +2 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +5 -5
- package/dist/receipt.d.ts +2 -268
- package/dist/receipt.js +70 -35
- package/dist/reference-span-CILpclrz.d.ts +40 -0
- package/dist/{rulers-9wljfVaO.d.ts → rulers-Dla6h_Sm.d.ts} +7 -2
- package/dist/sky.d.ts +25 -10
- package/dist/sky.js +11 -9
- package/dist/techniques.d.ts +61 -18
- package/dist/techniques.js +39 -46
- package/dist/timing.d.ts +53 -16
- package/dist/timing.js +19 -38
- package/dist/{types-B4MCoCCS.d.ts → types-B-yb_tGL.d.ts} +23 -11
- package/dist/vedic.d.ts +42 -123
- package/dist/vedic.js +43 -440
- package/dist/window.d.ts +81 -79
- package/dist/window.js +26 -27
- package/dist/zone-history-ghdyO0Sc.d.ts +268 -0
- package/package.json +3 -1
package/dist/window.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { H as HouseSystem, B as BodyName, Z as ZodiacSign, b as HouseNumber,
|
|
1
|
+
import { H as HouseSystem, B as BodyName, Z as ZodiacSign, b as HouseNumber, f as AspectType, D as DateInput } from './types-B-yb_tGL.js';
|
|
2
2
|
import './deltat.js';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
declare const
|
|
6
|
-
/**
|
|
7
|
-
declare const
|
|
4
|
+
/** The schema id of a birth window. */
|
|
5
|
+
declare const BIRTH_WINDOW_SCHEMA = "zodiacs.birth-window.v1";
|
|
6
|
+
/** How far this release's switch instants have been checked; a later release may check them further and say so here. */
|
|
7
|
+
declare const WINDOW_VERIFICATION: string;
|
|
8
|
+
/** The longest window accepted: 48 hours, in milliseconds. A minor release may accept a longer one. */
|
|
9
|
+
declare const MAX_WINDOW_MS: number;
|
|
8
10
|
/**
|
|
9
11
|
* Upper bounds on each body's longitude rate, degrees per day: twice the
|
|
10
12
|
* largest rate the engine's own positions reach from 1800 to 2200, scanned
|
|
@@ -15,15 +17,15 @@ declare const WINDOW_RATE_BOUNDS: Readonly<Record<BodyName, number>>;
|
|
|
15
17
|
/** A rounding model: the true instant is uniform over the rounding unit of the record. */
|
|
16
18
|
interface WindowRounding {
|
|
17
19
|
/** The recorded time, resolved to an instant. */
|
|
18
|
-
recorded: DateInput;
|
|
20
|
+
readonly recorded: DateInput;
|
|
19
21
|
/** The rounding unit, in minutes. */
|
|
20
|
-
minutes: number;
|
|
22
|
+
readonly minutes: number;
|
|
21
23
|
/**
|
|
22
24
|
* "nearest" (the default): the record is the nearest multiple of the unit,
|
|
23
25
|
* so the true instant lies within half a unit of it. "down": the record is
|
|
24
26
|
* the start of its unit, as a clock read without rounding up.
|
|
25
27
|
*/
|
|
26
|
-
mode?: "nearest" | "down";
|
|
28
|
+
readonly mode?: "nearest" | "down";
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* A window of possible birth instants, resolved by the caller, and a place.
|
|
@@ -32,95 +34,95 @@ interface WindowRounding {
|
|
|
32
34
|
*/
|
|
33
35
|
interface BirthWindowInput {
|
|
34
36
|
/** The first instant of the window. */
|
|
35
|
-
start?: DateInput;
|
|
37
|
+
readonly start?: DateInput;
|
|
36
38
|
/** The end of the window, which it does not include. */
|
|
37
|
-
end?: DateInput;
|
|
38
|
-
at?: DateInput;
|
|
39
|
+
readonly end?: DateInput;
|
|
40
|
+
readonly at?: DateInput;
|
|
39
41
|
/** Minutes either side of `at`, to the nearest millisecond. */
|
|
40
|
-
minutes?: number;
|
|
41
|
-
latitude: number;
|
|
42
|
-
longitude: number;
|
|
42
|
+
readonly minutes?: number;
|
|
43
|
+
readonly latitude: number;
|
|
44
|
+
readonly longitude: number;
|
|
43
45
|
/** Defaults to "whole", as for natalChart. */
|
|
44
|
-
houseSystem?: HouseSystem;
|
|
46
|
+
readonly houseSystem?: HouseSystem;
|
|
45
47
|
/** A second prior for the cells' shares; its unit must lie inside the window. */
|
|
46
|
-
rounding?: WindowRounding;
|
|
48
|
+
readonly rounding?: WindowRounding;
|
|
47
49
|
}
|
|
48
50
|
interface WindowAspect {
|
|
49
|
-
a: BodyName;
|
|
50
|
-
b: BodyName;
|
|
51
|
-
type: AspectType;
|
|
51
|
+
readonly a: BodyName;
|
|
52
|
+
readonly b: BodyName;
|
|
53
|
+
readonly type: AspectType;
|
|
52
54
|
}
|
|
53
55
|
/** The discrete features of the chart, as natalChart would give them, throughout a cell. */
|
|
54
56
|
interface WindowFeatures {
|
|
55
57
|
/** Each body's sign; null for the nodes inside an unresolved interval. */
|
|
56
|
-
signs: Record<BodyName, ZodiacSign | null
|
|
57
|
-
ascendant: ZodiacSign;
|
|
58
|
-
midheaven: ZodiacSign;
|
|
58
|
+
readonly signs: Readonly<Record<BodyName, ZodiacSign | null>>;
|
|
59
|
+
readonly ascendant: ZodiacSign;
|
|
60
|
+
readonly midheaven: ZodiacSign;
|
|
59
61
|
/**
|
|
60
62
|
* Each body's house, as houseOf gives it from the chart's cusps; null for
|
|
61
63
|
* the nodes inside an unresolved interval where the houses are whole signs.
|
|
62
64
|
*/
|
|
63
|
-
houses: Record<BodyName, HouseNumber | null
|
|
65
|
+
readonly houses: Readonly<Record<BodyName, HouseNumber | null>>;
|
|
64
66
|
/** The aspects in orb, in natalChart's pair order. */
|
|
65
|
-
aspects: WindowAspect[];
|
|
67
|
+
readonly aspects: readonly WindowAspect[];
|
|
66
68
|
/** The house system used: the requested one, or "whole" where Placidus or Koch falls back. */
|
|
67
|
-
houseSystem: HouseSystem;
|
|
69
|
+
readonly houseSystem: HouseSystem;
|
|
68
70
|
}
|
|
69
71
|
interface BirthWindowCell {
|
|
70
72
|
/** First instant of the cell. */
|
|
71
|
-
start: Date;
|
|
73
|
+
readonly start: Date;
|
|
72
74
|
/** End of the cell, which it does not include. */
|
|
73
|
-
end: Date;
|
|
74
|
-
milliseconds: number;
|
|
75
|
+
readonly end: Date;
|
|
76
|
+
readonly milliseconds: number;
|
|
75
77
|
/** Share of the window under a uniform prior. */
|
|
76
|
-
share: number;
|
|
78
|
+
readonly share: number;
|
|
77
79
|
/** Share under the rounding model, when one was given. */
|
|
78
|
-
roundedShare?: number;
|
|
79
|
-
features: WindowFeatures;
|
|
80
|
+
readonly roundedShare?: number;
|
|
81
|
+
readonly features: WindowFeatures;
|
|
80
82
|
}
|
|
81
83
|
/** A change to or from null opens or closes an unresolved interval; it is not a crossing. */
|
|
82
84
|
type WindowChange = {
|
|
83
|
-
feature: "sign";
|
|
84
|
-
body: BodyName;
|
|
85
|
-
from: ZodiacSign | null;
|
|
86
|
-
to: ZodiacSign | null;
|
|
85
|
+
readonly feature: "sign";
|
|
86
|
+
readonly body: BodyName;
|
|
87
|
+
readonly from: ZodiacSign | null;
|
|
88
|
+
readonly to: ZodiacSign | null;
|
|
87
89
|
} | {
|
|
88
|
-
feature: "ascendant" | "midheaven";
|
|
89
|
-
from: ZodiacSign;
|
|
90
|
-
to: ZodiacSign;
|
|
90
|
+
readonly feature: "ascendant" | "midheaven";
|
|
91
|
+
readonly from: ZodiacSign;
|
|
92
|
+
readonly to: ZodiacSign;
|
|
91
93
|
} | {
|
|
92
|
-
feature: "house";
|
|
93
|
-
body: BodyName;
|
|
94
|
-
from: HouseNumber | null;
|
|
95
|
-
to: HouseNumber | null;
|
|
94
|
+
readonly feature: "house";
|
|
95
|
+
readonly body: BodyName;
|
|
96
|
+
readonly from: HouseNumber | null;
|
|
97
|
+
readonly to: HouseNumber | null;
|
|
96
98
|
} | {
|
|
97
|
-
feature: "aspect";
|
|
98
|
-
a: BodyName;
|
|
99
|
-
b: BodyName;
|
|
100
|
-
from: AspectType | null;
|
|
101
|
-
to: AspectType | null;
|
|
99
|
+
readonly feature: "aspect";
|
|
100
|
+
readonly a: BodyName;
|
|
101
|
+
readonly b: BodyName;
|
|
102
|
+
readonly from: AspectType | null;
|
|
103
|
+
readonly to: AspectType | null;
|
|
102
104
|
} | {
|
|
103
|
-
feature: "house-system";
|
|
104
|
-
from: HouseSystem;
|
|
105
|
-
to: HouseSystem;
|
|
105
|
+
readonly feature: "house-system";
|
|
106
|
+
readonly from: HouseSystem;
|
|
107
|
+
readonly to: HouseSystem;
|
|
106
108
|
};
|
|
107
109
|
interface BirthWindowSwitch {
|
|
108
110
|
/**
|
|
109
111
|
* The first millisecond with the new features: the engine's value at the
|
|
110
112
|
* millisecond before differs, so the crossing lies in (at − 1 ms, at].
|
|
111
113
|
*/
|
|
112
|
-
at: Date;
|
|
113
|
-
changes: WindowChange[];
|
|
114
|
+
readonly at: Date;
|
|
115
|
+
readonly changes: readonly WindowChange[];
|
|
114
116
|
}
|
|
115
117
|
/** Where the node's jitter would outlast the budget: these features are null in every cell of [start, end). */
|
|
116
118
|
interface WindowUnresolved {
|
|
117
|
-
start: Date;
|
|
119
|
+
readonly start: Date;
|
|
118
120
|
/** The first instant at which they are resolved again. */
|
|
119
|
-
end: Date;
|
|
120
|
-
milliseconds: number;
|
|
121
|
-
features: {
|
|
122
|
-
feature: "sign" | "house";
|
|
123
|
-
body: "North Node" | "South Node";
|
|
121
|
+
readonly end: Date;
|
|
122
|
+
readonly milliseconds: number;
|
|
123
|
+
readonly features: readonly {
|
|
124
|
+
readonly feature: "sign" | "house";
|
|
125
|
+
readonly body: "North Node" | "South Node";
|
|
124
126
|
}[];
|
|
125
127
|
}
|
|
126
128
|
type BirthWindowFlag = "polar-fallback"
|
|
@@ -129,36 +131,36 @@ type BirthWindowFlag = "polar-fallback"
|
|
|
129
131
|
/** The result lists unresolved intervals. */
|
|
130
132
|
| "node-unresolved";
|
|
131
133
|
interface BirthWindow {
|
|
132
|
-
schema:
|
|
134
|
+
readonly schema: typeof BIRTH_WINDOW_SCHEMA;
|
|
133
135
|
/** How far the switch instants have been checked: dense one-second sampling, not proof. */
|
|
134
|
-
verification:
|
|
135
|
-
start: Date;
|
|
136
|
-
end: Date;
|
|
137
|
-
latitude: number;
|
|
138
|
-
longitude: number;
|
|
136
|
+
readonly verification: string;
|
|
137
|
+
readonly start: Date;
|
|
138
|
+
readonly end: Date;
|
|
139
|
+
readonly latitude: number;
|
|
140
|
+
readonly longitude: number;
|
|
139
141
|
/** The requested house system. */
|
|
140
|
-
houseSystem: HouseSystem;
|
|
141
|
-
rounding: {
|
|
142
|
-
recorded: Date;
|
|
143
|
-
minutes: number;
|
|
144
|
-
mode: "nearest" | "down";
|
|
145
|
-
start: Date;
|
|
146
|
-
end: Date;
|
|
142
|
+
readonly houseSystem: HouseSystem;
|
|
143
|
+
readonly rounding: {
|
|
144
|
+
readonly recorded: Date;
|
|
145
|
+
readonly minutes: number;
|
|
146
|
+
readonly mode: "nearest" | "down";
|
|
147
|
+
readonly start: Date;
|
|
148
|
+
readonly end: Date;
|
|
147
149
|
} | null;
|
|
148
150
|
/** Cells in time order; they tile [start, end). */
|
|
149
|
-
cells: BirthWindowCell[];
|
|
151
|
+
readonly cells: readonly BirthWindowCell[];
|
|
150
152
|
/** Switches in time order, one per cell boundary. */
|
|
151
|
-
switches: BirthWindowSwitch[];
|
|
153
|
+
readonly switches: readonly BirthWindowSwitch[];
|
|
152
154
|
/** Intervals left unresolved, in time order; empty unless `node-unresolved` is flagged. */
|
|
153
|
-
unresolved: WindowUnresolved[];
|
|
154
|
-
flags: BirthWindowFlag[];
|
|
155
|
-
engineVersion: string;
|
|
155
|
+
readonly unresolved: readonly WindowUnresolved[];
|
|
156
|
+
readonly flags: readonly BirthWindowFlag[];
|
|
157
|
+
readonly engineVersion: string;
|
|
156
158
|
}
|
|
157
159
|
/** Thrown when a window needs more evaluated instants than the search allows. An Error, not a RangeError. */
|
|
158
160
|
declare class WindowBudgetError extends Error {
|
|
159
161
|
readonly name = "WindowBudgetError";
|
|
160
|
-
/** The instants the search allows. */
|
|
161
|
-
readonly limit
|
|
162
|
+
/** The instants the search allows; a later release may allow more. */
|
|
163
|
+
readonly limit: number;
|
|
162
164
|
constructor();
|
|
163
165
|
}
|
|
164
166
|
/**
|
|
@@ -175,4 +177,4 @@ declare class WindowBudgetError extends Error {
|
|
|
175
177
|
*/
|
|
176
178
|
declare function birthWindow(input: BirthWindowInput): BirthWindow;
|
|
177
179
|
|
|
178
|
-
export { type BirthWindow, type BirthWindowCell, type BirthWindowFlag, type BirthWindowInput, type BirthWindowSwitch, MAX_WINDOW_MS, WINDOW_RATE_BOUNDS, WINDOW_VERIFICATION, type WindowAspect, WindowBudgetError, type WindowChange, type WindowFeatures, type WindowRounding, type WindowUnresolved, birthWindow };
|
|
180
|
+
export { BIRTH_WINDOW_SCHEMA, type BirthWindow, type BirthWindowCell, type BirthWindowFlag, type BirthWindowInput, type BirthWindowSwitch, MAX_WINDOW_MS, WINDOW_RATE_BOUNDS, WINDOW_VERIFICATION, type WindowAspect, WindowBudgetError, type WindowChange, type WindowFeatures, type WindowRounding, type WindowUnresolved, birthWindow };
|
package/dist/window.js
CHANGED
|
@@ -9,29 +9,29 @@ import {
|
|
|
9
9
|
gastHours,
|
|
10
10
|
onChartClock,
|
|
11
11
|
tilt
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SRXBTP5H.js";
|
|
13
13
|
import {
|
|
14
14
|
REFERENCE_SPAN,
|
|
15
15
|
elapsedDays,
|
|
16
16
|
timeBasis
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-B5LKF437.js";
|
|
18
|
+
import "./chunk-BHJXUY67.js";
|
|
19
19
|
import {
|
|
20
20
|
computeAngles,
|
|
21
21
|
computeHouses,
|
|
22
22
|
houseOf,
|
|
23
23
|
isPolarUndefinedHouseSystem
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DMGHYCDI.js";
|
|
25
25
|
import {
|
|
26
26
|
ASPECTS,
|
|
27
27
|
ASPECT_TYPES,
|
|
28
28
|
ENGINE_VERSION,
|
|
29
|
-
|
|
29
|
+
SIGN_SLUGS,
|
|
30
30
|
matchAspect,
|
|
31
31
|
normalizeLongitude,
|
|
32
32
|
separation,
|
|
33
33
|
signIndexForLongitude
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OG4OYTJJ.js";
|
|
35
35
|
|
|
36
36
|
// src/window-ranges.ts
|
|
37
37
|
var DEG = Math.PI / 180;
|
|
@@ -119,9 +119,10 @@ var DAY = 864e5;
|
|
|
119
119
|
var DEG2 = Math.PI / 180;
|
|
120
120
|
var RAD2 = 180 / Math.PI;
|
|
121
121
|
var J2000 = Date.UTC(2e3, 0, 1, 12);
|
|
122
|
+
var BIRTH_WINDOW_SCHEMA = "zodiacs.birth-window.v1";
|
|
122
123
|
var WINDOW_VERIFICATION = "sampled at one-second resolution";
|
|
123
124
|
var MAX_WINDOW_MS = 1728e5;
|
|
124
|
-
var WINDOW_RATE_BOUNDS = Object.freeze({
|
|
125
|
+
var WINDOW_RATE_BOUNDS = /* @__PURE__ */ Object.freeze({
|
|
125
126
|
Sun: 2.1,
|
|
126
127
|
Moon: 31,
|
|
127
128
|
Mercury: 4.5,
|
|
@@ -143,8 +144,8 @@ var SIDEREAL_RATE = 360.98562;
|
|
|
143
144
|
var MAX_ANGLE_MS = Math.floor(45 / SIDEREAL_RATE * DAY);
|
|
144
145
|
var BAND = 1e-9;
|
|
145
146
|
var MAX_EVALUATIONS = 2e6;
|
|
146
|
-
var SPAN_FROM = Date.parse(REFERENCE_SPAN.from);
|
|
147
|
-
var SPAN_TO = Date.parse(REFERENCE_SPAN.to);
|
|
147
|
+
var SPAN_FROM = /* @__PURE__ */ (() => Date.parse(REFERENCE_SPAN.from))();
|
|
148
|
+
var SPAN_TO = /* @__PURE__ */ (() => Date.parse(REFERENCE_SPAN.to))();
|
|
148
149
|
var POLE_MARGIN = 1e-6;
|
|
149
150
|
var NODE_COARSE_MS = 36e5;
|
|
150
151
|
var NODE_FINE_MS = 6e4;
|
|
@@ -167,7 +168,7 @@ var BODIES = [
|
|
|
167
168
|
];
|
|
168
169
|
var NORTH = 10;
|
|
169
170
|
var SOUTH = 11;
|
|
170
|
-
var RATES = BODIES.map((body) => WINDOW_RATE_BOUNDS[body]);
|
|
171
|
+
var RATES = /* @__PURE__ */ BODIES.map((body) => WINDOW_RATE_BOUNDS[body]);
|
|
171
172
|
var PAIRS = [];
|
|
172
173
|
for (let first = 0; first < 10; first += 1) {
|
|
173
174
|
for (let second = first + 1; second < 10; second += 1) PAIRS.push([first, second]);
|
|
@@ -176,8 +177,8 @@ var orbEdges = (luminary) => ASPECTS.flatMap(({ angle, orb, luminaryOrb }) => {
|
|
|
176
177
|
const width = luminary ? luminaryOrb : orb;
|
|
177
178
|
return [angle - width, angle + width].filter((edge) => edge > 0 && edge < 180);
|
|
178
179
|
});
|
|
179
|
-
var ORB_EDGES = orbEdges(false);
|
|
180
|
-
var LUMINARY_ORB_EDGES = orbEdges(true);
|
|
180
|
+
var ORB_EDGES = /* @__PURE__ */ orbEdges(false);
|
|
181
|
+
var LUMINARY_ORB_EDGES = /* @__PURE__ */ orbEdges(true);
|
|
181
182
|
var ASC = 12;
|
|
182
183
|
var MC = 13;
|
|
183
184
|
var HOUSE = 14;
|
|
@@ -195,7 +196,7 @@ var SENSITIVE_RAMC = {
|
|
|
195
196
|
};
|
|
196
197
|
var WindowBudgetError = class extends Error {
|
|
197
198
|
name = "WindowBudgetError";
|
|
198
|
-
/** The instants the search allows. */
|
|
199
|
+
/** The instants the search allows; a later release may allow more. */
|
|
199
200
|
limit = MAX_EVALUATIONS;
|
|
200
201
|
constructor() {
|
|
201
202
|
super(
|
|
@@ -784,7 +785,7 @@ function features(values, system) {
|
|
|
784
785
|
BODIES.forEach((body, index) => {
|
|
785
786
|
const sign = values[index];
|
|
786
787
|
const house = values[HOUSE + index];
|
|
787
|
-
signs[body] = sign === UNRESOLVED ? null :
|
|
788
|
+
signs[body] = sign === UNRESOLVED ? null : SIGN_SLUGS[sign];
|
|
788
789
|
houses[body] = house === UNRESOLVED ? null : house;
|
|
789
790
|
});
|
|
790
791
|
const aspects = [];
|
|
@@ -794,19 +795,19 @@ function features(values, system) {
|
|
|
794
795
|
});
|
|
795
796
|
return {
|
|
796
797
|
signs,
|
|
797
|
-
ascendant:
|
|
798
|
-
midheaven:
|
|
798
|
+
ascendant: SIGN_SLUGS[values[ASC]],
|
|
799
|
+
midheaven: SIGN_SLUGS[values[MC]],
|
|
799
800
|
houses,
|
|
800
801
|
aspects,
|
|
801
802
|
houseSystem: values[SYSTEM] === 1 ? "whole" : system
|
|
802
803
|
};
|
|
803
804
|
}
|
|
804
805
|
function change(id, from, to, system) {
|
|
805
|
-
const sign = (value) => value === UNRESOLVED ? null :
|
|
806
|
+
const sign = (value) => value === UNRESOLVED ? null : SIGN_SLUGS[value];
|
|
806
807
|
const house = (value) => value === UNRESOLVED ? null : value;
|
|
807
808
|
if (id < ASC) return { feature: "sign", body: BODIES[id], from: sign(from), to: sign(to) };
|
|
808
809
|
if (id === ASC || id === MC) {
|
|
809
|
-
return { feature: id === ASC ? "ascendant" : "midheaven", from:
|
|
810
|
+
return { feature: id === ASC ? "ascendant" : "midheaven", from: SIGN_SLUGS[from], to: SIGN_SLUGS[to] };
|
|
810
811
|
}
|
|
811
812
|
if (id < ASPECT) return { feature: "house", body: BODIES[id - HOUSE], from: house(from), to: house(to) };
|
|
812
813
|
if (id < SYSTEM) {
|
|
@@ -889,18 +890,15 @@ function birthWindow(input) {
|
|
|
889
890
|
let fallback = values[SYSTEM] === 1;
|
|
890
891
|
const close = (cellEnd) => {
|
|
891
892
|
const milliseconds = cellEnd - cellStart;
|
|
892
|
-
const
|
|
893
|
+
const overlap = support && Math.max(0, Math.min(cellEnd, support[1]) - Math.max(cellStart, support[0]));
|
|
894
|
+
cells.push({
|
|
893
895
|
start: new Date(cellStart),
|
|
894
896
|
end: new Date(cellEnd),
|
|
895
897
|
milliseconds,
|
|
896
898
|
share: milliseconds / length,
|
|
897
|
-
features: features(values, system)
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
const overlap = Math.max(0, Math.min(cellEnd, support[1]) - Math.max(cellStart, support[0]));
|
|
901
|
-
cell.roundedShare = overlap / (support[1] - support[0]);
|
|
902
|
-
}
|
|
903
|
-
cells.push(cell);
|
|
899
|
+
features: features(values, system),
|
|
900
|
+
...support ? { roundedShare: overlap / (support[1] - support[0]) } : {}
|
|
901
|
+
});
|
|
904
902
|
cellStart = cellEnd;
|
|
905
903
|
};
|
|
906
904
|
for (let index = 0; index < changes.length; ) {
|
|
@@ -926,7 +924,7 @@ function birthWindow(input) {
|
|
|
926
924
|
if (sky.violations > 0) flags.push("bound-exceeded");
|
|
927
925
|
if (unresolved.length > 0) flags.push("node-unresolved");
|
|
928
926
|
return {
|
|
929
|
-
schema:
|
|
927
|
+
schema: BIRTH_WINDOW_SCHEMA,
|
|
930
928
|
verification: WINDOW_VERIFICATION,
|
|
931
929
|
start: new Date(start),
|
|
932
930
|
end: new Date(end),
|
|
@@ -953,6 +951,7 @@ function birthWindow(input) {
|
|
|
953
951
|
};
|
|
954
952
|
}
|
|
955
953
|
export {
|
|
954
|
+
BIRTH_WINDOW_SCHEMA,
|
|
956
955
|
MAX_WINDOW_MS,
|
|
957
956
|
WINDOW_RATE_BOUNDS,
|
|
958
957
|
WINDOW_VERIFICATION,
|
|
@@ -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 };
|