siderust-js 0.1.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/.github/workflows/ci.yml +166 -0
- package/.gitmodules +9 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +661 -0
- package/README.md +138 -0
- package/package.json +12 -0
- package/qtty-js/.github/workflows/ci.yml +151 -0
- package/qtty-js/.gitmodules +3 -0
- package/qtty-js/CHANGELOG.md +31 -0
- package/qtty-js/LICENSE +661 -0
- package/qtty-js/README.md +132 -0
- package/qtty-js/package.json +20 -0
- package/qtty-js/qtty/.github/workflows/ci.yml +155 -0
- package/qtty-js/qtty/CHANGELOG.md +120 -0
- package/qtty-js/qtty/Cargo.lock +1462 -0
- package/qtty-js/qtty/Cargo.toml +12 -0
- package/qtty-js/qtty/LICENSE +661 -0
- package/qtty-js/qtty/README.md +9 -0
- package/qtty-js/qtty/qtty/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty/README.md +8 -0
- package/qtty-js/qtty/qtty/examples/angles.rs +14 -0
- package/qtty-js/qtty/qtty/examples/astronomy.rs +17 -0
- package/qtty-js/qtty/qtty/examples/dimensional_arithmetic.rs +83 -0
- package/qtty-js/qtty/qtty/examples/python_integration.rs +61 -0
- package/qtty-js/qtty/qtty/examples/quickstart.rs +15 -0
- package/qtty-js/qtty/qtty/examples/ratios.rs +12 -0
- package/qtty-js/qtty/qtty/examples/serde_with_unit.rs +234 -0
- package/qtty-js/qtty/qtty/examples/serialization.rs +141 -0
- package/qtty-js/qtty/qtty/examples/serialization_advanced.rs +155 -0
- package/qtty-js/qtty/qtty/src/f32.rs +108 -0
- package/qtty-js/qtty/qtty/src/f64.rs +30 -0
- package/qtty-js/qtty/qtty/src/i128.rs +111 -0
- package/qtty-js/qtty/qtty/src/i16.rs +111 -0
- package/qtty-js/qtty/qtty/src/i32.rs +111 -0
- package/qtty-js/qtty/qtty/src/i64.rs +111 -0
- package/qtty-js/qtty/qtty/src/i8.rs +111 -0
- package/qtty-js/qtty/qtty/src/lib.rs +238 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/src/lib.rs +5 -0
- package/qtty-js/qtty/qtty/tests/integration_tests.rs +529 -0
- package/qtty-js/qtty/qtty/tests/qtty_vec_feature_matrix.rs +58 -0
- package/qtty-js/qtty/qtty-core/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty-core/README.md +8 -0
- package/qtty-js/qtty/qtty-core/examples/diesel_integration.rs +145 -0
- package/qtty-js/qtty/qtty-core/examples/quantity_db_serde.rs +215 -0
- package/qtty-js/qtty/qtty-core/src/dimension.rs +249 -0
- package/qtty-js/qtty/qtty-core/src/feature_diesel.rs +318 -0
- package/qtty-js/qtty/qtty-core/src/feature_pyo3.rs +27 -0
- package/qtty-js/qtty/qtty-core/src/feature_serde.rs +203 -0
- package/qtty-js/qtty/qtty-core/src/feature_tiberius.rs +28 -0
- package/qtty-js/qtty/qtty-core/src/lib.rs +744 -0
- package/qtty-js/qtty/qtty-core/src/macros.rs +93 -0
- package/qtty-js/qtty/qtty-core/src/quantity.rs +810 -0
- package/qtty-js/qtty/qtty-core/src/scalar.rs +1742 -0
- package/qtty-js/qtty/qtty-core/src/unit.rs +332 -0
- package/qtty-js/qtty/qtty-core/src/units/angular.rs +1228 -0
- package/qtty-js/qtty/qtty-core/src/units/area.rs +243 -0
- package/qtty-js/qtty/qtty-core/src/units/frequency.rs +179 -0
- package/qtty-js/qtty/qtty-core/src/units/length.rs +1270 -0
- package/qtty-js/qtty/qtty-core/src/units/mass.rs +488 -0
- package/qtty-js/qtty/qtty-core/src/units/mod.rs +26 -0
- package/qtty-js/qtty/qtty-core/src/units/power.rs +324 -0
- package/qtty-js/qtty/qtty-core/src/units/time.rs +667 -0
- package/qtty-js/qtty/qtty-core/src/units/unitless.rs +212 -0
- package/qtty-js/qtty/qtty-core/src/units/velocity.rs +210 -0
- package/qtty-js/qtty/qtty-core/src/units/volume.rs +269 -0
- package/qtty-js/qtty/qtty-core/tests/core.rs +628 -0
- package/qtty-js/qtty/qtty-core/tests/diesel.rs +461 -0
- package/qtty-js/qtty/qtty-core/tests/integers.rs +632 -0
- package/qtty-js/qtty/qtty-core/tests/no_cross_unit_ops.rs +35 -0
- package/qtty-js/qtty/qtty-core/tests/pyo3.rs +334 -0
- package/qtty-js/qtty/qtty-core/tests/quantity_f32.rs +276 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_decimal.rs +258 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f32.rs +286 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f64_real.rs +287 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_rational.rs +260 -0
- package/qtty-js/qtty/qtty-core/tests/serde.rs +256 -0
- package/qtty-js/qtty/qtty-core/tests/tiberius.rs +208 -0
- package/qtty-js/qtty/qtty-derive/Cargo.toml +23 -0
- package/qtty-js/qtty/qtty-derive/README.md +8 -0
- package/qtty-js/qtty/qtty-derive/src/lib.rs +340 -0
- package/qtty-js/qtty/qtty-ffi/ARCHITECTURE.md +3 -0
- package/qtty-js/qtty/qtty-ffi/Cargo.toml +31 -0
- package/qtty-js/qtty/qtty-ffi/README.md +9 -0
- package/qtty-js/qtty/qtty-ffi/build.rs +326 -0
- package/qtty-js/qtty/qtty-ffi/cbindgen.toml +105 -0
- package/qtty-js/qtty/qtty-ffi/include/qtty_ffi.h +1126 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi.rs +1251 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi_serde.rs +294 -0
- package/qtty-js/qtty/qtty-ffi/src/helpers.rs +310 -0
- package/qtty-js/qtty/qtty-ffi/src/lib.rs +229 -0
- package/qtty-js/qtty/qtty-ffi/src/macros.rs +121 -0
- package/qtty-js/qtty/qtty-ffi/src/registry.rs +274 -0
- package/qtty-js/qtty/qtty-ffi/src/types.rs +620 -0
- package/qtty-js/qtty/qtty-ffi/tests/integration_tests.rs +842 -0
- package/qtty-js/qtty/qtty-ffi/units.csv +156 -0
- package/qtty-js/qtty/qtty-ffi/units.csv.md +3 -0
- package/qtty-js/qtty-node/.prettierignore +6 -0
- package/qtty-js/qtty-node/.prettierrc.json +6 -0
- package/qtty-js/qtty-node/README.md +250 -0
- package/qtty-js/qtty-node/c8.config.json +11 -0
- package/qtty-js/qtty-node/eslint.config.js +31 -0
- package/qtty-js/qtty-node/examples/arithmetic.mjs +64 -0
- package/qtty-js/qtty-node/examples/astronomy.mjs +90 -0
- package/qtty-js/qtty-node/examples/quickstart.mjs +36 -0
- package/qtty-js/qtty-node/examples/serialization.mjs +125 -0
- package/qtty-js/qtty-node/examples/unit_factories.mjs +74 -0
- package/qtty-js/qtty-node/index.d.ts +219 -0
- package/qtty-js/qtty-node/index.js +323 -0
- package/qtty-js/qtty-node/lib/DerivedQuantity.js +122 -0
- package/qtty-js/qtty-node/lib/Quantity.js +151 -0
- package/qtty-js/qtty-node/lib/backend.js +25 -0
- package/qtty-js/qtty-node/native.cjs +306 -0
- package/qtty-js/qtty-node/package-lock.json +3223 -0
- package/qtty-js/qtty-node/package.json +70 -0
- package/qtty-js/qtty-node/units.d.ts +299 -0
- package/qtty-js/qtty-node/units.js +210 -0
- package/qtty-js/qtty-web/Cargo.lock +767 -0
- package/qtty-js/qtty-web/Cargo.toml +21 -0
- package/qtty-js/qtty-web/index.d.ts +140 -0
- package/qtty-js/qtty-web/index.js +20 -0
- package/qtty-js/qtty-web/lib/DerivedQuantity.js +58 -0
- package/qtty-js/qtty-web/lib/Quantity.js +75 -0
- package/qtty-js/qtty-web/lib/backend.js +80 -0
- package/qtty-js/qtty-web/package.json +45 -0
- package/qtty-js/qtty-web/src/lib.rs +111 -0
- package/qtty-js/scripts/ci.sh +73 -0
- package/scripts/ci.sh +123 -0
- package/siderust-core/Cargo.lock +787 -0
- package/siderust-core/Cargo.toml +18 -0
- package/siderust-core/DEDUPLICATION.md +124 -0
- package/siderust-core/src/body.rs +120 -0
- package/siderust-core/src/events.rs +184 -0
- package/siderust-core/src/lib.rs +20 -0
- package/siderust-core/src/observer.rs +55 -0
- package/siderust-core/src/position.rs +213 -0
- package/siderust-node/.prettierignore +7 -0
- package/siderust-node/.prettierrc.json +6 -0
- package/siderust-node/Cargo.lock +906 -0
- package/siderust-node/Cargo.toml +29 -0
- package/siderust-node/README.md +109 -0
- package/siderust-node/__test__/index.test.mjs +248 -0
- package/siderust-node/build.rs +5 -0
- package/siderust-node/c8.config.json +3 -0
- package/siderust-node/eslint.config.js +31 -0
- package/siderust-node/examples/01_basic_coordinates.mjs +24 -0
- package/siderust-node/examples/02_coordinate_transformations.mjs +25 -0
- package/siderust-node/examples/03_all_frames_conversions.mjs +26 -0
- package/siderust-node/examples/04_all_center_conversions.mjs +24 -0
- package/siderust-node/examples/05_target_tracking.mjs +22 -0
- package/siderust-node/examples/06_night_events.mjs +18 -0
- package/siderust-node/examples/07_moon_properties.mjs +21 -0
- package/siderust-node/examples/08_solar_system.mjs +19 -0
- package/siderust-node/examples/09_star_observability.mjs +22 -0
- package/siderust-node/examples/10_time_periods.mjs +9 -0
- package/siderust-node/examples/11_serialization.mjs +31 -0
- package/siderust-node/examples/12_runtime_ephemeris.mjs +27 -0
- package/siderust-node/examples/13_coordinate_operations.mjs +20 -0
- package/siderust-node/index.d.ts +623 -0
- package/siderust-node/index.js +79 -0
- package/siderust-node/lib/Observer.js +112 -0
- package/siderust-node/lib/Star.js +118 -0
- package/siderust-node/lib/backend.js +63 -0
- package/siderust-node/lib/wrappers.js +566 -0
- package/siderust-node/main.js +20 -0
- package/siderust-node/native.cjs +360 -0
- package/siderust-node/package-lock.json +3261 -0
- package/siderust-node/package.json +71 -0
- package/siderust-node/src/body.rs +74 -0
- package/siderust-node/src/coordinates.rs +372 -0
- package/siderust-node/src/ephemeris.rs +462 -0
- package/siderust-node/src/events.rs +577 -0
- package/siderust-node/src/lib.rs +43 -0
- package/siderust-node/src/observer.rs +132 -0
- package/siderust-node/src/phase.rs +218 -0
- package/siderust-node/src/position.rs +292 -0
- package/siderust-node/src/star.rs +200 -0
- package/siderust-web/Cargo.lock +855 -0
- package/siderust-web/Cargo.toml +34 -0
- package/siderust-web/README.md +100 -0
- package/siderust-web/__test__/index.test.mjs +118 -0
- package/siderust-web/examples/github-pages/README.md +31 -0
- package/siderust-web/examples/github-pages/index.html +135 -0
- package/siderust-web/index.d.ts +311 -0
- package/siderust-web/index.js +66 -0
- package/siderust-web/lib/Observer.js +103 -0
- package/siderust-web/lib/Star.js +116 -0
- package/siderust-web/lib/backend.js +400 -0
- package/siderust-web/lib/wrappers.js +512 -0
- package/siderust-web/package.json +55 -0
- package/siderust-web/src/body.rs +69 -0
- package/siderust-web/src/coordinates.rs +302 -0
- package/siderust-web/src/ephemeris.rs +456 -0
- package/siderust-web/src/events.rs +520 -0
- package/siderust-web/src/lib.rs +51 -0
- package/siderust-web/src/observer.rs +117 -0
- package/siderust-web/src/phase.rs +190 -0
- package/siderust-web/src/position.rs +291 -0
- package/siderust-web/src/star.rs +178 -0
- package/tempoch-js/.github/workflows/ci.yml +142 -0
- package/tempoch-js/.gitmodules +3 -0
- package/tempoch-js/CHANGELOG.md +25 -0
- package/tempoch-js/LICENSE +661 -0
- package/tempoch-js/README.md +126 -0
- package/tempoch-js/package.json +20 -0
- package/tempoch-js/scripts/ci.sh +73 -0
- package/tempoch-js/tempoch/.github/workflows/ci.yml +113 -0
- package/tempoch-js/tempoch/CHANGELOG.md +82 -0
- package/tempoch-js/tempoch/Cargo.lock +947 -0
- package/tempoch-js/tempoch/Cargo.toml +3 -0
- package/tempoch-js/tempoch/LICENSE +661 -0
- package/tempoch-js/tempoch/README.md +76 -0
- package/tempoch-js/tempoch/tempoch/Cargo.toml +27 -0
- package/tempoch-js/tempoch/tempoch/examples/periods.rs +45 -0
- package/tempoch-js/tempoch/tempoch/examples/quickstart.rs +13 -0
- package/tempoch-js/tempoch/tempoch/src/lib.rs +49 -0
- package/tempoch-js/tempoch/tempoch/tests/integration.rs +57 -0
- package/tempoch-js/tempoch/tempoch-core/Cargo.toml +24 -0
- package/tempoch-js/tempoch/tempoch-core/src/delta_t.rs +345 -0
- package/tempoch-js/tempoch/tempoch-core/src/instant.rs +811 -0
- package/tempoch-js/tempoch/tempoch-core/src/julian_date_ext.rs +142 -0
- package/tempoch-js/tempoch/tempoch-core/src/lib.rs +81 -0
- package/tempoch-js/tempoch/tempoch-core/src/period.rs +1168 -0
- package/tempoch-js/tempoch/tempoch-core/src/scales.rs +779 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.lock +889 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.toml +26 -0
- package/tempoch-js/tempoch/tempoch-ffi/build.rs +24 -0
- package/tempoch-js/tempoch/tempoch-ffi/cbindgen.toml +30 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/error.rs +19 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/lib.rs +82 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/period.rs +101 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/time.rs +711 -0
- package/tempoch-js/tempoch/tempoch-ffi/tests/ffi.rs +265 -0
- package/tempoch-js/tempoch-node/.prettierignore +6 -0
- package/tempoch-js/tempoch-node/.prettierrc.json +6 -0
- package/tempoch-js/tempoch-node/Cargo.lock +496 -0
- package/tempoch-js/tempoch-node/Cargo.toml +29 -0
- package/tempoch-js/tempoch-node/README.md +265 -0
- package/tempoch-js/tempoch-node/__test__/index.test.mjs +598 -0
- package/tempoch-js/tempoch-node/build.rs +5 -0
- package/tempoch-js/tempoch-node/c8.config.json +3 -0
- package/tempoch-js/tempoch-node/eslint.config.js +31 -0
- package/tempoch-js/tempoch-node/examples/periods.mjs +79 -0
- package/tempoch-js/tempoch-node/examples/quickstart.mjs +71 -0
- package/tempoch-js/tempoch-node/examples/timescales.mjs +92 -0
- package/tempoch-js/tempoch-node/index.d.ts +280 -0
- package/tempoch-js/tempoch-node/index.js +32 -0
- package/tempoch-js/tempoch-node/lib/JulianDate.js +176 -0
- package/tempoch-js/tempoch-node/lib/ModifiedJulianDate.js +156 -0
- package/tempoch-js/tempoch-node/lib/Period.js +133 -0
- package/tempoch-js/tempoch-node/lib/backend.js +38 -0
- package/tempoch-js/tempoch-node/lib/qttyCompat.js +92 -0
- package/tempoch-js/tempoch-node/native.cjs +317 -0
- package/tempoch-js/tempoch-node/package-lock.json +3223 -0
- package/tempoch-js/tempoch-node/package.json +56 -0
- package/tempoch-js/tempoch-node/src/lib.rs +573 -0
- package/tempoch-js/tempoch-web/Cargo.toml +23 -0
- package/tempoch-js/tempoch-web/index.d.ts +95 -0
- package/tempoch-js/tempoch-web/index.js +27 -0
- package/tempoch-js/tempoch-web/lib/JulianDate.js +170 -0
- package/tempoch-js/tempoch-web/lib/ModifiedJulianDate.js +145 -0
- package/tempoch-js/tempoch-web/lib/Period.js +121 -0
- package/tempoch-js/tempoch-web/lib/backend.js +118 -0
- package/tempoch-js/tempoch-web/package.json +46 -0
- package/tempoch-js/tempoch-web/src/lib.rs +184 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust — High-precision astronomy for Node.js.
|
|
3
|
+
*
|
|
4
|
+
* Public entrypoint. Exposes JS-level façade classes (`Observer`,
|
|
5
|
+
* `Star`) and wrapped free functions from the native backend.
|
|
6
|
+
*
|
|
7
|
+
* @module @siderust/siderust
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const { Observer } = require('./lib/Observer.js');
|
|
13
|
+
const { Star } = require('./lib/Star.js');
|
|
14
|
+
const wrappers = require('./lib/wrappers.js');
|
|
15
|
+
|
|
16
|
+
// ── Classes ───────────────────────────────────────────────────────
|
|
17
|
+
module.exports.Observer = Observer;
|
|
18
|
+
module.exports.Star = Star;
|
|
19
|
+
|
|
20
|
+
// ── Bodies / Stars ────────────────────────────────────────────────
|
|
21
|
+
module.exports.getPlanet = wrappers.getPlanet;
|
|
22
|
+
module.exports.listBodies = wrappers.listBodies;
|
|
23
|
+
module.exports.listCatalogStars = wrappers.listCatalogStars;
|
|
24
|
+
|
|
25
|
+
// ── Coordinates ───────────────────────────────────────────────────
|
|
26
|
+
module.exports.transformDirection = wrappers.transformDirection;
|
|
27
|
+
module.exports.directionToHorizontal = wrappers.directionToHorizontal;
|
|
28
|
+
module.exports.geodeticToEcef = wrappers.geodeticToEcef;
|
|
29
|
+
module.exports.angularSeparation = wrappers.angularSeparation;
|
|
30
|
+
module.exports.cartesianDistance = wrappers.cartesianDistance;
|
|
31
|
+
module.exports.cartesianMagnitude = wrappers.cartesianMagnitude;
|
|
32
|
+
module.exports.dotProduct = wrappers.dotProduct;
|
|
33
|
+
module.exports.directionToCartesian = wrappers.directionToCartesian;
|
|
34
|
+
|
|
35
|
+
// ── Ephemeris ─────────────────────────────────────────────────────
|
|
36
|
+
module.exports.vsop87Heliocentric = wrappers.vsop87Heliocentric;
|
|
37
|
+
module.exports.vsop87Barycentric = wrappers.vsop87Barycentric;
|
|
38
|
+
module.exports.vsop87SunBarycentric = wrappers.vsop87SunBarycentric;
|
|
39
|
+
module.exports.vsop87EarthBarycentric = wrappers.vsop87EarthBarycentric;
|
|
40
|
+
module.exports.vsop87EarthHeliocentric = wrappers.vsop87EarthHeliocentric;
|
|
41
|
+
module.exports.vsop87MoonGeocentric = wrappers.vsop87MoonGeocentric;
|
|
42
|
+
module.exports.transformPositionCenter = wrappers.transformPositionCenter;
|
|
43
|
+
module.exports.transformPositionFrame = wrappers.transformPositionFrame;
|
|
44
|
+
module.exports.orbitalPeriod = wrappers.orbitalPeriod;
|
|
45
|
+
|
|
46
|
+
// ── Body events ───────────────────────────────────────────────────
|
|
47
|
+
module.exports.bodyAltitudeAt = wrappers.bodyAltitudeAt;
|
|
48
|
+
module.exports.bodyAzimuthAt = wrappers.bodyAzimuthAt;
|
|
49
|
+
module.exports.bodyCrossings = wrappers.bodyCrossings;
|
|
50
|
+
module.exports.bodyCulminations = wrappers.bodyCulminations;
|
|
51
|
+
module.exports.bodyAboveThreshold = wrappers.bodyAboveThreshold;
|
|
52
|
+
module.exports.bodyBelowThreshold = wrappers.bodyBelowThreshold;
|
|
53
|
+
module.exports.bodyAzimuthCrossings = wrappers.bodyAzimuthCrossings;
|
|
54
|
+
module.exports.bodyAzimuthExtrema = wrappers.bodyAzimuthExtrema;
|
|
55
|
+
|
|
56
|
+
// ── Star events ───────────────────────────────────────────────────
|
|
57
|
+
module.exports.starAltitudeAt = wrappers.starAltitudeAt;
|
|
58
|
+
module.exports.starAzimuthAt = wrappers.starAzimuthAt;
|
|
59
|
+
module.exports.starCrossings = wrappers.starCrossings;
|
|
60
|
+
module.exports.starCulminations = wrappers.starCulminations;
|
|
61
|
+
module.exports.starAboveThreshold = wrappers.starAboveThreshold;
|
|
62
|
+
module.exports.starBelowThreshold = wrappers.starBelowThreshold;
|
|
63
|
+
module.exports.starAzimuthCrossings = wrappers.starAzimuthCrossings;
|
|
64
|
+
module.exports.starAzimuthExtrema = wrappers.starAzimuthExtrema;
|
|
65
|
+
|
|
66
|
+
// ── Periods ───────────────────────────────────────────────────────
|
|
67
|
+
module.exports.intersectPeriods = wrappers.intersectPeriods;
|
|
68
|
+
|
|
69
|
+
// ── Moon ──────────────────────────────────────────────────────────
|
|
70
|
+
module.exports.moonPhase = wrappers.moonPhase;
|
|
71
|
+
module.exports.moonPhaseTopocentric = wrappers.moonPhaseTopocentric;
|
|
72
|
+
module.exports.findPhaseEvents = wrappers.findPhaseEvents;
|
|
73
|
+
module.exports.moonIlluminationAbove = wrappers.moonIlluminationAbove;
|
|
74
|
+
module.exports.moonIlluminationBelow = wrappers.moonIlluminationBelow;
|
|
75
|
+
module.exports.moonIlluminationRange = wrappers.moonIlluminationRange;
|
|
76
|
+
|
|
77
|
+
// ── Meta ──────────────────────────────────────────────────────────
|
|
78
|
+
module.exports.version = wrappers.version;
|
|
79
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust — Observer façade class.
|
|
3
|
+
*
|
|
4
|
+
* A geodetic observer location on the Earth's surface (WGS84 ellipsoid).
|
|
5
|
+
* This is a plain JS class that stores lon/lat/height as plain fields.
|
|
6
|
+
* The native Observer is only used internally for napi calls.
|
|
7
|
+
*
|
|
8
|
+
* @module @siderust/siderust/lib/Observer
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const { Quantity } = require('@siderust/qtty');
|
|
14
|
+
|
|
15
|
+
class Observer {
|
|
16
|
+
/**
|
|
17
|
+
* Create an observer at a geodetic position.
|
|
18
|
+
*
|
|
19
|
+
* @param {Quantity} lon Longitude, convertible to Degree.
|
|
20
|
+
* @param {Quantity} lat Latitude, convertible to Degree.
|
|
21
|
+
* @param {Quantity} height Height, convertible to Meter.
|
|
22
|
+
*/
|
|
23
|
+
constructor(lon, lat, height) {
|
|
24
|
+
this._lonDeg = _extractQuantityValue(lon, 'Degree', 'lon');
|
|
25
|
+
this._latDeg = _extractQuantityValue(lat, 'Degree', 'lat');
|
|
26
|
+
this._heightM = _extractQuantityValue(height, 'Meter', 'height');
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
!Number.isFinite(this._lonDeg) ||
|
|
30
|
+
!Number.isFinite(this._latDeg) ||
|
|
31
|
+
!Number.isFinite(this._heightM)
|
|
32
|
+
) {
|
|
33
|
+
throw new Error('Observer coordinates must be finite (not NaN or ±infinity)');
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ── preset observatories ───────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
/** Roque de los Muchachos Observatory (La Palma, Spain). */
|
|
40
|
+
static roqueDeLasMuchachos() {
|
|
41
|
+
return new Observer(
|
|
42
|
+
new Quantity(-17.8925, 'Degree'),
|
|
43
|
+
new Quantity(28.7543, 'Degree'),
|
|
44
|
+
new Quantity(2396, 'Meter'),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Paranal Observatory (ESO, Chile). */
|
|
49
|
+
static elParanal() {
|
|
50
|
+
return new Observer(
|
|
51
|
+
new Quantity(-70.4043, 'Degree'),
|
|
52
|
+
new Quantity(-24.6272, 'Degree'),
|
|
53
|
+
new Quantity(2635, 'Meter'),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Mauna Kea Observatory (Hawaiʻi, USA). */
|
|
58
|
+
static maunaKea() {
|
|
59
|
+
return new Observer(
|
|
60
|
+
new Quantity(-155.4681, 'Degree'),
|
|
61
|
+
new Quantity(19.8207, 'Degree'),
|
|
62
|
+
new Quantity(4207, 'Meter'),
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** La Silla Observatory (ESO, Chile). */
|
|
67
|
+
static laSilla() {
|
|
68
|
+
return new Observer(
|
|
69
|
+
new Quantity(-70.7346, 'Degree'),
|
|
70
|
+
new Quantity(-29.2584, 'Degree'),
|
|
71
|
+
new Quantity(2400, 'Meter'),
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ── typed accessors ────────────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
/** Longitude as a `Quantity` in Degree. */
|
|
78
|
+
get lon() {
|
|
79
|
+
return new Quantity(this._lonDeg, 'Degree');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Latitude as a `Quantity` in Degree. */
|
|
83
|
+
get lat() {
|
|
84
|
+
return new Quantity(this._latDeg, 'Degree');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Height as a `Quantity` in Meter. */
|
|
88
|
+
get height() {
|
|
89
|
+
return new Quantity(this._heightM, 'Meter');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Human-readable string representation. */
|
|
93
|
+
format() {
|
|
94
|
+
return `Observer(lon=${this._lonDeg.toFixed(4)}°, lat=${this._latDeg.toFixed(4)}°, h=${this._heightM.toFixed(1)} m)`;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Extract a canonical scalar value from a `Quantity`.
|
|
100
|
+
* @param {unknown} val
|
|
101
|
+
* @param {string} expectedUnit
|
|
102
|
+
* @param {string} label
|
|
103
|
+
* @returns {number}
|
|
104
|
+
*/
|
|
105
|
+
function _extractQuantityValue(val, expectedUnit, label) {
|
|
106
|
+
if (!(val instanceof Quantity)) {
|
|
107
|
+
throw new Error(`${label}: expected a Quantity`);
|
|
108
|
+
}
|
|
109
|
+
return val.to(expectedUnit).value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
module.exports = { Observer };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust — Star façade class.
|
|
3
|
+
*
|
|
4
|
+
* A star with physical parameters and sky coordinates.
|
|
5
|
+
* This is a plain JS class that stores raw properties.
|
|
6
|
+
*
|
|
7
|
+
* @module @siderust/siderust/lib/Star
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
const { Quantity } = require('@siderust/qtty');
|
|
13
|
+
const backend = require('./backend.js');
|
|
14
|
+
|
|
15
|
+
class Star {
|
|
16
|
+
/**
|
|
17
|
+
* Create a custom star.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} name Display name
|
|
20
|
+
* @param {Quantity} distance Distance, convertible to LightYear
|
|
21
|
+
* @param {Quantity} mass Mass, convertible to SolarMass
|
|
22
|
+
* @param {Quantity} radius Radius, convertible to NominalSolarRadius
|
|
23
|
+
* @param {Quantity} luminosity Luminosity, convertible to SolarLuminosity
|
|
24
|
+
* @param {Quantity} ra Right ascension, convertible to Degree
|
|
25
|
+
* @param {Quantity} dec Declination, convertible to Degree
|
|
26
|
+
*/
|
|
27
|
+
constructor(name, distance, mass, radius, luminosity, ra, dec) {
|
|
28
|
+
this._distanceLy = _extractQuantityValue(distance, 'LightYear', 'distance');
|
|
29
|
+
this._massSolar = _extractQuantityValue(mass, 'SolarMass', 'mass');
|
|
30
|
+
this._radiusSolar = _extractQuantityValue(radius, 'NominalSolarRadius', 'radius');
|
|
31
|
+
this._luminositySolar = _extractQuantityValue(luminosity, 'SolarLuminosity', 'luminosity');
|
|
32
|
+
this._raDeg = _extractQuantityValue(ra, 'Degree', 'ra');
|
|
33
|
+
this._decDeg = _extractQuantityValue(dec, 'Degree', 'dec');
|
|
34
|
+
|
|
35
|
+
this._name = name;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Look up a star from the built-in catalog by name.
|
|
40
|
+
* @param {string} name
|
|
41
|
+
* @returns {Star}
|
|
42
|
+
*/
|
|
43
|
+
static catalog(name) {
|
|
44
|
+
// Delegate to native for the catalog data
|
|
45
|
+
const native = backend.NativeStar.catalog(name);
|
|
46
|
+
return new Star(
|
|
47
|
+
native.name,
|
|
48
|
+
new Quantity(native.distanceLy, 'LightYear'),
|
|
49
|
+
new Quantity(native.massSolar, 'SolarMass'),
|
|
50
|
+
new Quantity(native.radiusSolar, 'NominalSolarRadius'),
|
|
51
|
+
new Quantity(native.luminositySolar, 'SolarLuminosity'),
|
|
52
|
+
new Quantity(native.raDeg, 'Degree'),
|
|
53
|
+
new Quantity(native.decDeg, 'Degree'),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Star name. */
|
|
58
|
+
get name() {
|
|
59
|
+
return this._name;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ── typed accessors ────────────────────────────────────────────
|
|
63
|
+
|
|
64
|
+
/** Distance as a `Quantity` in LightYear. */
|
|
65
|
+
get distance() {
|
|
66
|
+
return new Quantity(this._distanceLy, 'LightYear');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Mass as a `Quantity` in SolarMass. */
|
|
70
|
+
get mass() {
|
|
71
|
+
return new Quantity(this._massSolar, 'SolarMass');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Radius as a `Quantity` in NominalSolarRadius. */
|
|
75
|
+
get radius() {
|
|
76
|
+
return new Quantity(this._radiusSolar, 'NominalSolarRadius');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Luminosity as a `Quantity` in SolarLuminosity. */
|
|
80
|
+
get luminosity() {
|
|
81
|
+
return new Quantity(this._luminositySolar, 'SolarLuminosity');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Right ascension as a `Quantity` in Degree. */
|
|
85
|
+
get ra() {
|
|
86
|
+
return new Quantity(this._raDeg, 'Degree');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Declination as a `Quantity` in Degree. */
|
|
90
|
+
get dec() {
|
|
91
|
+
return new Quantity(this._decDeg, 'Degree');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Human-readable representation. */
|
|
95
|
+
format() {
|
|
96
|
+
return `Star(${this._name}, d=${this._distanceLy.toFixed(1)} ly, RA=${this._raDeg.toFixed(4)}°, Dec=${this._decDeg.toFixed(4)}°)`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Extract a canonical scalar value from a `Quantity`.
|
|
102
|
+
* @param {unknown} value
|
|
103
|
+
* @param {string} unit
|
|
104
|
+
* @param {string} label
|
|
105
|
+
* @returns {number}
|
|
106
|
+
*/
|
|
107
|
+
function _extractQuantityValue(value, unit, label) {
|
|
108
|
+
if (!(value instanceof Quantity)) {
|
|
109
|
+
throw new Error(`${label}: expected a Quantity`);
|
|
110
|
+
}
|
|
111
|
+
const converted = value.to(unit).value;
|
|
112
|
+
if (!Number.isFinite(converted)) {
|
|
113
|
+
throw new Error(`${label} must be finite (not NaN or ±infinity)`);
|
|
114
|
+
}
|
|
115
|
+
return converted;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
module.exports = { Star };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @siderust/siderust — Internal native backend wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Loads the NAPI-RS `.node` addon and re-exports the raw primitives
|
|
5
|
+
* that the public JS façade classes and free functions need.
|
|
6
|
+
*
|
|
7
|
+
* @module @siderust/siderust/lib/backend
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const native = require('../native.cjs');
|
|
14
|
+
|
|
15
|
+
// ── Native classes (internal only) ────────────────────────────────
|
|
16
|
+
module.exports.NativeObserver = native.Observer;
|
|
17
|
+
module.exports.NativeStar = native.Star;
|
|
18
|
+
|
|
19
|
+
// ── Free functions (pass-through) ─────────────────────────────────
|
|
20
|
+
module.exports.getPlanet = native.getPlanet;
|
|
21
|
+
module.exports.listBodies = native.listBodies;
|
|
22
|
+
module.exports.transformDirection = native.transformDirection;
|
|
23
|
+
module.exports.directionToHorizontal = native.directionToHorizontal;
|
|
24
|
+
module.exports.geodeticToEcef = native.geodeticToEcef;
|
|
25
|
+
module.exports.angularSeparation = native.angularSeparation;
|
|
26
|
+
module.exports.cartesianDistance = native.cartesianDistance;
|
|
27
|
+
module.exports.cartesianMagnitude = native.cartesianMagnitude;
|
|
28
|
+
module.exports.dotProduct = native.dotProduct;
|
|
29
|
+
module.exports.directionToCartesian = native.directionToCartesian;
|
|
30
|
+
module.exports.vsop87Heliocentric = native.vsop87Heliocentric;
|
|
31
|
+
module.exports.vsop87Barycentric = native.vsop87Barycentric;
|
|
32
|
+
module.exports.vsop87SunBarycentric = native.vsop87SunBarycentric;
|
|
33
|
+
module.exports.vsop87EarthBarycentric = native.vsop87EarthBarycentric;
|
|
34
|
+
module.exports.vsop87EarthHeliocentric = native.vsop87EarthHeliocentric;
|
|
35
|
+
module.exports.vsop87MoonGeocentric = native.vsop87MoonGeocentric;
|
|
36
|
+
module.exports.transformPositionCenter = native.transformPositionCenter;
|
|
37
|
+
module.exports.transformPositionFrame = native.transformPositionFrame;
|
|
38
|
+
module.exports.orbitalPeriodDays = native.orbitalPeriodDays;
|
|
39
|
+
module.exports.bodyAltitudeAt = native.bodyAltitudeAt;
|
|
40
|
+
module.exports.bodyAzimuthAt = native.bodyAzimuthAt;
|
|
41
|
+
module.exports.bodyCrossings = native.bodyCrossings;
|
|
42
|
+
module.exports.bodyCulminations = native.bodyCulminations;
|
|
43
|
+
module.exports.bodyAboveThreshold = native.bodyAboveThreshold;
|
|
44
|
+
module.exports.bodyBelowThreshold = native.bodyBelowThreshold;
|
|
45
|
+
module.exports.bodyAzimuthCrossings = native.bodyAzimuthCrossings;
|
|
46
|
+
module.exports.bodyAzimuthExtrema = native.bodyAzimuthExtrema;
|
|
47
|
+
module.exports.starAltitudeAt = native.starAltitudeAt;
|
|
48
|
+
module.exports.starAzimuthAt = native.starAzimuthAt;
|
|
49
|
+
module.exports.starCrossings = native.starCrossings;
|
|
50
|
+
module.exports.starCulminations = native.starCulminations;
|
|
51
|
+
module.exports.starAboveThreshold = native.starAboveThreshold;
|
|
52
|
+
module.exports.starBelowThreshold = native.starBelowThreshold;
|
|
53
|
+
module.exports.starAzimuthCrossings = native.starAzimuthCrossings;
|
|
54
|
+
module.exports.starAzimuthExtrema = native.starAzimuthExtrema;
|
|
55
|
+
module.exports.intersectPeriods = native.intersectPeriods;
|
|
56
|
+
module.exports.moonPhase = native.moonPhase;
|
|
57
|
+
module.exports.moonPhaseTopocentric = native.moonPhaseTopocentric;
|
|
58
|
+
module.exports.findPhaseEvents = native.findPhaseEvents;
|
|
59
|
+
module.exports.moonIlluminationAbove = native.moonIlluminationAbove;
|
|
60
|
+
module.exports.moonIlluminationBelow = native.moonIlluminationBelow;
|
|
61
|
+
module.exports.moonIlluminationRange = native.moonIlluminationRange;
|
|
62
|
+
module.exports.listCatalogStars = native.listCatalogStars;
|
|
63
|
+
module.exports.version = native.version;
|