3.9 KiB
ADDED Requirements
Requirement: RawStar shape
The system SHALL export a RawStar interface with catalog ID, RA, Dec, apparent magnitude, spectral type, optional distance, proper motion, and parallax.
Scenario: Raw star validation
- WHEN a
RawStarwith all required fields is parsed - THEN validation succeeds
- AND omitting
catalogIdcauses validation to fail
Requirement: StarCatalogSource interface
The system SHALL export a StarCatalogSource interface with id, magnitudeLimit, starCount, queryCone, and getById.
Scenario: Source query
- WHEN
queryConeis called on a source with RA, Dec, radius, and options - THEN the returned
RawStar[]contains only stars within the cone
Requirement: BSC5 bundled catalog
The system SHALL export createBsc5Source returning a StarCatalogSource with ~9,096 stars, requiring no network or configuration.
Scenario: BSC5 offline query
- WHEN
createBsc5Source()is created andqueryCone(0, 0, 1)is called - THEN the promise resolves with an array of
RawStarentries - AND the source
idequals"bsc5"
Requirement: StarProvider implementation
The system SHALL export StarProviderImpl implementing StarProvider with priority-ordered catalog sources.
Scenario: Visible stars query
- WHEN
getVisibleStarsis called with a surface observer and default options - THEN the result is an
ObservedStar[]sorted by brightness (brightest first) - AND every entry has
altitudeandazimuthpopulated
Requirement: Horizon frame computation
The system SHALL compute the local horizon frame from ObserverPosition for star altitude/azimuth calculation.
Scenario: Zenith star altitude
- WHEN a star with RA/Dec matching the observer's zenith is queried
- THEN the returned
altitudeis approximately90 - AND
azimuthis0or180depending on convention
Requirement: Atmospheric extinction
The system SHALL apply Pogson's extinction formula using the Kasten–Young air mass when the observer has an AtmosphereConfig.
Scenario: Extinction at low altitude
- WHEN
getVisibleStarsis called for a surface observer on a planet with atmosphere - THEN stars near the horizon have
extinctedMagnitude > apparentMagnitude - AND stars at the zenith have
extinctedMagnitude ≈ apparentMagnitude
Requirement: No extinction in vacuum
The system SHALL NOT apply extinction for SpacePosition observers or planets without AtmosphereConfig.
Scenario: Space observer magnitudes
- WHEN
getVisibleStarsis called for aSpacePositionobserver - THEN
extinctedMagnitudeequalsapparentMagnitudefor all stars
Requirement: Cone query returns catalog stars
The system SHALL return CatalogStar[] (without altitude/azimuth) from queryCone.
Scenario: Catalog cone query
- WHEN
queryCone(ra, dec, radiusDeg)is called - THEN the result contains
CatalogStarentries withoutaltitudeorazimuth
Requirement: SurrealDB adapter interface
The system SHALL export SurrealAdapterLike, SurrealStarProviderOptions, and createSurrealStarSource as a structural interface with no hard dependency on @suaveplan/surrealdb.
Scenario: Structural satisfaction
- WHEN an object with a
querymethod matchingSurrealAdapterLikeis passed tocreateSurrealStarSource - THEN the returned object satisfies
StarCatalogSource
Requirement: Deferred catalog interfaces
The system SHALL export type signatures for createHipparcosSource, createTycho2Source, and createGaiaSource with injectable fetchFn and optional cacheFn.
Scenario: Interface existence
- WHEN the public API surface of
@suaveplan/starsis inspected - THEN the three deferred factory function types are present
- AND their option types include
fetchFnandcacheFnfields