Restore preset metadata to registry without modifying timestamps. Use this method for rollback scenarios where you have a complete backup of the registry entry (including installed_at) and want to restore it exactly as it was. Args: pack_id: Preset ID
(self, pack_id: str, metadata: dict)
| 419 | self._save() |
| 420 | |
| 421 | def restore(self, pack_id: str, metadata: dict): |
| 422 | """Restore preset metadata to registry without modifying timestamps. |
| 423 | |
| 424 | Use this method for rollback scenarios where you have a complete backup |
| 425 | of the registry entry (including installed_at) and want to restore it |
| 426 | exactly as it was. |
| 427 | |
| 428 | Args: |
| 429 | pack_id: Preset ID |
| 430 | metadata: Complete preset metadata including installed_at |
| 431 | |
| 432 | Raises: |
| 433 | ValueError: If metadata is None or not a dict |
| 434 | """ |
| 435 | if metadata is None or not isinstance(metadata, dict): |
| 436 | raise ValueError(f"Cannot restore '{pack_id}': metadata must be a dict") |
| 437 | # Ensure presets dict exists (handle corrupted registry) |
| 438 | if not isinstance(self.data.get("presets"), dict): |
| 439 | self.data["presets"] = {} |
| 440 | self.data["presets"][pack_id] = copy.deepcopy(metadata) |
| 441 | self._save() |
| 442 | |
| 443 | def get(self, pack_id: str) -> Optional[dict]: |
| 444 | """Get preset metadata from registry. |