126 lines
6.5 KiB
Rust
126 lines
6.5 KiB
Rust
// file: crates/ksp-app-store-desk/src/dto_observation.rs
|
|
// version: 1
|
|
|
|
//! Application-owned DTOs for safe RAW observation inspection inside entity detail modals.
|
|
|
|
use ts_rs::TS; // rust-rules: trait-import
|
|
|
|
/// Safe source-independent acquisition provenance projected for Store Desk observation tables.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreObservationProvenanceDto.ts")]
|
|
pub(crate) struct StoreObservationProvenanceDto {
|
|
/// Logical acquisition-method code.
|
|
pub(crate) acquisition_method: String,
|
|
/// Optional bounded capture/session identifier.
|
|
pub(crate) capture_session_id: std::option::Option<String>,
|
|
/// Optional commitment code captured at acquisition.
|
|
pub(crate) commitment: std::option::Option<String>,
|
|
/// Optional Config-owned logical endpoint identifier.
|
|
pub(crate) endpoint_id: std::option::Option<String>,
|
|
/// Optional bounded logical filter identifier.
|
|
pub(crate) filter_id: std::option::Option<String>,
|
|
/// Optional source-observation timestamp encoded as exact Unix-millisecond decimal text.
|
|
pub(crate) observed_at_unix_millis_decimal: std::option::Option<String>,
|
|
/// Stable acquisition-origin code.
|
|
pub(crate) origin: String,
|
|
/// Logical transport/protocol code.
|
|
pub(crate) protocol: String,
|
|
/// Safe provider code.
|
|
pub(crate) provider: String,
|
|
/// Local receipt timestamp encoded as exact Unix-millisecond decimal text.
|
|
pub(crate) received_at_unix_millis_decimal: String,
|
|
/// Optional source-wire payload digest encoded as lower-case hexadecimal text, never source bytes.
|
|
pub(crate) source_payload_hash: std::option::Option<String>,
|
|
/// Optional source-wire payload size encoded as exact decimal text.
|
|
pub(crate) source_payload_size_decimal: std::option::Option<String>,
|
|
}
|
|
|
|
/// DataTables random-access request for observations of one explicit RAW transaction.
|
|
#[derive(Debug, serde::Deserialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreTransactionObservationQueryRequestDto.ts")]
|
|
pub(crate) struct StoreTransactionObservationQueryRequestDto {
|
|
/// Whitelisted page size (`25`, `50`, or `100`).
|
|
pub(crate) limit: u32,
|
|
/// Absolute zero-based observation offset encoded as exact decimal text.
|
|
pub(crate) offset: String,
|
|
/// Canonical 64-byte transaction signature encoded as lower-case hexadecimal text.
|
|
pub(crate) signature: String,
|
|
}
|
|
|
|
/// Safe metadata-only row for one RAW transaction observation.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreTransactionObservationRowDto.ts")]
|
|
pub(crate) struct StoreTransactionObservationRowDto {
|
|
/// Deterministic observation key encoded as lower-case hexadecimal text.
|
|
pub(crate) observation_key: String,
|
|
/// Safe source-independent acquisition provenance.
|
|
pub(crate) provenance: crate::StoreObservationProvenanceDto,
|
|
}
|
|
|
|
/// Server-side transaction-observation table result using exact decimal counts.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreTransactionObservationQueryResponseDto.ts")]
|
|
pub(crate) struct StoreTransactionObservationQueryResponseDto {
|
|
/// Exact count after the mandatory transaction filter.
|
|
pub(crate) records_filtered_decimal: String,
|
|
/// Exact count in the mandatory Store network scope before the entity filter.
|
|
pub(crate) records_total_decimal: String,
|
|
/// Metadata-only observation rows for the requested random-access page.
|
|
pub(crate) rows: std::vec::Vec<crate::StoreTransactionObservationRowDto>,
|
|
}
|
|
|
|
/// DataTables random-access request for observations of one explicit RAW account state.
|
|
#[derive(Debug, serde::Deserialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreAccountObservationQueryRequestDto.ts")]
|
|
pub(crate) struct StoreAccountObservationQueryRequestDto {
|
|
/// Whitelisted page size (`25`, `50`, or `100`).
|
|
pub(crate) limit: u32,
|
|
/// Absolute zero-based observation offset encoded as exact decimal text.
|
|
pub(crate) offset: String,
|
|
/// Account public key in canonical base58 text.
|
|
pub(crate) pubkey: String,
|
|
/// Solana slot encoded as exact decimal text.
|
|
pub(crate) slot: String,
|
|
/// Canonical account-state hash encoded as lower-case hexadecimal text.
|
|
pub(crate) state_hash: String,
|
|
}
|
|
|
|
/// Safe metadata-only row for one RAW account observation.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreAccountObservationRowDto.ts")]
|
|
pub(crate) struct StoreAccountObservationRowDto {
|
|
/// Optional source-reported startup/replay marker.
|
|
pub(crate) is_startup: std::option::Option<bool>,
|
|
/// Deterministic observation key encoded as lower-case hexadecimal text.
|
|
pub(crate) observation_key: String,
|
|
/// Safe source-independent acquisition provenance.
|
|
pub(crate) provenance: crate::StoreObservationProvenanceDto,
|
|
/// Optional transaction signature associated with the account write, encoded as lower-case hexadecimal text.
|
|
pub(crate) transaction_signature: std::option::Option<String>,
|
|
/// Optional source-specific account write version encoded as exact decimal text.
|
|
pub(crate) write_version_decimal: std::option::Option<String>,
|
|
}
|
|
|
|
/// Server-side account-observation table result using exact decimal counts.
|
|
#[derive(Clone, Debug, Eq, PartialEq, serde::Serialize, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export, export_to = "../frontend/ts/bindings/ksp_app_store_desk/dto_observation/StoreAccountObservationQueryResponseDto.ts")]
|
|
pub(crate) struct StoreAccountObservationQueryResponseDto {
|
|
/// Exact count after the mandatory account-state filter.
|
|
pub(crate) records_filtered_decimal: String,
|
|
/// Exact count in the mandatory Store network scope before the entity filter.
|
|
pub(crate) records_total_decimal: String,
|
|
/// Metadata-only observation rows for the requested random-access page.
|
|
pub(crate) rows: std::vec::Vec<crate::StoreAccountObservationRowDto>,
|
|
}
|
|
|
|
#[cfg(test)]
|
|
#[path = "../unit_tests/dto_observation.rs"]
|
|
mod tests;
|