Skip to content

Introduce Star class and enhance backend integration for celestial bodies - #4

Merged
VPRamon merged 6 commits into
mainfrom
web
Mar 11, 2026
Merged

Introduce Star class and enhance backend integration for celestial bodies#4
VPRamon merged 6 commits into
mainfrom
web

Conversation

@VPRamon

@VPRamon VPRamon commented Mar 11, 2026

Copy link
Copy Markdown
Member

This pull request establishes the initial structure for the siderust-js JavaScript workspace, introducing a shared Rust core for Node and WebAssembly adapters, and providing a strictly-typed, domain-driven API for astronomy computations. The main themes are: (1) initial workspace and documentation; (2) introduction of a deduplicated Rust core crate; and (3) implementation of shared domain types for observer, body, and event logic.

Workspace and Documentation

  • Adds a top-level README.md describing the purpose, package structure, installation, and usage examples for both Node.js and browser/WebAssembly targets. The documentation emphasizes strict typing and the use of domain objects at the public API boundary.
  • Introduces a CHANGELOG.md documenting the initial release, highlighting the new packages, typed API, and removal of raw numeric inputs.

Shared Rust Binding Core

  • Creates the siderust-core crate (siderust-binding-core), which contains the shared Rust logic and data types for both Node and Web adapters, as specified in Cargo.toml. This enables code deduplication and consistent behavior across platforms.
  • Adds a DEDUPLICATION.md outlining the architectural plan for reducing code duplication between Node and Web adapters, including migration phases and conversion strategies.
  • Implements the crate root (lib.rs), exposing modules for body, events, observer, and position logic.

Domain Types and Logic

  • Implements body.rs, defining the BodyKind enum for solar-system bodies, a macro for dispatching to concrete body types, and a PlanetInfo struct for physical parameters.
  • Implements events.rs, defining shared event data types (e.g., CrossingEventData, CulminationEventData), enums for event directions/kinds, and conversion logic from core siderust types.
  • Implements observer.rs, providing observer validation, creation, and accessors, as well as helpers for common observatory locations.

Other Changes

  • Removes the previous siderust subproject commit, indicating a move to the new deduplicated core approach.

VPRamon added 3 commits March 8, 2026 18:18
- Added Star class to represent stars with physical parameters and sky coordinates.
- Implemented backend.js to handle WASM module initialization and native star operations.
- Created wrappers.js to provide typed wrapper functions for Observer and Star objects.
- Updated package.json to reflect version change to 1.0.0 and added dependencies.
- Refactored body.rs to re-export shared types and simplify planet info retrieval.
- Enhanced events.rs to utilize new body parsing logic for celestial body operations.
- Introduced position.rs to manage Cartesian positions and displacements with validation.
- Updated Star constructor to accept Quantity objects for distance, mass, radius, luminosity, right ascension, and declination.
- Introduced _extractQuantityValue function for extracting scalar values from Quantity objects with validation.
- Modified the catalog method to return Quantity objects for star properties.
- Updated accessors to return Quantity objects instead of raw numbers.

Enhance backend initialization with quantity and tempoch support

- Added initialization checks for @siderust/qtty-web and @siderust/tempoch-web in the backend module.
- Refactored ensureInit function to throw errors if not initialized.
- Updated NativeStar function to accept parameters as per new Quantity structure.

Refactor wrappers to enforce public JS domain types

- Updated wrapper functions to validate input types and convert them to appropriate formats.
- Introduced mapping functions for various data structures returned from backend calls.
- Refactored event and crossing functions to accept window objects instead of separate start and end parameters.

Update package dependencies for qtty-web and tempoch-web

- Changed dependency versions for @siderust/qtty-web and added @siderust/tempoch-web.
@VPRamon VPRamon self-assigned this Mar 11, 2026
- Updated `siderust` dependency to version 0.6.0 in both `Cargo.toml` files for `siderust-node` and `siderust-web`.
- Updated other dependencies: `qtty` to 0.4.1, `tempoch` to 0.4, `affn` to 0.4.1, and `chrono` to 0.4.44.
- Removed local path dependencies for `affn`, `cheby`, and `tempoch` in `siderust-node` and `siderust-web`.
- Refactored `index.test.mjs` to require the main module directly.
- Expanded TypeScript definitions in `index.d.ts` to include new functions and interfaces for celestial calculations.
- Introduced a new entry point `main.js` for the `siderust` module, consolidating exports.
- Updated `package.json` to reflect the new main entry point and added exports field for module resolution.
- Updated `Cargo.lock` to reflect the new dependency versions and ensure compatibility.
VPRamon added 2 commits March 11, 2026 20:40
The package-lock.json previously resolved these packages to the root
qtty-js@0.1.0 and tempoch-js@0.1.0 container packages on npm, which do
not contain index.js and have not been published as @siderust/* scoped
packages.

Fix:
- Add qtty-js and tempoch-js as git submodules (HTTPS URLs for CI auth)
- Switch siderust-node dependencies to file: paths pointing at the
  qtty-node and tempoch-node sub-packages in those submodules
- npm now symlinks node_modules/@siderust/qtty → qtty-js/qtty-node and
  node_modules/@siderust/tempoch → tempoch-js/tempoch-node, making
  index.js immediately available after install
- Update scripts/ci.sh: run_install also does npm ci for each peer dep;
  run_build compiles their native binaries before building siderust-node
- Update ci.yml Rust cache workspaces in test and coverage jobs to
  cache qtty-js/qtty-node and tempoch-js/tempoch-node target dirs
@VPRamon
VPRamon merged commit 6c1b83c into main Mar 11, 2026
5 checks passed
@VPRamon
VPRamon deleted the web branch March 11, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant