refactor(space): separate satellite and mission layer components

This commit is contained in:
Sameh Khamis committed 2026-09-13 13:12:34 -07:00
1 parent 61db945b21
commit ce0568983a
44 files changed
+8767 -6095

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
/** Read launch records and their optional active-orbit catalog with explicit cancellation. */
export function createLaunchSource({
fetchImpl = (...args) => globalThis.fetch(...args),
} = {}) {
return {
async getLaunches({ signal } = {}) {
signal?.throwIfAborted();
const response = await fetchImpl('/api/launches', { signal });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const payload = await response.json();
signal?.throwIfAborted();
if (!Array.isArray(payload) && !Array.isArray(payload?.results))
throw new Error('Malformed launch snapshot');
return payload;
},
async getActiveTle({ signal } = {}) {
signal?.throwIfAborted();
const response = await fetchImpl('/api/celestrak/active', { signal });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const text = await response.text();
signal?.throwIfAborted();
return text;
},
};
}