chart2txt 0.6.0 → 0.7.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 +101 -34
- package/dist/chart2txt.d.ts +9 -0
- package/dist/chart2txt.js +30 -0
- package/dist/chart2txt.min.js +1 -1
- package/dist/config/ChartSettings.d.ts +12 -6
- package/dist/config/ChartSettings.js +36 -11
- package/dist/constants.d.ts +17 -2
- package/dist/constants.js +301 -34
- package/dist/core/analysis.d.ts +6 -0
- package/dist/core/analysis.js +235 -0
- package/dist/core/aspectPatterns.d.ts +8 -3
- package/dist/core/aspectPatterns.js +234 -218
- package/dist/core/aspects.d.ts +14 -11
- package/dist/core/aspects.js +49 -32
- package/dist/core/dignities.d.ts +2 -27
- package/dist/core/dignities.js +56 -121
- package/dist/core/dispositors.d.ts +6 -19
- package/dist/core/dispositors.js +45 -131
- package/dist/core/grouping.d.ts +9 -0
- package/dist/core/grouping.js +45 -0
- package/dist/core/signDistributions.d.ts +20 -30
- package/dist/core/signDistributions.js +22 -122
- package/dist/core/stelliums.d.ts +10 -0
- package/dist/core/stelliums.js +108 -0
- package/dist/formatters/text/sections/aspectPatterns.d.ts +3 -1
- package/dist/formatters/text/sections/aspectPatterns.js +118 -94
- package/dist/formatters/text/sections/aspects.d.ts +3 -6
- package/dist/formatters/text/sections/aspects.js +35 -52
- package/dist/formatters/text/sections/dispositors.d.ts +4 -3
- package/dist/formatters/text/sections/dispositors.js +7 -8
- package/dist/formatters/text/sections/houseOverlays.d.ts +11 -6
- package/dist/formatters/text/sections/houseOverlays.js +37 -44
- package/dist/formatters/text/sections/metadata.d.ts +2 -0
- package/dist/formatters/text/sections/metadata.js +54 -0
- package/dist/formatters/text/sections/planets.d.ts +3 -5
- package/dist/formatters/text/sections/planets.js +11 -22
- package/dist/formatters/text/sections/signDistributions.d.ts +9 -25
- package/dist/formatters/text/sections/signDistributions.js +9 -55
- package/dist/formatters/text/textFormatter.d.ts +4 -5
- package/dist/formatters/text/textFormatter.js +81 -141
- package/dist/index.d.ts +7 -4
- package/dist/index.js +11 -6
- package/dist/types.d.ts +100 -15
- package/dist/types.js +15 -0
- package/dist/utils/formatting.d.ts +4 -0
- package/dist/utils/formatting.js +43 -0
- package/dist/utils/houseCalculations.d.ts +10 -13
- package/dist/utils/houseCalculations.js +15 -57
- package/package.json +1 -1
package/dist/core/aspects.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Aspect, AspectData, UnionedPoint } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Unified aspect calculation function that handles both single-chart and multi-chart scenarios
|
|
4
4
|
* @param aspectDefinitions Array of aspect types to check for.
|
|
5
|
-
* @param
|
|
5
|
+
* @param unionedPlanets Array of UnionedPoint pairs to analyze.
|
|
6
|
+
* @param skipOutOfSignAspects Whether to skip aspects that cross sign boundaries.
|
|
7
|
+
* @param aspectStrengthThresholds Thresholds for classifying aspect strength.
|
|
8
|
+
* @param forceChartType Optional override for chart type determination.
|
|
6
9
|
* @returns Array of found aspects.
|
|
7
10
|
*/
|
|
8
|
-
export declare function calculateAspects(aspectDefinitions: Aspect[],
|
|
11
|
+
export declare function calculateAspects(aspectDefinitions: Aspect[], unionedPlanets: UnionedPoint[], skipOutOfSignAspects?: boolean): AspectData[];
|
|
9
12
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @returns Array of found aspects
|
|
13
|
+
* Calculates aspects in a multi-chart context (synastry, transits, etc.)
|
|
14
|
+
* @param aspectDefinitions Array of aspect types to check for
|
|
15
|
+
* @param unionedPlanets Array of UnionedPoint pairs to analyze
|
|
16
|
+
* @param skipOutOfSignAspects Whether to skip aspects that cross sign boundaries
|
|
17
|
+
* @param aspectStrengthThresholds Thresholds for classifying aspect strength
|
|
18
|
+
* @returns Array of found aspects
|
|
16
19
|
*/
|
|
17
|
-
export declare function calculateMultichartAspects(aspectDefinitions: Aspect[],
|
|
20
|
+
export declare function calculateMultichartAspects(aspectDefinitions: Aspect[], unionedPlanets: UnionedPoint[], skipOutOfSignAspects?: boolean): AspectData[];
|
package/dist/core/aspects.js
CHANGED
|
@@ -81,7 +81,18 @@ function determineAspectApplication(planetA, planetB, aspectAngle) {
|
|
|
81
81
|
const isApplying = futureAspectDistance < currentAspectDistance;
|
|
82
82
|
return isApplying ? 'applying' : 'separating';
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Finds the tightest aspect between two planets using simple orb detection
|
|
86
|
+
* @param aspectDefinitions Array of aspect types to check for
|
|
87
|
+
* @param planetA First planet
|
|
88
|
+
* @param planetB Second planet
|
|
89
|
+
* @param skipOutOfSignAspects Whether to skip aspects that cross sign boundaries
|
|
90
|
+
* @param aspectStrengthThresholds Thresholds for classifying aspect strength
|
|
91
|
+
* @param p1ChartName Optional chart name for planetA
|
|
92
|
+
* @param p2ChartName Optional chart name for planetB
|
|
93
|
+
* @returns The tightest aspect found, or null if none
|
|
94
|
+
*/
|
|
95
|
+
function findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAspects, p1ChartName, p2ChartName) {
|
|
85
96
|
const degreeA = (0, precision_1.roundDegrees)((0, astrology_1.normalizeDegree)(planetA.degree));
|
|
86
97
|
const degreeB = (0, precision_1.roundDegrees)((0, astrology_1.normalizeDegree)(planetB.degree));
|
|
87
98
|
let diff = Math.abs(degreeA - degreeB);
|
|
@@ -94,7 +105,6 @@ function findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAs
|
|
|
94
105
|
const planetASign = Math.floor(degreeA / 30);
|
|
95
106
|
const planetBSign = Math.floor(degreeB / 30);
|
|
96
107
|
// Calculate expected sign difference for this aspect
|
|
97
|
-
// For major aspects: 0° = 0 signs, 60° = 2 signs, 90° = 3 signs, 120° = 4 signs, 180° = 6 signs
|
|
98
108
|
const expectedSignDiff = getExpectedSignDifference(aspectType.angle);
|
|
99
109
|
let actualSignDiff = Math.abs(planetASign - planetBSign);
|
|
100
110
|
if (actualSignDiff > 6)
|
|
@@ -103,12 +113,16 @@ function findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAs
|
|
|
103
113
|
continue;
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
|
-
|
|
116
|
+
// Use simple orb from aspect definition
|
|
117
|
+
const maxAllowedOrb = aspectType.orb;
|
|
118
|
+
if (orb <= maxAllowedOrb) {
|
|
107
119
|
if (!tightestAspect || orb < tightestAspect.orb) {
|
|
108
120
|
const application = determineAspectApplication(planetA, planetB, aspectType.angle);
|
|
109
121
|
tightestAspect = {
|
|
110
122
|
planetA: planetA.name,
|
|
111
123
|
planetB: planetB.name,
|
|
124
|
+
p1ChartName,
|
|
125
|
+
p2ChartName,
|
|
112
126
|
aspectType: aspectType.name,
|
|
113
127
|
orb,
|
|
114
128
|
application,
|
|
@@ -119,20 +133,23 @@ function findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAs
|
|
|
119
133
|
return tightestAspect;
|
|
120
134
|
}
|
|
121
135
|
/**
|
|
122
|
-
*
|
|
136
|
+
* Unified aspect calculation function that handles both single-chart and multi-chart scenarios
|
|
123
137
|
* @param aspectDefinitions Array of aspect types to check for.
|
|
124
|
-
* @param
|
|
138
|
+
* @param unionedPlanets Array of UnionedPoint pairs to analyze.
|
|
139
|
+
* @param skipOutOfSignAspects Whether to skip aspects that cross sign boundaries.
|
|
140
|
+
* @param aspectStrengthThresholds Thresholds for classifying aspect strength.
|
|
141
|
+
* @param forceChartType Optional override for chart type determination.
|
|
125
142
|
* @returns Array of found aspects.
|
|
126
143
|
*/
|
|
127
|
-
function calculateAspects(aspectDefinitions,
|
|
144
|
+
function calculateAspects(aspectDefinitions, unionedPlanets, skipOutOfSignAspects = true) {
|
|
128
145
|
const aspects = [];
|
|
129
|
-
if (!
|
|
146
|
+
if (!unionedPlanets || unionedPlanets.length < 2)
|
|
130
147
|
return aspects;
|
|
131
|
-
for (let i = 0; i <
|
|
132
|
-
for (let j = i + 1; j <
|
|
133
|
-
const planetA =
|
|
134
|
-
const planetB =
|
|
135
|
-
const aspect = findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAspects);
|
|
148
|
+
for (let i = 0; i < unionedPlanets.length; i++) {
|
|
149
|
+
for (let j = i + 1; j < unionedPlanets.length; j++) {
|
|
150
|
+
const [planetA, chartNameA] = unionedPlanets[i];
|
|
151
|
+
const [planetB, chartNameB] = unionedPlanets[j];
|
|
152
|
+
const aspect = findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAspects, chartNameA, chartNameB);
|
|
136
153
|
if (aspect) {
|
|
137
154
|
aspects.push(aspect);
|
|
138
155
|
}
|
|
@@ -141,28 +158,28 @@ function calculateAspects(aspectDefinitions, planets, skipOutOfSignAspects = tru
|
|
|
141
158
|
return aspects;
|
|
142
159
|
}
|
|
143
160
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @param
|
|
147
|
-
* @param
|
|
148
|
-
* @param
|
|
149
|
-
* @returns Array of found aspects
|
|
161
|
+
* Calculates aspects in a multi-chart context (synastry, transits, etc.)
|
|
162
|
+
* @param aspectDefinitions Array of aspect types to check for
|
|
163
|
+
* @param unionedPlanets Array of UnionedPoint pairs to analyze
|
|
164
|
+
* @param skipOutOfSignAspects Whether to skip aspects that cross sign boundaries
|
|
165
|
+
* @param aspectStrengthThresholds Thresholds for classifying aspect strength
|
|
166
|
+
* @returns Array of found aspects
|
|
150
167
|
*/
|
|
151
|
-
function calculateMultichartAspects(aspectDefinitions,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
168
|
+
function calculateMultichartAspects(aspectDefinitions, unionedPlanets, skipOutOfSignAspects = true) {
|
|
169
|
+
// Filter to only cross-chart aspects
|
|
170
|
+
const crossChartAspects = [];
|
|
171
|
+
for (let i = 0; i < unionedPlanets.length; i++) {
|
|
172
|
+
for (let j = i + 1; j < unionedPlanets.length; j++) {
|
|
173
|
+
const [planetA, chartNameA] = unionedPlanets[i];
|
|
174
|
+
const [planetB, chartNameB] = unionedPlanets[j];
|
|
175
|
+
// Only calculate aspects between planets from different charts
|
|
176
|
+
if (chartNameA !== chartNameB) {
|
|
177
|
+
const aspect = findTightestAspect(aspectDefinitions, planetA, planetB, skipOutOfSignAspects, chartNameA, chartNameB);
|
|
178
|
+
if (aspect) {
|
|
179
|
+
crossChartAspects.push(aspect);
|
|
180
|
+
}
|
|
164
181
|
}
|
|
165
182
|
}
|
|
166
183
|
}
|
|
167
|
-
return
|
|
184
|
+
return crossChartAspects;
|
|
168
185
|
}
|
package/dist/core/dignities.d.ts
CHANGED
|
@@ -1,27 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
rulers: string[];
|
|
4
|
-
exaltation?: string;
|
|
5
|
-
detriment?: string;
|
|
6
|
-
fall?: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Gets the essential dignities for a planet in a specific sign
|
|
10
|
-
* @param planetName Name of the planet
|
|
11
|
-
* @param sign The zodiac sign
|
|
12
|
-
* @returns Array of dignity descriptions
|
|
13
|
-
*/
|
|
14
|
-
export declare function getPlanetDignities(planetName: string, sign: string): string[];
|
|
15
|
-
/**
|
|
16
|
-
* Gets the ruler(s) of a zodiac sign
|
|
17
|
-
* @param sign The zodiac sign
|
|
18
|
-
* @returns Array of ruling planets
|
|
19
|
-
*/
|
|
20
|
-
export declare function getSignRulers(sign: string): string[];
|
|
21
|
-
/**
|
|
22
|
-
* Formats planet dignities for display
|
|
23
|
-
* @param planet The planet point
|
|
24
|
-
* @param houseCusps Array of house cusps (optional)
|
|
25
|
-
* @returns Formatted string with dignities
|
|
26
|
-
*/
|
|
27
|
-
export declare function formatPlanetWithDignities(planet: Point, houseCusps?: number[]): string;
|
|
1
|
+
import { PlanetPosition } from '../types';
|
|
2
|
+
export declare function formatPlanetWithDignities(planet: PlanetPosition): string;
|
package/dist/core/dignities.js
CHANGED
|
@@ -1,136 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPlanetDignities = getPlanetDignities;
|
|
4
|
-
exports.getSignRulers = getSignRulers;
|
|
5
3
|
exports.formatPlanetWithDignities = formatPlanetWithDignities;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
fall: 'Saturn',
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const DIGNITY_MAP = {
|
|
6
|
+
Sun: {
|
|
7
|
+
Leo: ['Domicile'],
|
|
8
|
+
Aries: ['Exaltation'],
|
|
9
|
+
Aquarius: ['Detriment'],
|
|
10
|
+
Libra: ['Fall'],
|
|
14
11
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
Moon: {
|
|
13
|
+
Cancer: ['Domicile'],
|
|
14
|
+
Taurus: ['Exaltation'],
|
|
15
|
+
Capricorn: ['Detriment'],
|
|
16
|
+
Scorpio: ['Fall'],
|
|
20
17
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
Mercury: {
|
|
19
|
+
Gemini: ['Domicile'],
|
|
20
|
+
Virgo: ['Domicile', 'Exaltation'],
|
|
21
|
+
Pisces: ['Detriment', 'Fall'],
|
|
22
|
+
Sagittarius: ['Detriment'],
|
|
24
23
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
Venus: {
|
|
25
|
+
Taurus: ['Domicile'],
|
|
26
|
+
Libra: ['Domicile'],
|
|
27
|
+
Scorpio: ['Detriment'],
|
|
28
|
+
Aries: ['Fall'],
|
|
29
|
+
Virgo: ['Fall'],
|
|
30
30
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
Mars: {
|
|
32
|
+
Aries: ['Domicile'],
|
|
33
|
+
Scorpio: ['Domicile'],
|
|
34
|
+
Libra: ['Detriment'],
|
|
35
|
+
Cancer: ['Fall'],
|
|
35
36
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
Jupiter: {
|
|
38
|
+
Sagittarius: ['Domicile'],
|
|
39
|
+
Pisces: ['Domicile'],
|
|
40
|
+
Gemini: ['Detriment'],
|
|
41
|
+
Virgo: ['Fall'],
|
|
41
42
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
Scorpio: {
|
|
49
|
-
rulers: ['Mars'],
|
|
50
|
-
detriment: 'Venus',
|
|
51
|
-
fall: 'Moon',
|
|
52
|
-
},
|
|
53
|
-
Sagittarius: {
|
|
54
|
-
rulers: ['Jupiter'],
|
|
55
|
-
detriment: 'Mercury',
|
|
56
|
-
},
|
|
57
|
-
Capricorn: {
|
|
58
|
-
rulers: ['Saturn'],
|
|
59
|
-
exaltation: 'Mars',
|
|
60
|
-
detriment: 'Moon',
|
|
61
|
-
fall: 'Jupiter',
|
|
62
|
-
},
|
|
63
|
-
Aquarius: {
|
|
64
|
-
rulers: ['Saturn'],
|
|
65
|
-
detriment: 'Sun',
|
|
66
|
-
fall: 'Neptune',
|
|
67
|
-
},
|
|
68
|
-
Pisces: {
|
|
69
|
-
rulers: ['Jupiter'],
|
|
70
|
-
exaltation: 'Venus',
|
|
71
|
-
detriment: 'Mercury',
|
|
72
|
-
fall: 'Mercury',
|
|
43
|
+
Saturn: {
|
|
44
|
+
Capricorn: ['Domicile'],
|
|
45
|
+
Aquarius: ['Domicile'],
|
|
46
|
+
Cancer: ['Detriment'],
|
|
47
|
+
Leo: ['Fall'],
|
|
73
48
|
},
|
|
74
49
|
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const dignities = [];
|
|
83
|
-
const normalizedSign = sign.trim();
|
|
84
|
-
const signInfo = SIGN_DIGNITIES[normalizedSign];
|
|
85
|
-
if (!signInfo)
|
|
86
|
-
return dignities;
|
|
87
|
-
// Check for rulership (domicile)
|
|
88
|
-
if (signInfo.rulers.includes(planetName)) {
|
|
89
|
-
dignities.push(`Domicile`);
|
|
90
|
-
}
|
|
91
|
-
// Check for exaltation
|
|
92
|
-
if (signInfo.exaltation === planetName) {
|
|
93
|
-
dignities.push(`Exaltation`);
|
|
94
|
-
}
|
|
95
|
-
// Check for detriment
|
|
96
|
-
if (signInfo.detriment === planetName) {
|
|
97
|
-
dignities.push(`Detriment`);
|
|
98
|
-
}
|
|
99
|
-
// Check for fall
|
|
100
|
-
if (signInfo.fall && signInfo.fall === planetName) {
|
|
101
|
-
dignities.push(`Fall`);
|
|
102
|
-
}
|
|
103
|
-
return dignities;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Gets the ruler(s) of a zodiac sign
|
|
107
|
-
* @param sign The zodiac sign
|
|
108
|
-
* @returns Array of ruling planets
|
|
109
|
-
*/
|
|
110
|
-
function getSignRulers(sign) {
|
|
111
|
-
const normalizedSign = sign.trim();
|
|
112
|
-
const signInfo = SIGN_DIGNITIES[normalizedSign];
|
|
113
|
-
return signInfo ? signInfo.rulers : [];
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Formats planet dignities for display
|
|
117
|
-
* @param planet The planet point
|
|
118
|
-
* @param houseCusps Array of house cusps (optional)
|
|
119
|
-
* @returns Formatted string with dignities
|
|
120
|
-
*/
|
|
121
|
-
function formatPlanetWithDignities(planet, houseCusps) {
|
|
122
|
-
const sign = (0, astrology_1.getDegreeSign)(planet.degree);
|
|
123
|
-
const dignities = getPlanetDignities(planet.name, sign);
|
|
124
|
-
const rulers = getSignRulers(sign);
|
|
125
|
-
let dignitiesStr = '';
|
|
126
|
-
if (dignities.length > 0 && dignities.includes('Domicile')) {
|
|
127
|
-
dignitiesStr = `[${dignities.join(', ')}]`;
|
|
50
|
+
function formatPlanetWithDignities(planet) {
|
|
51
|
+
const sign = planet.sign;
|
|
52
|
+
const dignities = DIGNITY_MAP[planet.name];
|
|
53
|
+
const ruler = constants_1.ZODIAC_SIGN_DATA.find((s) => s.name === sign)?.ruler;
|
|
54
|
+
const dignityParts = [];
|
|
55
|
+
if (dignities && dignities[sign]) {
|
|
56
|
+
dignityParts.push(...dignities[sign]);
|
|
128
57
|
}
|
|
129
|
-
|
|
130
|
-
|
|
58
|
+
let dignityString = dignityParts.join(', ');
|
|
59
|
+
if (ruler && planet.name !== ruler) {
|
|
60
|
+
if (dignityString) {
|
|
61
|
+
dignityString += ` | Ruler: ${ruler}`;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
dignityString = `Ruler: ${ruler}`;
|
|
65
|
+
}
|
|
131
66
|
}
|
|
132
|
-
|
|
133
|
-
|
|
67
|
+
if (dignityString) {
|
|
68
|
+
return `[${dignityString}]`;
|
|
134
69
|
}
|
|
135
|
-
return
|
|
70
|
+
return '';
|
|
136
71
|
}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
import { Point } from '../types';
|
|
2
|
-
export interface DispositorChain {
|
|
3
|
-
planet: string;
|
|
4
|
-
disposedBy: string[];
|
|
5
|
-
disposes: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface DispositorAnalysis {
|
|
8
|
-
chains: DispositorChain[];
|
|
9
|
-
finalDispositors: string[];
|
|
10
|
-
}
|
|
11
2
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param planets
|
|
14
|
-
* @returns
|
|
3
|
+
* Calculates the full dispositor chain for each planet in the chart.
|
|
4
|
+
* @param planets The list of planets in the chart.
|
|
5
|
+
* @returns A map of each planet to its full dispositor chain string.
|
|
15
6
|
*/
|
|
16
|
-
export declare function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param analysis The dispositor analysis
|
|
20
|
-
* @returns Array of formatted strings
|
|
21
|
-
*/
|
|
22
|
-
export declare function formatDispositorAnalysis(analysis: DispositorAnalysis): string[];
|
|
7
|
+
export declare function calculateDispositors(planets: Point[]): {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
package/dist/core/dispositors.js
CHANGED
|
@@ -1,143 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const dignities_1 = require("./dignities");
|
|
3
|
+
exports.calculateDispositors = calculateDispositors;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const formatting_1 = require("../utils/formatting");
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
7
|
+
* Calculates the dispositor for a single planet.
|
|
8
|
+
* @param planet The planet to find the dispositor for.
|
|
9
|
+
* @returns The name of the dispositor planet.
|
|
11
10
|
*/
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
planets.forEach((planet) => {
|
|
17
|
-
const sign = (0, astrology_1.getDegreeSign)(planet.degree);
|
|
18
|
-
const rulers = (0, dignities_1.getSignRulers)(sign);
|
|
19
|
-
dispositorMap.set(planet.name, rulers);
|
|
20
|
-
rulers.forEach((ruler) => {
|
|
21
|
-
if (!disposedByMap.has(ruler)) {
|
|
22
|
-
disposedByMap.set(ruler, []);
|
|
23
|
-
}
|
|
24
|
-
disposedByMap.get(ruler).push(planet.name);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
// Find final dispositors - these are the roots of dispositor trees
|
|
28
|
-
const finalDispositors = [];
|
|
29
|
-
const planetNames = new Set(planets.map((p) => p.name));
|
|
30
|
-
planets.forEach((planet) => {
|
|
31
|
-
const rulers = dispositorMap.get(planet.name) || [];
|
|
32
|
-
const isRuledBySelf = rulers.includes(planet.name);
|
|
33
|
-
const isRuledByPlanetNotInChart = rulers.length > 0 && !rulers.some((ruler) => planetNames.has(ruler));
|
|
34
|
-
// A planet is a final dispositor if:
|
|
35
|
-
// 1. It rules itself (traditional dignity)
|
|
36
|
-
// 2. It's ruled by a planet not in the chart
|
|
37
|
-
if (isRuledBySelf || isRuledByPlanetNotInChart) {
|
|
38
|
-
finalDispositors.push(planet.name);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
// Build chains
|
|
42
|
-
const chains = planets.map((planet) => ({
|
|
43
|
-
planet: planet.name,
|
|
44
|
-
disposedBy: dispositorMap.get(planet.name) || [],
|
|
45
|
-
disposes: disposedByMap.get(planet.name) || [],
|
|
46
|
-
}));
|
|
47
|
-
return {
|
|
48
|
-
chains,
|
|
49
|
-
finalDispositors,
|
|
50
|
-
};
|
|
11
|
+
function getDispositor(planet) {
|
|
12
|
+
const sign = (0, formatting_1.getSign)(planet.degree);
|
|
13
|
+
const signData = constants_1.ZODIAC_SIGN_DATA.find((s) => s.name === sign);
|
|
14
|
+
return signData ? signData.ruler : 'Unknown';
|
|
51
15
|
}
|
|
52
16
|
/**
|
|
53
|
-
*
|
|
17
|
+
* Calculates the full dispositor chain for each planet in the chart.
|
|
18
|
+
* @param planets The list of planets in the chart.
|
|
19
|
+
* @returns A map of each planet to its full dispositor chain string.
|
|
54
20
|
*/
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
21
|
+
function calculateDispositors(planets) {
|
|
22
|
+
const dispositorMap = {};
|
|
23
|
+
planets.forEach((p) => {
|
|
24
|
+
dispositorMap[p.name] = getDispositor(p);
|
|
25
|
+
});
|
|
26
|
+
const chains = {};
|
|
27
|
+
planets.forEach((planet) => {
|
|
28
|
+
const path = [planet.name];
|
|
29
|
+
let current = planet.name;
|
|
30
|
+
let chain = `${current}`;
|
|
31
|
+
// eslint-disable-next-line no-constant-condition
|
|
32
|
+
while (true) {
|
|
33
|
+
const nextDispositor = dispositorMap[current];
|
|
34
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
35
|
+
if (!nextDispositor || !dispositorMap.hasOwnProperty(nextDispositor)) {
|
|
36
|
+
// Dispositor is not in the chart, so the chain ends.
|
|
37
|
+
chain += ` → ${nextDispositor} (not in chart)`;
|
|
38
|
+
break;
|
|
69
39
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
visited.add(planet);
|
|
75
|
-
path.add(planet);
|
|
76
|
-
currentPath.push(planet);
|
|
77
|
-
const chain = chains.find((c) => c.planet === planet);
|
|
78
|
-
if (chain) {
|
|
79
|
-
// Follow the dispositor chain (only follow planets in the chart)
|
|
80
|
-
const inChartRulers = chain.disposedBy.filter((ruler) => chains.some((c) => c.planet === ruler));
|
|
81
|
-
for (const ruler of inChartRulers) {
|
|
82
|
-
dfs(ruler, [...currentPath]);
|
|
40
|
+
if (nextDispositor === current) {
|
|
41
|
+
// Planet is its own dispositor (final dispositor).
|
|
42
|
+
chain += ` → (final)`;
|
|
43
|
+
break;
|
|
83
44
|
}
|
|
45
|
+
if (path.includes(nextDispositor)) {
|
|
46
|
+
// A loop is detected.
|
|
47
|
+
chain += ` → ${nextDispositor} (cycle)`;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
path.push(nextDispositor);
|
|
51
|
+
chain += ` → ${nextDispositor}`;
|
|
52
|
+
current = nextDispositor;
|
|
84
53
|
}
|
|
85
|
-
|
|
86
|
-
currentPath.pop();
|
|
87
|
-
}
|
|
88
|
-
// Start DFS from each planet
|
|
89
|
-
chains.forEach((chain) => {
|
|
90
|
-
if (!visited.has(chain.planet)) {
|
|
91
|
-
dfs(chain.planet, []);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
return cycles;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Builds the full dispositor chain for a planet
|
|
98
|
-
* @param planet Starting planet
|
|
99
|
-
* @param chains All dispositor chains
|
|
100
|
-
* @param pathSoFar Array to track the current path (prevents infinite loops)
|
|
101
|
-
* @returns Array of planets in the chain (excluding the starting planet)
|
|
102
|
-
*/
|
|
103
|
-
function buildDispositorChain(planet, chains, pathSoFar = []) {
|
|
104
|
-
const chain = chains.find((c) => c.planet === planet);
|
|
105
|
-
if (!chain || chain.disposedBy.length === 0) {
|
|
106
|
-
return ['(final)'];
|
|
107
|
-
}
|
|
108
|
-
// Get the first in-chart ruler
|
|
109
|
-
const inChartRulers = chain.disposedBy.filter((ruler) => chains.some((c) => c.planet === ruler));
|
|
110
|
-
if (inChartRulers.length === 0) {
|
|
111
|
-
return ['(final)'];
|
|
112
|
-
}
|
|
113
|
-
const ruler = inChartRulers[0];
|
|
114
|
-
// If the ruler is the same as the planet (self-ruler), it's final
|
|
115
|
-
if (ruler === planet) {
|
|
116
|
-
return ['(final)'];
|
|
117
|
-
}
|
|
118
|
-
// If we've seen this ruler in the current path, we have a cycle
|
|
119
|
-
if (pathSoFar.includes(ruler)) {
|
|
120
|
-
return ['(cycle)'];
|
|
121
|
-
}
|
|
122
|
-
// Continue the chain
|
|
123
|
-
const newPath = [...pathSoFar, planet];
|
|
124
|
-
const nextChain = buildDispositorChain(ruler, chains, newPath);
|
|
125
|
-
// If the next chain ends in (final), this whole chain ends in (final)
|
|
126
|
-
// If the next chain ends in (cycle), this chain also ends in (cycle)
|
|
127
|
-
return [ruler, ...nextChain];
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Formats the dispositor analysis for display
|
|
131
|
-
* @param analysis The dispositor analysis
|
|
132
|
-
* @returns Array of formatted strings
|
|
133
|
-
*/
|
|
134
|
-
function formatDispositorAnalysis(analysis) {
|
|
135
|
-
const output = [];
|
|
136
|
-
// Build and format chains for each planet
|
|
137
|
-
analysis.chains.forEach((chainInfo) => {
|
|
138
|
-
const chainRest = buildDispositorChain(chainInfo.planet, analysis.chains);
|
|
139
|
-
const chainString = chainRest.join(' → ');
|
|
140
|
-
output.push(`${chainInfo.planet} → ${chainString}`);
|
|
54
|
+
chains[planet.name] = chain;
|
|
141
55
|
});
|
|
142
|
-
return
|
|
56
|
+
return chains;
|
|
143
57
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AspectData, Settings } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Provides a default grouping of aspects into "Tight", "Moderate", and "Wide" categories
|
|
4
|
+
* based on orb thresholds. This is used by the simple chart2txt() function.
|
|
5
|
+
* @param aspects The raw list of aspects to group.
|
|
6
|
+
* @param settings The chart settings, containing aspectStrengthThresholds.
|
|
7
|
+
* @returns A map of category names to aspect data arrays.
|
|
8
|
+
*/
|
|
9
|
+
export declare function groupAspects(aspects: AspectData[], settings: Settings): Map<string, AspectData[]>;
|