fix spacetime-client runtime tracking batch mapper

This commit is contained in:
kdletters
2026-05-19 10:52:21 +08:00
parent 356d54a034
commit 34d16b7f0a
2 changed files with 30 additions and 3 deletions

View File

@@ -92,6 +92,23 @@ impl From<module_runtime::RuntimeSnapshotDeleteInput> for RuntimeSnapshotDeleteI
}
}
impl From<module_runtime::RuntimeTrackingEventInput> for RuntimeTrackingEventInput {
fn from(input: module_runtime::RuntimeTrackingEventInput) -> Self {
Self {
event_id: input.event_id,
event_key: input.event_key,
scope_kind: map_runtime_tracking_scope_kind(input.scope_kind),
scope_id: input.scope_id,
user_id: input.user_id,
owner_user_id: input.owner_user_id,
profile_id: input.profile_id,
module_key: input.module_key,
metadata_json: input.metadata_json,
occurred_at_micros: input.occurred_at_micros,
}
}
}
pub type CreationEntryConfigRecord =
shared_contracts::creation_entry_config::CreationEntryConfigResponse;
@@ -213,6 +230,16 @@ pub(crate) fn map_runtime_tracking_event_procedure_result(
Ok(())
}
pub(crate) fn map_runtime_tracking_event_batch_procedure_result(
result: RuntimeTrackingEventBatchProcedureResult,
) -> Result<u32, SpacetimeClientError> {
if !result.ok {
return Err(SpacetimeClientError::procedure_failed(result.error_message));
}
Ok(result.accepted_count)
}
pub(crate) fn map_runtime_snapshot_procedure_result(
result: RuntimeSnapshotProcedureResult,
) -> Result<Option<RuntimeSnapshotRecord>, SpacetimeClientError> {