kaabalah
Version:
The de-facto library for any esoteric calculations and tooling
105 lines (99 loc) • 2.41 kB
TypeScript
/**
* TypeScript wrapper for Swiss Ephemeris WebAssembly module
*/
declare enum Planet {
SUN = 0,
MOON = 1,
MERCURY = 2,
VENUS = 3,
MARS = 4,
JUPITER = 5,
SATURN = 6,
URANUS = 7,
NEPTUNE = 8,
PLUTO = 9,
MEAN_NODE = 10,
TRUE_NODE = 11,
CHIRON = 15
}
declare enum HouseSystem {
PLACIDUS = "P",
KOCH = "K",
PORPHYRIUS = "O",
REGIOMONTANUS = "R",
CAMPANUS = "C",
EQUAL = "E",
WHOLE_SIGN = "W",
MERIDIAN = "X",
MORINUS = "M",
KRUSINSKI = "U",
ALCABITIUS = "B"
}
declare enum CalcFlag {
SWISS_EPH = 2,
MOSHIER = 4,
HELIOCENTRIC = 8,
TRUE_POS = 16,
SPEED = 32
}
/**
* Integration with the Swiss Ephemeris WebAssembly module
*/
/**
* Get the Swiss Ephemeris instance, initializing it if needed
*/
declare function getSwissEph(ephePath?: string): Promise<void>;
/**
* Clean up Swiss Ephemeris resources
*/
declare function closeSwissEph(): void;
/**
* Astrological calculations using Swiss Ephemeris
*/
interface BirthChartOptions {
date: Date;
latitude: number;
longitude: number;
timezone: number;
houseSystem?: HouseSystem;
}
interface BirthChart {
dateUtc: Date;
planets: Record<string, {
longitude: number;
latitude: number;
distance: number;
}>;
houses: {
houses: number[];
ascendant: number;
mc: number;
};
}
/**
* Calculate a birth chart using Swiss Ephemeris
*
* @param options Chart calculation options
* @returns Birth chart data
*/
declare function getBirthChart(options: BirthChartOptions): Promise<BirthChart>;
/**
* Convert decimal degrees to degrees and minutes format
*
* @param decimalDegrees Decimal degrees (e.g., 9.8)
* @returns Formatted string (e.g., "9°48'")
*/
declare function formatDegreeMinutes(decimalDegrees: number): string;
/**
* Convert decimal degrees to zodiac position (sign and degrees)
*
* @param longitude Longitude in decimal degrees (0-360)
* @returns Formatted zodiac position with both decimal and traditional format
*/
declare function getZodiacPosition(longitude: number): {
sign: string;
decimalDegrees: number;
traditionalFormat: string;
decimal: string;
};
export { type BirthChart, type BirthChartOptions, CalcFlag, HouseSystem, Planet, closeSwissEph, formatDegreeMinutes, getBirthChart, getSwissEph, getZodiacPosition };