-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Summary
DotrainRegistry in crates/js_api/src/registry.rs (~1,639 lines) contains platform-agnostic business logic trapped in the WASM-only crate. No other Rust crate can depend on js_api, so CLI and integration tests can't reuse registry functionality. Rename from DotrainRegistry to RaindexRegistry for consistency with Raindex* naming convention.
What needs to move
Core logic (~90% of the file):
- Registry file format parsing (
parse_registry_content) - HTTP fetching of registry, settings, and order files
- Registry format validation
- Order metadata extraction (name/description from dotrain configs)
- Error type:
DotrainRegistryError→RaindexRegistryError
Key renames
DotrainRegistry→RaindexRegistryDotrainRegistryError→RaindexRegistryError
What stays in js_api
Thin WASM wrapper (~10%):
#[wasm_bindgen]struct decorator and#[wasm_export]method attributesjs_sys::Functioncallback parameter for state updatesJsValueerror conversions- Wrapper methods that delegate to the core implementation
Proposed approach
- Create
common::registrymodule with the coreRaindexRegistrystruct and logic - Keep
js_api::registryas a thin wrapper that re-exports/wraps the core type with WASM annotations - Replace
js_sys::Functioncallbacks with a Rust trait or generic callback
Benefits
- CLI can implement native registry support
- Integration tests can test registry logic without WASM
- Reduces coupling between business logic and platform bindings
- Consistent
Raindex*naming across the codebase
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels