commit ff49f82f8fbbffe7d1ec456693fe1f2320bdd628
parent 983667ec44193c8cc952f1e0a3423ae9f33ba74b
Author: triesap <tyson@radroots.org>
Date: Wed, 24 Jun 2026 07:53:27 +0000
dto: render events indexed bindings
- Switch events-indexed type output to the dto registry renderer.
- Inject the shard id package alias while preserving declaration order.
- Remove binding_model from the migrated events-indexed binding crate.
- Validate indexed output through xtask, workspace, and package checks.
Diffstat:
3 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/tools/sdk_xtask_import/Cargo.toml b/tools/sdk_xtask_import/Cargo.toml
@@ -19,7 +19,7 @@ radroots_sdk_binding_model = { path = "../../crates/binding_model" }
radroots_core = { workspace = true, features = ["dto-bindgen"] }
radroots_events = { workspace = true, features = ["dto-bindgen"] }
radroots_events_bindings = { path = "../../crates/events_bindings" }
-radroots_events_indexed_bindings = { path = "../../crates/events_indexed_bindings" }
+radroots_events_indexed = { workspace = true, features = ["dto-bindgen"] }
radroots_identity_bindings = { path = "../../crates/identity_bindings" }
radroots_replica_db_schema_bindings = { path = "../../crates/replica_db_schema_bindings" }
radroots_types_bindings = { path = "../../crates/types_bindings" }
diff --git a/tools/sdk_xtask_import/src/dto_roots.rs b/tools/sdk_xtask_import/src/dto_roots.rs
@@ -41,6 +41,10 @@ pub const DTO_PACKAGE_ROOTS: &[DtoPackageRootSet] = &[
package_key: "events",
roots: events_roots,
},
+ DtoPackageRootSet {
+ package_key: "events_indexed",
+ roots: events_indexed_roots,
+ },
];
pub const MANUAL_DESCRIPTOR_FAMILIES: &[ManualDescriptorFamily] = &[
@@ -132,6 +136,17 @@ pub fn events_types_module() -> Result<DtoTypesModule, String> {
))
}
+pub fn events_indexed_types_module() -> Result<DtoTypesModule, String> {
+ let root_set = package_root_set("events_indexed")
+ .ok_or_else(|| "missing events-indexed DTO roots".to_owned())?;
+ let rendered =
+ render_registry_types(&root_set.registry(), &DtoRegistryRenderOptions::default())?;
+ Ok(DtoTypesModule::new(
+ rendered.imports_ts().unwrap_or_default(),
+ with_events_indexed_sdk_wrappers(rendered.body_ts()),
+ ))
+}
+
fn core_roots() -> Vec<RootDescriptor> {
radroots_core::dto::dto_roots().into_iter().collect()
}
@@ -140,6 +155,12 @@ fn events_roots() -> Vec<RootDescriptor> {
radroots_events::dto::dto_roots().into_iter().collect()
}
+fn events_indexed_roots() -> Vec<RootDescriptor> {
+ radroots_events_indexed::dto::dto_roots()
+ .into_iter()
+ .collect()
+}
+
fn core_import_options(
registry: &Registry,
mut options: DtoRegistryRenderOptions,
@@ -193,6 +214,30 @@ fn declaration_name(declaration: &str) -> &str {
.unwrap_or(declaration)
}
+fn with_events_indexed_sdk_wrappers(body: &str) -> String {
+ let mut declarations = body
+ .split("\n\n")
+ .filter(|declaration| !declaration.trim().is_empty())
+ .map(str::to_owned)
+ .collect::<Vec<_>>();
+ declarations.push("export type RadrootsEventsIndexedShardId = string;".to_owned());
+ let order = [
+ "RadrootsEventsIndexedShardId",
+ "RadrootsEventsIndexedIdRange",
+ "RadrootsEventsIndexedShardMetadata",
+ "RadrootsEventsIndexedManifest",
+ "RadrootsEventsIndexedShardCheckpoint",
+ "RadrootsEventsIndexedIndexCheckpoint",
+ ];
+ declarations.sort_by_key(|declaration| {
+ order
+ .iter()
+ .position(|name| *name == declaration_name(declaration))
+ .unwrap_or(order.len())
+ });
+ declarations.join("\n\n")
+}
+
#[cfg(test)]
mod tests {
use super::{
@@ -323,6 +368,7 @@ mod tests {
fn package_roots_are_explicit_not_discovered() {
assert!(package_root_set("core").is_some());
assert!(package_root_set("events").is_some());
+ assert!(package_root_set("events_indexed").is_some());
assert!(package_root_set("trade").is_none());
}
diff --git a/tools/sdk_xtask_import/src/output.rs b/tools/sdk_xtask_import/src/output.rs
@@ -98,8 +98,8 @@ pub fn package_outputs() -> Result<Vec<PackageOutput>, String> {
},
PackageOutput {
spec: spec_by_key("events_indexed"),
- types_ts: Some(TsSource::Module(
- radroots_events_indexed_bindings::types_module(),
+ types_ts: Some(TsSource::DtoRegistry(
+ dto_roots::events_indexed_types_module()?,
)),
types_imports_ts: None,
constants_ts: None,