Converted:
- toasts.js → toasts.ts (typed Writable<Toast[]>, typed addToast/removeToast)
- api.js → api.ts (C5 module with 12 nested C2/C4 function contracts)
- utils.js → utils.ts, utils/debounce.js → debounce.ts
- Updated 67 import references across src/ (.js extension stripped)
- Added types/api.ts, types/models.ts, types/validation.ts (foundation DTOs)
api.ts contracts:
- Top-level: [C:5] with @INVARIANT, @DATA_CONTRACT, @RATIONALE, @REJECTED
- C4 functions: buildApiError, notifyApiError, shouldSuppressApiErrorToast
- C2 helpers: getWsUrl, getTaskEventsWsUrl, getMaintenanceEventsWsUrl,
getTranslateRunWsUrl, getAuthHeaders
- C4 fetch/request wrappers: fetchApi, fetchApiBlob, postApi, deleteApi, requestApi
- C3 endpoint registry: api.* methods with @RELATION DEPENDS_ON chains
- All C4 functions have @PRE/@POST/@SIDE_EFFECT
- all generic <T = unknown> for type-safe API responses
Build: npm run build passes cleanly
Superset Tools Frontend (SvelteKit)
This is the frontend for the Superset Tools application, built with SvelteKit in SPA mode.
Development
-
Install dependencies:
npm install -
Run development server:
npm run devThe frontend will be available at
http://localhost:5173. It is configured to proxy API requests tohttp://localhost:8000.
Production Build
-
Build the static SPA:
npm run buildThis generates a static SPA in the
build/directory. -
Serve with Backend: The Python backend is configured to serve the files from
frontend/build/. Ensure the backend is running:cd ../backend python src/app.py
Architecture
- Routing: File-based routing in
src/routes/. - Layouts: Shared UI in
src/routes/+layout.svelte. - Data Loading:
loadfunctions in+page.tsfor efficient data fetching. - API Client: Centralized API logic in
src/lib/api.js. - Styling: Tailwind CSS.