Collapse the Storage Adapter Chain
Before
After
Files
service/rootPluginDataStorage.ts · service/codePointStorage.ts · service/useHistoryStorage.ts · service/favoriteStorage.ts · service/poolStorage.ts · service/metaStorage.ts · service/codePointStore.ts · service/useHistoryStore.ts · service/favoriteStore.ts · service/poolStore.ts
Problem
The storage layer has five near-identical adapter classes that each wrap RootPluginDataStorage with one trivial transformation (get chunk → extract array, serialize → overwrite chunk). The interface surface — RootPluginDataStorage with 10 get/overwrite methods, plus four separate *Store interfaces — is nearly as wide as the implementation. The modules are shallow.
Solution
Collapse the chain into a single generic ChunkStorage<T> adapter that handles get/overwrite/merge for any chunk type. Delete the four *Storage classes and four *Store interfaces. The few that have extra logic (e.g., PoolStorage's event triggering) move into a dedicated PoolModule.
Benefits
- • leverage: one generic adapter handles all five chunks — delete four shallow wrappers
- • locality: serialization/deserialization logic centralises in one place
- • interface shrinks: callers depend on
ChunkStorage<T>instead of five separate interfaces - • tests: one adapter to mock, not four — test surface halves