Update Documentation.docc, Services + docs

Summary:
- Sources: Documentation.docc, Services
- Docs: README

Stats:
- 4 files changed, 15 insertions(+), 2 deletions(-)
This commit is contained in:
Matt Bruce 2026-01-17 11:00:51 -06:00
parent 982a12099e
commit c28b30b808
4 changed files with 15 additions and 2 deletions

View File

@ -268,7 +268,9 @@ try await StorageRouter.shared.forceMigration(for: StorageKey.modernToken)
#### Automated Startup Sweep
When registering a catalog, you can enable `migrateImmediately` to perform a global sweep of all legacy keys for every key in the catalog.
> [!NOTE]
> [!IMPORTANT]
> **Catalog Enforcement**: Once any catalog is registered, *all* storage operations require the key to be in a registered catalog. Any unregistered key will throw `StorageError.unregisteredKey`.
>
> **Modular Registration**: `registerCatalog` is additive. You can call it multiple times from different modules to build an aggregate registry. The library will throw an error if multiple catalogs attempt to register the same key name.
```swift

View File

@ -35,6 +35,10 @@ await StorageRouter.shared.updateStorageConfiguration(storageConfig)
Catalogs are mandatory if you want auditing and duplicate detection.
> [!IMPORTANT]
> Once any catalog is registered, *all* storage operations require the key to be present in a registered catalog.
> Unregistered keys will throw `StorageError.unregisteredKey`.
```swift
struct AuthCatalog: StorageKeyCatalog {
let allKeys: [AnyStorageKey] = [

View File

@ -18,6 +18,10 @@ Catalog registration enforces correctness:
- Duplicate key names across catalogs are rejected.
- Unregistered keys throw ``StorageError/unregisteredKey(_:)`` at runtime.
> [!IMPORTANT]
> Once any catalog is registered, *all* storage operations require keys to be registered.
> If you add a new module or feature, you must register its catalog before using its keys.
If you skip catalog registration, LocalData cannot guarantee that all writes are auditable.
## Modular catalogs

View File

@ -89,7 +89,10 @@ public actor StorageRouter: StorageProviding {
}
/// Registers a catalog of known storage keys for audit and validation.
/// When registered, all storage operations will verify keys are listed.
///
/// - Important: Once any catalog is registered, *all* storage operations require keys
/// to be present in a registered catalog. Unregistered keys throw
/// ``StorageError/unregisteredKey(_:)``.
/// - Parameters:
/// - catalog: The catalog type to register.
/// - migrateImmediately: If true, triggers a proactive migration (sweep) for all keys in the catalog.