Persist dynamic extension config so we can resume recipe sessions w/ extensions (#4331)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Extension data management for sessions
|
||||
// Provides a simple way to store extension-specific data with versioned keys
|
||||
|
||||
use crate::config::ExtensionConfig;
|
||||
use anyhow::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
@@ -95,6 +96,23 @@ impl TodoState {
|
||||
}
|
||||
}
|
||||
|
||||
/// Enabled extensions state implementation for storing which extensions are active
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct EnabledExtensionsState {
|
||||
pub extensions: Vec<ExtensionConfig>,
|
||||
}
|
||||
|
||||
impl ExtensionState for EnabledExtensionsState {
|
||||
const EXTENSION_NAME: &'static str = "enabled_extensions";
|
||||
const VERSION: &'static str = "v0";
|
||||
}
|
||||
|
||||
impl EnabledExtensionsState {
|
||||
pub fn new(extensions: Vec<ExtensionConfig>) -> Self {
|
||||
Self { extensions }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -2,4 +2,5 @@ pub mod extension_data;
|
||||
mod legacy;
|
||||
pub mod session_manager;
|
||||
|
||||
pub use extension_data::{EnabledExtensionsState, ExtensionData, ExtensionState, TodoState};
|
||||
pub use session_manager::{Session, SessionInsights, SessionManager};
|
||||
|
||||
Reference in New Issue
Block a user