server: compose Workspace config schemas

This commit is contained in:
2026-08-14 05:38:21 +09:00
parent 7a8bd7717e
commit f8baa1edb7
9 changed files with 869 additions and 130 deletions
+8 -2
View File
@@ -1,6 +1,6 @@
use config_source::{
ConfigTreeChange, ConfigTreeSnapshot, EvaluationResult, SnapshotEnvironment, ToolchainContract,
VirtualPath,
ConfigSchemaContribution, ConfigTreeChange, ConfigTreeSnapshot, EvaluationResult,
SnapshotEnvironment, ToolchainContract, VirtualPath, WorkspaceConfigSchemaBundle,
};
use serde_wasm_bindgen::{Serializer, from_value};
use std::cell::RefCell;
@@ -10,6 +10,12 @@ thread_local! {
static SESSION: RefCell<Option<ConfigTreeSnapshot>> = const { RefCell::new(None) };
}
#[wasm_bindgen]
pub fn compose_schema_bundle(contributions: JsValue) -> Result<JsValue, JsValue> {
let contributions: Vec<ConfigSchemaContribution> = decode(contributions)?;
encode(WorkspaceConfigSchemaBundle::compose(contributions).map_err(js_error)?)
}
#[wasm_bindgen]
pub fn set_snapshot(snapshot: JsValue) -> Result<(), JsValue> {
let snapshot: ConfigTreeSnapshot = decode(snapshot)?;