Changelog
[0.1.0] - 2026-10-15
First usable version: a local storage library for uni-app x built on the native uni.setStorage API family without reinventing the storage stack — folding TTL expiration, key naming hygiene, async orchestration, and multi-instance isolation into one axios-minded API set.
Added
- Promise-based full API:
set/get<T>/remove/clear/info/keys/clearExpired, all async/await; miss and expired resolvenullinstead of rejecting (the nativegetStorage"data not found" fail is translated into miss semantics inside the adapter) - TTL expiration: records wrap
{ data, expire }timestamps, reads are lazily checked (Date.now() > expire→ removed and returnsnull);clearExpired()sweeps the namespace and returns the removed count; three-level fallback: call-levelttl→ instancedefaultTTL→ built-in never-expire - Key-prefix namespace: default prefix
mx_storage:avoids the reserveduni-/dcloud_prefixes; invalid prefixes are rejected withERR_PARAMat operation time;keys()returns original keys with the prefix stripped;clearfilters by prefix and removes one by one — only its own namespace - Default instance + multiple instances: the default instance works out of the box with global defaults via
configureStorage;createStorage(defaults)creates prefix / TTL isolated instances mirroringaxios.create, each with its ownsetConfig - Unified error shape
StorageError: literal-union codesERR_PARAM/ERR_NATIVE;errSubjectis alwaysunix-storage; the nativeerrCodepasses through untouched vianativeErrCode;keycarries the related business key - Compatibility policy: foreign-format data (legacy entries written straight through native APIs) is returned as-is and treated as never-expiring — no errors, no accidental removal
- Type safety: nullable-safe config fields (
| null, null keeps built-in defaults),get<T>generic static annotation, public types re-exported through the plugin entry
Platform support
- Web: build verified, all 22 functional verification logs passed (six verification pages: basic I/O / TTL / namespace & instances / global config / clearExpired / error paths)
- Android: cloud packaging release compiles with zero errors (Kotlin toolchain unblocked); on-device case verification pending
- WeChat Mini Program: same codebase for all platforms (the
uni.setStoragefamily is unified), pending testing - iOS / HarmonyOS: adapted, untested due to environment limits (iOS needs macOS, HarmonyOS needs DevEco Studio)
Links
- Sample project packages/playground (home navigation + six feature pages, verified via HBuilderX web publish / cloud packaging)
- Design doc docs/design/store.md
