lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

commit 9337dce1ec555f597365b59bf8620ed1aec6162a
parent 1eac3cd5171be8b605d6bbd7cf4f935053fc6697
Author: triesap <tyson@radroots.org>
Date:   Thu, 11 Jun 2026 06:36:43 -0700

sdk: remove TypeScript generator surface

Diffstat:
MCargo.lock | 63---------------------------------------------------------------
MCargo.toml | 2--
Mcrates/core/Cargo.toml | 7+------
Mcrates/core/README | 3+--
Dcrates/core/build.rs | 39---------------------------------------
Mcrates/core/src/currency.rs | 5-----
Mcrates/core/src/decimal.rs | 5-----
Mcrates/core/src/discount.rs | 14--------------
Mcrates/core/src/lib.rs | 67-------------------------------------------------------------------
Mcrates/core/src/money.rs | 7-------
Mcrates/core/src/percent.rs | 6------
Mcrates/core/src/quantity.rs | 6------
Mcrates/core/src/quantity_price.rs | 15++-------------
Mcrates/core/src/unit.rs | 18------------------
Mcrates/events/Cargo.toml | 7+------
Mcrates/events/README | 3+--
Dcrates/events/build.rs | 39---------------------------------------
Mcrates/events/src/account.rs | 5-----
Mcrates/events/src/app_data.rs | 4----
Mcrates/events/src/comment.rs | 5-----
Mcrates/events/src/coop.rs | 18------------------
Mcrates/events/src/document.rs | 12------------
Mcrates/events/src/farm.rs | 40----------------------------------------
Mcrates/events/src/follow.rs | 9---------
Mcrates/events/src/geochat.rs | 6------
Mcrates/events/src/gift_wrap.rs | 9---------
Mcrates/events/src/job.rs | 10----------
Mcrates/events/src/job_feedback.rs | 9---------
Mcrates/events/src/job_request.rs | 13-------------
Mcrates/events/src/job_result.rs | 9---------
Mcrates/events/src/kinds.rs | 217+------------------------------------------------------------------------------
Mcrates/events/src/lib.rs | 12------------
Mcrates/events/src/list.rs | 7-------
Mcrates/events/src/list_set.rs | 7-------
Mcrates/events/src/listing.rs | 165+------------------------------------------------------------------------------
Mcrates/events/src/message.rs | 9---------
Mcrates/events/src/message_file.rs | 16----------------
Mcrates/events/src/plot.rs | 15---------------
Mcrates/events/src/post.rs | 5-----
Mcrates/events/src/profile.rs | 16----------------
Mcrates/events/src/reaction.rs | 4----
Mcrates/events/src/relay_document.rs | 12------------
Mcrates/events/src/resource_area.rs | 14--------------
Mcrates/events/src/resource_cap.rs | 12------------
Mcrates/events/src/seal.rs | 5-----
Mcrates/events/src/trade.rs | 141++-----------------------------------------------------------------------------
Mcrates/events_indexed/Cargo.toml | 4+---
Mcrates/events_indexed/README | 3+--
Mcrates/events_indexed/src/checkpoint.rs | 2--
Mcrates/events_indexed/src/manifest.rs | 2--
Mcrates/events_indexed/src/types.rs | 2--
Mcrates/identity/Cargo.toml | 3---
Mcrates/identity/README | 4++--
Dcrates/identity/build.rs | 39---------------------------------------
Mcrates/identity/src/username.rs | 44--------------------------------------------
Mcrates/net/Cargo.toml | 1-
Mcrates/replica_db_schema/Cargo.toml | 3---
Mcrates/replica_db_schema/README | 3+--
Dcrates/replica_db_schema/build.rs | 39---------------------------------------
Mcrates/replica_db_schema/src/models/farm.rs | 132-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/farm_gcs_location.rs | 108-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/farm_member.rs | 108-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/farm_member_claim.rs | 106-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/farm_tag.rs | 106-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/gcs_location.rs | 166-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/log_error.rs | 121-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/media_image.rs | 122-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/nostr_event_state.rs | 116-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/nostr_profile.rs | 138-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/nostr_profile_relay.rs | 14--------------
Mcrates/replica_db_schema/src/models/nostr_relay.rs | 137-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/plot.rs | 123-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/plot_gcs_location.rs | 108-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/plot_tag.rs | 106-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/trade_product.rs | 154-------------------------------------------------------------------------------
Mcrates/replica_db_schema/src/models/trade_product_location.rs | 14--------------
Mcrates/replica_db_schema/src/models/trade_product_media.rs | 14--------------
Mcrates/sdk/Cargo.toml | 2--
Mcrates/sql_wasm_core/Cargo.toml | 1-
Mcrates/trade/Cargo.toml | 5+----
Mcrates/trade/README | 3+--
Dcrates/trade/build.rs | 39---------------------------------------
Mcrates/trade/src/listing/dvm.rs | 26--------------------------
Mcrates/trade/src/listing/kinds.rs | 12------------
Mcrates/trade/src/listing/model.rs | 15---------------
Mcrates/trade/src/listing/order.rs | 36------------------------------------
Mcrates/trade/src/listing/overlay.rs | 71-----------------------------------------------------------------------
Mcrates/trade/src/listing/projection.rs | 130-------------------------------------------------------------------------------
Mcrates/trade/src/listing/validation.rs | 8--------
Mcrates/types/Cargo.toml | 3---
Mcrates/types/README | 3+--
Dcrates/types/build.rs | 39---------------------------------------
Mcrates/types/src/types.rs | 10----------
Mnix/apps.nix | 1-
Mnix/checks.nix | 1-
Mnix/common.nix | 1-
Dscripts/ci/guard_committed_ts_artifacts.sh | 12------------
Mspec/README.md | 1-
98 files changed, 20 insertions(+), 3553 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -3909,8 +3909,6 @@ dependencies = [ "rust_decimal_macros", "serde", "serde_json", - "ts-rs", - "typeshare", ] [[package]] @@ -3920,8 +3918,6 @@ dependencies = [ "radroots_core", "serde", "serde_json", - "ts-rs", - "typeshare", ] [[package]] @@ -3953,7 +3949,6 @@ version = "0.1.0-alpha.2" dependencies = [ "serde", "serde_json", - "typeshare", ] [[package]] @@ -3982,7 +3977,6 @@ dependencies = [ "tempfile", "thiserror 1.0.69", "tracing", - "ts-rs", "zeroize", ] @@ -4153,7 +4147,6 @@ dependencies = [ "radroots_types", "serde", "serde_json", - "ts-rs", ] [[package]] @@ -4451,7 +4444,6 @@ dependencies = [ "serde-wasm-bindgen", "serde_json", "thiserror 1.0.69", - "ts-rs", "uuid", "wasm-bindgen", ] @@ -4473,7 +4465,6 @@ dependencies = [ "serde_json", "sha2", "thiserror 1.0.69", - "ts-rs", ] [[package]] @@ -4482,7 +4473,6 @@ version = "0.1.0-alpha.2" dependencies = [ "serde", "serde_json", - "ts-rs", ] [[package]] @@ -6641,15 +6631,6 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] name = "thiserror" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -7154,28 +7135,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] -name = "ts-rs" -version = "11.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4994acea2522cd2b3b85c1d9529a55991e3ad5e25cdcd3de9d505972c4379424" -dependencies = [ - "thiserror 2.0.18", - "ts-rs-macros", -] - -[[package]] -name = "ts-rs-macros" -version = "11.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6ff59666c9cbaec3533964505d39154dc4e0a56151fdea30a09ed0301f62e2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.117", - "termcolor", -] - -[[package]] name = "tungstenite" version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -7228,28 +7187,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] -name = "typeshare" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da1bf9fe204f358ffea7f8f779b53923a20278b3ab8e8d97962c5e1b3a54edb7" -dependencies = [ - "chrono", - "serde", - "serde_json", - "typeshare-annotation", -] - -[[package]] -name = "typeshare-annotation" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "621963e302416b389a1ec177397e9e62de849a78bd8205d428608553def75350" -dependencies = [ - "quote", - "syn 2.0.117", -] - -[[package]] name = "ucd-trie" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/Cargo.toml b/Cargo.toml @@ -162,8 +162,6 @@ tracing = { version = "0.1", default-features = false } tracing-appender = { version = "0.2" } tracing-log = { version = "0.2" } tracing-subscriber = { version = "0.3" } -ts-rs = { version = "11.1" } -typeshare = { version = "1" } url = { version = "2" } uuid = { version = "1.22.0", features = ["v4", "v7"] } x509-parser = { version = "0.17", default-features = false } diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml @@ -11,14 +11,11 @@ repository.workspace = true homepage.workspace = true documentation = "https://docs.rs/radroots_core" readme = "README" -build = "build.rs" [features] -default = ["std", "serde", "typeshare"] +default = ["std", "serde"] std = [] serde = ["dep:serde", "rust_decimal/serde"] -typeshare = ["dep:typeshare"] -ts-rs = ["dep:ts-rs"] [dependencies] rust_decimal = { workspace = true, default-features = false } @@ -27,8 +24,6 @@ serde = { workspace = true, default-features = false, features = [ "alloc", "derive", ], optional = true } -typeshare = { workspace = true, optional = true } -ts-rs = { workspace = true, optional = true } [dev-dependencies] serde_json = { workspace = true } diff --git a/crates/core/README b/crates/core/README @@ -9,8 +9,7 @@ unit semantics for the `radroots` core libraries. percent, discounts, and decimals; * unit kinds, dimensions, parsing, and deterministic conversion helpers; * portable core semantics for both `std` and `no_std` builds; - * optional integration with `serde`, `typeshare`, and `ts-rs` for - serialization and cross-language type export. + * optional integration with `serde` for serialization. ## Copyright diff --git a/crates/core/build.rs b/crates/core/build.rs @@ -1,39 +0,0 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; - -fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } -} - -fn export_dir(crate_name: &str) -> PathBuf { - if let Some(export_dir) = env::var_os("RADROOTS_TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from( - env::var("CARGO_MANIFEST_DIR").expect("missing required env var CARGO_MANIFEST_DIR"), - ); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join(crate_name) -} - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - if env::var_os("CARGO_FEATURE_TS_RS").is_some() { - let out_dir = export_dir("core"); - println!("cargo:rustc-env=TS_RS_EXPORT_DIR={}", out_dir.display()); - println!("cargo:rerun-if-env-changed=RADROOTS_TS_RS_EXPORT_DIR"); - if !out_dir.exists() { - fs::create_dir_all(&out_dir).expect("create TS export dir"); - } - println!("cargo:rerun-if-changed=src"); - } -} diff --git a/crates/core/src/currency.rs b/crates/core/src/currency.rs @@ -9,12 +9,7 @@ use std::string::String; #[cfg(feature = "serde")] use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error as DeError}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts", type = "string"))] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct RadrootsCoreCurrency([u8; 3]); diff --git a/crates/core/src/decimal.rs b/crates/core/src/decimal.rs @@ -11,12 +11,7 @@ use alloc::{format, string::ToString}; #[cfg(feature = "serde")] use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error as DeError}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts", type = "string"))] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub struct RadrootsCoreDecimal(pub Decimal); diff --git a/crates/core/src/discount.rs b/crates/core/src/discount.rs @@ -2,13 +2,8 @@ use alloc::string::String; #[cfg(feature = "std")] use std::string::String; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] pub enum RadrootsCoreDiscountScope { @@ -16,10 +11,7 @@ pub enum RadrootsCoreDiscountScope { OrderTotal, } -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr( feature = "serde", @@ -30,10 +22,7 @@ pub enum RadrootsCoreDiscountThreshold { OrderQuantity { min: crate::RadrootsCoreQuantity }, } -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr( feature = "serde", @@ -44,10 +33,7 @@ pub enum RadrootsCoreDiscountValue { Percent(crate::RadrootsCorePercent), } -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] pub struct RadrootsCoreDiscount { diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs @@ -31,70 +31,3 @@ pub use unit::{ RadrootsCoreUnitParseError, convert_mass_decimal, convert_unit_decimal, convert_volume_decimal, parse_mass_unit, parse_volume_unit, }; - -#[cfg(all(test, feature = "ts-rs", feature = "std"))] -mod ts_export_tests { - use crate::{RadrootsCoreDiscount, RadrootsCoreUnitDimension}; - use std::{ - fs, - path::{Path, PathBuf}, - }; - use ts_rs::TS; - - fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } - } - - fn ts_export_dir() -> PathBuf { - if let Some(export_dir) = option_env!("TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join("core") - } - - fn export_types() { - RadrootsCoreDiscount::export_all().expect("export core ts-rs definitions"); - RadrootsCoreUnitDimension::export_all().expect("export core unit dimension definition"); - } - - #[test] - fn exports_core_types_file() { - export_types(); - let path = ts_export_dir().join("types.ts"); - let raw = fs::read_to_string(path).expect("read generated core types"); - assert!(raw.contains("export type RadrootsCoreMoney")); - assert!(raw.contains("export type RadrootsCoreQuantity")); - assert!(raw.contains("export type RadrootsCoreQuantityPrice")); - assert!(raw.contains("export type RadrootsCoreDiscount")); - } - - #[test] - fn exports_unit_literal_values() { - export_types(); - let path = ts_export_dir().join("types.ts"); - let raw = fs::read_to_string(path).expect("read generated core types"); - for literal in [ - "\"each\"", "\"kg\"", "\"g\"", "\"oz\"", "\"lb\"", "\"l\"", "\"ml\"", - ] { - assert!( - raw.contains(literal), - "missing core unit literal: {literal}" - ); - } - for literal in ["\"count\"", "\"mass\"", "\"volume\""] { - assert!( - raw.contains(literal), - "missing core unit dimension literal: {literal}" - ); - } - } -} diff --git a/crates/core/src/money.rs b/crates/core/src/money.rs @@ -2,18 +2,11 @@ use core::fmt; use rust_decimal::Decimal; use rust_decimal::RoundingStrategy; use rust_decimal::prelude::ToPrimitive; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsCoreMoney { - #[cfg_attr(feature = "ts-rs", ts(type = "string"))] pub amount: crate::RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "string"))] pub currency: crate::RadrootsCoreCurrency, } diff --git a/crates/core/src/percent.rs b/crates/core/src/percent.rs @@ -3,16 +3,10 @@ use core::str::FromStr; use crate::RadrootsCoreDecimal; use crate::money::RadrootsCoreMoney; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsCorePercent { - #[cfg_attr(feature = "ts-rs", ts(type = "string"))] #[cfg_attr(feature = "serde", serde(with = "crate::serde_ext::decimal_str"))] pub value: RadrootsCoreDecimal, } diff --git a/crates/core/src/quantity.rs b/crates/core/src/quantity.rs @@ -7,16 +7,10 @@ use crate::unit::{RadrootsCoreUnit, RadrootsCoreUnitConvertError, convert_unit_d use alloc::string::String; #[cfg(feature = "std")] use std::string::String; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsCoreQuantity { - #[cfg_attr(feature = "ts-rs", ts(type = "string"))] #[cfg_attr(feature = "serde", serde(with = "crate::serde_ext::decimal_str"))] pub amount: RadrootsCoreDecimal, pub unit: RadrootsCoreUnit, diff --git a/crates/core/src/quantity_price.rs b/crates/core/src/quantity_price.rs @@ -1,22 +1,11 @@ use crate::{RadrootsCoreDecimal, RadrootsCoreMoney, RadrootsCoreQuantity, RadrootsCoreUnit}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsCoreQuantityPrice { - #[cfg_attr( - all(feature = "serde", not(feature = "ts-rs")), - serde(alias = "money", alias = "price") - )] + #[cfg_attr(feature = "serde", serde(alias = "money", alias = "price"))] pub amount: RadrootsCoreMoney, - #[cfg_attr( - all(feature = "serde", not(feature = "ts-rs")), - serde(alias = "per", alias = "quantity") - )] + #[cfg_attr(feature = "serde", serde(alias = "per", alias = "quantity"))] pub quantity: RadrootsCoreQuantity, } diff --git a/crates/core/src/unit.rs b/crates/core/src/unit.rs @@ -10,17 +10,9 @@ use std::string::String; #[cfg(feature = "serde")] use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error as DeError}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; use crate::RadrootsCoreDecimal; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename_all = "snake_case") -)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum RadrootsCoreUnitDimension { Count, @@ -28,24 +20,14 @@ pub enum RadrootsCoreUnitDimension { Volume, } -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum RadrootsCoreUnit { - #[cfg_attr(feature = "ts-rs", ts(rename = "each"))] Each, - #[cfg_attr(feature = "ts-rs", ts(rename = "kg"))] MassKg, - #[cfg_attr(feature = "ts-rs", ts(rename = "g"))] MassG, - #[cfg_attr(feature = "ts-rs", ts(rename = "oz"))] MassOz, - #[cfg_attr(feature = "ts-rs", ts(rename = "lb"))] MassLb, - #[cfg_attr(feature = "ts-rs", ts(rename = "l"))] VolumeL, - #[cfg_attr(feature = "ts-rs", ts(rename = "ml"))] VolumeMl, } diff --git a/crates/events/Cargo.toml b/crates/events/Cargo.toml @@ -11,14 +11,11 @@ repository.workspace = true homepage.workspace = true documentation = "https://docs.rs/radroots_events" readme = "README" -build = "build.rs" [features] -default = ["std", "serde", "ts-rs", "typeshare"] +default = ["std", "serde"] std = ["radroots_core/std"] serde = ["dep:serde", "radroots_core/serde"] -ts-rs = ["dep:ts-rs"] -typeshare = ["dep:typeshare", "radroots_core/typeshare"] [dependencies] radroots_core = { workspace = true, default-features = false } @@ -26,8 +23,6 @@ serde = { workspace = true, default-features = false, features = [ "alloc", "derive", ], optional = true } -ts-rs = { workspace = true, optional = true } -typeshare = { workspace = true, optional = true } [dev-dependencies] serde_json = { workspace = true } diff --git a/crates/events/README b/crates/events/README @@ -11,8 +11,7 @@ models, kinds, and tag conventions for the `radroots` core libraries. * shared event references, pointers, and kind and tag definitions used across event-processing code; * portable event model semantics for both `std` and `no_std` builds; - * optional integration with `serde`, `typeshare`, and `ts-rs` for - serialization and cross-language type export. + * optional integration with `serde` for serialization. ## Copyright diff --git a/crates/events/build.rs b/crates/events/build.rs @@ -1,39 +0,0 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; - -fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } -} - -fn export_dir(crate_name: &str) -> PathBuf { - if let Some(export_dir) = env::var_os("RADROOTS_TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from( - env::var("CARGO_MANIFEST_DIR").expect("missing required env var CARGO_MANIFEST_DIR"), - ); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join(crate_name) -} - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - if env::var_os("CARGO_FEATURE_TS_RS").is_some() { - let out_dir = export_dir("events"); - println!("cargo:rustc-env=TS_RS_EXPORT_DIR={}", out_dir.display()); - println!("cargo:rerun-if-env-changed=RADROOTS_TS_RS_EXPORT_DIR"); - if !out_dir.exists() { - fs::create_dir_all(&out_dir).expect("create TS export dir"); - } - println!("cargo:rerun-if-changed=src"); - } -} diff --git a/crates/events/src/account.rs b/crates/events/src/account.rs @@ -1,19 +1,14 @@ use crate::kinds::KIND_ACCOUNT_CLAIM as KIND_ACCOUNT_CLAIM_EVENT; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::string::String; pub const KIND_ACCOUNT_CLAIM: u32 = KIND_ACCOUNT_CLAIM_EVENT; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsAccountClaim { pub username: String, pub pubkey: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub nip05: Option<String>, } diff --git a/crates/events/src/app_data.rs b/crates/events/src/app_data.rs @@ -1,16 +1,12 @@ #![forbid(unsafe_code)] use crate::kinds::KIND_APP_DATA as KIND_APP_DATA_EVENT; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::string::String; pub const KIND_APP_DATA: u32 = KIND_APP_DATA_EVENT; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsAppData { diff --git a/crates/events/src/comment.rs b/crates/events/src/comment.rs @@ -1,13 +1,8 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - use crate::RadrootsNostrEventRef; #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsComment { diff --git a/crates/events/src/coop.rs b/crates/events/src/coop.rs @@ -1,35 +1,23 @@ #![forbid(unsafe_code)] use crate::farm::RadrootsGcsLocation; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsCoop { pub d_tag: String, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoopLocation | null"))] pub location: Option<RadrootsCoopLocation>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub tags: Option<Vec<String>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsCoopRef { @@ -37,18 +25,12 @@ pub struct RadrootsCoopRef { pub d_tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsCoopLocation { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub country: Option<String>, pub gcs: RadrootsGcsLocation, } diff --git a/crates/events/src/document.rs b/crates/events/src/document.rs @@ -1,23 +1,15 @@ #![forbid(unsafe_code)] -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsDocumentSubject { pub pubkey: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub address: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsDocument { @@ -25,13 +17,9 @@ pub struct RadrootsDocument { pub doc_type: String, pub title: String, pub version: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub summary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub effective_at: Option<u32>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub body_markdown: Option<String>, pub subject: RadrootsDocumentSubject, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub tags: Option<Vec<String>>, } diff --git a/crates/events/src/farm.rs b/crates/events/src/farm.rs @@ -1,32 +1,19 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsFarm { pub d_tag: String, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsFarmLocation | null"))] pub location: Option<RadrootsFarmLocation>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub tags: Option<Vec<String>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default)] pub struct RadrootsFarmRef { @@ -34,8 +21,6 @@ pub struct RadrootsFarmRef { pub d_tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsGeoJsonPoint { @@ -44,8 +29,6 @@ pub struct RadrootsGeoJsonPoint { pub coordinates: [f64; 2], } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsGeoJsonPolygon { @@ -54,8 +37,6 @@ pub struct RadrootsGeoJsonPolygon { pub coordinates: Vec<Vec<[f64; 2]>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsGcsLocation { @@ -64,49 +45,28 @@ pub struct RadrootsGcsLocation { pub geohash: String, pub point: RadrootsGeoJsonPoint, pub polygon: RadrootsGeoJsonPolygon, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub accuracy: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub altitude: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub tag_0: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub area: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub elevation: Option<u32>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub soil: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub climate: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_admin1_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_admin1_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_country_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_country_name: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsFarmLocation { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub country: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsGcsLocation | null"))] pub gcs: Option<RadrootsGcsLocation>, } diff --git a/crates/events/src/follow.rs b/crates/events/src/follow.rs @@ -1,26 +1,17 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsFollow { pub list: Vec<RadrootsFollowProfile>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsFollowProfile { pub published_at: u32, pub public_key: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relay_url: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub contact_name: Option<String>, } diff --git a/crates/events/src/geochat.rs b/crates/events/src/geochat.rs @@ -1,19 +1,13 @@ #![forbid(unsafe_code)] -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsGeoChat { pub geohash: String, pub content: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub nickname: Option<String>, pub teleported: bool, } diff --git a/crates/events/src/gift_wrap.rs b/crates/events/src/gift_wrap.rs @@ -1,28 +1,19 @@ #![forbid(unsafe_code)] -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsGiftWrap { pub recipient: RadrootsGiftWrapRecipient, pub content: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub expiration: Option<u32>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsGiftWrapRecipient { pub public_key: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relay_url: Option<String>, } diff --git a/crates/events/src/job.rs b/crates/events/src/job.rs @@ -1,11 +1,6 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Debug, PartialEq, Eq, Copy)] @@ -16,8 +11,6 @@ pub enum JobInputType { Text, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Debug, PartialEq, Eq, Copy)] @@ -29,12 +22,9 @@ pub enum JobFeedbackStatus { Partial, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct JobPaymentRequest { pub amount_sat: u32, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub bolt11: Option<String>, } diff --git a/crates/events/src/job_feedback.rs b/crates/events/src/job_feedback.rs @@ -1,6 +1,3 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - use crate::{ RadrootsNostrEventPtr, job::{JobFeedbackStatus, JobPaymentRequest}, @@ -9,21 +6,15 @@ use crate::{ #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsJobFeedback { pub kind: u16, pub status: JobFeedbackStatus, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub extra_info: Option<String>, pub request_event: RadrootsNostrEventPtr, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub customer_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "JobPaymentRequest | null"))] pub payment: Option<JobPaymentRequest>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub content: Option<String>, pub encrypted: bool, } diff --git a/crates/events/src/job_request.rs b/crates/events/src/job_request.rs @@ -1,26 +1,17 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - use crate::job::JobInputType; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsJobInput { pub data: String, pub input_type: JobInputType, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relay: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub marker: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsJobParam { @@ -28,17 +19,13 @@ pub struct RadrootsJobParam { pub value: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsJobRequest { pub kind: u16, pub inputs: Vec<RadrootsJobInput>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub output: Option<String>, pub params: Vec<RadrootsJobParam>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub bid_sat: Option<u32>, pub relays: Vec<String>, pub providers: Vec<String>, diff --git a/crates/events/src/job_result.rs b/crates/events/src/job_result.rs @@ -1,26 +1,17 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - use crate::{RadrootsNostrEventPtr, job::JobPaymentRequest, job_request::RadrootsJobInput}; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsJobResult { pub kind: u16, pub request_event: RadrootsNostrEventPtr, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub request_json: Option<String>, pub inputs: Vec<RadrootsJobInput>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub customer_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "JobPaymentRequest | null"))] pub payment: Option<JobPaymentRequest>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub content: Option<String>, pub encrypted: bool, } diff --git a/crates/events/src/kinds.rs b/crates/events/src/kinds.rs @@ -398,196 +398,9 @@ pub const fn request_kind_for_result_kind(kind: u32) -> Option<u32> { } } -#[cfg(all(test, feature = "ts-rs", feature = "std"))] -mod kinds_constants_tests { +#[cfg(test)] +mod tests { use super::*; - use std::{ - fs, - path::{Path, PathBuf}, - }; - - fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } - } - - fn ts_export_dir_from(export_dir: Option<&str>) -> PathBuf { - if let Some(export_dir) = export_dir { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join("events") - } - - fn ts_export_dir() -> PathBuf { - ts_export_dir_from(option_env!("TS_RS_EXPORT_DIR")) - } - - const KIND_EXPORTS: &[(&str, u32)] = &[ - ("KIND_PROFILE", KIND_PROFILE), - ("KIND_POST", KIND_POST), - ("KIND_FOLLOW", KIND_FOLLOW), - ("KIND_REACTION", KIND_REACTION), - ("KIND_SEAL", KIND_SEAL), - ("KIND_MESSAGE", KIND_MESSAGE), - ("KIND_MESSAGE_FILE", KIND_MESSAGE_FILE), - ("KIND_GIFT_WRAP", KIND_GIFT_WRAP), - ("KIND_COMMENT", KIND_COMMENT), - ("KIND_GEOCHAT", KIND_GEOCHAT), - ("KIND_LIST_MUTE", KIND_LIST_MUTE), - ("KIND_LIST_PINNED_NOTES", KIND_LIST_PINNED_NOTES), - ("KIND_LIST_READ_WRITE_RELAYS", KIND_LIST_READ_WRITE_RELAYS), - ("KIND_LIST_BOOKMARKS", KIND_LIST_BOOKMARKS), - ("KIND_LIST_COMMUNITIES", KIND_LIST_COMMUNITIES), - ("KIND_LIST_PUBLIC_CHATS", KIND_LIST_PUBLIC_CHATS), - ("KIND_LIST_BLOCKED_RELAYS", KIND_LIST_BLOCKED_RELAYS), - ("KIND_LIST_SEARCH_RELAYS", KIND_LIST_SEARCH_RELAYS), - ("KIND_LIST_SIMPLE_GROUPS", KIND_LIST_SIMPLE_GROUPS), - ("KIND_LIST_RELAY_FEEDS", KIND_LIST_RELAY_FEEDS), - ("KIND_LIST_INTERESTS", KIND_LIST_INTERESTS), - ("KIND_LIST_MEDIA_FOLLOWS", KIND_LIST_MEDIA_FOLLOWS), - ("KIND_LIST_EMOJIS", KIND_LIST_EMOJIS), - ("KIND_LIST_DM_RELAYS", KIND_LIST_DM_RELAYS), - ("KIND_LIST_GOOD_WIKI_AUTHORS", KIND_LIST_GOOD_WIKI_AUTHORS), - ("KIND_LIST_GOOD_WIKI_RELAYS", KIND_LIST_GOOD_WIKI_RELAYS), - ("KIND_LIST_SET_FOLLOW", KIND_LIST_SET_FOLLOW), - ("KIND_LIST_SET_GENERIC", KIND_LIST_SET_GENERIC), - ("KIND_LIST_SET_RELAY", KIND_LIST_SET_RELAY), - ("KIND_LIST_SET_BOOKMARK", KIND_LIST_SET_BOOKMARK), - ("KIND_LIST_SET_CURATION", KIND_LIST_SET_CURATION), - ("KIND_LIST_SET_VIDEO", KIND_LIST_SET_VIDEO), - ("KIND_LIST_SET_PICTURE", KIND_LIST_SET_PICTURE), - ("KIND_LIST_SET_KIND_MUTE", KIND_LIST_SET_KIND_MUTE), - ("KIND_LIST_SET_INTEREST", KIND_LIST_SET_INTEREST), - ("KIND_LIST_SET_EMOJI", KIND_LIST_SET_EMOJI), - ( - "KIND_LIST_SET_RELEASE_ARTIFACT", - KIND_LIST_SET_RELEASE_ARTIFACT, - ), - ("KIND_LIST_SET_APP_CURATION", KIND_LIST_SET_APP_CURATION), - ("KIND_LIST_SET_CALENDAR", KIND_LIST_SET_CALENDAR), - ("KIND_LIST_SET_STARTER_PACK", KIND_LIST_SET_STARTER_PACK), - ( - "KIND_LIST_SET_MEDIA_STARTER_PACK", - KIND_LIST_SET_MEDIA_STARTER_PACK, - ), - ("KIND_FARM", KIND_FARM), - ("KIND_PLOT", KIND_PLOT), - ("KIND_COOP", KIND_COOP), - ("KIND_DOCUMENT", KIND_DOCUMENT), - ("KIND_RESOURCE_AREA", KIND_RESOURCE_AREA), - ("KIND_RESOURCE_HARVEST_CAP", KIND_RESOURCE_HARVEST_CAP), - ("KIND_ACCOUNT_CLAIM", KIND_ACCOUNT_CLAIM), - ("KIND_APP_DATA", KIND_APP_DATA), - ("KIND_LISTING", KIND_LISTING), - ("KIND_APPLICATION_HANDLER", KIND_APPLICATION_HANDLER), - ( - "KIND_TRADE_LISTING_VALIDATE_REQ", - KIND_TRADE_LISTING_VALIDATE_REQ, - ), - ( - "KIND_TRADE_LISTING_VALIDATE_RES", - KIND_TRADE_LISTING_VALIDATE_RES, - ), - ( - "KIND_WORKER_TRADE_TRANSITION_PROOF_REQ", - KIND_WORKER_TRADE_TRANSITION_PROOF_REQ, - ), - ( - "KIND_WORKER_TRADE_TRANSITION_PROOF_RES", - KIND_WORKER_TRADE_TRANSITION_PROOF_RES, - ), - ("KIND_TRADE_ORDER_REQUEST", KIND_TRADE_ORDER_REQUEST), - ("KIND_TRADE_ORDER_RESPONSE", KIND_TRADE_ORDER_RESPONSE), - ("KIND_TRADE_ORDER_DECISION", KIND_TRADE_ORDER_DECISION), - ("KIND_TRADE_ORDER_REVISION", KIND_TRADE_ORDER_REVISION), - ( - "KIND_TRADE_ORDER_REVISION_RESPONSE", - KIND_TRADE_ORDER_REVISION_RESPONSE, - ), - ("KIND_TRADE_QUESTION", KIND_TRADE_QUESTION), - ("KIND_TRADE_ANSWER", KIND_TRADE_ANSWER), - ("KIND_TRADE_DISCOUNT_REQUEST", KIND_TRADE_DISCOUNT_REQUEST), - ("KIND_TRADE_DISCOUNT_OFFER", KIND_TRADE_DISCOUNT_OFFER), - ("KIND_TRADE_DISCOUNT_ACCEPT", KIND_TRADE_DISCOUNT_ACCEPT), - ("KIND_TRADE_FORBIDDEN_3431", KIND_TRADE_FORBIDDEN_3431), - ("KIND_TRADE_CANCEL", KIND_TRADE_CANCEL), - ( - "KIND_TRADE_FULFILLMENT_UPDATE", - KIND_TRADE_FULFILLMENT_UPDATE, - ), - ("KIND_TRADE_RECEIPT", KIND_TRADE_RECEIPT), - ( - "KIND_TRADE_VALIDATION_RECEIPT", - KIND_TRADE_VALIDATION_RECEIPT, - ), - ("KIND_TRADE_LISTING_ORDER_REQ", KIND_TRADE_LISTING_ORDER_REQ), - ("KIND_TRADE_LISTING_ORDER_RES", KIND_TRADE_LISTING_ORDER_RES), - ( - "KIND_TRADE_LISTING_ORDER_REVISION_REQ", - KIND_TRADE_LISTING_ORDER_REVISION_REQ, - ), - ( - "KIND_TRADE_LISTING_ORDER_REVISION_RES", - KIND_TRADE_LISTING_ORDER_REVISION_RES, - ), - ( - "KIND_TRADE_LISTING_QUESTION_REQ", - KIND_TRADE_LISTING_QUESTION_REQ, - ), - ( - "KIND_TRADE_LISTING_ANSWER_RES", - KIND_TRADE_LISTING_ANSWER_RES, - ), - ( - "KIND_TRADE_LISTING_DISCOUNT_REQ", - KIND_TRADE_LISTING_DISCOUNT_REQ, - ), - ( - "KIND_TRADE_LISTING_DISCOUNT_OFFER_RES", - KIND_TRADE_LISTING_DISCOUNT_OFFER_RES, - ), - ( - "KIND_TRADE_LISTING_DISCOUNT_ACCEPT_REQ", - KIND_TRADE_LISTING_DISCOUNT_ACCEPT_REQ, - ), - ( - "KIND_TRADE_LISTING_CANCEL_REQ", - KIND_TRADE_LISTING_CANCEL_REQ, - ), - ( - "KIND_TRADE_LISTING_FULFILLMENT_UPDATE_REQ", - KIND_TRADE_LISTING_FULFILLMENT_UPDATE_REQ, - ), - ( - "KIND_TRADE_LISTING_RECEIPT_REQ", - KIND_TRADE_LISTING_RECEIPT_REQ, - ), - ("KIND_JOB_REQUEST_MIN", KIND_JOB_REQUEST_MIN), - ("KIND_JOB_REQUEST_MAX", KIND_JOB_REQUEST_MAX), - ("KIND_JOB_RESULT_MIN", KIND_JOB_RESULT_MIN), - ("KIND_JOB_RESULT_MAX", KIND_JOB_RESULT_MAX), - ("KIND_JOB_FEEDBACK", KIND_JOB_FEEDBACK), - ]; - - #[test] - fn export_kind_constants() { - let path = ts_export_dir().join("kinds.ts"); - let parent = path.parent().expect("kinds export path has parent"); - fs::create_dir_all(parent).expect("create ts export dir"); - let mut content = String::new(); - for (name, value) in KIND_EXPORTS { - content.push_str(&format!("export const {name} = {value};\n")); - } - fs::write(&path, content).expect("write kinds"); - } #[test] fn classifies_standard_list_kinds() { @@ -628,32 +441,6 @@ mod kinds_constants_tests { } #[test] - fn resolves_workspace_root_for_crates_and_non_crates_paths() { - let inside_crates = PathBuf::from("/tmp/radroots/crates/events"); - let non_crates = PathBuf::from("/tmp/radroots/events"); - assert_eq!( - workspace_root(&inside_crates), - PathBuf::from("/tmp/radroots") - ); - assert_eq!(workspace_root(&non_crates), PathBuf::from("/tmp/radroots")); - } - - #[test] - fn resolves_export_dir_for_override_and_fallback() { - let override_dir = PathBuf::from("/tmp/radroots-ts-export"); - assert_eq!( - ts_export_dir_from(Some("/tmp/radroots-ts-export")), - override_dir - ); - - let expected = workspace_root(Path::new(env!("CARGO_MANIFEST_DIR"))) - .join("target") - .join("ts-rs") - .join("events"); - assert_eq!(ts_export_dir_from(None), expected); - } - - #[test] fn classifies_trade_listing_kinds() { assert!(is_listing_kind(KIND_LISTING)); assert!(is_listing_kind(KIND_LISTING_DRAFT)); diff --git a/crates/events/src/lib.rs b/crates/events/src/lib.rs @@ -3,9 +3,6 @@ #[cfg(not(feature = "std"))] extern crate alloc; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; @@ -39,8 +36,6 @@ pub mod seal; pub mod tags; pub mod trade; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsNostrEvent { @@ -53,26 +48,19 @@ pub struct RadrootsNostrEvent { pub sig: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsNostrEventRef { pub id: String, pub author: String, pub kind: u32, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub d_tag: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub relays: Option<Vec<String>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsNostrEventPtr { pub id: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relays: Option<String>, } diff --git a/crates/events/src/list.rs b/crates/events/src/list.rs @@ -1,11 +1,6 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsList { @@ -13,8 +8,6 @@ pub struct RadrootsList { pub entries: Vec<RadrootsListEntry>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListEntry { diff --git a/crates/events/src/list_set.rs b/crates/events/src/list_set.rs @@ -1,22 +1,15 @@ use crate::list::RadrootsListEntry; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListSet { pub d_tag: String, pub content: String, pub entries: Vec<RadrootsListEntry>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub title: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub description: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub image: Option<String>, } diff --git a/crates/events/src/listing.rs b/crates/events/src/listing.rs @@ -2,8 +2,6 @@ use radroots_core::{ RadrootsCoreDecimal, RadrootsCoreDiscount, RadrootsCoreMoney, RadrootsCoreQuantity, RadrootsCoreQuantityPrice, RadrootsCoreUnit, }; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; use crate::farm::RadrootsFarmRef; use crate::plot::RadrootsPlotRef; @@ -12,8 +10,6 @@ use crate::resource_area::RadrootsResourceAreaRef; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -22,9 +18,7 @@ use alloc::{string::String, vec::Vec}; #[derive(Clone, Debug)] pub enum RadrootsListingAvailability { Window { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] start: Option<u64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] end: Option<u64>, }, Status { @@ -32,8 +26,6 @@ pub enum RadrootsListingAvailability { }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -46,8 +38,6 @@ pub enum RadrootsListingStatus { Other { value: String }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -61,8 +51,6 @@ pub enum RadrootsListingDeliveryMethod { Other { method: String }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListing { @@ -72,61 +60,27 @@ pub struct RadrootsListing { pub product: RadrootsListingProduct, pub primary_bin_id: String, pub bins: Vec<RadrootsListingBin>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsResourceAreaRef | null") - )] pub resource_area: Option<RadrootsResourceAreaRef>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsPlotRef | null"))] pub plot: Option<RadrootsPlotRef>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsCoreDiscount[] | null") - )] pub discounts: Option<Vec<RadrootsCoreDiscount>>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreDecimal | null"))] pub inventory_available: Option<RadrootsCoreDecimal>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingAvailability | null") - )] pub availability: Option<RadrootsListingAvailability>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingDeliveryMethod | null") - )] pub delivery_method: Option<RadrootsListingDeliveryMethod>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingLocation | null") - )] pub location: Option<RadrootsListingLocation>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingImage[] | null") - )] pub images: Option<Vec<RadrootsListingImage>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListingProduct { pub key: String, pub title: String, pub category: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub summary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub process: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lot: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub profile: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub year: Option<String>, } @@ -134,74 +88,40 @@ pub const RADROOTS_LISTING_PRODUCT_TAG_KEYS: [&str; 9] = [ "key", "title", "category", "summary", "process", "lot", "location", "profile", "year", ]; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - type = "readonly [\"key\", \"title\", \"category\", \"summary\", \"process\", \"lot\", \"location\", \"profile\", \"year\"]" - ) -)] pub struct RadrootsListingProductTagKeys; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListingBin { pub bin_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreQuantity"))] pub quantity: RadrootsCoreQuantity, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreQuantityPrice"))] pub price_per_canonical_unit: RadrootsCoreQuantityPrice, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreDecimal | null"))] pub display_amount: Option<RadrootsCoreDecimal>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreUnit | null"))] pub display_unit: Option<RadrootsCoreUnit>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub display_label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreMoney | null"))] pub display_price: Option<RadrootsCoreMoney>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreUnit | null"))] pub display_price_unit: Option<RadrootsCoreUnit>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListingLocation { pub primary: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub country: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub lat: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub lng: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub geohash: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListingImage { pub url: String, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingImageSize | null") - )] pub size: Option<RadrootsListingImageSize>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsListingImageSize { @@ -209,64 +129,9 @@ pub struct RadrootsListingImageSize { pub h: u32, } -#[cfg(all(test, feature = "ts-rs", feature = "std"))] -mod constants_tests { - use super::RADROOTS_LISTING_PRODUCT_TAG_KEYS; +#[cfg(all(test, feature = "std"))] +mod tests { use crate::farm::RadrootsFarmRef; - use std::{ - fs, - path::{Path, PathBuf}, - }; - - fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } - } - - fn ts_export_dir_from(export_dir: Option<&str>) -> PathBuf { - if let Some(export_dir) = export_dir { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join("events") - } - - fn ts_export_dir() -> PathBuf { - ts_export_dir_from(option_env!("TS_RS_EXPORT_DIR")) - } - - fn listing_product_tag_keys_literal() -> String { - let mut out = String::from("["); - for (idx, key) in RADROOTS_LISTING_PRODUCT_TAG_KEYS.iter().enumerate() { - if idx > 0 { - out.push_str(", "); - } - out.push('"'); - out.push_str(key); - out.push('"'); - } - out.push(']'); - out - } - - #[test] - fn export_listing_product_tag_keys_const() { - let path = ts_export_dir().join("constants.ts"); - let parent = path.parent().expect("listing export path has parent"); - fs::create_dir_all(parent).expect("create ts export dir"); - let keys = listing_product_tag_keys_literal(); - let content = format!( - "import type {{ RadrootsListingProductTagKeys }} from \"./types.js\";\n\nexport const RADROOTS_LISTING_PRODUCT_TAG_KEYS: RadrootsListingProductTagKeys = {keys};\n" - ); - fs::write(&path, content).expect("write constants"); - } #[test] fn defaults_listing_farm_ref_to_empty_values() { @@ -274,30 +139,4 @@ mod constants_tests { assert!(farm_ref.pubkey.is_empty()); assert!(farm_ref.d_tag.is_empty()); } - - #[test] - fn resolves_workspace_root_for_crates_and_non_crates_paths() { - let inside_crates = PathBuf::from("/tmp/radroots/crates/events"); - let non_crates = PathBuf::from("/tmp/radroots/events"); - assert_eq!( - workspace_root(&inside_crates), - PathBuf::from("/tmp/radroots") - ); - assert_eq!(workspace_root(&non_crates), PathBuf::from("/tmp/radroots")); - } - - #[test] - fn resolves_export_dir_for_override_and_fallback() { - let override_dir = PathBuf::from("/tmp/radroots_events-ts-export"); - assert_eq!( - ts_export_dir_from(Some("/tmp/radroots_events-ts-export")), - override_dir - ); - - let expected = workspace_root(Path::new(env!("CARGO_MANIFEST_DIR"))) - .join("target") - .join("ts-rs") - .join("events"); - assert_eq!(ts_export_dir_from(None), expected); - } } diff --git a/crates/events/src/message.rs b/crates/events/src/message.rs @@ -1,31 +1,22 @@ #![forbid(unsafe_code)] use crate::RadrootsNostrEventPtr; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsMessage { pub recipients: Vec<RadrootsMessageRecipient>, pub content: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsNostrEventPtr | null"))] pub reply_to: Option<RadrootsNostrEventPtr>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub subject: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsMessageRecipient { pub public_key: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relay_url: Option<String>, } diff --git a/crates/events/src/message_file.rs b/crates/events/src/message_file.rs @@ -2,46 +2,30 @@ use crate::RadrootsNostrEventPtr; use crate::message::RadrootsMessageRecipient; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsMessageFile { pub recipients: Vec<RadrootsMessageRecipient>, pub file_url: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsNostrEventPtr | null"))] pub reply_to: Option<RadrootsNostrEventPtr>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub subject: Option<String>, pub file_type: String, pub encryption_algorithm: String, pub decryption_key: String, pub decryption_nonce: String, pub encrypted_hash: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub original_hash: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub size: Option<u64>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsMessageFileDimensions | null") - )] pub dimensions: Option<RadrootsMessageFileDimensions>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub blurhash: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub thumb: Option<String>, pub fallbacks: Vec<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct RadrootsMessageFileDimensions { diff --git a/crates/events/src/plot.rs b/crates/events/src/plot.rs @@ -1,12 +1,8 @@ use crate::farm::{RadrootsFarmRef, RadrootsGcsLocation}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsPlotRef { @@ -14,34 +10,23 @@ pub struct RadrootsPlotRef { pub d_tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsPlot { pub d_tag: String, pub farm: RadrootsFarmRef, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsPlotLocation | null"))] pub location: Option<RadrootsPlotLocation>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub tags: Option<Vec<String>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsPlotLocation { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub country: Option<String>, pub gcs: RadrootsGcsLocation, } diff --git a/crates/events/src/post.rs b/crates/events/src/post.rs @@ -1,11 +1,6 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsPost { diff --git a/crates/events/src/profile.rs b/crates/events/src/profile.rs @@ -1,6 +1,3 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::string::String; @@ -11,8 +8,6 @@ pub const RADROOTS_PROFILE_TYPE_TAG_COOP: &str = "radroots:type:coop"; pub const RADROOTS_PROFILE_TYPE_TAG_ANY: &str = "radroots:type:any"; pub const RADROOTS_PROFILE_TYPE_TAG_RADROOTSD: &str = "radroots:type:radrootsd"; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Debug, PartialEq, Eq, Copy)] @@ -45,29 +40,18 @@ pub fn radroots_profile_type_from_tag_value(value: &str) -> Option<RadrootsProfi } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsProfile { pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub display_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub nip05: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lud06: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lud16: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub bot: Option<String>, } diff --git a/crates/events/src/reaction.rs b/crates/events/src/reaction.rs @@ -1,12 +1,8 @@ use crate::RadrootsNostrEventRef; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsReaction { diff --git a/crates/events/src/relay_document.rs b/crates/events/src/relay_document.rs @@ -1,33 +1,21 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsRelayDocument { #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub name: Option<String>, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub description: Option<String>, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub pubkey: Option<String>, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub contact: Option<String>, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number[] | null"))] pub supported_nips: Option<Vec<u16>>, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub software: Option<String>, #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub version: Option<String>, } diff --git a/crates/events/src/resource_area.rs b/crates/events/src/resource_area.rs @@ -1,28 +1,20 @@ #![forbid(unsafe_code)] use crate::farm::RadrootsGcsLocation; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsResourceArea { pub d_tag: String, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, pub location: RadrootsResourceAreaLocation, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub tags: Option<Vec<String>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsResourceAreaRef { @@ -30,18 +22,12 @@ pub struct RadrootsResourceAreaRef { pub d_tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsResourceAreaLocation { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub country: Option<String>, pub gcs: RadrootsGcsLocation, } diff --git a/crates/events/src/resource_cap.rs b/crates/events/src/resource_cap.rs @@ -3,24 +3,17 @@ use radroots_core::{RadrootsCoreDecimal, RadrootsCoreQuantity, RadrootsCoreUnit}; use crate::resource_area::RadrootsResourceAreaRef; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; #[cfg(not(feature = "std"))] use alloc::{string::String, vec::Vec}; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsResourceHarvestProduct { pub key: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub category: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsResourceHarvestCap { @@ -29,14 +22,9 @@ pub struct RadrootsResourceHarvestCap { pub product: RadrootsResourceHarvestProduct, pub start: u64, pub end: u64, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreQuantity"))] pub cap_quantity: RadrootsCoreQuantity, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreDecimal | null"))] pub display_amount: Option<RadrootsCoreDecimal>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreUnit | null"))] pub display_unit: Option<RadrootsCoreUnit>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub display_label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string[] | null"))] pub tags: Option<Vec<String>>, } diff --git a/crates/events/src/seal.rs b/crates/events/src/seal.rs @@ -1,13 +1,8 @@ #![forbid(unsafe_code)] -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsSeal { diff --git a/crates/events/src/trade.rs b/crates/events/src/trade.rs @@ -11,14 +11,10 @@ use radroots_core::{ RadrootsCoreCurrency, RadrootsCoreDecimal, RadrootsCoreDiscountValue, RadrootsCoreMoney, RadrootsCoreUnit, }; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; pub const RADROOTS_TRADE_LISTING_DOMAIN: &str = "trade:listing"; pub const RADROOTS_TRADE_ENVELOPE_VERSION: u16 = 1; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub enum RadrootsTradeListingParseError { @@ -50,8 +46,6 @@ impl core::fmt::Display for RadrootsTradeListingParseError { #[cfg(feature = "std")] impl std::error::Error for RadrootsTradeListingParseError {} -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -125,8 +119,6 @@ impl core::fmt::Display for RadrootsTradeListingValidationError { #[cfg(feature = "std")] impl std::error::Error for RadrootsTradeListingValidationError {} -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderItem { @@ -134,8 +126,6 @@ pub struct RadrootsTradeOrderItem { pub bin_count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -143,8 +133,6 @@ pub enum RadrootsTradePricingBasis { ListingEvent, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -154,8 +142,6 @@ pub enum RadrootsTradeEconomicLineKind { RevisionAdjustment, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -164,8 +150,6 @@ pub enum RadrootsTradeEconomicActor { Seller, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -174,27 +158,18 @@ pub enum RadrootsTradeEconomicEffect { Decrease, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderEconomicItem { pub bin_id: String, pub bin_count: u32, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub quantity_amount: RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreUnit"))] pub quantity_unit: RadrootsCoreUnit, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub unit_price_amount: RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreCurrency"))] pub unit_price_currency: RadrootsCoreCurrency, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub line_subtotal: RadrootsCoreMoney, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderEconomicLine { @@ -202,46 +177,32 @@ pub struct RadrootsTradeOrderEconomicLine { pub kind: RadrootsTradeEconomicLineKind, pub actor: RadrootsTradeEconomicActor, pub effect: RadrootsTradeEconomicEffect, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub amount: RadrootsCoreMoney, pub reason: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderEconomicTotals { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub subtotal: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub discount_total: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub adjustment_total: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub total: RadrootsCoreMoney, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderEconomics { pub quote_id: String, pub quote_version: u32, pub pricing_basis: RadrootsTradePricingBasis, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreCurrency"))] pub currency: RadrootsCoreCurrency, pub items: Vec<RadrootsTradeOrderEconomicItem>, pub discounts: Vec<RadrootsTradeOrderEconomicLine>, pub adjustments: Vec<RadrootsTradeOrderEconomicLine>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub subtotal: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub discount_total: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub adjustment_total: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub total: RadrootsCoreMoney, } @@ -356,8 +317,6 @@ impl RadrootsTradeOrderEconomics { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -370,8 +329,6 @@ pub enum RadrootsTradeOrderChange { ItemRemove { item_index: u32 }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderRevision { @@ -379,8 +336,6 @@ pub struct RadrootsTradeOrderRevision { pub changes: Vec<RadrootsTradeOrderChange>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Debug, PartialEq, Eq)] @@ -397,8 +352,6 @@ pub enum RadrootsTradeOrderStatus { Completed, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderRequested { @@ -422,8 +375,6 @@ impl RadrootsTradeOrderRequested { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderRevisionProposed { @@ -455,8 +406,6 @@ impl RadrootsTradeOrderRevisionProposed { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case", tag = "decision"))] #[derive(Clone, Debug, PartialEq, Eq)] @@ -474,8 +423,6 @@ impl RadrootsTradeOrderRevisionDecision { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderRevisionDecisionEvent { @@ -502,8 +449,6 @@ impl RadrootsTradeOrderRevisionDecisionEvent { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeInventoryCommitment { @@ -511,8 +456,6 @@ pub struct RadrootsTradeInventoryCommitment { pub bin_count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case", tag = "decision"))] #[derive(Clone, Debug, PartialEq, Eq)] @@ -536,8 +479,6 @@ impl RadrootsTradeOrderDecision { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderDecisionEvent { @@ -558,8 +499,6 @@ impl RadrootsTradeOrderDecisionEvent { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -579,8 +518,6 @@ impl RadrootsActiveTradeFulfillmentState { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeFulfillmentUpdated { @@ -605,8 +542,6 @@ impl RadrootsTradeFulfillmentUpdated { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderCancelled { @@ -627,8 +562,6 @@ impl RadrootsTradeOrderCancelled { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeBuyerReceipt { @@ -637,7 +570,6 @@ pub struct RadrootsTradeBuyerReceipt { pub buyer_pubkey: String, pub seller_pubkey: String, pub received: bool, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub issue: Option<String>, pub received_at: u64, } @@ -662,8 +594,6 @@ impl RadrootsTradeBuyerReceipt { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -673,8 +603,6 @@ pub enum RadrootsTradePaymentMethod { Other, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradePaymentRecorded { @@ -688,14 +616,10 @@ pub struct RadrootsTradePaymentRecorded { pub quote_id: String, pub quote_version: u32, pub economics_digest: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub amount: RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreCurrency"))] pub currency: RadrootsCoreCurrency, pub method: RadrootsTradePaymentMethod, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reference: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub paid_at: Option<u64>, } @@ -723,8 +647,6 @@ impl RadrootsTradePaymentRecorded { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -733,8 +655,6 @@ pub enum RadrootsTradeSettlementDecision { Rejected, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeSettlementDecisionEvent { @@ -749,12 +669,9 @@ pub struct RadrootsTradeSettlementDecisionEvent { pub quote_id: String, pub quote_version: u32, pub economics_digest: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub amount: RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreCurrency"))] pub currency: RadrootsCoreCurrency, pub decision: RadrootsTradeSettlementDecision, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } @@ -791,44 +708,32 @@ impl RadrootsTradeSettlementDecisionEvent { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeQuestion { pub question_id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeAnswer { pub question_id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeDiscountRequest { pub discount_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDiscountValue"))] pub value: RadrootsCoreDiscountValue, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeDiscountOffer { pub discount_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDiscountValue"))] pub value: RadrootsCoreDiscountValue, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -836,18 +741,10 @@ pub struct RadrootsTradeDiscountOffer { )] #[derive(Clone, Debug, PartialEq, Eq)] pub enum RadrootsTradeDiscountDecision { - Accept { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDiscountValue"))] - value: RadrootsCoreDiscountValue, - }, - Decline { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] - reason: Option<String>, - }, + Accept { value: RadrootsCoreDiscountValue }, + Decline { reason: Option<String> }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -862,16 +759,12 @@ pub enum RadrootsTradeFulfillmentStatus { Cancelled, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeFulfillmentUpdate { pub status: RadrootsTradeFulfillmentStatus, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeReceipt { @@ -879,56 +772,39 @@ pub struct RadrootsTradeReceipt { pub at: u64, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingValidateRequest { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsNostrEventPtr | null"))] pub listing_event: Option<RadrootsNostrEventPtr>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingValidateResult { pub valid: bool, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeListingValidationError[]"))] pub errors: Vec<RadrootsTradeListingValidationError>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderResponse { pub accepted: bool, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderRevisionResponse { pub accepted: bool, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingCancel { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -937,8 +813,6 @@ pub enum RadrootsTradeDomain { TradeListing, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -947,8 +821,6 @@ pub enum RadrootsTradeTransportLane { Public, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum RadrootsActiveTradeMessageType { @@ -1040,8 +912,6 @@ impl RadrootsActiveTradeMessageType { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -1185,8 +1055,6 @@ impl RadrootsTradeMessageType { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsActiveTradeEnvelope<T> { @@ -1259,8 +1127,6 @@ impl core::fmt::Display for RadrootsActiveTradeEnvelopeError { #[cfg(feature = "std")] impl std::error::Error for RadrootsActiveTradeEnvelopeError {} -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeEnvelope<T> { @@ -1268,7 +1134,6 @@ pub struct RadrootsTradeEnvelope<T> { pub domain: RadrootsTradeDomain, #[cfg_attr(feature = "serde", serde(rename = "type"))] pub message_type: RadrootsTradeMessageType, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub order_id: Option<String>, pub listing_addr: String, pub payload: T, @@ -1717,8 +1582,6 @@ impl core::fmt::Display for RadrootsTradeEnvelopeError { #[cfg(feature = "std")] impl std::error::Error for RadrootsTradeEnvelopeError {} -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", diff --git a/crates/events_indexed/Cargo.toml b/crates/events_indexed/Cargo.toml @@ -13,9 +13,8 @@ documentation = "https://docs.rs/radroots_events_indexed" readme = "README" [features] -default = ["serde", "typeshare"] +default = ["serde"] serde = ["dep:serde"] -typeshare = ["dep:typeshare"] std = [] [dependencies] @@ -23,7 +22,6 @@ serde = { workspace = true, default-features = false, features = [ "alloc", "derive", ], optional = true } -typeshare = { workspace = true, optional = true } [dev-dependencies] serde_json = { workspace = true } diff --git a/crates/events_indexed/README b/crates/events_indexed/README @@ -8,8 +8,7 @@ manifest and checkpoint models for the `radroots` core libraries. * manifest and checkpoint value types for indexed event shards; * shard identifiers, id ranges, and shard metadata validation helpers; * portable model semantics for both `std` and `no_std` builds; - * optional integration with `serde` and `typeshare` for serialization and - shared type export. + * optional integration with `serde` for serialization. ## Copyright diff --git a/crates/events_indexed/src/checkpoint.rs b/crates/events_indexed/src/checkpoint.rs @@ -4,7 +4,6 @@ use alloc::{string::String, vec::Vec}; use crate::types::RadrootsEventsIndexedShardId; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsEventsIndexedShardCheckpoint { @@ -18,7 +17,6 @@ pub struct RadrootsEventsIndexedShardCheckpoint { pub cursor: Option<String>, } -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsEventsIndexedIndexCheckpoint { diff --git a/crates/events_indexed/src/manifest.rs b/crates/events_indexed/src/manifest.rs @@ -3,7 +3,6 @@ use alloc::{string::String, vec::Vec}; use core::fmt; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsEventsIndexedShardMetadata { @@ -16,7 +15,6 @@ pub struct RadrootsEventsIndexedShardMetadata { pub sha256: String, } -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsEventsIndexedManifest { diff --git a/crates/events_indexed/src/types.rs b/crates/events_indexed/src/types.rs @@ -1,12 +1,10 @@ #[cfg(not(feature = "std"))] use alloc::string::String; -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct RadrootsEventsIndexedShardId(pub String); -#[cfg_attr(feature = "typeshare", typeshare::typeshare)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsEventsIndexedIdRange { diff --git a/crates/identity/Cargo.toml b/crates/identity/Cargo.toml @@ -11,7 +11,6 @@ repository.workspace = true homepage.workspace = true documentation = "https://docs.rs/radroots_identity" readme = "README" -build = "build.rs" [features] default = ["std", "profile", "json-file", "nip49"] @@ -25,7 +24,6 @@ json-file = ["std", "dep:radroots_runtime"] nip49 = ["std", "nostr/nip49"] secrecy = ["dep:secrecy"] zeroize = ["dep:zeroize"] -ts-rs = ["dep:ts-rs"] [dependencies] radroots_runtime = { workspace = true, optional = true } @@ -45,7 +43,6 @@ serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } tracing = { workspace = true } -ts-rs = { workspace = true, optional = true } zeroize = { workspace = true, optional = true } [dev-dependencies] diff --git a/crates/identity/README b/crates/identity/README @@ -11,8 +11,8 @@ libraries. * default identity path constants and JSON file support behind feature flags; * encrypted identity-file and public-profile storage helpers for local runtime consumers; - * optional NIP-49, `secrecy`, `zeroize`, and `ts-rs` support for protected key - material and shared model export. + * optional NIP-49, `secrecy`, and `zeroize` support for protected key + material. ## Copyright diff --git a/crates/identity/build.rs b/crates/identity/build.rs @@ -1,39 +0,0 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; - -fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } -} - -fn export_dir(crate_name: &str) -> PathBuf { - if let Some(export_dir) = env::var_os("RADROOTS_TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from( - env::var("CARGO_MANIFEST_DIR").expect("missing required env var CARGO_MANIFEST_DIR"), - ); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join(crate_name) -} - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - if env::var_os("CARGO_FEATURE_TS_RS").is_some() { - let out_dir = export_dir("identity"); - println!("cargo:rustc-env=TS_RS_EXPORT_DIR={}", out_dir.display()); - println!("cargo:rerun-if-env-changed=RADROOTS_TS_RS_EXPORT_DIR"); - if !out_dir.exists() { - fs::create_dir_all(&out_dir).expect("create TS export dir"); - } - println!("cargo:rerun-if-changed=src"); - } -} diff --git a/crates/identity/src/username.rs b/crates/identity/src/username.rs @@ -89,47 +89,3 @@ mod tests { assert_eq!(radroots_username_normalize(" "), None); } } - -#[cfg(all(test, feature = "ts-rs", feature = "std"))] -mod constants_tests { - use super::*; - use std::{ - fs, - path::{Path, PathBuf}, - }; - - fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } - } - - fn ts_export_dir() -> PathBuf { - if let Some(export_dir) = option_env!("TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join("identity") - } - - #[test] - fn export_username_constants() { - let path = ts_export_dir().join("constants.ts"); - if let Some(parent) = path.parent() { - fs::create_dir_all(parent).expect("create ts export dir"); - } - let content = format!( - "export const RADROOTS_USERNAME_MIN_LEN = {min_len};\nexport const RADROOTS_USERNAME_MAX_LEN = {max_len};\nexport const RADROOTS_USERNAME_REGEX = \"{regex}\";\n", - min_len = RADROOTS_USERNAME_MIN_LEN, - max_len = RADROOTS_USERNAME_MAX_LEN, - regex = RADROOTS_USERNAME_REGEX - ); - fs::write(&path, content).expect("write constants"); - } -} diff --git a/crates/net/Cargo.toml b/crates/net/Cargo.toml @@ -36,7 +36,6 @@ fs-persistence = ["std", "dep:radroots_runtime_paths"] radroots_events = { workspace = true, optional = true, default-features = true, features = [ "std", "serde", - "typeshare", ] } radroots_log = { workspace = true, features = ["std"] } radroots_nostr_accounts = { workspace = true, optional = true, default-features = true } diff --git a/crates/replica_db_schema/Cargo.toml b/crates/replica_db_schema/Cargo.toml @@ -11,17 +11,14 @@ repository.workspace = true homepage.workspace = true documentation = "https://docs.rs/radroots_replica_db_schema" readme = "README" -build = "build.rs" [lib] crate-type = ["rlib"] [features] default = [] -ts-rs = ["dep:ts-rs"] [dependencies] serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } -ts-rs = { workspace = true, optional = true } radroots_types = { workspace = true } diff --git a/crates/replica_db_schema/README b/crates/replica_db_schema/README @@ -7,8 +7,7 @@ schema models for the `radroots` core libraries. * schema model types reexported from the `models` module; * table- and record-oriented value types shared by replica database code; - * optional serialization and shared type export support through `serde`, - `typeshare`, and `ts-rs`; + * optional serialization support through `serde`; * no runtime backend logic beyond the shared schema model layer. ## Copyright diff --git a/crates/replica_db_schema/build.rs b/crates/replica_db_schema/build.rs @@ -1,39 +0,0 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; - -fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } -} - -fn export_dir(crate_name: &str) -> PathBuf { - if let Some(export_dir) = env::var_os("RADROOTS_TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from( - env::var("CARGO_MANIFEST_DIR").expect("missing required env var CARGO_MANIFEST_DIR"), - ); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join(crate_name) -} - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - if env::var_os("CARGO_FEATURE_TS_RS").is_some() { - let out_dir = export_dir("replica-db-schema"); - println!("cargo:rustc-env=TS_RS_EXPORT_DIR={}", out_dir.display()); - println!("cargo:rerun-if-env-changed=RADROOTS_TS_RS_EXPORT_DIR"); - if !out_dir.exists() { - fs::create_dir_all(&out_dir).expect("create TS export dir"); - } - println!("cargo:rerun-if-changed=src"); - } -} diff --git a/crates/replica_db_schema/src/models/farm.rs b/crates/replica_db_schema/src/models/farm.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct Farm { pub id: String, @@ -24,95 +20,54 @@ pub struct Farm { pub location_country: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmFields { pub d_tag: String, pub pubkey: String, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_country: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub d_tag: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub pubkey: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_primary: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_city: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_region: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_country: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub d_tag: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_country: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum FarmQueryBindValues { @@ -145,126 +100,39 @@ impl FarmQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmCreate", - type = "IFarmFields" - ) -)] pub struct IFarmCreateTs; pub type IFarmCreate = IFarmFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmCreateResolve", - type = "IResult<Farm>" - ) -)] pub struct IFarmCreateResolveTs; pub type IFarmCreateResolve = IResult<Farm>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IFarmFindOneArgs { pub on: FarmQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IFarmFindOne { On(IFarmFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmFindOneResolve", - type = "IResult<Farm>" - ) -)] pub struct IFarmFindOneResolveTs; pub type IFarmFindOneResolve = IResult<Option<Farm>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IFarmFindManyArgs { pub filter: Option<IFarmFieldsFilter>, } pub type IFarmFindMany = IFarmFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmFindManyResolve", - type = "IResultList<Farm>" - ) -)] pub struct IFarmFindManyResolveTs; pub type IFarmFindManyResolve = IResultList<Farm>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmDelete", - type = "IFarmFindOne" - ) -)] pub struct IFarmDeleteTs; pub type IFarmDelete = IFarmFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IFarmDeleteResolveTs; pub type IFarmDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IFarmUpdateArgs { pub on: FarmQueryBindValues, pub fields: IFarmFieldsPartial, } pub type IFarmUpdate = IFarmUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmUpdateResolve", - type = "IResult<Farm>" - ) -)] pub struct IFarmUpdateResolveTs; pub type IFarmUpdateResolve = IResult<Farm>; diff --git a/crates/replica_db_schema/src/models/farm_gcs_location.rs b/crates/replica_db_schema/src/models/farm_gcs_location.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct FarmGcsLocation { pub id: String, @@ -16,8 +12,6 @@ pub struct FarmGcsLocation { pub role: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmGcsLocationFields { pub farm_id: String, @@ -25,38 +19,23 @@ pub struct IFarmGcsLocationFields { pub role: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmGcsLocationFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gcs_location_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub role: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmGcsLocationFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub farm_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gcs_location_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub role: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum FarmGcsLocationQueryBindValues { @@ -91,126 +70,39 @@ impl FarmGcsLocationQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationCreate", - type = "IFarmGcsLocationFields" - ) -)] pub struct IFarmGcsLocationCreateTs; pub type IFarmGcsLocationCreate = IFarmGcsLocationFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationCreateResolve", - type = "IResult<FarmGcsLocation>" - ) -)] pub struct IFarmGcsLocationCreateResolveTs; pub type IFarmGcsLocationCreateResolve = IResult<FarmGcsLocation>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IFarmGcsLocationFindOneArgs { pub on: FarmGcsLocationQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmGcsLocationFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IFarmGcsLocationFindOne { On(IFarmGcsLocationFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationFindOneResolve", - type = "IResult<FarmGcsLocation>" - ) -)] pub struct IFarmGcsLocationFindOneResolveTs; pub type IFarmGcsLocationFindOneResolve = IResult<Option<FarmGcsLocation>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmGcsLocationFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IFarmGcsLocationFindManyArgs { pub filter: Option<IFarmGcsLocationFieldsFilter>, } pub type IFarmGcsLocationFindMany = IFarmGcsLocationFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationFindManyResolve", - type = "IResultList<FarmGcsLocation>" - ) -)] pub struct IFarmGcsLocationFindManyResolveTs; pub type IFarmGcsLocationFindManyResolve = IResultList<FarmGcsLocation>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationDelete", - type = "IFarmGcsLocationFindOne" - ) -)] pub struct IFarmGcsLocationDeleteTs; pub type IFarmGcsLocationDelete = IFarmGcsLocationFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IFarmGcsLocationDeleteResolveTs; pub type IFarmGcsLocationDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmGcsLocationUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IFarmGcsLocationUpdateArgs { pub on: FarmGcsLocationQueryBindValues, pub fields: IFarmGcsLocationFieldsPartial, } pub type IFarmGcsLocationUpdate = IFarmGcsLocationUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmGcsLocationUpdateResolve", - type = "IResult<FarmGcsLocation>" - ) -)] pub struct IFarmGcsLocationUpdateResolveTs; pub type IFarmGcsLocationUpdateResolve = IResult<FarmGcsLocation>; diff --git a/crates/replica_db_schema/src/models/farm_member.rs b/crates/replica_db_schema/src/models/farm_member.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct FarmMember { pub id: String, @@ -16,8 +12,6 @@ pub struct FarmMember { pub role: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmMemberFields { pub farm_id: String, @@ -25,38 +19,23 @@ pub struct IFarmMemberFields { pub role: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmMemberFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub member_pubkey: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub role: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmMemberFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub farm_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub member_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub role: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum FarmMemberQueryBindValues { @@ -91,126 +70,39 @@ impl FarmMemberQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberCreate", - type = "IFarmMemberFields" - ) -)] pub struct IFarmMemberCreateTs; pub type IFarmMemberCreate = IFarmMemberFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberCreateResolve", - type = "IResult<FarmMember>" - ) -)] pub struct IFarmMemberCreateResolveTs; pub type IFarmMemberCreateResolve = IResult<FarmMember>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IFarmMemberFindOneArgs { pub on: FarmMemberQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmMemberFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IFarmMemberFindOne { On(IFarmMemberFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberFindOneResolve", - type = "IResult<FarmMember>" - ) -)] pub struct IFarmMemberFindOneResolveTs; pub type IFarmMemberFindOneResolve = IResult<Option<FarmMember>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmMemberFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IFarmMemberFindManyArgs { pub filter: Option<IFarmMemberFieldsFilter>, } pub type IFarmMemberFindMany = IFarmMemberFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberFindManyResolve", - type = "IResultList<FarmMember>" - ) -)] pub struct IFarmMemberFindManyResolveTs; pub type IFarmMemberFindManyResolve = IResultList<FarmMember>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberDelete", - type = "IFarmMemberFindOne" - ) -)] pub struct IFarmMemberDeleteTs; pub type IFarmMemberDelete = IFarmMemberFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IFarmMemberDeleteResolveTs; pub type IFarmMemberDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmMemberUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IFarmMemberUpdateArgs { pub on: FarmMemberQueryBindValues, pub fields: IFarmMemberFieldsPartial, } pub type IFarmMemberUpdate = IFarmMemberUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberUpdateResolve", - type = "IResult<FarmMember>" - ) -)] pub struct IFarmMemberUpdateResolveTs; pub type IFarmMemberUpdateResolve = IResult<FarmMember>; diff --git a/crates/replica_db_schema/src/models/farm_member_claim.rs b/crates/replica_db_schema/src/models/farm_member_claim.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct FarmMemberClaim { pub id: String, @@ -15,42 +11,27 @@ pub struct FarmMemberClaim { pub farm_pubkey: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmMemberClaimFields { pub member_pubkey: String, pub farm_pubkey: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmMemberClaimFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub member_pubkey: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_pubkey: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmMemberClaimFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub member_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub farm_pubkey: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum FarmMemberClaimQueryBindValues { @@ -85,126 +66,39 @@ impl FarmMemberClaimQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimCreate", - type = "IFarmMemberClaimFields" - ) -)] pub struct IFarmMemberClaimCreateTs; pub type IFarmMemberClaimCreate = IFarmMemberClaimFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimCreateResolve", - type = "IResult<FarmMemberClaim>" - ) -)] pub struct IFarmMemberClaimCreateResolveTs; pub type IFarmMemberClaimCreateResolve = IResult<FarmMemberClaim>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IFarmMemberClaimFindOneArgs { pub on: FarmMemberClaimQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmMemberClaimFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IFarmMemberClaimFindOne { On(IFarmMemberClaimFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimFindOneResolve", - type = "IResult<FarmMemberClaim>" - ) -)] pub struct IFarmMemberClaimFindOneResolveTs; pub type IFarmMemberClaimFindOneResolve = IResult<Option<FarmMemberClaim>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmMemberClaimFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IFarmMemberClaimFindManyArgs { pub filter: Option<IFarmMemberClaimFieldsFilter>, } pub type IFarmMemberClaimFindMany = IFarmMemberClaimFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimFindManyResolve", - type = "IResultList<FarmMemberClaim>" - ) -)] pub struct IFarmMemberClaimFindManyResolveTs; pub type IFarmMemberClaimFindManyResolve = IResultList<FarmMemberClaim>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimDelete", - type = "IFarmMemberClaimFindOne" - ) -)] pub struct IFarmMemberClaimDeleteTs; pub type IFarmMemberClaimDelete = IFarmMemberClaimFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IFarmMemberClaimDeleteResolveTs; pub type IFarmMemberClaimDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmMemberClaimUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IFarmMemberClaimUpdateArgs { pub on: FarmMemberClaimQueryBindValues, pub fields: IFarmMemberClaimFieldsPartial, } pub type IFarmMemberClaimUpdate = IFarmMemberClaimUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmMemberClaimUpdateResolve", - type = "IResult<FarmMemberClaim>" - ) -)] pub struct IFarmMemberClaimUpdateResolveTs; pub type IFarmMemberClaimUpdateResolve = IResult<FarmMemberClaim>; diff --git a/crates/replica_db_schema/src/models/farm_tag.rs b/crates/replica_db_schema/src/models/farm_tag.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct FarmTag { pub id: String, @@ -15,42 +11,27 @@ pub struct FarmTag { pub tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmTagFields { pub farm_id: String, pub tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmTagFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub tag: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IFarmTagFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub farm_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub tag: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum FarmTagQueryBindValues { @@ -83,126 +64,39 @@ impl FarmTagQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagCreate", - type = "IFarmTagFields" - ) -)] pub struct IFarmTagCreateTs; pub type IFarmTagCreate = IFarmTagFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagCreateResolve", - type = "IResult<FarmTag>" - ) -)] pub struct IFarmTagCreateResolveTs; pub type IFarmTagCreateResolve = IResult<FarmTag>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IFarmTagFindOneArgs { pub on: FarmTagQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmTagFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IFarmTagFindOne { On(IFarmTagFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagFindOneResolve", - type = "IResult<FarmTag>" - ) -)] pub struct IFarmTagFindOneResolveTs; pub type IFarmTagFindOneResolve = IResult<Option<FarmTag>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmTagFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IFarmTagFindManyArgs { pub filter: Option<IFarmTagFieldsFilter>, } pub type IFarmTagFindMany = IFarmTagFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagFindManyResolve", - type = "IResultList<FarmTag>" - ) -)] pub struct IFarmTagFindManyResolveTs; pub type IFarmTagFindManyResolve = IResultList<FarmTag>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagDelete", - type = "IFarmTagFindOne" - ) -)] pub struct IFarmTagDeleteTs; pub type IFarmTagDelete = IFarmTagFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IFarmTagDeleteResolveTs; pub type IFarmTagDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IFarmTagUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IFarmTagUpdateArgs { pub on: FarmTagQueryBindValues, pub fields: IFarmTagFieldsPartial, } pub type IFarmTagUpdate = IFarmTagUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IFarmTagUpdateResolve", - type = "IResult<FarmTag>" - ) -)] pub struct IFarmTagUpdateResolveTs; pub type IFarmTagUpdateResolve = IResult<FarmTag>; diff --git a/crates/replica_db_schema/src/models/gcs_location.rs b/crates/replica_db_schema/src/models/gcs_location.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct GcsLocation { pub id: String, @@ -33,8 +29,6 @@ pub struct GcsLocation { pub gc_country_name: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IGcsLocationFields { pub d_tag: String, @@ -43,136 +37,73 @@ pub struct IGcsLocationFields { pub geohash: String, pub point: String, pub polygon: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub accuracy: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub altitude: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub tag_0: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub area: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub elevation: Option<u32>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub soil: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub climate: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_admin1_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_admin1_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_country_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_country_name: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IGcsLocationFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub d_tag: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub lat: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub lng: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub geohash: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub point: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub polygon: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub accuracy: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub altitude: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub tag_0: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub label: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub area: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub elevation: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub soil: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub climate: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_admin1_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_admin1_name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_country_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gc_country_name: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IGcsLocationFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub d_tag: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub lat: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub lng: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub geohash: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub point: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub polygon: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub accuracy: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub altitude: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub tag_0: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub area: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub elevation: Option<u32>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub soil: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub climate: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gc_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gc_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gc_admin1_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gc_admin1_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gc_country_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gc_country_name: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum GcsLocationQueryBindValues { @@ -205,29 +136,21 @@ impl GcsLocationQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct GcsLocationTradeProductArgs { pub id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct GcsLocationFarmArgs { pub id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct GcsLocationPlotArgs { pub id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub enum GcsLocationFindManyRel { #[serde(rename = "on_trade_product")] @@ -244,49 +167,20 @@ pub enum GcsLocationFindManyRel { OffPlot(GcsLocationPlotArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationCreate", - type = "IGcsLocationFields" - ) -)] pub struct IGcsLocationCreateTs; pub type IGcsLocationCreate = IGcsLocationFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationCreateResolve", - type = "IResult<GcsLocation>" - ) -)] pub struct IGcsLocationCreateResolveTs; pub type IGcsLocationCreateResolve = IResult<GcsLocation>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IGcsLocationFindOneArgs { pub on: GcsLocationQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IGcsLocationFindOneRelArgs { pub rel: GcsLocationFindManyRel, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IGcsLocationFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IGcsLocationFindOne { @@ -294,23 +188,8 @@ pub enum IGcsLocationFindOne { Rel(IGcsLocationFindOneRelArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationFindOneResolve", - type = "IResult<GcsLocation>" - ) -)] pub struct IGcsLocationFindOneResolveTs; pub type IGcsLocationFindOneResolve = IResult<Option<GcsLocation>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IGcsLocationFindMany") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IGcsLocationFindMany { @@ -321,62 +200,17 @@ pub enum IGcsLocationFindMany { rel: GcsLocationFindManyRel, }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationFindManyResolve", - type = "IResultList<GcsLocation>" - ) -)] pub struct IGcsLocationFindManyResolveTs; pub type IGcsLocationFindManyResolve = IResultList<GcsLocation>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationDelete", - type = "IGcsLocationFindOne" - ) -)] pub struct IGcsLocationDeleteTs; pub type IGcsLocationDelete = IGcsLocationFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IGcsLocationDeleteResolveTs; pub type IGcsLocationDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IGcsLocationUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IGcsLocationUpdateArgs { pub on: GcsLocationQueryBindValues, pub fields: IGcsLocationFieldsPartial, } pub type IGcsLocationUpdate = IGcsLocationUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IGcsLocationUpdateResolve", - type = "IResult<GcsLocation>" - ) -)] pub struct IGcsLocationUpdateResolveTs; pub type IGcsLocationUpdateResolve = IResult<GcsLocation>; diff --git a/crates/replica_db_schema/src/models/log_error.rs b/crates/replica_db_schema/src/models/log_error.rs @@ -1,10 +1,6 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct LogError { pub id: String, @@ -19,72 +15,42 @@ pub struct LogError { pub nostr_pubkey: String, pub data: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ILogErrorFields { pub error: String, pub message: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub stack_trace: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub cause: Option<String>, pub app_system: String, pub app_version: String, pub nostr_pubkey: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub data: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ILogErrorFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub error: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub message: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub stack_trace: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub cause: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub app_system: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub app_version: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub nostr_pubkey: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub data: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ILogErrorFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub error: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub message: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub stack_trace: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub cause: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub app_system: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub app_version: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub nostr_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub data: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum LogErrorQueryBindValues { @@ -115,126 +81,39 @@ impl LogErrorQueryBindValues { } } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorCreate", - type = "ILogErrorFields" - ) -)] pub struct ILogErrorCreateTs; pub type ILogErrorCreate = ILogErrorFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorCreateResolve", - type = "IResult<LogError>" - ) -)] pub struct ILogErrorCreateResolveTs; pub type ILogErrorCreateResolve = IResult<LogError>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct ILogErrorFindOneArgs { pub on: LogErrorQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "ILogErrorFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum ILogErrorFindOne { On(ILogErrorFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorFindOneResolve", - type = "IResult<LogError>" - ) -)] pub struct ILogErrorFindOneResolveTs; pub type ILogErrorFindOneResolve = IResult<Option<LogError>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "ILogErrorFindMany") -)] #[derive(Deserialize, Serialize)] pub struct ILogErrorFindManyArgs { pub filter: Option<ILogErrorFieldsFilter>, } pub type ILogErrorFindMany = ILogErrorFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorFindManyResolve", - type = "IResultList<LogError>" - ) -)] pub struct ILogErrorFindManyResolveTs; pub type ILogErrorFindManyResolve = IResultList<LogError>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorDelete", - type = "ILogErrorFindOne" - ) -)] pub struct ILogErrorDeleteTs; pub type ILogErrorDelete = ILogErrorFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorDeleteResolve", - type = "IResult<string>" - ) -)] pub struct ILogErrorDeleteResolveTs; pub type ILogErrorDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "ILogErrorUpdate") -)] #[derive(Deserialize, Serialize)] pub struct ILogErrorUpdateArgs { pub on: LogErrorQueryBindValues, pub fields: ILogErrorFieldsPartial, } pub type ILogErrorUpdate = ILogErrorUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ILogErrorUpdateResolve", - type = "IResult<LogError>" - ) -)] pub struct ILogErrorUpdateResolveTs; pub type ILogErrorUpdateResolve = IResult<LogError>; diff --git a/crates/replica_db_schema/src/models/media_image.rs b/crates/replica_db_schema/src/models/media_image.rs @@ -1,10 +1,6 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct MediaImage { pub id: String, @@ -17,61 +13,36 @@ pub struct MediaImage { pub label: Option<String>, pub description: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IMediaImageFields { pub file_path: String, pub mime_type: String, pub res_base: String, pub res_path: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub description: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IMediaImageFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub file_path: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub mime_type: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub res_base: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub res_path: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub label: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub description: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IMediaImageFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub file_path: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub mime_type: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub res_base: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub res_path: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub description: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum MediaImageQueryBindValues { @@ -100,15 +71,11 @@ impl MediaImageQueryBindValues { } } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct MediaImageTradeProductArgs { pub id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub enum MediaImageFindManyRel { #[serde(rename = "on_trade_product")] @@ -117,49 +84,20 @@ pub enum MediaImageFindManyRel { OffTradeProduct(MediaImageTradeProductArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageCreate", - type = "IMediaImageFields" - ) -)] pub struct IMediaImageCreateTs; pub type IMediaImageCreate = IMediaImageFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageCreateResolve", - type = "IResult<MediaImage>" - ) -)] pub struct IMediaImageCreateResolveTs; pub type IMediaImageCreateResolve = IResult<MediaImage>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IMediaImageFindOneArgs { pub on: MediaImageQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IMediaImageFindOneRelArgs { pub rel: MediaImageFindManyRel, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IMediaImageFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IMediaImageFindOne { @@ -167,23 +105,8 @@ pub enum IMediaImageFindOne { Rel(IMediaImageFindOneRelArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageFindOneResolve", - type = "IResult<MediaImage>" - ) -)] pub struct IMediaImageFindOneResolveTs; pub type IMediaImageFindOneResolve = IResult<Option<MediaImage>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IMediaImageFindMany") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IMediaImageFindMany { @@ -194,62 +117,17 @@ pub enum IMediaImageFindMany { rel: MediaImageFindManyRel, }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageFindManyResolve", - type = "IResultList<MediaImage>" - ) -)] pub struct IMediaImageFindManyResolveTs; pub type IMediaImageFindManyResolve = IResultList<MediaImage>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageDelete", - type = "IMediaImageFindOne" - ) -)] pub struct IMediaImageDeleteTs; pub type IMediaImageDelete = IMediaImageFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IMediaImageDeleteResolveTs; pub type IMediaImageDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IMediaImageUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IMediaImageUpdateArgs { pub on: MediaImageQueryBindValues, pub fields: IMediaImageFieldsPartial, } pub type IMediaImageUpdate = IMediaImageUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IMediaImageUpdateResolve", - type = "IResult<MediaImage>" - ) -)] pub struct IMediaImageUpdateResolveTs; pub type IMediaImageUpdateResolve = IResult<MediaImage>; diff --git a/crates/replica_db_schema/src/models/nostr_event_state.rs b/crates/replica_db_schema/src/models/nostr_event_state.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct NostrEventState { pub id: String, @@ -20,8 +16,6 @@ pub struct NostrEventState { pub content_hash: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrEventStateFields { pub key: String, @@ -33,54 +27,31 @@ pub struct INostrEventStateFields { pub content_hash: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrEventStateFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub key: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub kind: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub pubkey: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub d_tag: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub last_event_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub last_created_at: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub content_hash: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrEventStateFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub key: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub kind: Option<u32>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub d_tag: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub last_event_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub last_created_at: Option<u32>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub content_hash: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum NostrEventStateQueryBindValues { @@ -110,126 +81,39 @@ impl NostrEventStateQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateCreate", - type = "INostrEventStateFields" - ) -)] pub struct INostrEventStateCreateTs; pub type INostrEventStateCreate = INostrEventStateFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateCreateResolve", - type = "IResult<NostrEventState>" - ) -)] pub struct INostrEventStateCreateResolveTs; pub type INostrEventStateCreateResolve = IResult<NostrEventState>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct INostrEventStateFindOneArgs { pub on: NostrEventStateQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrEventStateFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum INostrEventStateFindOne { On(INostrEventStateFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateFindOneResolve", - type = "IResult<NostrEventState>" - ) -)] pub struct INostrEventStateFindOneResolveTs; pub type INostrEventStateFindOneResolve = IResult<Option<NostrEventState>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrEventStateFindMany") -)] #[derive(Deserialize, Serialize)] pub struct INostrEventStateFindManyArgs { pub filter: Option<INostrEventStateFieldsFilter>, } pub type INostrEventStateFindMany = INostrEventStateFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateFindManyResolve", - type = "IResultList<NostrEventState>" - ) -)] pub struct INostrEventStateFindManyResolveTs; pub type INostrEventStateFindManyResolve = IResultList<NostrEventState>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateDelete", - type = "INostrEventStateFindOne" - ) -)] pub struct INostrEventStateDeleteTs; pub type INostrEventStateDelete = INostrEventStateFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateDeleteResolve", - type = "IResult<string>" - ) -)] pub struct INostrEventStateDeleteResolveTs; pub type INostrEventStateDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrEventStateUpdate") -)] #[derive(Deserialize, Serialize)] pub struct INostrEventStateUpdateArgs { pub on: NostrEventStateQueryBindValues, pub fields: INostrEventStateFieldsPartial, } pub type INostrEventStateUpdate = INostrEventStateUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrEventStateUpdateResolve", - type = "IResult<NostrEventState>" - ) -)] pub struct INostrEventStateUpdateResolveTs; pub type INostrEventStateUpdateResolve = IResult<NostrEventState>; diff --git a/crates/replica_db_schema/src/models/nostr_profile.rs b/crates/replica_db_schema/src/models/nostr_profile.rs @@ -1,10 +1,6 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct NostrProfile { pub id: String, @@ -22,92 +18,51 @@ pub struct NostrProfile { pub lud06: Option<String>, pub lud16: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrProfileFields { pub public_key: String, pub profile_type: String, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub display_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub nip05: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lud06: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lud16: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrProfileFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub public_key: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub profile_type: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub display_name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub website: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub picture: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub banner: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub nip05: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lud06: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lud16: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrProfileFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub public_key: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub profile_type: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub display_name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub website: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub picture: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub banner: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub nip05: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub lud06: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub lud16: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum NostrProfileQueryBindValues { @@ -136,15 +91,11 @@ impl NostrProfileQueryBindValues { } } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct NostrProfileRelayArgs { pub id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub enum NostrProfileFindManyRel { #[serde(rename = "on_relay")] @@ -153,49 +104,20 @@ pub enum NostrProfileFindManyRel { OffRelay(NostrProfileRelayArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileCreate", - type = "INostrProfileFields" - ) -)] pub struct INostrProfileCreateTs; pub type INostrProfileCreate = INostrProfileFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileCreateResolve", - type = "IResult<NostrProfile>" - ) -)] pub struct INostrProfileCreateResolveTs; pub type INostrProfileCreateResolve = IResult<NostrProfile>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct INostrProfileFindOneArgs { pub on: NostrProfileQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct INostrProfileFindOneRelArgs { pub rel: NostrProfileFindManyRel, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrProfileFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum INostrProfileFindOne { @@ -203,23 +125,8 @@ pub enum INostrProfileFindOne { Rel(INostrProfileFindOneRelArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileFindOneResolve", - type = "IResult<NostrProfile>" - ) -)] pub struct INostrProfileFindOneResolveTs; pub type INostrProfileFindOneResolve = IResult<Option<NostrProfile>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrProfileFindMany") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum INostrProfileFindMany { @@ -230,62 +137,17 @@ pub enum INostrProfileFindMany { rel: NostrProfileFindManyRel, }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileFindManyResolve", - type = "IResultList<NostrProfile>" - ) -)] pub struct INostrProfileFindManyResolveTs; pub type INostrProfileFindManyResolve = IResultList<NostrProfile>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileDelete", - type = "INostrProfileFindOne" - ) -)] pub struct INostrProfileDeleteTs; pub type INostrProfileDelete = INostrProfileFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileDeleteResolve", - type = "IResult<string>" - ) -)] pub struct INostrProfileDeleteResolveTs; pub type INostrProfileDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrProfileUpdate") -)] #[derive(Deserialize, Serialize)] pub struct INostrProfileUpdateArgs { pub on: NostrProfileQueryBindValues, pub fields: INostrProfileFieldsPartial, } pub type INostrProfileUpdate = INostrProfileUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileUpdateResolve", - type = "IResult<NostrProfile>" - ) -)] pub struct INostrProfileUpdateResolveTs; pub type INostrProfileUpdateResolve = IResult<NostrProfile>; diff --git a/crates/replica_db_schema/src/models/nostr_profile_relay.rs b/crates/replica_db_schema/src/models/nostr_profile_relay.rs @@ -2,26 +2,12 @@ use crate::nostr_profile::NostrProfileQueryBindValues; use crate::nostr_relay::NostrRelayQueryBindValues; use radroots_types::types::IResultPass; use serde::{Deserialize, Serialize}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrProfileRelayRelation { pub nostr_profile: NostrProfileQueryBindValues, pub nostr_relay: NostrRelayQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrProfileRelayResolve", - type = "IResultPass" - ) -)] pub struct INostrProfileRelayResolveTs; pub type INostrProfileRelayResolve = IResultPass; diff --git a/crates/replica_db_schema/src/models/nostr_relay.rs b/crates/replica_db_schema/src/models/nostr_relay.rs @@ -1,10 +1,6 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct NostrRelay { pub id: String, @@ -21,88 +17,48 @@ pub struct NostrRelay { pub version: Option<String>, pub data: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrRelayFields { pub url: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relay_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub description: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub contact: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub supported_nips: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub software: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub version: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub data: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrRelayFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub url: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub relay_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub description: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub pubkey: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub contact: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub supported_nips: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub software: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub version: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub data: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct INostrRelayFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub url: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub relay_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub description: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub contact: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub supported_nips: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub software: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub version: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub data: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum NostrRelayQueryBindValues { @@ -131,15 +87,11 @@ impl NostrRelayQueryBindValues { } } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct NostrRelayProfileArgs { pub public_key: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub enum NostrRelayFindManyRel { #[serde(rename = "on_profile")] @@ -148,49 +100,20 @@ pub enum NostrRelayFindManyRel { OffProfile(NostrRelayProfileArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayCreate", - type = "INostrRelayFields" - ) -)] pub struct INostrRelayCreateTs; pub type INostrRelayCreate = INostrRelayFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayCreateResolve", - type = "IResult<NostrRelay>" - ) -)] pub struct INostrRelayCreateResolveTs; pub type INostrRelayCreateResolve = IResult<NostrRelay>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct INostrRelayFindOneArgs { pub on: NostrRelayQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct INostrRelayFindOneRelArgs { pub rel: NostrRelayFindManyRel, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrRelayFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum INostrRelayFindOne { @@ -198,23 +121,8 @@ pub enum INostrRelayFindOne { Rel(INostrRelayFindOneRelArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayFindOneResolve", - type = "IResult<NostrRelay>" - ) -)] pub struct INostrRelayFindOneResolveTs; pub type INostrRelayFindOneResolve = IResult<Option<NostrRelay>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrRelayFindMany") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum INostrRelayFindMany { @@ -225,62 +133,17 @@ pub enum INostrRelayFindMany { rel: NostrRelayFindManyRel, }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayFindManyResolve", - type = "IResultList<NostrRelay>" - ) -)] pub struct INostrRelayFindManyResolveTs; pub type INostrRelayFindManyResolve = IResultList<NostrRelay>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayDelete", - type = "INostrRelayFindOne" - ) -)] pub struct INostrRelayDeleteTs; pub type INostrRelayDelete = INostrRelayFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayDeleteResolve", - type = "IResult<string>" - ) -)] pub struct INostrRelayDeleteResolveTs; pub type INostrRelayDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "INostrRelayUpdate") -)] #[derive(Deserialize, Serialize)] pub struct INostrRelayUpdateArgs { pub on: NostrRelayQueryBindValues, pub fields: INostrRelayFieldsPartial, } pub type INostrRelayUpdate = INostrRelayUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "INostrRelayUpdateResolve", - type = "IResult<NostrRelay>" - ) -)] pub struct INostrRelayUpdateResolveTs; pub type INostrRelayUpdateResolve = IResult<NostrRelay>; diff --git a/crates/replica_db_schema/src/models/plot.rs b/crates/replica_db_schema/src/models/plot.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct Plot { pub id: String, @@ -21,77 +17,45 @@ pub struct Plot { pub location_country: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotFields { pub d_tag: String, pub farm_id: String, pub name: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_country: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub d_tag: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub name: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub about: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_primary: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_city: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_region: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_country: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub d_tag: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub farm_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub name: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub about: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_city: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_region: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub location_country: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum PlotQueryBindValues { @@ -124,126 +88,39 @@ impl PlotQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotCreate", - type = "IPlotFields" - ) -)] pub struct IPlotCreateTs; pub type IPlotCreate = IPlotFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotCreateResolve", - type = "IResult<Plot>" - ) -)] pub struct IPlotCreateResolveTs; pub type IPlotCreateResolve = IResult<Plot>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IPlotFindOneArgs { pub on: PlotQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IPlotFindOne { On(IPlotFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotFindOneResolve", - type = "IResult<Plot>" - ) -)] pub struct IPlotFindOneResolveTs; pub type IPlotFindOneResolve = IResult<Option<Plot>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IPlotFindManyArgs { pub filter: Option<IPlotFieldsFilter>, } pub type IPlotFindMany = IPlotFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotFindManyResolve", - type = "IResultList<Plot>" - ) -)] pub struct IPlotFindManyResolveTs; pub type IPlotFindManyResolve = IResultList<Plot>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotDelete", - type = "IPlotFindOne" - ) -)] pub struct IPlotDeleteTs; pub type IPlotDelete = IPlotFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IPlotDeleteResolveTs; pub type IPlotDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IPlotUpdateArgs { pub on: PlotQueryBindValues, pub fields: IPlotFieldsPartial, } pub type IPlotUpdate = IPlotUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotUpdateResolve", - type = "IResult<Plot>" - ) -)] pub struct IPlotUpdateResolveTs; pub type IPlotUpdateResolve = IResult<Plot>; diff --git a/crates/replica_db_schema/src/models/plot_gcs_location.rs b/crates/replica_db_schema/src/models/plot_gcs_location.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct PlotGcsLocation { pub id: String, @@ -16,8 +12,6 @@ pub struct PlotGcsLocation { pub role: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotGcsLocationFields { pub plot_id: String, @@ -25,38 +19,23 @@ pub struct IPlotGcsLocationFields { pub role: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotGcsLocationFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub plot_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub gcs_location_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub role: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotGcsLocationFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub plot_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub gcs_location_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub role: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum PlotGcsLocationQueryBindValues { @@ -91,126 +70,39 @@ impl PlotGcsLocationQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationCreate", - type = "IPlotGcsLocationFields" - ) -)] pub struct IPlotGcsLocationCreateTs; pub type IPlotGcsLocationCreate = IPlotGcsLocationFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationCreateResolve", - type = "IResult<PlotGcsLocation>" - ) -)] pub struct IPlotGcsLocationCreateResolveTs; pub type IPlotGcsLocationCreateResolve = IResult<PlotGcsLocation>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IPlotGcsLocationFindOneArgs { pub on: PlotGcsLocationQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotGcsLocationFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IPlotGcsLocationFindOne { On(IPlotGcsLocationFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationFindOneResolve", - type = "IResult<PlotGcsLocation>" - ) -)] pub struct IPlotGcsLocationFindOneResolveTs; pub type IPlotGcsLocationFindOneResolve = IResult<Option<PlotGcsLocation>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotGcsLocationFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IPlotGcsLocationFindManyArgs { pub filter: Option<IPlotGcsLocationFieldsFilter>, } pub type IPlotGcsLocationFindMany = IPlotGcsLocationFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationFindManyResolve", - type = "IResultList<PlotGcsLocation>" - ) -)] pub struct IPlotGcsLocationFindManyResolveTs; pub type IPlotGcsLocationFindManyResolve = IResultList<PlotGcsLocation>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationDelete", - type = "IPlotGcsLocationFindOne" - ) -)] pub struct IPlotGcsLocationDeleteTs; pub type IPlotGcsLocationDelete = IPlotGcsLocationFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IPlotGcsLocationDeleteResolveTs; pub type IPlotGcsLocationDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotGcsLocationUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IPlotGcsLocationUpdateArgs { pub on: PlotGcsLocationQueryBindValues, pub fields: IPlotGcsLocationFieldsPartial, } pub type IPlotGcsLocationUpdate = IPlotGcsLocationUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotGcsLocationUpdateResolve", - type = "IResult<PlotGcsLocation>" - ) -)] pub struct IPlotGcsLocationUpdateResolveTs; pub type IPlotGcsLocationUpdateResolve = IResult<PlotGcsLocation>; diff --git a/crates/replica_db_schema/src/models/plot_tag.rs b/crates/replica_db_schema/src/models/plot_tag.rs @@ -1,11 +1,7 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct PlotTag { pub id: String, @@ -15,42 +11,27 @@ pub struct PlotTag { pub tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotTagFields { pub plot_id: String, pub tag: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotTagFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub plot_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub tag: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct IPlotTagFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub plot_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub tag: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum PlotTagQueryBindValues { @@ -83,126 +64,39 @@ impl PlotTagQueryBindValues { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagCreate", - type = "IPlotTagFields" - ) -)] pub struct IPlotTagCreateTs; pub type IPlotTagCreate = IPlotTagFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagCreateResolve", - type = "IResult<PlotTag>" - ) -)] pub struct IPlotTagCreateResolveTs; pub type IPlotTagCreateResolve = IResult<PlotTag>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct IPlotTagFindOneArgs { pub on: PlotTagQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotTagFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum IPlotTagFindOne { On(IPlotTagFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagFindOneResolve", - type = "IResult<PlotTag>" - ) -)] pub struct IPlotTagFindOneResolveTs; pub type IPlotTagFindOneResolve = IResult<Option<PlotTag>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotTagFindMany") -)] #[derive(Deserialize, Serialize)] pub struct IPlotTagFindManyArgs { pub filter: Option<IPlotTagFieldsFilter>, } pub type IPlotTagFindMany = IPlotTagFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagFindManyResolve", - type = "IResultList<PlotTag>" - ) -)] pub struct IPlotTagFindManyResolveTs; pub type IPlotTagFindManyResolve = IResultList<PlotTag>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagDelete", - type = "IPlotTagFindOne" - ) -)] pub struct IPlotTagDeleteTs; pub type IPlotTagDelete = IPlotTagFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagDeleteResolve", - type = "IResult<string>" - ) -)] pub struct IPlotTagDeleteResolveTs; pub type IPlotTagDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "IPlotTagUpdate") -)] #[derive(Deserialize, Serialize)] pub struct IPlotTagUpdateArgs { pub on: PlotTagQueryBindValues, pub fields: IPlotTagFieldsPartial, } pub type IPlotTagUpdate = IPlotTagUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "IPlotTagUpdateResolve", - type = "IResult<PlotTag>" - ) -)] pub struct IPlotTagUpdateResolveTs; pub type IPlotTagUpdateResolve = IResult<PlotTag>; diff --git a/crates/replica_db_schema/src/models/trade_product.rs b/crates/replica_db_schema/src/models/trade_product.rs @@ -1,10 +1,6 @@ use radroots_types::types::{IResult, IResultList}; use serde::{Deserialize, Serialize}; use serde_json::Value; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Serialize, Deserialize)] pub struct TradeProduct { pub id: String, @@ -34,8 +30,6 @@ pub struct TradeProduct { pub verified_primary_bin_id: Option<String>, pub notes: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ITradeProductFields { pub key: String, @@ -49,9 +43,7 @@ pub struct ITradeProductFields { pub qty_amt: f64, pub qty_amt_exact: String, pub qty_unit: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub qty_label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub qty_avail: Option<i64>, pub price_amt: f64, pub price_amt_exact: String, @@ -59,125 +51,66 @@ pub struct ITradeProductFields { pub price_qty_amt: f64, pub price_qty_amt_exact: String, pub price_qty_unit: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub listing_addr: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary_bin_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub verified_primary_bin_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub notes: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ITradeProductFieldsPartial { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub key: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub category: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub title: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub summary: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub process: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub lot: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub profile: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub year: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub qty_amt: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub qty_amt_exact: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub qty_unit: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub qty_label: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub qty_avail: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub price_amt: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub price_amt_exact: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub price_currency: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub price_qty_amt: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub price_qty_amt_exact: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub price_qty_unit: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub listing_addr: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary_bin_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub verified_primary_bin_id: Option<serde_json::Value>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub notes: Option<serde_json::Value>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ITradeProductFieldsFilter { - #[cfg_attr(feature = "ts-rs", ts(optional))] pub id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub created_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub updated_at: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub key: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub category: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub title: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub summary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub process: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub lot: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub profile: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub year: Option<i64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub qty_amt: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub qty_amt_exact: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub qty_unit: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub qty_label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub qty_avail: Option<i64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub price_amt: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub price_amt_exact: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub price_currency: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub price_qty_amt: Option<f64>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub price_qty_amt_exact: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub price_qty_unit: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub listing_addr: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub primary_bin_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub verified_primary_bin_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional))] pub notes: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] #[serde(untagged)] pub enum TradeProductQueryBindValues { @@ -202,126 +135,39 @@ impl TradeProductQueryBindValues { } } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductCreate", - type = "ITradeProductFields" - ) -)] pub struct ITradeProductCreateTs; pub type ITradeProductCreate = ITradeProductFields; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductCreateResolve", - type = "IResult<TradeProduct>" - ) -)] pub struct ITradeProductCreateResolveTs; pub type ITradeProductCreateResolve = IResult<TradeProduct>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Deserialize, Serialize)] pub struct ITradeProductFindOneArgs { pub on: TradeProductQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "ITradeProductFindOne") -)] #[derive(Deserialize, Serialize)] #[serde(untagged)] pub enum ITradeProductFindOne { On(ITradeProductFindOneArgs), } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductFindOneResolve", - type = "IResult<TradeProduct>" - ) -)] pub struct ITradeProductFindOneResolveTs; pub type ITradeProductFindOneResolve = IResult<Option<TradeProduct>>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "ITradeProductFindMany") -)] #[derive(Deserialize, Serialize)] pub struct ITradeProductFindManyArgs { pub filter: Option<ITradeProductFieldsFilter>, } pub type ITradeProductFindMany = ITradeProductFindManyArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductFindManyResolve", - type = "IResultList<TradeProduct>" - ) -)] pub struct ITradeProductFindManyResolveTs; pub type ITradeProductFindManyResolve = IResultList<TradeProduct>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductDelete", - type = "ITradeProductFindOne" - ) -)] pub struct ITradeProductDeleteTs; pub type ITradeProductDelete = ITradeProductFindOne; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductDeleteResolve", - type = "IResult<string>" - ) -)] pub struct ITradeProductDeleteResolveTs; pub type ITradeProductDeleteResolve = IResult<String>; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts(export, export_to = "types.ts", rename = "ITradeProductUpdate") -)] #[derive(Deserialize, Serialize)] pub struct ITradeProductUpdateArgs { pub on: TradeProductQueryBindValues, pub fields: ITradeProductFieldsPartial, } pub type ITradeProductUpdate = ITradeProductUpdateArgs; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductUpdateResolve", - type = "IResult<TradeProduct>" - ) -)] pub struct ITradeProductUpdateResolveTs; pub type ITradeProductUpdateResolve = IResult<TradeProduct>; diff --git a/crates/replica_db_schema/src/models/trade_product_location.rs b/crates/replica_db_schema/src/models/trade_product_location.rs @@ -2,26 +2,12 @@ use crate::gcs_location::GcsLocationQueryBindValues; use crate::trade_product::TradeProductQueryBindValues; use radroots_types::types::IResultPass; use serde::{Deserialize, Serialize}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ITradeProductLocationRelation { pub trade_product: TradeProductQueryBindValues, pub gcs_location: GcsLocationQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductLocationResolve", - type = "IResultPass" - ) -)] pub struct ITradeProductLocationResolveTs; pub type ITradeProductLocationResolve = IResultPass; diff --git a/crates/replica_db_schema/src/models/trade_product_media.rs b/crates/replica_db_schema/src/models/trade_product_media.rs @@ -2,26 +2,12 @@ use crate::media_image::MediaImageQueryBindValues; use crate::trade_product::TradeProductQueryBindValues; use radroots_types::types::IResultPass; use serde::{Deserialize, Serialize}; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Deserialize, Serialize)] pub struct ITradeProductMediaRelation { pub trade_product: TradeProductQueryBindValues, pub media_image: MediaImageQueryBindValues, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename = "ITradeProductMediaResolve", - type = "IResultPass" - ) -)] pub struct ITradeProductMediaResolveTs; pub type ITradeProductMediaResolve = IResultPass; diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml @@ -40,8 +40,6 @@ signer-adapters = [ "dep:radroots_nostr_connect", "dep:radroots_nostr_signer", ] -ts-rs = ["radroots_events/ts-rs", "radroots_trade/ts-rs"] -typeshare = ["radroots_events/typeshare"] [dependencies] radroots_events = { workspace = true, default-features = false } diff --git a/crates/sql_wasm_core/Cargo.toml b/crates/sql_wasm_core/Cargo.toml @@ -34,5 +34,4 @@ serde-wasm-bindgen = { workspace = true } thiserror = { workspace = true } wasm-bindgen = { workspace = true } js-sys = { workspace = true } -ts-rs = { workspace = true } uuid = { workspace = true, features = ["v4", "fast-rng", "js"] } diff --git a/crates/trade/Cargo.toml b/crates/trade/Cargo.toml @@ -11,10 +11,9 @@ repository.workspace = true homepage.workspace = true documentation = "https://docs.rs/radroots_trade" readme = "README" -build = "build.rs" [features] -default = ["std", "serde", "serde_json", "ts-rs"] +default = ["std", "serde", "serde_json"] std = ["radroots_core/std", "radroots_events/std", "radroots_events_codec/std"] serde = [ "dep:serde", @@ -30,7 +29,6 @@ serde_json = [ "dep:sha2", "radroots_events_codec/serde_json", ] -ts-rs = ["dep:ts-rs", "radroots_events/ts-rs", "radroots_events/std"] [dependencies] radroots_core = { workspace = true, default-features = false } @@ -47,4 +45,3 @@ serde_json = { workspace = true, default-features = false, features = [ ], optional = true } sha2 = { workspace = true, default-features = false, optional = true } thiserror = { workspace = true } -ts-rs = { workspace = true, optional = true } diff --git a/crates/trade/README b/crates/trade/README @@ -10,8 +10,7 @@ helpers for the `radroots` core libraries. * listing publish helpers for canonical address normalization, author checks, and event-shaping workflows; * order and public-trade helpers for shared request validation and projection; - * optional `serde`, `serde_json`, and `ts-rs` support for shared model - serialization and export; + * optional `serde` and `serde_json` support for shared model serialization; * portable shared-model support for both `std` and `no_std` builds. ## Copyright diff --git a/crates/trade/build.rs b/crates/trade/build.rs @@ -1,39 +0,0 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; - -fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } -} - -fn export_dir(crate_name: &str) -> PathBuf { - if let Some(export_dir) = env::var_os("RADROOTS_TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from( - env::var("CARGO_MANIFEST_DIR").expect("missing required env var CARGO_MANIFEST_DIR"), - ); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join(crate_name) -} - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - if env::var_os("CARGO_FEATURE_TS_RS").is_some() { - let out_dir = export_dir("trade"); - println!("cargo:rustc-env=TS_RS_EXPORT_DIR={}", out_dir.display()); - println!("cargo:rerun-if-env-changed=RADROOTS_TS_RS_EXPORT_DIR"); - if !out_dir.exists() { - fs::create_dir_all(&out_dir).expect("create TS export dir"); - } - println!("cargo:rerun-if-changed=src"); - } -} diff --git a/crates/trade/src/listing/dvm.rs b/crates/trade/src/listing/dvm.rs @@ -11,8 +11,6 @@ use radroots_events_codec::d_tag::is_d_tag_base64url; use radroots_events_codec::error::{EventEncodeError, EventParseError}; #[cfg(feature = "serde_json")] use serde::de::DeserializeOwned; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; use crate::listing::kinds::{ KIND_TRADE_LISTING_ANSWER_RES, KIND_TRADE_LISTING_CANCEL_REQ, @@ -40,8 +38,6 @@ use crate::listing::validation::TradeListingValidationError; pub const TRADE_LISTING_DOMAIN: &str = "trade:listing"; pub const TRADE_LISTING_ENVELOPE_VERSION: u16 = 1; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -50,8 +46,6 @@ pub enum TradeListingDomain { TradeListing, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -178,8 +172,6 @@ impl TradeListingMessageType { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeListingEnvelope<T> { @@ -187,7 +179,6 @@ pub struct TradeListingEnvelope<T> { pub domain: TradeListingDomain, #[cfg_attr(feature = "serde", serde(rename = "type"))] pub message_type: TradeListingMessageType, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub order_id: Option<String>, pub listing_addr: String, pub payload: T, @@ -577,56 +568,39 @@ fn map_event_parse_error(error: EventParseError) -> TradeListingEnvelopeParseErr } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeListingValidateRequest { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsNostrEventPtr | null"))] pub listing_event: Option<RadrootsNostrEventPtr>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeListingValidateResult { pub valid: bool, - #[cfg_attr(feature = "ts-rs", ts(type = "TradeListingValidationError[]"))] pub errors: Vec<TradeListingValidationError>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeOrderResponse { pub accepted: bool, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeOrderRevisionResponse { pub accepted: bool, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeListingCancel { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", diff --git a/crates/trade/src/listing/kinds.rs b/crates/trade/src/listing/kinds.rs @@ -1,7 +1,5 @@ #![forbid(unsafe_code)] -#[cfg(feature = "ts-rs")] -use ts_rs::TS; pub const KIND_TRADE_LISTING_VALIDATE_REQ: u16 = 5321; pub const KIND_TRADE_LISTING_VALIDATE_RES: u16 = 6321; @@ -43,16 +41,6 @@ pub const TRADE_LISTING_KINDS: [u16; 15] = [ KIND_TRADE_LISTING_RECEIPT_REQ, ]; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr( - feature = "ts-rs", - ts( - export, - export_to = "types.ts", - rename_all = "SCREAMING_SNAKE_CASE", - repr(enum) - ) -)] #[repr(u16)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub enum TradeListingKind { diff --git a/crates/trade/src/listing/model.rs b/crates/trade/src/listing/model.rs @@ -1,32 +1,17 @@ -#[cfg(feature = "ts-rs")] -use ts_rs::TS; - -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingSubtotal { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub price_amount: radroots_core::RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreCurrency"))] pub price_currency: radroots_core::RadrootsCoreCurrency, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub quantity_amount: radroots_core::RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreUnit"))] pub quantity_unit: radroots_core::RadrootsCoreUnit, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingTotal { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub price_amount: radroots_core::RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreCurrency"))] pub price_currency: radroots_core::RadrootsCoreCurrency, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub quantity_amount: radroots_core::RadrootsCoreDecimal, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreUnit"))] pub quantity_unit: radroots_core::RadrootsCoreUnit, } diff --git a/crates/trade/src/listing/order.rs b/crates/trade/src/listing/order.rs @@ -4,11 +4,7 @@ use alloc::{string::String, vec::Vec}; use radroots_core::RadrootsCoreDiscountValue; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeOrderItem { @@ -16,8 +12,6 @@ pub struct TradeOrderItem { pub bin_count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -30,8 +24,6 @@ pub enum TradeOrderChange { ItemRemove { item_index: u32 }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeOrderRevision { @@ -39,8 +31,6 @@ pub struct TradeOrderRevision { pub changes: Vec<TradeOrderChange>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeOrder { @@ -49,15 +39,9 @@ pub struct TradeOrder { pub buyer_pubkey: String, pub seller_pubkey: String, pub items: Vec<TradeOrderItem>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsCoreDiscountValue[] | null") - )] pub discounts: Option<Vec<RadrootsCoreDiscountValue>>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Debug, PartialEq, Eq)] @@ -74,44 +58,32 @@ pub enum TradeOrderStatus { Completed, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeQuestion { pub question_id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeAnswer { pub question_id: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeDiscountRequest { pub discount_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDiscountValue"))] pub value: RadrootsCoreDiscountValue, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeDiscountOffer { pub discount_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDiscountValue"))] pub value: RadrootsCoreDiscountValue, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -120,17 +92,13 @@ pub struct TradeDiscountOffer { #[derive(Clone, Debug, PartialEq, Eq)] pub enum TradeDiscountDecision { Accept { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDiscountValue"))] value: RadrootsCoreDiscountValue, }, Decline { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] reason: Option<String>, }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( feature = "serde", @@ -145,16 +113,12 @@ pub enum TradeFulfillmentStatus { Cancelled, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeFulfillmentUpdate { pub status: TradeFulfillmentStatus, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct TradeReceipt { diff --git a/crates/trade/src/listing/overlay.rs b/crates/trade/src/listing/overlay.rs @@ -11,11 +11,7 @@ use crate::listing::projection::{ RadrootsTradeOrderQuery, RadrootsTradeOrderSort, RadrootsTradeOrderWorkflowProjection, RadrootsTradeReadIndex, }; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -26,8 +22,6 @@ pub enum RadrootsTradeReviewPriority { Critical, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -38,17 +32,13 @@ pub enum RadrootsTradeReviewStatus { Resolved, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeReviewQueueEntry { pub queue: String, pub priority: RadrootsTradeReviewPriority, pub status: RadrootsTradeReviewStatus, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub assigned_operator: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } @@ -58,8 +48,6 @@ impl RadrootsTradeReviewQueueEntry { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -69,8 +57,6 @@ pub enum RadrootsTradeModerationSeverity { Block, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -80,17 +66,13 @@ pub enum RadrootsTradeModerationStatus { Resolved, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeModerationFlag { pub code: String, pub severity: RadrootsTradeModerationSeverity, pub status: RadrootsTradeModerationStatus, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub source: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub reason: Option<String>, } @@ -100,8 +82,6 @@ impl RadrootsTradeModerationFlag { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -111,8 +91,6 @@ pub enum RadrootsTradeFulfillmentExceptionSeverity { Blocking, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -122,17 +100,13 @@ pub enum RadrootsTradeFulfillmentExceptionStatus { Resolved, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeFulfillmentException { pub code: String, pub severity: RadrootsTradeFulfillmentExceptionSeverity, pub status: RadrootsTradeFulfillmentExceptionStatus, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub source: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub notes: Option<String>, } @@ -145,18 +119,11 @@ impl RadrootsTradeFulfillmentException { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingBackofficeOverlay { pub listing_addr: String, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeReviewQueueEntry | null") - )] pub review_queue: Option<RadrootsTradeReviewQueueEntry>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeModerationFlag[]"))] pub moderation_flags: Vec<RadrootsTradeModerationFlag>, } @@ -182,20 +149,12 @@ impl RadrootsTradeListingBackofficeOverlay { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderBackofficeOverlay { pub order_id: String, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeReviewQueueEntry | null") - )] pub review_queue: Option<RadrootsTradeReviewQueueEntry>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeModerationFlag[]"))] pub moderation_flags: Vec<RadrootsTradeModerationFlag>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFulfillmentException[]"))] pub fulfillment_exceptions: Vec<RadrootsTradeFulfillmentException>, } @@ -237,68 +196,38 @@ impl RadrootsTradeOrderBackofficeOverlay { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct RadrootsTradeListingBackofficeQuery { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeListingQuery"))] pub listing: RadrootsTradeListingQuery, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "boolean | null"))] pub requires_review: Option<bool>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "boolean | null"))] pub has_open_moderation_flags: Option<bool>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct RadrootsTradeOrderBackofficeQuery { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeOrderQuery"))] pub order: RadrootsTradeOrderQuery, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "boolean | null"))] pub requires_review: Option<bool>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "boolean | null"))] pub has_open_moderation_flags: Option<bool>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "boolean | null"))] pub has_open_fulfillment_exceptions: Option<bool>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsTradeListingBackofficeView { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeListingProjection"))] pub listing: RadrootsTradeListingProjection, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeMarketplaceListingSummary | null") - )] pub marketplace: Option<RadrootsTradeMarketplaceListingSummary>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeListingBackofficeOverlay | null") - )] pub overlay: Option<RadrootsTradeListingBackofficeOverlay>, pub requires_review: bool, pub open_moderation_flag_count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsTradeOrderBackofficeView { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeOrderWorkflowProjection"))] pub order: RadrootsTradeOrderWorkflowProjection, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeMarketplaceOrderSummary"))] pub marketplace: RadrootsTradeMarketplaceOrderSummary, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeOrderBackofficeOverlay | null") - )] pub overlay: Option<RadrootsTradeOrderBackofficeOverlay>, pub requires_review: bool, pub open_moderation_flag_count: u32, diff --git a/crates/trade/src/listing/projection.rs b/crates/trade/src/listing/projection.rs @@ -20,8 +20,6 @@ use radroots_events::{ plot::RadrootsPlotRef, resource_area::RadrootsResourceAreaRef, }; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; use crate::listing::{ codec::{TradeListingParseError, listing_from_event_parts}, @@ -42,73 +40,36 @@ use radroots_events_codec::trade::{ trade_event_context_from_tags, }; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsTradeListingBinProjection { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsListingBin"))] pub bin: RadrootsListingBin, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeListingTotal"))] pub one_bin_total: RadrootsTradeListingTotal, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsTradeListingProjection { pub listing_addr: String, pub seller_pubkey: String, pub listing_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsFarmRef"))] pub farm: RadrootsFarmRef, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsListingProduct"))] pub product: RadrootsListingProduct, pub primary_bin_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeListingBinProjection[]"))] pub bins: Vec<RadrootsTradeListingBinProjection>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsResourceAreaRef | null") - )] pub resource_area: Option<RadrootsResourceAreaRef>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsPlotRef | null"))] pub plot: Option<RadrootsPlotRef>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsCoreDiscount[] | null") - )] pub discounts: Option<Vec<RadrootsCoreDiscount>>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreDecimal | null"))] pub inventory_available: Option<RadrootsCoreDecimal>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingAvailability | null") - )] pub availability: Option<RadrootsListingAvailability>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingDeliveryMethod | null") - )] pub delivery_method: Option<RadrootsListingDeliveryMethod>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingLocation | null") - )] pub location: Option<RadrootsListingLocation>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsListingImage[] | null") - )] pub images: Option<Vec<RadrootsListingImage>>, pub order_count: u32, pub open_order_count: u32, pub terminal_order_count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderWorkflowProjection { @@ -116,45 +77,19 @@ pub struct RadrootsTradeOrderWorkflowProjection { pub listing_addr: String, pub buyer_pubkey: String, pub seller_pubkey: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeOrderItem[]"))] pub items: Vec<TradeOrderItem>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeOrderEconomicLine[] | null") - )] pub requested_discounts: Option<Vec<TradeOrderEconomicLine>>, pub status: TradeOrderStatus, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsNostrEventPtr | null"))] pub listing_snapshot: Option<RadrootsNostrEventPtr>, pub root_event_id: String, pub last_event_id: String, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsCoreDiscountValue | null") - )] pub last_discount_request: Option<RadrootsCoreDiscountValue>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsCoreDiscountValue | null") - )] pub last_discount_offer: Option<RadrootsCoreDiscountValue>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsCoreDiscountValue | null") - )] pub accepted_discount: Option<RadrootsCoreDiscountValue>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeFulfillmentStatus | null") - )] pub last_fulfillment_status: Option<TradeFulfillmentStatus>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "bool | null"))] pub receipt_acknowledged: Option<bool>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "number | null"))] pub receipt_at: Option<u64>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub last_reason: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub last_discount_decline_reason: Option<String>, pub question_count: u32, pub answer_count: u32, @@ -170,8 +105,6 @@ pub struct RadrootsTradeOrderWorkflowProjection { pub last_actor_pubkey: String, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderWorkflowMessage { @@ -179,20 +112,13 @@ pub struct RadrootsTradeOrderWorkflowMessage { pub actor_pubkey: String, pub counterparty_pubkey: String, pub listing_addr: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub order_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsNostrEventPtr | null"))] pub listing_event: Option<RadrootsNostrEventPtr>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub root_event_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub prev_event_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeMessagePayload"))] pub payload: TradeListingMessagePayload, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -201,8 +127,6 @@ pub enum RadrootsTradeSortDirection { Desc, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Debug, PartialEq, Eq)] @@ -214,30 +138,17 @@ pub enum RadrootsTradeListingMarketStatus { Other { value: String }, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct RadrootsTradeListingQuery { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub seller_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub farm_id: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub product_key: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub product_category: Option<String>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeListingMarketStatus | null") - )] pub listing_status: Option<RadrootsTradeListingMarketStatus>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -251,8 +162,6 @@ pub enum RadrootsTradeListingSortField { TotalOrderCount, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingSort { @@ -269,26 +178,15 @@ impl Default for RadrootsTradeListingSort { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct RadrootsTradeOrderQuery { - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub listing_addr: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub buyer_pubkey: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub seller_pubkey: Option<String>, - #[cfg_attr( - feature = "ts-rs", - ts(optional, type = "RadrootsTradeOrderStatus | null") - )] pub status: Option<TradeOrderStatus>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] @@ -302,8 +200,6 @@ pub enum RadrootsTradeOrderSortField { TotalBinCount, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderSort { @@ -320,8 +216,6 @@ impl Default for RadrootsTradeOrderSort { } } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeFacetCount { @@ -329,42 +223,26 @@ pub struct RadrootsTradeFacetCount { pub count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeListingFacets { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub seller_pubkeys: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub farm_pubkeys: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub farm_ids: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub product_keys: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub product_categories: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub listing_statuses: Vec<RadrootsTradeFacetCount>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeOrderFacets { - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub buyer_pubkeys: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub seller_pubkeys: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub listing_addrs: Vec<RadrootsTradeFacetCount>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeFacetCount[]"))] pub statuses: Vec<RadrootsTradeFacetCount>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeMarketplaceListingSummary { @@ -375,25 +253,18 @@ pub struct RadrootsTradeMarketplaceListingSummary { pub product_key: String, pub product_title: String, pub product_category: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub product_summary: Option<String>, pub listing_status: RadrootsTradeListingMarketStatus, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub location_primary: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "RadrootsCoreDecimal | null"))] pub inventory_available: Option<RadrootsCoreDecimal>, pub primary_bin_id: String, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub primary_bin_label: Option<String>, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsTradeListingTotal"))] pub primary_bin_total: RadrootsTradeListingTotal, pub order_count: u32, pub open_order_count: u32, pub terminal_order_count: u32, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug, PartialEq, Eq)] pub struct RadrootsTradeMarketplaceOrderSummary { @@ -406,7 +277,6 @@ pub struct RadrootsTradeMarketplaceOrderSummary { pub item_count: u32, pub total_bin_count: u32, pub has_requested_discounts: bool, - #[cfg_attr(feature = "ts-rs", ts(optional, type = "string | null"))] pub last_reason: Option<String>, } diff --git a/crates/trade/src/listing/validation.rs b/crates/trade/src/listing/validation.rs @@ -15,14 +15,10 @@ use radroots_events::{ }, trade::RadrootsTradeListingValidationError as TradeListingValidationError, }; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; use crate::listing::codec::listing_from_event_parts; use crate::listing::dvm::TradeListingAddress; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct RadrootsTradeListing { @@ -33,13 +29,9 @@ pub struct RadrootsTradeListing { pub description: String, pub product_type: String, pub primary_bin_id: String, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreQuantity"))] pub bin_quantity: RadrootsCoreQuantity, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreUnit"))] pub unit: RadrootsCoreUnit, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreMoney"))] pub unit_price: RadrootsCoreMoney, - #[cfg_attr(feature = "ts-rs", ts(type = "RadrootsCoreDecimal"))] pub inventory_available: RadrootsCoreDecimal, pub availability: RadrootsListingAvailability, pub location: RadrootsListingLocation, diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml @@ -11,13 +11,10 @@ repository.workspace = true homepage.workspace = true documentation = "https://docs.rs/radroots_types" readme = "README" -build = "build.rs" [features] default = [] -ts-rs = ["dep:ts-rs"] [dependencies] serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } -ts-rs = { workspace = true, optional = true } diff --git a/crates/types/README b/crates/types/README @@ -7,8 +7,7 @@ wrappers for the `radroots` core libraries. * `IError`, `IResult`, `IResultList`, and `IResultPass` wrapper types; * small constructor helpers and status-label logic for pass and fail outcomes; - * optional `serde` and `ts-rs` support for API boundary serialization and - export; + * optional `serde` support for API boundary serialization; * a compact support crate with no domain-specific business logic. ## Copyright diff --git a/crates/types/build.rs b/crates/types/build.rs @@ -1,39 +0,0 @@ -use std::{ - env, fs, - path::{Path, PathBuf}, -}; - -fn workspace_root(manifest_dir: &Path) -> PathBuf { - let parent = manifest_dir.parent().unwrap_or(manifest_dir); - if parent.file_name().and_then(|name| name.to_str()) == Some("crates") { - parent.parent().unwrap_or(parent).to_path_buf() - } else { - parent.to_path_buf() - } -} - -fn export_dir(crate_name: &str) -> PathBuf { - if let Some(export_dir) = env::var_os("RADROOTS_TS_RS_EXPORT_DIR") { - return PathBuf::from(export_dir); - } - let manifest_dir = PathBuf::from( - env::var("CARGO_MANIFEST_DIR").expect("missing required env var CARGO_MANIFEST_DIR"), - ); - workspace_root(&manifest_dir) - .join("target") - .join("ts-rs") - .join(crate_name) -} - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - if env::var_os("CARGO_FEATURE_TS_RS").is_some() { - let out_dir = export_dir("types"); - println!("cargo:rustc-env=TS_RS_EXPORT_DIR={}", out_dir.display()); - println!("cargo:rerun-if-env-changed=RADROOTS_TS_RS_EXPORT_DIR"); - if !out_dir.exists() { - fs::create_dir_all(&out_dir).expect("Failed to create TS export directory"); - } - println!("cargo:rerun-if-changed=src"); - } -} diff --git a/crates/types/src/types.rs b/crates/types/src/types.rs @@ -1,30 +1,20 @@ use serde::Serialize; -#[cfg(feature = "ts-rs")] -use ts_rs::TS; -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct IError<T> { pub err: T, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct IResult<T> { pub result: T, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct IResultList<T> { pub results: Vec<T>, } -#[cfg_attr(feature = "ts-rs", derive(TS))] -#[cfg_attr(feature = "ts-rs", ts(export, export_to = "types.ts"))] #[derive(Clone, Debug, PartialEq, Eq, Serialize)] pub struct IResultPass { pub pass: bool, diff --git a/nix/apps.nix b/nix/apps.nix @@ -72,7 +72,6 @@ in description = "Run repository guard scripts"; runtimeInputs = common.runtimeInputs.stable; command = '' - ./scripts/ci/guard_committed_ts_artifacts.sh ./scripts/ci/guard_no_legacy_identifiers.sh ''; }; diff --git a/nix/checks.nix b/nix/checks.nix @@ -40,7 +40,6 @@ in ]; initGit = true; command = '' - ./scripts/ci/guard_committed_ts_artifacts.sh ./scripts/ci/guard_no_legacy_identifiers.sh ''; }; diff --git a/nix/common.nix b/nix/common.nix @@ -181,7 +181,6 @@ let cargo check --workspace ''; contractCommand = '' - ./scripts/ci/guard_committed_ts_artifacts.sh ./scripts/ci/guard_no_legacy_identifiers.sh cargo check -q ${sdkContractCargoArgs} cargo test -q ${sdkContractCargoArgs} diff --git a/scripts/ci/guard_committed_ts_artifacts.sh b/scripts/ci/guard_committed_ts_artifacts.sh @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -tracked_artifacts="$(git ls-files 'target/ts-rs/**')" - -if [[ -n $tracked_artifacts ]]; then - echo "committed generated typescript artifacts are not allowed under target/ts-rs" - echo "$tracked_artifacts" - exit 1 -fi - -echo "no committed generated typescript artifacts found under target/ts-rs" diff --git a/spec/README.md b/spec/README.md @@ -132,7 +132,6 @@ Repository guards also enforce: - deterministic export requirements - strict no-legacy identifier policy for replica surfaces -- no committed generated TypeScript artifacts under `target/ts-rs/` ## Coverage Policy