kaabalah 5.2.0 → 5.3.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 +20 -3
- package/dist/astrology/index.d.mts +7 -8
- package/dist/astrology/index.d.ts +7 -8
- package/dist/astrology/index.js +25 -21
- package/dist/astrology/index.mjs +1 -1
- package/dist/{chunk-IAKSKHGA.js → chunk-AHUZONHJ.js} +209 -67
- package/dist/chunk-AHUZONHJ.js.map +1 -0
- package/dist/{chunk-CYWQV2RL.mjs → chunk-VSTGPXLM.mjs} +209 -68
- package/dist/chunk-VSTGPXLM.mjs.map +1 -0
- package/dist/cli.js +18714 -1005
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -21
- package/dist/index.mjs +1 -1
- package/package.json +12 -2
- package/dist/chunk-CYWQV2RL.mjs.map +0 -1
- package/dist/chunk-IAKSKHGA.js.map +0 -1
- package/dist/cli.mjs +0 -1388
- package/dist/cli.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ Complete documentation here [https://docs.kaabalah.com/](https://docs.kaabalah.c
|
|
|
20
20
|
npm install kaabalah
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
Node.js 18.18+ is required for the bundled CLI and runtime helpers.
|
|
24
|
+
|
|
23
25
|
## Support us on Ko-Fi
|
|
24
26
|
|
|
25
27
|
If you find this package useful, you can support it on Ko-Fi too (or just star the repo):
|
|
@@ -117,10 +119,10 @@ kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006
|
|
|
117
119
|
kaabalah astrology 1990-01-15 14:30 --location="New York, USA"
|
|
118
120
|
|
|
119
121
|
# Synastry (cross-chart aspects)
|
|
120
|
-
kaabalah astrology:synastry --input-json
|
|
122
|
+
kaabalah astrology:synastry --input-json=- --json < synastry.json
|
|
121
123
|
|
|
122
124
|
# Composite (midpoint chart)
|
|
123
|
-
kaabalah astrology:composite --input-json
|
|
125
|
+
kaabalah astrology:composite --input-json=- --json < composite.json
|
|
124
126
|
|
|
125
127
|
# Tree of Life correspondences
|
|
126
128
|
kaabalah tree:node path:1 --json
|
|
@@ -136,7 +138,9 @@ kaabalah tree:node sphere:Kether --type=tarotArkAnnu --json
|
|
|
136
138
|
| `--no-json` | Force human-readable output even when piped |
|
|
137
139
|
| `--compact` | Minified JSON (no indentation) |
|
|
138
140
|
| `--fields=a.b,c.d` | Filter JSON output to specified dot-paths |
|
|
139
|
-
| `--input-json
|
|
141
|
+
| `--input-json=-` | Read a JSON object from stdin |
|
|
142
|
+
| `--debug` | Emit debug logs to stderr (same effect as `DEBUG=kaabalah:*`) |
|
|
143
|
+
| `--trace` | Print stack traces for unexpected fatal errors in human-readable mode |
|
|
140
144
|
|
|
141
145
|
### Schema Introspection
|
|
142
146
|
|
|
@@ -148,6 +152,19 @@ kaabalah help --json
|
|
|
148
152
|
kaabalah help astrology --json
|
|
149
153
|
```
|
|
150
154
|
|
|
155
|
+
### Debugging
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Emit parser/config/astrology debug logs to stderr
|
|
159
|
+
DEBUG=kaabalah:* kaabalah help --json
|
|
160
|
+
|
|
161
|
+
# Same as above, but from the CLI flag
|
|
162
|
+
kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006 --debug
|
|
163
|
+
|
|
164
|
+
# Add --trace while reproducing an unexpected fatal error locally
|
|
165
|
+
kaabalah <command> --trace --no-json
|
|
166
|
+
```
|
|
167
|
+
|
|
151
168
|
## Development
|
|
152
169
|
|
|
153
170
|
This project uses TypeScript and WebAssembly for the Swiss Ephemeris calculations.
|
|
@@ -148,6 +148,8 @@ declare function computeSynastryAspects(planetsA: Record<string, {
|
|
|
148
148
|
}>, planetsB: Record<string, {
|
|
149
149
|
longitude: number;
|
|
150
150
|
}>, specs?: AspectSpec[]): AspectEdge[];
|
|
151
|
+
/** Shorter-arc midpoint of two ecliptic longitudes. */
|
|
152
|
+
declare function shorterArcMidpoint(a: number, b: number): number;
|
|
151
153
|
declare function computeMidpoints(planetsA: Record<string, {
|
|
152
154
|
longitude: number;
|
|
153
155
|
}>, planetsB: Record<string, {
|
|
@@ -226,22 +228,18 @@ declare function formatDegreeMinutes(decimalDegrees: number): string;
|
|
|
226
228
|
*/
|
|
227
229
|
declare function getZodiacPosition(longitude: number, houseCusps: number[]): ZodiacPosition;
|
|
228
230
|
declare function findHouseOf(longitude: number, housePositions: number[]): number;
|
|
229
|
-
interface
|
|
231
|
+
interface TwoChartOptions {
|
|
230
232
|
chartA: BirthChartOptions;
|
|
231
233
|
chartB: BirthChartOptions;
|
|
232
234
|
aspectSpecs?: AspectSpec[];
|
|
233
235
|
}
|
|
236
|
+
type SynastryChartOptions = TwoChartOptions;
|
|
237
|
+
type CompositeChartOptions = TwoChartOptions;
|
|
234
238
|
interface SynastryChart {
|
|
235
239
|
chartA: BirthChart;
|
|
236
240
|
chartB: BirthChart;
|
|
237
241
|
aspects: AspectEdge[];
|
|
238
242
|
}
|
|
239
|
-
declare function getSynastryChart(options: SynastryChartOptions): Promise<SynastryChart>;
|
|
240
|
-
interface CompositeChartOptions {
|
|
241
|
-
chartA: BirthChartOptions;
|
|
242
|
-
chartB: BirthChartOptions;
|
|
243
|
-
aspectSpecs?: AspectSpec[];
|
|
244
|
-
}
|
|
245
243
|
interface CompositeChart {
|
|
246
244
|
chartA: BirthChart;
|
|
247
245
|
chartB: BirthChart;
|
|
@@ -253,6 +251,7 @@ interface CompositeChart {
|
|
|
253
251
|
compositeHouses: ZodiacPosition[];
|
|
254
252
|
aspects: AspectEdge[];
|
|
255
253
|
}
|
|
254
|
+
declare function getSynastryChart(options: SynastryChartOptions): Promise<SynastryChart>;
|
|
256
255
|
declare function getCompositeChart(options: CompositeChartOptions): Promise<CompositeChart>;
|
|
257
256
|
|
|
258
|
-
export { type AspectEdge, type AspectName, type AspectSpec, type BirthChart, type BirthChartOptions, CalcFlag, type CompositeChart, type CompositeChartOptions, DEFAULT_ASPECT_SPECS, HouseSystem, type HydratedNode, type HydratedPlanet, PLANET_AND_NODE_NAMES, Planet, SIGNS, type SynastryChart, type SynastryChartOptions, VirtualNodes, type ZodiacPosition, closeSwissEph, computeAspects, computeMidpoints, computeSynastryAspects, findHouseOf, formatDegreeMinutes, getAspectMatch, getBirthChart, getCompositeChart, getSwissEph, getSynastryChart, getZodiacPosition, normalizeAngle };
|
|
257
|
+
export { type AspectEdge, type AspectName, type AspectSpec, type BirthChart, type BirthChartOptions, CalcFlag, type CompositeChart, type CompositeChartOptions, DEFAULT_ASPECT_SPECS, HouseSystem, type HydratedNode, type HydratedPlanet, PLANET_AND_NODE_NAMES, Planet, SIGNS, type SynastryChart, type SynastryChartOptions, type TwoChartOptions, VirtualNodes, type ZodiacPosition, closeSwissEph, computeAspects, computeMidpoints, computeSynastryAspects, findHouseOf, formatDegreeMinutes, getAspectMatch, getBirthChart, getCompositeChart, getSwissEph, getSynastryChart, getZodiacPosition, normalizeAngle, shorterArcMidpoint };
|
|
@@ -148,6 +148,8 @@ declare function computeSynastryAspects(planetsA: Record<string, {
|
|
|
148
148
|
}>, planetsB: Record<string, {
|
|
149
149
|
longitude: number;
|
|
150
150
|
}>, specs?: AspectSpec[]): AspectEdge[];
|
|
151
|
+
/** Shorter-arc midpoint of two ecliptic longitudes. */
|
|
152
|
+
declare function shorterArcMidpoint(a: number, b: number): number;
|
|
151
153
|
declare function computeMidpoints(planetsA: Record<string, {
|
|
152
154
|
longitude: number;
|
|
153
155
|
}>, planetsB: Record<string, {
|
|
@@ -226,22 +228,18 @@ declare function formatDegreeMinutes(decimalDegrees: number): string;
|
|
|
226
228
|
*/
|
|
227
229
|
declare function getZodiacPosition(longitude: number, houseCusps: number[]): ZodiacPosition;
|
|
228
230
|
declare function findHouseOf(longitude: number, housePositions: number[]): number;
|
|
229
|
-
interface
|
|
231
|
+
interface TwoChartOptions {
|
|
230
232
|
chartA: BirthChartOptions;
|
|
231
233
|
chartB: BirthChartOptions;
|
|
232
234
|
aspectSpecs?: AspectSpec[];
|
|
233
235
|
}
|
|
236
|
+
type SynastryChartOptions = TwoChartOptions;
|
|
237
|
+
type CompositeChartOptions = TwoChartOptions;
|
|
234
238
|
interface SynastryChart {
|
|
235
239
|
chartA: BirthChart;
|
|
236
240
|
chartB: BirthChart;
|
|
237
241
|
aspects: AspectEdge[];
|
|
238
242
|
}
|
|
239
|
-
declare function getSynastryChart(options: SynastryChartOptions): Promise<SynastryChart>;
|
|
240
|
-
interface CompositeChartOptions {
|
|
241
|
-
chartA: BirthChartOptions;
|
|
242
|
-
chartB: BirthChartOptions;
|
|
243
|
-
aspectSpecs?: AspectSpec[];
|
|
244
|
-
}
|
|
245
243
|
interface CompositeChart {
|
|
246
244
|
chartA: BirthChart;
|
|
247
245
|
chartB: BirthChart;
|
|
@@ -253,6 +251,7 @@ interface CompositeChart {
|
|
|
253
251
|
compositeHouses: ZodiacPosition[];
|
|
254
252
|
aspects: AspectEdge[];
|
|
255
253
|
}
|
|
254
|
+
declare function getSynastryChart(options: SynastryChartOptions): Promise<SynastryChart>;
|
|
256
255
|
declare function getCompositeChart(options: CompositeChartOptions): Promise<CompositeChart>;
|
|
257
256
|
|
|
258
|
-
export { type AspectEdge, type AspectName, type AspectSpec, type BirthChart, type BirthChartOptions, CalcFlag, type CompositeChart, type CompositeChartOptions, DEFAULT_ASPECT_SPECS, HouseSystem, type HydratedNode, type HydratedPlanet, PLANET_AND_NODE_NAMES, Planet, SIGNS, type SynastryChart, type SynastryChartOptions, VirtualNodes, type ZodiacPosition, closeSwissEph, computeAspects, computeMidpoints, computeSynastryAspects, findHouseOf, formatDegreeMinutes, getAspectMatch, getBirthChart, getCompositeChart, getSwissEph, getSynastryChart, getZodiacPosition, normalizeAngle };
|
|
257
|
+
export { type AspectEdge, type AspectName, type AspectSpec, type BirthChart, type BirthChartOptions, CalcFlag, type CompositeChart, type CompositeChartOptions, DEFAULT_ASPECT_SPECS, HouseSystem, type HydratedNode, type HydratedPlanet, PLANET_AND_NODE_NAMES, Planet, SIGNS, type SynastryChart, type SynastryChartOptions, type TwoChartOptions, VirtualNodes, type ZodiacPosition, closeSwissEph, computeAspects, computeMidpoints, computeSynastryAspects, findHouseOf, formatDegreeMinutes, getAspectMatch, getBirthChart, getCompositeChart, getSwissEph, getSynastryChart, getZodiacPosition, normalizeAngle, shorterArcMidpoint };
|
package/dist/astrology/index.js
CHANGED
|
@@ -1,89 +1,93 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkAHUZONHJ_js = require('../chunk-AHUZONHJ.js');
|
|
4
4
|
require('../chunk-FM7WUVZV.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "CalcFlag", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkAHUZONHJ_js.CalcFlag; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "DEFAULT_ASPECT_SPECS", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkAHUZONHJ_js.DEFAULT_ASPECT_SPECS; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "HouseSystem", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkAHUZONHJ_js.HouseSystem; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "PLANET_AND_NODE_NAMES", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkAHUZONHJ_js.PLANET_AND_NODE_NAMES; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "Planet", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkAHUZONHJ_js.Planet; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "SIGNS", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkAHUZONHJ_js.SIGNS; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "VirtualNodes", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkAHUZONHJ_js.VirtualNodes; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "closeSwissEph", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkAHUZONHJ_js.closeSwissEph; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "computeAspects", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkAHUZONHJ_js.computeAspects; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "computeMidpoints", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkAHUZONHJ_js.computeMidpoints; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "computeSynastryAspects", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkAHUZONHJ_js.computeSynastryAspects; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "findHouseOf", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkAHUZONHJ_js.findHouseOf; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "formatDegreeMinutes", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkAHUZONHJ_js.formatDegreeMinutes; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "getAspectMatch", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkAHUZONHJ_js.getAspectMatch; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "getBirthChart", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkAHUZONHJ_js.getBirthChart; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "getCompositeChart", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkAHUZONHJ_js.getCompositeChart; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "getSwissEph", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkAHUZONHJ_js.getSwissEph; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "getSynastryChart", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkAHUZONHJ_js.getSynastryChart; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "getZodiacPosition", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkAHUZONHJ_js.getZodiacPosition; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "normalizeAngle", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkAHUZONHJ_js.normalizeAngle; }
|
|
87
|
+
});
|
|
88
|
+
Object.defineProperty(exports, "shorterArcMidpoint", {
|
|
89
|
+
enumerable: true,
|
|
90
|
+
get: function () { return chunkAHUZONHJ_js.shorterArcMidpoint; }
|
|
87
91
|
});
|
|
88
92
|
//# sourceMappingURL=index.js.map
|
|
89
93
|
//# sourceMappingURL=index.js.map
|
package/dist/astrology/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CalcFlag, DEFAULT_ASPECT_SPECS, HouseSystem, PLANET_AND_NODE_NAMES, Planet, SIGNS, VirtualNodes, closeSwissEph, computeAspects, computeMidpoints, computeSynastryAspects, findHouseOf, formatDegreeMinutes, getAspectMatch, getBirthChart, getCompositeChart, getSwissEph, getSynastryChart, getZodiacPosition, normalizeAngle } from '../chunk-
|
|
1
|
+
export { CalcFlag, DEFAULT_ASPECT_SPECS, HouseSystem, PLANET_AND_NODE_NAMES, Planet, SIGNS, VirtualNodes, closeSwissEph, computeAspects, computeMidpoints, computeSynastryAspects, findHouseOf, formatDegreeMinutes, getAspectMatch, getBirthChart, getCompositeChart, getSwissEph, getSynastryChart, getZodiacPosition, normalizeAngle, shorterArcMidpoint } from '../chunk-VSTGPXLM.mjs';
|
|
2
2
|
import '../chunk-WY6NIR2V.mjs';
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -356,6 +356,176 @@ function parsFortunae(asc, sunLon, moonLon, diurnal) {
|
|
|
356
356
|
// src/astrology/swisseph.ts
|
|
357
357
|
var swissEph = null;
|
|
358
358
|
var DEFAULT_FLAGS = 2 /* SWISS_EPH */ | 256 /* SPEED */;
|
|
359
|
+
var REQUIRED_EPHE_FILES = ["seas_18.se1", "semo_18.se1", "sepl_18.se1"];
|
|
360
|
+
var NODE_EPHE_MOUNT_POINT = "/ephefs";
|
|
361
|
+
var NODE_EPHE_MEMFS_PATH = "/ephemem";
|
|
362
|
+
function normalizeVirtualPath(path) {
|
|
363
|
+
if (path === "/") {
|
|
364
|
+
return path;
|
|
365
|
+
}
|
|
366
|
+
return path.replace(/\/+$/, "") || "/";
|
|
367
|
+
}
|
|
368
|
+
function joinVirtualPath(rootPath, leaf) {
|
|
369
|
+
const normalizedRoot = normalizeVirtualPath(rootPath);
|
|
370
|
+
return normalizedRoot === "/" ? `/${leaf}` : `${normalizedRoot}/${leaf}`;
|
|
371
|
+
}
|
|
372
|
+
function ensureVirtualDir(fs, path) {
|
|
373
|
+
try {
|
|
374
|
+
fs.mkdir(path);
|
|
375
|
+
} catch {
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
function safeAnalyzePath(fs, path) {
|
|
379
|
+
if (!fs.analyzePath) {
|
|
380
|
+
return null;
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
return fs.analyzePath(path).exists === true;
|
|
384
|
+
} catch {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function safeReaddir(fs, path) {
|
|
389
|
+
if (!fs.readdir) {
|
|
390
|
+
return [];
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
return fs.readdir(path).filter((entry) => entry !== "." && entry !== "..");
|
|
394
|
+
} catch {
|
|
395
|
+
return [];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
function inspectVirtualEphemerisPath(fs, rootPath, requiredFiles = REQUIRED_EPHE_FILES) {
|
|
399
|
+
if (!fs) {
|
|
400
|
+
return {
|
|
401
|
+
rootExists: null,
|
|
402
|
+
visibleEntries: [],
|
|
403
|
+
missingFiles: [...requiredFiles]
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
const rootExists = safeAnalyzePath(fs, rootPath);
|
|
407
|
+
const visibleEntries = safeReaddir(fs, rootPath);
|
|
408
|
+
const missingFiles = requiredFiles.filter((file) => {
|
|
409
|
+
const filePath = joinVirtualPath(rootPath, file);
|
|
410
|
+
return !visibleEntries.includes(file) && safeAnalyzePath(fs, filePath) !== true;
|
|
411
|
+
});
|
|
412
|
+
return {
|
|
413
|
+
rootExists,
|
|
414
|
+
visibleEntries,
|
|
415
|
+
missingFiles
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function formatVirtualPathCheck(label, path, check) {
|
|
419
|
+
if (!check) {
|
|
420
|
+
return `${label} "${path}" could not be inspected.`;
|
|
421
|
+
}
|
|
422
|
+
const exists = check.rootExists == null ? "unknown" : check.rootExists ? "yes" : "no";
|
|
423
|
+
const visibleEntries = check.visibleEntries.length > 0 ? check.visibleEntries.join(", ") : "(none)";
|
|
424
|
+
const missingFiles = check.missingFiles.length > 0 ? check.missingFiles.join(", ") : "(none)";
|
|
425
|
+
return `${label} "${path}" exists: ${exists}; visible entries: ${visibleEntries}; missing required files: ${missingFiles}.`;
|
|
426
|
+
}
|
|
427
|
+
function normalizeHostFileData(data) {
|
|
428
|
+
return data instanceof Uint8Array ? data : new Uint8Array(data);
|
|
429
|
+
}
|
|
430
|
+
function loadHostEphemerisFiles(ephePath, requiredFiles, nodeFs, pathModule) {
|
|
431
|
+
const files = /* @__PURE__ */ new Map();
|
|
432
|
+
for (const file of requiredFiles) {
|
|
433
|
+
files.set(file, normalizeHostFileData(nodeFs.readFileSync(pathModule.join(ephePath, file))));
|
|
434
|
+
}
|
|
435
|
+
return files;
|
|
436
|
+
}
|
|
437
|
+
function writeEphemerisFilesToMemfs(fs, targetPath, files) {
|
|
438
|
+
ensureVirtualDir(fs, targetPath);
|
|
439
|
+
for (const [fileName, fileData] of files.entries()) {
|
|
440
|
+
fs.writeFile(joinVirtualPath(targetPath, fileName), fileData);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function toError(err) {
|
|
444
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
445
|
+
}
|
|
446
|
+
function buildEphemerisResolutionError(finalEphePath, requiredFiles, details) {
|
|
447
|
+
const parts = [
|
|
448
|
+
`Unable to resolve Swiss Ephemeris data files. Expected ${requiredFiles.join(", ")} under "${finalEphePath}".`
|
|
449
|
+
];
|
|
450
|
+
if (details.mountAttempted) {
|
|
451
|
+
parts.push(
|
|
452
|
+
`${formatVirtualPathCheck("Mounted ephemeris path", details.mountPoint, details.mountCheck)} The NODEFS mount may have failed silently.`
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
if (details.mountError) {
|
|
456
|
+
parts.push(`Mounting the ephemeris directory failed: ${details.mountError.message}.`);
|
|
457
|
+
}
|
|
458
|
+
parts.push(formatVirtualPathCheck("Direct host ephemeris path", finalEphePath, details.hostCheck));
|
|
459
|
+
if (details.memfsCheck) {
|
|
460
|
+
parts.push(formatVirtualPathCheck("MEMFS ephemeris copy", details.memfsPath, details.memfsCheck));
|
|
461
|
+
}
|
|
462
|
+
if (details.hostReadError) {
|
|
463
|
+
parts.push(`Reading host ephemeris files failed: ${details.hostReadError.message}.`);
|
|
464
|
+
}
|
|
465
|
+
parts.push(
|
|
466
|
+
`Pass an explicit ephePath that contains ${requiredFiles.join(", ")} or ensure the packaged ephemeris directory is readable.`
|
|
467
|
+
);
|
|
468
|
+
return parts.join(" ");
|
|
469
|
+
}
|
|
470
|
+
function resolveNodeEphemerisPath(module, finalEphePath, options = {}) {
|
|
471
|
+
const fs = module.FS;
|
|
472
|
+
const requiredFiles = options.requiredFiles ?? REQUIRED_EPHE_FILES;
|
|
473
|
+
const mountPoint = options.mountPoint ?? NODE_EPHE_MOUNT_POINT;
|
|
474
|
+
const memfsPath = options.memfsPath ?? NODE_EPHE_MEMFS_PATH;
|
|
475
|
+
const nodeFs = options.nodeFs ?? chunkFM7WUVZV_js.__require("fs");
|
|
476
|
+
const pathModule = options.pathModule ?? chunkFM7WUVZV_js.__require("path");
|
|
477
|
+
let mountAttempted = false;
|
|
478
|
+
let mountCheck = null;
|
|
479
|
+
let mountError = null;
|
|
480
|
+
let hostCheck = null;
|
|
481
|
+
let memfsCheck = null;
|
|
482
|
+
let hostReadError = null;
|
|
483
|
+
if (fs?.mount && fs.filesystems?.NODEFS) {
|
|
484
|
+
mountAttempted = true;
|
|
485
|
+
ensureVirtualDir(fs, mountPoint);
|
|
486
|
+
try {
|
|
487
|
+
fs.mount(fs.filesystems.NODEFS, { root: finalEphePath }, mountPoint);
|
|
488
|
+
mountCheck = inspectVirtualEphemerisPath(fs, mountPoint, requiredFiles);
|
|
489
|
+
if (mountCheck.missingFiles.length === 0) {
|
|
490
|
+
return { path: mountPoint, strategy: "nodefs-mount" };
|
|
491
|
+
}
|
|
492
|
+
} catch (mountErr) {
|
|
493
|
+
mountError = toError(mountErr);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
hostCheck = inspectVirtualEphemerisPath(fs, finalEphePath, requiredFiles);
|
|
497
|
+
if (fs && hostCheck.missingFiles.length === 0) {
|
|
498
|
+
return { path: finalEphePath, strategy: "host-path" };
|
|
499
|
+
}
|
|
500
|
+
let hostFiles = null;
|
|
501
|
+
try {
|
|
502
|
+
hostFiles = loadHostEphemerisFiles(finalEphePath, requiredFiles, nodeFs, pathModule);
|
|
503
|
+
} catch (err) {
|
|
504
|
+
hostReadError = toError(err);
|
|
505
|
+
}
|
|
506
|
+
if (hostFiles && fs?.writeFile) {
|
|
507
|
+
writeEphemerisFilesToMemfs(fs, memfsPath, hostFiles);
|
|
508
|
+
memfsCheck = inspectVirtualEphemerisPath(fs, memfsPath, requiredFiles);
|
|
509
|
+
if (memfsCheck.missingFiles.length === 0) {
|
|
510
|
+
return { path: memfsPath, strategy: "memfs-copy" };
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (hostFiles) {
|
|
514
|
+
return { path: finalEphePath, strategy: "host-path" };
|
|
515
|
+
}
|
|
516
|
+
throw new Error(
|
|
517
|
+
buildEphemerisResolutionError(finalEphePath, requiredFiles, {
|
|
518
|
+
mountAttempted,
|
|
519
|
+
mountPoint,
|
|
520
|
+
mountCheck,
|
|
521
|
+
mountError,
|
|
522
|
+
hostCheck,
|
|
523
|
+
memfsPath,
|
|
524
|
+
memfsCheck,
|
|
525
|
+
hostReadError
|
|
526
|
+
})
|
|
527
|
+
);
|
|
528
|
+
}
|
|
359
529
|
async function getSwissEph(options = {}) {
|
|
360
530
|
if (swissEph) {
|
|
361
531
|
return;
|
|
@@ -392,45 +562,24 @@ async function getSwissEph(options = {}) {
|
|
|
392
562
|
);
|
|
393
563
|
})
|
|
394
564
|
);
|
|
565
|
+
const browserCheck = inspectVirtualEphemerisPath(module.FS, epheFsPath, REQUIRED_EPHE_FILES);
|
|
566
|
+
if (browserCheck.missingFiles.length > 0) {
|
|
567
|
+
throw new Error(
|
|
568
|
+
`Failed to materialize browser ephemeris files at "${epheFsPath}". Missing: ${browserCheck.missingFiles.join(", ")}.`
|
|
569
|
+
);
|
|
570
|
+
}
|
|
395
571
|
console.info(`Setting ephemeris path to: ${epheFsPath}`);
|
|
396
572
|
instance.setEphemerisPath(epheFsPath);
|
|
397
573
|
} else {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
"NODEFS:",
|
|
404
|
-
Boolean(module.FS?.filesystems?.NODEFS)
|
|
405
|
-
);
|
|
406
|
-
if (module.FS?.mount && module.FS?.filesystems?.NODEFS) {
|
|
407
|
-
const mountPoint = "/ephefs";
|
|
408
|
-
try {
|
|
409
|
-
try {
|
|
410
|
-
module.FS?.mkdir(mountPoint);
|
|
411
|
-
} catch {
|
|
412
|
-
}
|
|
413
|
-
module.FS?.mount(
|
|
414
|
-
module.FS?.filesystems.NODEFS,
|
|
415
|
-
{ root: finalEphePath },
|
|
416
|
-
mountPoint
|
|
417
|
-
);
|
|
418
|
-
console.info(
|
|
419
|
-
`Setting ephemeris path to: ${mountPoint} (mounted from ${finalEphePath})`
|
|
420
|
-
);
|
|
421
|
-
instance.setEphemerisPath(mountPoint);
|
|
422
|
-
} catch (mountErr) {
|
|
423
|
-
console.warn(
|
|
424
|
-
`Failed to mount ephemeris directory, falling back to host path: ${finalEphePath}`,
|
|
425
|
-
mountErr
|
|
426
|
-
);
|
|
427
|
-
console.info(`Setting ephemeris path to: ${finalEphePath}`);
|
|
428
|
-
instance.setEphemerisPath(finalEphePath);
|
|
429
|
-
}
|
|
574
|
+
const resolution = resolveNodeEphemerisPath(module, finalEphePath);
|
|
575
|
+
if (resolution.strategy === "nodefs-mount") {
|
|
576
|
+
console.info(`Setting ephemeris path to: ${resolution.path} (mounted from ${finalEphePath})`);
|
|
577
|
+
} else if (resolution.strategy === "memfs-copy") {
|
|
578
|
+
console.info(`Setting ephemeris path to: ${resolution.path} (copied from ${finalEphePath})`);
|
|
430
579
|
} else {
|
|
431
|
-
console.info(`Setting ephemeris path to: ${
|
|
432
|
-
instance.setEphemerisPath(finalEphePath);
|
|
580
|
+
console.info(`Setting ephemeris path to: ${resolution.path}`);
|
|
433
581
|
}
|
|
582
|
+
instance.setEphemerisPath(resolution.path);
|
|
434
583
|
}
|
|
435
584
|
swissEph = instance;
|
|
436
585
|
} catch (error) {
|
|
@@ -677,16 +826,17 @@ function computeSynastryAspects(planetsA, planetsB, specs = DEFAULT_ASPECT_SPECS
|
|
|
677
826
|
}
|
|
678
827
|
return edges;
|
|
679
828
|
}
|
|
829
|
+
function shorterArcMidpoint(a, b) {
|
|
830
|
+
let diff = b - a;
|
|
831
|
+
if (diff > 180) diff -= 360;
|
|
832
|
+
if (diff < -180) diff += 360;
|
|
833
|
+
return normalizeAngle(a + diff / 2);
|
|
834
|
+
}
|
|
680
835
|
function computeMidpoints(planetsA, planetsB) {
|
|
681
836
|
const result = {};
|
|
682
837
|
for (const key of Object.keys(planetsA)) {
|
|
683
838
|
if (!(key in planetsB)) continue;
|
|
684
|
-
|
|
685
|
-
const b = planetsB[key].longitude;
|
|
686
|
-
let diff = b - a;
|
|
687
|
-
if (diff > 180) diff -= 360;
|
|
688
|
-
if (diff < -180) diff += 360;
|
|
689
|
-
result[key] = normalizeAngle(a + diff / 2);
|
|
839
|
+
result[key] = shorterArcMidpoint(planetsA[key].longitude, planetsB[key].longitude);
|
|
690
840
|
}
|
|
691
841
|
return result;
|
|
692
842
|
}
|
|
@@ -782,10 +932,7 @@ async function getBirthChart(options) {
|
|
|
782
932
|
name: PLANET_AND_NODE_NAMES["parsFortunae" /* PARS_FORTUNAE */]
|
|
783
933
|
}
|
|
784
934
|
};
|
|
785
|
-
const
|
|
786
|
-
allPoints["ascendant"] = { longitude: houses.ascendant.longitude };
|
|
787
|
-
allPoints["mc"] = { longitude: houses.mc.longitude };
|
|
788
|
-
const aspects = computeAspects(allPoints);
|
|
935
|
+
const aspects = computeAspects(getAspectPoints(planets, houses.ascendant.longitude, houses.mc.longitude));
|
|
789
936
|
return {
|
|
790
937
|
dateUtc: utcDate,
|
|
791
938
|
planets,
|
|
@@ -851,38 +998,32 @@ function findHouseOf(longitude, housePositions) {
|
|
|
851
998
|
}
|
|
852
999
|
return 1;
|
|
853
1000
|
}
|
|
854
|
-
function getAspectPoints(
|
|
855
|
-
|
|
856
|
-
for (const [k, v] of Object.entries(chart.planets)) {
|
|
857
|
-
points[k] = v;
|
|
858
|
-
}
|
|
859
|
-
points["ascendant"] = { longitude: chart.houses.ascendant.longitude };
|
|
860
|
-
points["mc"] = { longitude: chart.houses.mc.longitude };
|
|
861
|
-
return points;
|
|
1001
|
+
function getAspectPoints(planets, ascLon, mcLon) {
|
|
1002
|
+
return { ...planets, ascendant: { longitude: ascLon }, mc: { longitude: mcLon } };
|
|
862
1003
|
}
|
|
863
1004
|
async function getSynastryChart(options) {
|
|
864
|
-
const chartA = await
|
|
865
|
-
|
|
1005
|
+
const [chartA, chartB] = await Promise.all([
|
|
1006
|
+
getBirthChart(options.chartA),
|
|
1007
|
+
getBirthChart(options.chartB)
|
|
1008
|
+
]);
|
|
866
1009
|
const aspects = computeSynastryAspects(
|
|
867
|
-
getAspectPoints(chartA),
|
|
868
|
-
getAspectPoints(chartB),
|
|
1010
|
+
getAspectPoints(chartA.planets, chartA.houses.ascendant.longitude, chartA.houses.mc.longitude),
|
|
1011
|
+
getAspectPoints(chartB.planets, chartB.houses.ascendant.longitude, chartB.houses.mc.longitude),
|
|
869
1012
|
options.aspectSpecs
|
|
870
1013
|
);
|
|
871
1014
|
return { chartA, chartB, aspects };
|
|
872
1015
|
}
|
|
873
1016
|
async function getCompositeChart(options) {
|
|
874
|
-
const chartA = await
|
|
875
|
-
|
|
1017
|
+
const [chartA, chartB] = await Promise.all([
|
|
1018
|
+
getBirthChart(options.chartA),
|
|
1019
|
+
getBirthChart(options.chartB)
|
|
1020
|
+
]);
|
|
876
1021
|
const midpointLongitudes = computeMidpoints(chartA.planets, chartB.planets);
|
|
877
1022
|
const cuspsA = chartA.houses.houses.map((h) => h.longitude);
|
|
878
1023
|
const cuspsB = chartB.houses.houses.map((h) => h.longitude);
|
|
879
|
-
const compositeCusps =
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
if (diff > 180) diff -= 360;
|
|
883
|
-
if (diff < -180) diff += 360;
|
|
884
|
-
compositeCusps.push(normalizeAngle(cuspsA[i] + diff / 2));
|
|
885
|
-
}
|
|
1024
|
+
const compositeCusps = cuspsA.map(
|
|
1025
|
+
(a, i) => i < cuspsB.length ? shorterArcMidpoint(a, cuspsB[i]) : a
|
|
1026
|
+
);
|
|
886
1027
|
const compositePlanets = {};
|
|
887
1028
|
for (const [key, lon] of Object.entries(midpointLongitudes)) {
|
|
888
1029
|
compositePlanets[key] = {
|
|
@@ -924,5 +1065,6 @@ exports.getSwissEph = getSwissEph;
|
|
|
924
1065
|
exports.getSynastryChart = getSynastryChart;
|
|
925
1066
|
exports.getZodiacPosition = getZodiacPosition;
|
|
926
1067
|
exports.normalizeAngle = normalizeAngle;
|
|
927
|
-
|
|
928
|
-
//# sourceMappingURL=chunk-
|
|
1068
|
+
exports.shorterArcMidpoint = shorterArcMidpoint;
|
|
1069
|
+
//# sourceMappingURL=chunk-AHUZONHJ.js.map
|
|
1070
|
+
//# sourceMappingURL=chunk-AHUZONHJ.js.map
|