sdk

Radroots SDK and bindings
git clone https://radroots.dev/git/sdk.git
Log | Files | Refs | README

commit d2ab63b6b6927a3f32d6880238313ba2431a190a
parent 4136534a7a66413ff0e362615b15e23d649a2600
Author: triesap <tyson@radroots.org>
Date:   Thu, 11 Jun 2026 14:16:45 -0700

refactor: align schema bindings

Diffstat:
MCargo.lock | 2++
Mcrates/replica_db_schema_bindings/Cargo.toml | 1+
Mcrates/replica_db_schema_bindings/src/lib.rs | 13++++++++-----
Acrates/replica_db_schema_bindings/src/model.rs | 1943+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcrates/replica_db_schema_bindings/src/typescript/types.ts | 521-------------------------------------------------------------------------------
Mcrates/trade_bindings/Cargo.toml | 1+
Mcrates/trade_bindings/src/lib.rs | 13++++++++-----
Acrates/trade_bindings/src/model.rs | 809+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dcrates/trade_bindings/src/typescript/types.ts | 91-------------------------------------------------------------------------------
Mcrates/xtask/src/output.rs | 26+++++++-------------------
Mcrates/xtask/src/ts.rs | 27---------------------------
Mpackages/replica-db-schema-bindings/src/generated/types.ts | 8++++----
Mpackages/trade-bindings/src/generated/types.ts | 24+++++++++++-------------
13 files changed, 2794 insertions(+), 685 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -670,6 +670,7 @@ name = "radroots_replica_db_schema_bindings" version = "0.1.0" dependencies = [ "radroots_replica_db_schema", + "radroots_sdk_binding_model", ] [[package]] @@ -722,6 +723,7 @@ dependencies = [ name = "radroots_trade_bindings" version = "0.1.0" dependencies = [ + "radroots_sdk_binding_model", "radroots_trade", ] diff --git a/crates/replica_db_schema_bindings/Cargo.toml b/crates/replica_db_schema_bindings/Cargo.toml @@ -9,4 +9,5 @@ homepage.workspace = true publish = false [dependencies] +radroots_sdk_binding_model = { path = "../binding_model" } radroots_replica_db_schema = { workspace = true } diff --git a/crates/replica_db_schema_bindings/src/lib.rs b/crates/replica_db_schema_bindings/src/lib.rs @@ -1,15 +1,18 @@ pub use radroots_replica_db_schema as upstream; -pub const TYPES_TS: &str = include_str!("typescript/types.ts"); +mod model; + +pub use model::types_module; #[cfg(test)] mod tests { - use super::TYPES_TS; + use super::types_module; #[test] fn preserves_replica_schema_exports() { - assert!(TYPES_TS.contains("export type Farm")); - assert!(TYPES_TS.contains("export type GcsLocation")); - assert!(TYPES_TS.contains("export type IGcsLocationFindManyResolve")); + let rendered = types_module().render(); + assert!(rendered.contains("export type Farm")); + assert!(rendered.contains("export type GcsLocation")); + assert!(rendered.contains("export type IGcsLocationFindManyResolve")); } } diff --git a/crates/replica_db_schema_bindings/src/model.rs b/crates/replica_db_schema_bindings/src/model.rs @@ -0,0 +1,1943 @@ +use radroots_sdk_binding_model as ts; + +pub fn types_module() -> ts::TsModule { + ts::module(vec![ + ts::type_alias( + "Farm", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("d_tag", ts::string()), + ts::field("pubkey", ts::string()), + ts::field("name", ts::string()), + ts::field("about", ts::union(vec![ts::string(), ts::null()])), + ts::field("website", ts::union(vec![ts::string(), ts::null()])), + ts::field("picture", ts::union(vec![ts::string(), ts::null()])), + ts::field("banner", ts::union(vec![ts::string(), ts::null()])), + ts::field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::field("location_city", ts::union(vec![ts::string(), ts::null()])), + ts::field("location_region", ts::union(vec![ts::string(), ts::null()])), + ts::field( + "location_country", + ts::union(vec![ts::string(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "FarmGcsLocation", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("farm_id", ts::string()), + ts::field("gcs_location_id", ts::string()), + ts::field("role", ts::string()), + ]), + ), + ts::type_alias( + "FarmGcsLocationQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("farm_id", ts::string())]), + ts::object(vec![ts::field("gcs_location_id", ts::string())]), + ]), + ), + ts::type_alias( + "FarmMember", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("farm_id", ts::string()), + ts::field("member_pubkey", ts::string()), + ts::field("role", ts::string()), + ]), + ), + ts::type_alias( + "FarmMemberClaim", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("member_pubkey", ts::string()), + ts::field("farm_pubkey", ts::string()), + ]), + ), + ts::type_alias( + "FarmMemberClaimQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("member_pubkey", ts::string())]), + ts::object(vec![ts::field("farm_pubkey", ts::string())]), + ]), + ), + ts::type_alias( + "FarmMemberQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("farm_id", ts::string())]), + ts::object(vec![ts::field("member_pubkey", ts::string())]), + ]), + ), + ts::type_alias( + "FarmQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("d_tag", ts::string())]), + ts::object(vec![ts::field("pubkey", ts::string())]), + ]), + ), + ts::type_alias( + "FarmTag", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("farm_id", ts::string()), + ts::field("tag", ts::string()), + ]), + ), + ts::type_alias( + "FarmTagQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("farm_id", ts::string())]), + ts::object(vec![ts::field("tag", ts::string())]), + ]), + ), + ts::type_alias( + "GcsLocation", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("d_tag", ts::string()), + ts::field("lat", ts::number()), + ts::field("lng", ts::number()), + ts::field("geohash", ts::string()), + ts::field("point", ts::string()), + ts::field("polygon", ts::string()), + ts::field("accuracy", ts::union(vec![ts::number(), ts::null()])), + ts::field("altitude", ts::union(vec![ts::number(), ts::null()])), + ts::field("tag_0", ts::union(vec![ts::string(), ts::null()])), + ts::field("label", ts::union(vec![ts::string(), ts::null()])), + ts::field("area", ts::union(vec![ts::number(), ts::null()])), + ts::field("elevation", ts::union(vec![ts::number(), ts::null()])), + ts::field("soil", ts::union(vec![ts::string(), ts::null()])), + ts::field("climate", ts::union(vec![ts::string(), ts::null()])), + ts::field("gc_id", ts::union(vec![ts::string(), ts::null()])), + ts::field("gc_name", ts::union(vec![ts::string(), ts::null()])), + ts::field("gc_admin1_id", ts::union(vec![ts::string(), ts::null()])), + ts::field("gc_admin1_name", ts::union(vec![ts::string(), ts::null()])), + ts::field("gc_country_id", ts::union(vec![ts::string(), ts::null()])), + ts::field("gc_country_name", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "GcsLocationFarmArgs", + ts::object(vec![ts::field("id", ts::string())]), + ), + ts::type_alias( + "GcsLocationFindManyRel", + ts::union(vec![ + ts::object(vec![ts::field( + "on_trade_product", + ts::reference("GcsLocationTradeProductArgs"), + )]), + ts::object(vec![ts::field( + "off_trade_product", + ts::reference("GcsLocationTradeProductArgs"), + )]), + ts::object(vec![ts::field( + "on_farm", + ts::reference("GcsLocationFarmArgs"), + )]), + ts::object(vec![ts::field( + "off_farm", + ts::reference("GcsLocationFarmArgs"), + )]), + ts::object(vec![ts::field( + "on_plot", + ts::reference("GcsLocationPlotArgs"), + )]), + ts::object(vec![ts::field( + "off_plot", + ts::reference("GcsLocationPlotArgs"), + )]), + ]), + ), + ts::type_alias( + "GcsLocationPlotArgs", + ts::object(vec![ts::field("id", ts::string())]), + ), + ts::type_alias( + "GcsLocationQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("d_tag", ts::string())]), + ts::object(vec![ts::field("geohash", ts::string())]), + ]), + ), + ts::type_alias( + "GcsLocationTradeProductArgs", + ts::object(vec![ts::field("id", ts::string())]), + ), + ts::type_alias("IFarmCreate", ts::reference("IFarmFields")), + ts::type_alias( + "IFarmCreateResolve", + ts::generic("IResult", vec![ts::reference("Farm")]), + ), + ts::type_alias("IFarmDelete", ts::reference("IFarmFindOne")), + ts::type_alias( + "IFarmDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IFarmFields", + ts::object(vec![ + ts::field("d_tag", ts::string()), + ts::field("pubkey", ts::string()), + ts::field("name", ts::string()), + ts::optional_field("about", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("website", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("picture", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("banner", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("location_city", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("location_region", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_country", + ts::union(vec![ts::string(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "IFarmFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("d_tag", ts::string()), + ts::optional_field("pubkey", ts::string()), + ts::optional_field("name", ts::string()), + ts::optional_field("about", ts::string()), + ts::optional_field("website", ts::string()), + ts::optional_field("picture", ts::string()), + ts::optional_field("banner", ts::string()), + ts::optional_field("location_primary", ts::string()), + ts::optional_field("location_city", ts::string()), + ts::optional_field("location_region", ts::string()), + ts::optional_field("location_country", ts::string()), + ]), + ), + ts::type_alias( + "IFarmFieldsPartial", + ts::object(vec![ + ts::optional_field("d_tag", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("about", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("website", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("picture", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("banner", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("location_city", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("location_region", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_country", + ts::union(vec![ts::string(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "IFarmFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IFarmFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "IFarmFindManyResolve", + ts::generic("IResultList", vec![ts::reference("Farm")]), + ), + ts::type_alias("IFarmFindOne", ts::reference("IFarmFindOneArgs")), + ts::type_alias( + "IFarmFindOneArgs", + ts::object(vec![ts::field("on", ts::reference("FarmQueryBindValues"))]), + ), + ts::type_alias( + "IFarmFindOneResolve", + ts::generic("IResult", vec![ts::reference("Farm")]), + ), + ts::type_alias( + "IFarmGcsLocationCreate", + ts::reference("IFarmGcsLocationFields"), + ), + ts::type_alias( + "IFarmGcsLocationCreateResolve", + ts::generic("IResult", vec![ts::reference("FarmGcsLocation")]), + ), + ts::type_alias( + "IFarmGcsLocationDelete", + ts::reference("IFarmGcsLocationFindOne"), + ), + ts::type_alias( + "IFarmGcsLocationDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IFarmGcsLocationFields", + ts::object(vec![ + ts::field("farm_id", ts::string()), + ts::field("gcs_location_id", ts::string()), + ts::field("role", ts::string()), + ]), + ), + ts::type_alias( + "IFarmGcsLocationFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("farm_id", ts::string()), + ts::optional_field("gcs_location_id", ts::string()), + ts::optional_field("role", ts::string()), + ]), + ), + ts::type_alias( + "IFarmGcsLocationFieldsPartial", + ts::object(vec![ + ts::optional_field("farm_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gcs_location_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("role", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IFarmGcsLocationFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ + ts::reference("IFarmGcsLocationFieldsFilter"), + ts::null(), + ]), + )]), + ), + ts::type_alias( + "IFarmGcsLocationFindManyResolve", + ts::generic("IResultList", vec![ts::reference("FarmGcsLocation")]), + ), + ts::type_alias( + "IFarmGcsLocationFindOne", + ts::reference("IFarmGcsLocationFindOneArgs"), + ), + ts::type_alias( + "IFarmGcsLocationFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("FarmGcsLocationQueryBindValues"), + )]), + ), + ts::type_alias( + "IFarmGcsLocationFindOneResolve", + ts::generic("IResult", vec![ts::reference("FarmGcsLocation")]), + ), + ts::type_alias( + "IFarmGcsLocationUpdate", + ts::object(vec![ + ts::field("on", ts::reference("FarmGcsLocationQueryBindValues")), + ts::field("fields", ts::reference("IFarmGcsLocationFieldsPartial")), + ]), + ), + ts::type_alias( + "IFarmGcsLocationUpdateResolve", + ts::generic("IResult", vec![ts::reference("FarmGcsLocation")]), + ), + ts::type_alias( + "IFarmMemberClaimCreate", + ts::reference("IFarmMemberClaimFields"), + ), + ts::type_alias( + "IFarmMemberClaimCreateResolve", + ts::generic("IResult", vec![ts::reference("FarmMemberClaim")]), + ), + ts::type_alias( + "IFarmMemberClaimDelete", + ts::reference("IFarmMemberClaimFindOne"), + ), + ts::type_alias( + "IFarmMemberClaimDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IFarmMemberClaimFields", + ts::object(vec![ + ts::field("member_pubkey", ts::string()), + ts::field("farm_pubkey", ts::string()), + ]), + ), + ts::type_alias( + "IFarmMemberClaimFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("member_pubkey", ts::string()), + ts::optional_field("farm_pubkey", ts::string()), + ]), + ), + ts::type_alias( + "IFarmMemberClaimFieldsPartial", + ts::object(vec![ + ts::optional_field("member_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("farm_pubkey", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IFarmMemberClaimFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ + ts::reference("IFarmMemberClaimFieldsFilter"), + ts::null(), + ]), + )]), + ), + ts::type_alias( + "IFarmMemberClaimFindManyResolve", + ts::generic("IResultList", vec![ts::reference("FarmMemberClaim")]), + ), + ts::type_alias( + "IFarmMemberClaimFindOne", + ts::reference("IFarmMemberClaimFindOneArgs"), + ), + ts::type_alias( + "IFarmMemberClaimFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("FarmMemberClaimQueryBindValues"), + )]), + ), + ts::type_alias( + "IFarmMemberClaimFindOneResolve", + ts::generic("IResult", vec![ts::reference("FarmMemberClaim")]), + ), + ts::type_alias( + "IFarmMemberClaimUpdate", + ts::object(vec![ + ts::field("on", ts::reference("FarmMemberClaimQueryBindValues")), + ts::field("fields", ts::reference("IFarmMemberClaimFieldsPartial")), + ]), + ), + ts::type_alias( + "IFarmMemberClaimUpdateResolve", + ts::generic("IResult", vec![ts::reference("FarmMemberClaim")]), + ), + ts::type_alias("IFarmMemberCreate", ts::reference("IFarmMemberFields")), + ts::type_alias( + "IFarmMemberCreateResolve", + ts::generic("IResult", vec![ts::reference("FarmMember")]), + ), + ts::type_alias("IFarmMemberDelete", ts::reference("IFarmMemberFindOne")), + ts::type_alias( + "IFarmMemberDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IFarmMemberFields", + ts::object(vec![ + ts::field("farm_id", ts::string()), + ts::field("member_pubkey", ts::string()), + ts::field("role", ts::string()), + ]), + ), + ts::type_alias( + "IFarmMemberFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("farm_id", ts::string()), + ts::optional_field("member_pubkey", ts::string()), + ts::optional_field("role", ts::string()), + ]), + ), + ts::type_alias( + "IFarmMemberFieldsPartial", + ts::object(vec![ + ts::optional_field("farm_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("member_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("role", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IFarmMemberFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IFarmMemberFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "IFarmMemberFindManyResolve", + ts::generic("IResultList", vec![ts::reference("FarmMember")]), + ), + ts::type_alias( + "IFarmMemberFindOne", + ts::reference("IFarmMemberFindOneArgs"), + ), + ts::type_alias( + "IFarmMemberFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("FarmMemberQueryBindValues"), + )]), + ), + ts::type_alias( + "IFarmMemberFindOneResolve", + ts::generic("IResult", vec![ts::reference("FarmMember")]), + ), + ts::type_alias( + "IFarmMemberUpdate", + ts::object(vec![ + ts::field("on", ts::reference("FarmMemberQueryBindValues")), + ts::field("fields", ts::reference("IFarmMemberFieldsPartial")), + ]), + ), + ts::type_alias( + "IFarmMemberUpdateResolve", + ts::generic("IResult", vec![ts::reference("FarmMember")]), + ), + ts::type_alias("IFarmTagCreate", ts::reference("IFarmTagFields")), + ts::type_alias( + "IFarmTagCreateResolve", + ts::generic("IResult", vec![ts::reference("FarmTag")]), + ), + ts::type_alias("IFarmTagDelete", ts::reference("IFarmTagFindOne")), + ts::type_alias( + "IFarmTagDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IFarmTagFields", + ts::object(vec![ + ts::field("farm_id", ts::string()), + ts::field("tag", ts::string()), + ]), + ), + ts::type_alias( + "IFarmTagFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("farm_id", ts::string()), + ts::optional_field("tag", ts::string()), + ]), + ), + ts::type_alias( + "IFarmTagFieldsPartial", + ts::object(vec![ + ts::optional_field("farm_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("tag", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IFarmTagFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IFarmTagFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "IFarmTagFindManyResolve", + ts::generic("IResultList", vec![ts::reference("FarmTag")]), + ), + ts::type_alias("IFarmTagFindOne", ts::reference("IFarmTagFindOneArgs")), + ts::type_alias( + "IFarmTagFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("FarmTagQueryBindValues"), + )]), + ), + ts::type_alias( + "IFarmTagFindOneResolve", + ts::generic("IResult", vec![ts::reference("FarmTag")]), + ), + ts::type_alias( + "IFarmTagUpdate", + ts::object(vec![ + ts::field("on", ts::reference("FarmTagQueryBindValues")), + ts::field("fields", ts::reference("IFarmTagFieldsPartial")), + ]), + ), + ts::type_alias( + "IFarmTagUpdateResolve", + ts::generic("IResult", vec![ts::reference("FarmTag")]), + ), + ts::type_alias( + "IFarmUpdate", + ts::object(vec![ + ts::field("on", ts::reference("FarmQueryBindValues")), + ts::field("fields", ts::reference("IFarmFieldsPartial")), + ]), + ), + ts::type_alias( + "IFarmUpdateResolve", + ts::generic("IResult", vec![ts::reference("Farm")]), + ), + ts::type_alias("IGcsLocationCreate", ts::reference("IGcsLocationFields")), + ts::type_alias( + "IGcsLocationCreateResolve", + ts::generic("IResult", vec![ts::reference("GcsLocation")]), + ), + ts::type_alias("IGcsLocationDelete", ts::reference("IGcsLocationFindOne")), + ts::type_alias( + "IGcsLocationDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IGcsLocationFields", + ts::object(vec![ + ts::field("d_tag", ts::string()), + ts::field("lat", ts::number()), + ts::field("lng", ts::number()), + ts::field("geohash", ts::string()), + ts::field("point", ts::string()), + ts::field("polygon", ts::string()), + ts::optional_field("accuracy", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("altitude", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("tag_0", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("area", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("elevation", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("soil", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("climate", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_admin1_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_admin1_name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_country_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_country_name", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IGcsLocationFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("d_tag", ts::string()), + ts::optional_field("lat", ts::number()), + ts::optional_field("lng", ts::number()), + ts::optional_field("geohash", ts::string()), + ts::optional_field("point", ts::string()), + ts::optional_field("polygon", ts::string()), + ts::optional_field("accuracy", ts::number()), + ts::optional_field("altitude", ts::number()), + ts::optional_field("tag_0", ts::string()), + ts::optional_field("label", ts::string()), + ts::optional_field("area", ts::number()), + ts::optional_field("elevation", ts::number()), + ts::optional_field("soil", ts::string()), + ts::optional_field("climate", ts::string()), + ts::optional_field("gc_id", ts::string()), + ts::optional_field("gc_name", ts::string()), + ts::optional_field("gc_admin1_id", ts::string()), + ts::optional_field("gc_admin1_name", ts::string()), + ts::optional_field("gc_country_id", ts::string()), + ts::optional_field("gc_country_name", ts::string()), + ]), + ), + ts::type_alias( + "IGcsLocationFieldsPartial", + ts::object(vec![ + ts::optional_field("d_tag", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lat", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("lng", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("geohash", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("point", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("polygon", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("accuracy", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("altitude", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("tag_0", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("area", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("elevation", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("soil", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("climate", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_admin1_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_admin1_name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_country_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gc_country_name", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IGcsLocationFindMany", + ts::union(vec![ + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IGcsLocationFieldsFilter"), ts::null()]), + )]), + ts::object(vec![ts::field( + "rel", + ts::reference("GcsLocationFindManyRel"), + )]), + ]), + ), + ts::type_alias( + "IGcsLocationFindManyResolve", + ts::generic("IResultList", vec![ts::reference("GcsLocation")]), + ), + ts::type_alias( + "IGcsLocationFindOne", + ts::union(vec![ + ts::reference("IGcsLocationFindOneArgs"), + ts::reference("IGcsLocationFindOneRelArgs"), + ]), + ), + ts::type_alias( + "IGcsLocationFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("GcsLocationQueryBindValues"), + )]), + ), + ts::type_alias( + "IGcsLocationFindOneRelArgs", + ts::object(vec![ts::field( + "rel", + ts::reference("GcsLocationFindManyRel"), + )]), + ), + ts::type_alias( + "IGcsLocationFindOneResolve", + ts::generic("IResult", vec![ts::reference("GcsLocation")]), + ), + ts::type_alias( + "IGcsLocationUpdate", + ts::object(vec![ + ts::field("on", ts::reference("GcsLocationQueryBindValues")), + ts::field("fields", ts::reference("IGcsLocationFieldsPartial")), + ]), + ), + ts::type_alias( + "IGcsLocationUpdateResolve", + ts::generic("IResult", vec![ts::reference("GcsLocation")]), + ), + ts::type_alias("ILogErrorCreate", ts::reference("ILogErrorFields")), + ts::type_alias( + "ILogErrorCreateResolve", + ts::generic("IResult", vec![ts::reference("LogError")]), + ), + ts::type_alias("ILogErrorDelete", ts::reference("ILogErrorFindOne")), + ts::type_alias( + "ILogErrorDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "ILogErrorFields", + ts::object(vec![ + ts::field("error", ts::string()), + ts::field("message", ts::string()), + ts::optional_field("stack_trace", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("cause", ts::union(vec![ts::string(), ts::null()])), + ts::field("app_system", ts::string()), + ts::field("app_version", ts::string()), + ts::field("nostr_pubkey", ts::string()), + ts::optional_field("data", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "ILogErrorFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("error", ts::string()), + ts::optional_field("message", ts::string()), + ts::optional_field("stack_trace", ts::string()), + ts::optional_field("cause", ts::string()), + ts::optional_field("app_system", ts::string()), + ts::optional_field("app_version", ts::string()), + ts::optional_field("nostr_pubkey", ts::string()), + ts::optional_field("data", ts::string()), + ]), + ), + ts::type_alias( + "ILogErrorFieldsPartial", + ts::object(vec![ + ts::optional_field("error", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("message", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("stack_trace", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("cause", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("app_system", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("app_version", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("nostr_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("data", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "ILogErrorFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("ILogErrorFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "ILogErrorFindManyResolve", + ts::generic("IResultList", vec![ts::reference("LogError")]), + ), + ts::type_alias("ILogErrorFindOne", ts::reference("ILogErrorFindOneArgs")), + ts::type_alias( + "ILogErrorFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("LogErrorQueryBindValues"), + )]), + ), + ts::type_alias( + "ILogErrorFindOneResolve", + ts::generic("IResult", vec![ts::reference("LogError")]), + ), + ts::type_alias( + "ILogErrorUpdate", + ts::object(vec![ + ts::field("on", ts::reference("LogErrorQueryBindValues")), + ts::field("fields", ts::reference("ILogErrorFieldsPartial")), + ]), + ), + ts::type_alias( + "ILogErrorUpdateResolve", + ts::generic("IResult", vec![ts::reference("LogError")]), + ), + ts::type_alias("IMediaImageCreate", ts::reference("IMediaImageFields")), + ts::type_alias( + "IMediaImageCreateResolve", + ts::generic("IResult", vec![ts::reference("MediaImage")]), + ), + ts::type_alias("IMediaImageDelete", ts::reference("IMediaImageFindOne")), + ts::type_alias( + "IMediaImageDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IMediaImageFields", + ts::object(vec![ + ts::field("file_path", ts::string()), + ts::field("mime_type", ts::string()), + ts::field("res_base", ts::string()), + ts::field("res_path", ts::string()), + ts::optional_field("label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("description", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IMediaImageFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("file_path", ts::string()), + ts::optional_field("mime_type", ts::string()), + ts::optional_field("res_base", ts::string()), + ts::optional_field("res_path", ts::string()), + ts::optional_field("label", ts::string()), + ts::optional_field("description", ts::string()), + ]), + ), + ts::type_alias( + "IMediaImageFieldsPartial", + ts::object(vec![ + ts::optional_field("file_path", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("mime_type", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("res_base", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("res_path", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("description", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IMediaImageFindMany", + ts::union(vec![ + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IMediaImageFieldsFilter"), ts::null()]), + )]), + ts::object(vec![ts::field( + "rel", + ts::reference("MediaImageFindManyRel"), + )]), + ]), + ), + ts::type_alias( + "IMediaImageFindManyResolve", + ts::generic("IResultList", vec![ts::reference("MediaImage")]), + ), + ts::type_alias( + "IMediaImageFindOne", + ts::union(vec![ + ts::reference("IMediaImageFindOneArgs"), + ts::reference("IMediaImageFindOneRelArgs"), + ]), + ), + ts::type_alias( + "IMediaImageFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("MediaImageQueryBindValues"), + )]), + ), + ts::type_alias( + "IMediaImageFindOneRelArgs", + ts::object(vec![ts::field( + "rel", + ts::reference("MediaImageFindManyRel"), + )]), + ), + ts::type_alias( + "IMediaImageFindOneResolve", + ts::generic("IResult", vec![ts::reference("MediaImage")]), + ), + ts::type_alias( + "IMediaImageUpdate", + ts::object(vec![ + ts::field("on", ts::reference("MediaImageQueryBindValues")), + ts::field("fields", ts::reference("IMediaImageFieldsPartial")), + ]), + ), + ts::type_alias( + "IMediaImageUpdateResolve", + ts::generic("IResult", vec![ts::reference("MediaImage")]), + ), + ts::type_alias( + "INostrEventStateCreate", + ts::reference("INostrEventStateFields"), + ), + ts::type_alias( + "INostrEventStateCreateResolve", + ts::generic("IResult", vec![ts::reference("NostrEventState")]), + ), + ts::type_alias( + "INostrEventStateDelete", + ts::reference("INostrEventStateFindOne"), + ), + ts::type_alias( + "INostrEventStateDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "INostrEventStateFields", + ts::object(vec![ + ts::field("key", ts::string()), + ts::field("kind", ts::number()), + ts::field("pubkey", ts::string()), + ts::field("d_tag", ts::string()), + ts::field("last_event_id", ts::string()), + ts::field("last_created_at", ts::number()), + ts::field("content_hash", ts::string()), + ]), + ), + ts::type_alias( + "INostrEventStateFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("key", ts::string()), + ts::optional_field("kind", ts::number()), + ts::optional_field("pubkey", ts::string()), + ts::optional_field("d_tag", ts::string()), + ts::optional_field("last_event_id", ts::string()), + ts::optional_field("last_created_at", ts::number()), + ts::optional_field("content_hash", ts::string()), + ]), + ), + ts::type_alias( + "INostrEventStateFieldsPartial", + ts::object(vec![ + ts::optional_field("key", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("kind", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("d_tag", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("last_event_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("last_created_at", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("content_hash", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "INostrEventStateFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ + ts::reference("INostrEventStateFieldsFilter"), + ts::null(), + ]), + )]), + ), + ts::type_alias( + "INostrEventStateFindManyResolve", + ts::generic("IResultList", vec![ts::reference("NostrEventState")]), + ), + ts::type_alias( + "INostrEventStateFindOne", + ts::reference("INostrEventStateFindOneArgs"), + ), + ts::type_alias( + "INostrEventStateFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("NostrEventStateQueryBindValues"), + )]), + ), + ts::type_alias( + "INostrEventStateFindOneResolve", + ts::generic("IResult", vec![ts::reference("NostrEventState")]), + ), + ts::type_alias( + "INostrEventStateUpdate", + ts::object(vec![ + ts::field("on", ts::reference("NostrEventStateQueryBindValues")), + ts::field("fields", ts::reference("INostrEventStateFieldsPartial")), + ]), + ), + ts::type_alias( + "INostrEventStateUpdateResolve", + ts::generic("IResult", vec![ts::reference("NostrEventState")]), + ), + ts::type_alias("INostrProfileCreate", ts::reference("INostrProfileFields")), + ts::type_alias( + "INostrProfileCreateResolve", + ts::generic("IResult", vec![ts::reference("NostrProfile")]), + ), + ts::type_alias("INostrProfileDelete", ts::reference("INostrProfileFindOne")), + ts::type_alias( + "INostrProfileDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "INostrProfileFields", + ts::object(vec![ + ts::field("public_key", ts::string()), + ts::field("profile_type", ts::string()), + ts::field("name", ts::string()), + ts::optional_field("display_name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("about", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("website", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("picture", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("banner", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("nip05", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lud06", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lud16", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "INostrProfileFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("public_key", ts::string()), + ts::optional_field("profile_type", ts::string()), + ts::optional_field("name", ts::string()), + ts::optional_field("display_name", ts::string()), + ts::optional_field("about", ts::string()), + ts::optional_field("website", ts::string()), + ts::optional_field("picture", ts::string()), + ts::optional_field("banner", ts::string()), + ts::optional_field("nip05", ts::string()), + ts::optional_field("lud06", ts::string()), + ts::optional_field("lud16", ts::string()), + ]), + ), + ts::type_alias( + "INostrProfileFieldsPartial", + ts::object(vec![ + ts::optional_field("public_key", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("profile_type", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("display_name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("about", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("website", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("picture", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("banner", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("nip05", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lud06", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lud16", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "INostrProfileFindMany", + ts::union(vec![ + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("INostrProfileFieldsFilter"), ts::null()]), + )]), + ts::object(vec![ts::field( + "rel", + ts::reference("NostrProfileFindManyRel"), + )]), + ]), + ), + ts::type_alias( + "INostrProfileFindManyResolve", + ts::generic("IResultList", vec![ts::reference("NostrProfile")]), + ), + ts::type_alias( + "INostrProfileFindOne", + ts::union(vec![ + ts::reference("INostrProfileFindOneArgs"), + ts::reference("INostrProfileFindOneRelArgs"), + ]), + ), + ts::type_alias( + "INostrProfileFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("NostrProfileQueryBindValues"), + )]), + ), + ts::type_alias( + "INostrProfileFindOneRelArgs", + ts::object(vec![ts::field( + "rel", + ts::reference("NostrProfileFindManyRel"), + )]), + ), + ts::type_alias( + "INostrProfileFindOneResolve", + ts::generic("IResult", vec![ts::reference("NostrProfile")]), + ), + ts::type_alias( + "INostrProfileRelayRelation", + ts::object(vec![ + ts::field( + "nostr_profile", + ts::reference("NostrProfileQueryBindValues"), + ), + ts::field("nostr_relay", ts::reference("NostrRelayQueryBindValues")), + ]), + ), + ts::type_alias("INostrProfileRelayResolve", ts::reference("IResultPass")), + ts::type_alias( + "INostrProfileUpdate", + ts::object(vec![ + ts::field("on", ts::reference("NostrProfileQueryBindValues")), + ts::field("fields", ts::reference("INostrProfileFieldsPartial")), + ]), + ), + ts::type_alias( + "INostrProfileUpdateResolve", + ts::generic("IResult", vec![ts::reference("NostrProfile")]), + ), + ts::type_alias("INostrRelayCreate", ts::reference("INostrRelayFields")), + ts::type_alias( + "INostrRelayCreateResolve", + ts::generic("IResult", vec![ts::reference("NostrRelay")]), + ), + ts::type_alias("INostrRelayDelete", ts::reference("INostrRelayFindOne")), + ts::type_alias( + "INostrRelayDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "INostrRelayFields", + ts::object(vec![ + ts::field("url", ts::string()), + ts::optional_field("relay_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("description", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("contact", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("supported_nips", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("software", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("version", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("data", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "INostrRelayFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("url", ts::string()), + ts::optional_field("relay_id", ts::string()), + ts::optional_field("name", ts::string()), + ts::optional_field("description", ts::string()), + ts::optional_field("pubkey", ts::string()), + ts::optional_field("contact", ts::string()), + ts::optional_field("supported_nips", ts::string()), + ts::optional_field("software", ts::string()), + ts::optional_field("version", ts::string()), + ts::optional_field("data", ts::string()), + ]), + ), + ts::type_alias( + "INostrRelayFieldsPartial", + ts::object(vec![ + ts::optional_field("url", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("relay_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("description", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("contact", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("supported_nips", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("software", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("version", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("data", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "INostrRelayFindMany", + ts::union(vec![ + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("INostrRelayFieldsFilter"), ts::null()]), + )]), + ts::object(vec![ts::field( + "rel", + ts::reference("NostrRelayFindManyRel"), + )]), + ]), + ), + ts::type_alias( + "INostrRelayFindManyResolve", + ts::generic("IResultList", vec![ts::reference("NostrRelay")]), + ), + ts::type_alias( + "INostrRelayFindOne", + ts::union(vec![ + ts::reference("INostrRelayFindOneArgs"), + ts::reference("INostrRelayFindOneRelArgs"), + ]), + ), + ts::type_alias( + "INostrRelayFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("NostrRelayQueryBindValues"), + )]), + ), + ts::type_alias( + "INostrRelayFindOneRelArgs", + ts::object(vec![ts::field( + "rel", + ts::reference("NostrRelayFindManyRel"), + )]), + ), + ts::type_alias( + "INostrRelayFindOneResolve", + ts::generic("IResult", vec![ts::reference("NostrRelay")]), + ), + ts::type_alias( + "INostrRelayUpdate", + ts::object(vec![ + ts::field("on", ts::reference("NostrRelayQueryBindValues")), + ts::field("fields", ts::reference("INostrRelayFieldsPartial")), + ]), + ), + ts::type_alias( + "INostrRelayUpdateResolve", + ts::generic("IResult", vec![ts::reference("NostrRelay")]), + ), + ts::type_alias("IPlotCreate", ts::reference("IPlotFields")), + ts::type_alias( + "IPlotCreateResolve", + ts::generic("IResult", vec![ts::reference("Plot")]), + ), + ts::type_alias("IPlotDelete", ts::reference("IPlotFindOne")), + ts::type_alias( + "IPlotDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IPlotFields", + ts::object(vec![ + ts::field("d_tag", ts::string()), + ts::field("farm_id", ts::string()), + ts::field("name", ts::string()), + ts::optional_field("about", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("location_city", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("location_region", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_country", + ts::union(vec![ts::string(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "IPlotFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("d_tag", ts::string()), + ts::optional_field("farm_id", ts::string()), + ts::optional_field("name", ts::string()), + ts::optional_field("about", ts::string()), + ts::optional_field("location_primary", ts::string()), + ts::optional_field("location_city", ts::string()), + ts::optional_field("location_region", ts::string()), + ts::optional_field("location_country", ts::string()), + ]), + ), + ts::type_alias( + "IPlotFieldsPartial", + ts::object(vec![ + ts::optional_field("d_tag", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("farm_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("name", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("about", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("location_city", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("location_region", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "location_country", + ts::union(vec![ts::string(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "IPlotFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IPlotFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "IPlotFindManyResolve", + ts::generic("IResultList", vec![ts::reference("Plot")]), + ), + ts::type_alias("IPlotFindOne", ts::reference("IPlotFindOneArgs")), + ts::type_alias( + "IPlotFindOneArgs", + ts::object(vec![ts::field("on", ts::reference("PlotQueryBindValues"))]), + ), + ts::type_alias( + "IPlotFindOneResolve", + ts::generic("IResult", vec![ts::reference("Plot")]), + ), + ts::type_alias( + "IPlotGcsLocationCreate", + ts::reference("IPlotGcsLocationFields"), + ), + ts::type_alias( + "IPlotGcsLocationCreateResolve", + ts::generic("IResult", vec![ts::reference("PlotGcsLocation")]), + ), + ts::type_alias( + "IPlotGcsLocationDelete", + ts::reference("IPlotGcsLocationFindOne"), + ), + ts::type_alias( + "IPlotGcsLocationDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IPlotGcsLocationFields", + ts::object(vec![ + ts::field("plot_id", ts::string()), + ts::field("gcs_location_id", ts::string()), + ts::field("role", ts::string()), + ]), + ), + ts::type_alias( + "IPlotGcsLocationFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("plot_id", ts::string()), + ts::optional_field("gcs_location_id", ts::string()), + ts::optional_field("role", ts::string()), + ]), + ), + ts::type_alias( + "IPlotGcsLocationFieldsPartial", + ts::object(vec![ + ts::optional_field("plot_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("gcs_location_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("role", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IPlotGcsLocationFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ + ts::reference("IPlotGcsLocationFieldsFilter"), + ts::null(), + ]), + )]), + ), + ts::type_alias( + "IPlotGcsLocationFindManyResolve", + ts::generic("IResultList", vec![ts::reference("PlotGcsLocation")]), + ), + ts::type_alias( + "IPlotGcsLocationFindOne", + ts::reference("IPlotGcsLocationFindOneArgs"), + ), + ts::type_alias( + "IPlotGcsLocationFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("PlotGcsLocationQueryBindValues"), + )]), + ), + ts::type_alias( + "IPlotGcsLocationFindOneResolve", + ts::generic("IResult", vec![ts::reference("PlotGcsLocation")]), + ), + ts::type_alias( + "IPlotGcsLocationUpdate", + ts::object(vec![ + ts::field("on", ts::reference("PlotGcsLocationQueryBindValues")), + ts::field("fields", ts::reference("IPlotGcsLocationFieldsPartial")), + ]), + ), + ts::type_alias( + "IPlotGcsLocationUpdateResolve", + ts::generic("IResult", vec![ts::reference("PlotGcsLocation")]), + ), + ts::type_alias("IPlotTagCreate", ts::reference("IPlotTagFields")), + ts::type_alias( + "IPlotTagCreateResolve", + ts::generic("IResult", vec![ts::reference("PlotTag")]), + ), + ts::type_alias("IPlotTagDelete", ts::reference("IPlotTagFindOne")), + ts::type_alias( + "IPlotTagDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "IPlotTagFields", + ts::object(vec![ + ts::field("plot_id", ts::string()), + ts::field("tag", ts::string()), + ]), + ), + ts::type_alias( + "IPlotTagFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("plot_id", ts::string()), + ts::optional_field("tag", ts::string()), + ]), + ), + ts::type_alias( + "IPlotTagFieldsPartial", + ts::object(vec![ + ts::optional_field("plot_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("tag", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "IPlotTagFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("IPlotTagFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "IPlotTagFindManyResolve", + ts::generic("IResultList", vec![ts::reference("PlotTag")]), + ), + ts::type_alias("IPlotTagFindOne", ts::reference("IPlotTagFindOneArgs")), + ts::type_alias( + "IPlotTagFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("PlotTagQueryBindValues"), + )]), + ), + ts::type_alias( + "IPlotTagFindOneResolve", + ts::generic("IResult", vec![ts::reference("PlotTag")]), + ), + ts::type_alias( + "IPlotTagUpdate", + ts::object(vec![ + ts::field("on", ts::reference("PlotTagQueryBindValues")), + ts::field("fields", ts::reference("IPlotTagFieldsPartial")), + ]), + ), + ts::type_alias( + "IPlotTagUpdateResolve", + ts::generic("IResult", vec![ts::reference("PlotTag")]), + ), + ts::type_alias( + "IPlotUpdate", + ts::object(vec![ + ts::field("on", ts::reference("PlotQueryBindValues")), + ts::field("fields", ts::reference("IPlotFieldsPartial")), + ]), + ), + ts::type_alias( + "IPlotUpdateResolve", + ts::generic("IResult", vec![ts::reference("Plot")]), + ), + ts::type_alias("ITradeProductCreate", ts::reference("ITradeProductFields")), + ts::type_alias( + "ITradeProductCreateResolve", + ts::generic("IResult", vec![ts::reference("TradeProduct")]), + ), + ts::type_alias("ITradeProductDelete", ts::reference("ITradeProductFindOne")), + ts::type_alias( + "ITradeProductDeleteResolve", + ts::generic("IResult", vec![ts::string()]), + ), + ts::type_alias( + "ITradeProductFields", + ts::object(vec![ + ts::field("key", ts::string()), + ts::field("category", ts::string()), + ts::field("title", ts::string()), + ts::field("summary", ts::string()), + ts::field("process", ts::string()), + ts::field("lot", ts::string()), + ts::field("profile", ts::string()), + ts::field("year", ts::bigint()), + ts::field("qty_amt", ts::number()), + ts::field("qty_amt_exact", ts::string()), + ts::field("qty_unit", ts::string()), + ts::optional_field("qty_label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("qty_avail", ts::union(vec![ts::number(), ts::null()])), + ts::field("price_amt", ts::number()), + ts::field("price_amt_exact", ts::string()), + ts::field("price_currency", ts::string()), + ts::field("price_qty_amt", ts::number()), + ts::field("price_qty_amt_exact", ts::string()), + ts::field("price_qty_unit", ts::string()), + ts::optional_field("listing_addr", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("primary_bin_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "verified_primary_bin_id", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("notes", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "ITradeProductFieldsFilter", + ts::object(vec![ + ts::optional_field("id", ts::string()), + ts::optional_field("created_at", ts::string()), + ts::optional_field("updated_at", ts::string()), + ts::optional_field("key", ts::string()), + ts::optional_field("category", ts::string()), + ts::optional_field("title", ts::string()), + ts::optional_field("summary", ts::string()), + ts::optional_field("process", ts::string()), + ts::optional_field("lot", ts::string()), + ts::optional_field("profile", ts::string()), + ts::optional_field("year", ts::bigint()), + ts::optional_field("qty_amt", ts::number()), + ts::optional_field("qty_amt_exact", ts::string()), + ts::optional_field("qty_unit", ts::string()), + ts::optional_field("qty_label", ts::string()), + ts::optional_field("qty_avail", ts::bigint()), + ts::optional_field("price_amt", ts::number()), + ts::optional_field("price_amt_exact", ts::string()), + ts::optional_field("price_currency", ts::string()), + ts::optional_field("price_qty_amt", ts::number()), + ts::optional_field("price_qty_amt_exact", ts::string()), + ts::optional_field("price_qty_unit", ts::string()), + ts::optional_field("listing_addr", ts::string()), + ts::optional_field("primary_bin_id", ts::string()), + ts::optional_field("verified_primary_bin_id", ts::string()), + ts::optional_field("notes", ts::string()), + ]), + ), + ts::type_alias( + "ITradeProductFieldsPartial", + ts::object(vec![ + ts::optional_field("key", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("category", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("title", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("summary", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("process", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lot", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("profile", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("year", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("qty_amt", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("qty_amt_exact", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("qty_unit", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("qty_label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("qty_avail", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("price_amt", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("price_amt_exact", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("price_currency", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("price_qty_amt", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field( + "price_qty_amt_exact", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("price_qty_unit", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("listing_addr", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("primary_bin_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "verified_primary_bin_id", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("notes", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "ITradeProductFindMany", + ts::object(vec![ts::field( + "filter", + ts::union(vec![ts::reference("ITradeProductFieldsFilter"), ts::null()]), + )]), + ), + ts::type_alias( + "ITradeProductFindManyResolve", + ts::generic("IResultList", vec![ts::reference("TradeProduct")]), + ), + ts::type_alias( + "ITradeProductFindOne", + ts::reference("ITradeProductFindOneArgs"), + ), + ts::type_alias( + "ITradeProductFindOneArgs", + ts::object(vec![ts::field( + "on", + ts::reference("TradeProductQueryBindValues"), + )]), + ), + ts::type_alias( + "ITradeProductFindOneResolve", + ts::generic("IResult", vec![ts::reference("TradeProduct")]), + ), + ts::type_alias( + "ITradeProductLocationRelation", + ts::object(vec![ + ts::field( + "trade_product", + ts::reference("TradeProductQueryBindValues"), + ), + ts::field("gcs_location", ts::reference("GcsLocationQueryBindValues")), + ]), + ), + ts::type_alias("ITradeProductLocationResolve", ts::reference("IResultPass")), + ts::type_alias( + "ITradeProductMediaRelation", + ts::object(vec![ + ts::field( + "trade_product", + ts::reference("TradeProductQueryBindValues"), + ), + ts::field("media_image", ts::reference("MediaImageQueryBindValues")), + ]), + ), + ts::type_alias("ITradeProductMediaResolve", ts::reference("IResultPass")), + ts::type_alias( + "ITradeProductUpdate", + ts::object(vec![ + ts::field("on", ts::reference("TradeProductQueryBindValues")), + ts::field("fields", ts::reference("ITradeProductFieldsPartial")), + ]), + ), + ts::type_alias( + "ITradeProductUpdateResolve", + ts::generic("IResult", vec![ts::reference("TradeProduct")]), + ), + ts::type_alias( + "LogError", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("error", ts::string()), + ts::field("message", ts::string()), + ts::field("stack_trace", ts::union(vec![ts::string(), ts::null()])), + ts::field("cause", ts::union(vec![ts::string(), ts::null()])), + ts::field("app_system", ts::string()), + ts::field("app_version", ts::string()), + ts::field("nostr_pubkey", ts::string()), + ts::field("data", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "LogErrorQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("nostr_pubkey", ts::string())]), + ]), + ), + ts::type_alias( + "MediaImage", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("file_path", ts::string()), + ts::field("mime_type", ts::string()), + ts::field("res_base", ts::string()), + ts::field("res_path", ts::string()), + ts::field("label", ts::union(vec![ts::string(), ts::null()])), + ts::field("description", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "MediaImageFindManyRel", + ts::union(vec![ + ts::object(vec![ts::field( + "on_trade_product", + ts::reference("MediaImageTradeProductArgs"), + )]), + ts::object(vec![ts::field( + "off_trade_product", + ts::reference("MediaImageTradeProductArgs"), + )]), + ]), + ), + ts::type_alias( + "MediaImageQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("file_path", ts::string())]), + ]), + ), + ts::type_alias( + "MediaImageTradeProductArgs", + ts::object(vec![ts::field("id", ts::string())]), + ), + ts::type_alias( + "NostrEventState", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("key", ts::string()), + ts::field("kind", ts::number()), + ts::field("pubkey", ts::string()), + ts::field("d_tag", ts::string()), + ts::field("last_event_id", ts::string()), + ts::field("last_created_at", ts::number()), + ts::field("content_hash", ts::string()), + ]), + ), + ts::type_alias( + "NostrEventStateQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("key", ts::string())]), + ]), + ), + ts::type_alias( + "NostrProfile", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("public_key", ts::string()), + ts::field("profile_type", ts::string()), + ts::field("name", ts::string()), + ts::field("display_name", ts::union(vec![ts::string(), ts::null()])), + ts::field("about", ts::union(vec![ts::string(), ts::null()])), + ts::field("website", ts::union(vec![ts::string(), ts::null()])), + ts::field("picture", ts::union(vec![ts::string(), ts::null()])), + ts::field("banner", ts::union(vec![ts::string(), ts::null()])), + ts::field("nip05", ts::union(vec![ts::string(), ts::null()])), + ts::field("lud06", ts::union(vec![ts::string(), ts::null()])), + ts::field("lud16", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "NostrProfileFindManyRel", + ts::union(vec![ + ts::object(vec![ts::field( + "on_relay", + ts::reference("NostrProfileRelayArgs"), + )]), + ts::object(vec![ts::field( + "off_relay", + ts::reference("NostrProfileRelayArgs"), + )]), + ]), + ), + ts::type_alias( + "NostrProfileQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("public_key", ts::string())]), + ]), + ), + ts::type_alias( + "NostrProfileRelayArgs", + ts::object(vec![ts::field("id", ts::string())]), + ), + ts::type_alias( + "NostrRelay", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("url", ts::string()), + ts::field("relay_id", ts::union(vec![ts::string(), ts::null()])), + ts::field("name", ts::union(vec![ts::string(), ts::null()])), + ts::field("description", ts::union(vec![ts::string(), ts::null()])), + ts::field("pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::field("contact", ts::union(vec![ts::string(), ts::null()])), + ts::field("supported_nips", ts::union(vec![ts::string(), ts::null()])), + ts::field("software", ts::union(vec![ts::string(), ts::null()])), + ts::field("version", ts::union(vec![ts::string(), ts::null()])), + ts::field("data", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "NostrRelayFindManyRel", + ts::union(vec![ + ts::object(vec![ts::field( + "on_profile", + ts::reference("NostrRelayProfileArgs"), + )]), + ts::object(vec![ts::field( + "off_profile", + ts::reference("NostrRelayProfileArgs"), + )]), + ]), + ), + ts::type_alias( + "NostrRelayProfileArgs", + ts::object(vec![ts::field("public_key", ts::string())]), + ), + ts::type_alias( + "NostrRelayQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("url", ts::string())]), + ]), + ), + ts::type_alias( + "Plot", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("d_tag", ts::string()), + ts::field("farm_id", ts::string()), + ts::field("name", ts::string()), + ts::field("about", ts::union(vec![ts::string(), ts::null()])), + ts::field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::field("location_city", ts::union(vec![ts::string(), ts::null()])), + ts::field("location_region", ts::union(vec![ts::string(), ts::null()])), + ts::field( + "location_country", + ts::union(vec![ts::string(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "PlotGcsLocation", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("plot_id", ts::string()), + ts::field("gcs_location_id", ts::string()), + ts::field("role", ts::string()), + ]), + ), + ts::type_alias( + "PlotGcsLocationQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("plot_id", ts::string())]), + ts::object(vec![ts::field("gcs_location_id", ts::string())]), + ]), + ), + ts::type_alias( + "PlotQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("d_tag", ts::string())]), + ts::object(vec![ts::field("farm_id", ts::string())]), + ]), + ), + ts::type_alias( + "PlotTag", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("plot_id", ts::string()), + ts::field("tag", ts::string()), + ]), + ), + ts::type_alias( + "PlotTagQueryBindValues", + ts::union(vec![ + ts::object(vec![ts::field("id", ts::string())]), + ts::object(vec![ts::field("plot_id", ts::string())]), + ts::object(vec![ts::field("tag", ts::string())]), + ]), + ), + ts::type_alias( + "TradeProduct", + ts::object(vec![ + ts::field("id", ts::string()), + ts::field("created_at", ts::string()), + ts::field("updated_at", ts::string()), + ts::field("key", ts::string()), + ts::field("category", ts::string()), + ts::field("title", ts::string()), + ts::field("summary", ts::string()), + ts::field("process", ts::string()), + ts::field("lot", ts::string()), + ts::field("profile", ts::string()), + ts::field("year", ts::bigint()), + ts::field("qty_amt", ts::number()), + ts::field("qty_amt_exact", ts::union(vec![ts::string(), ts::null()])), + ts::field("qty_unit", ts::string()), + ts::field("qty_label", ts::union(vec![ts::string(), ts::null()])), + ts::field("qty_avail", ts::union(vec![ts::bigint(), ts::null()])), + ts::field("price_amt", ts::number()), + ts::field("price_amt_exact", ts::union(vec![ts::string(), ts::null()])), + ts::field("price_currency", ts::string()), + ts::field("price_qty_amt", ts::number()), + ts::field( + "price_qty_amt_exact", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::field("price_qty_unit", ts::string()), + ts::field("listing_addr", ts::union(vec![ts::string(), ts::null()])), + ts::field("primary_bin_id", ts::union(vec![ts::string(), ts::null()])), + ts::field( + "verified_primary_bin_id", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::field("notes", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "TradeProductQueryBindValues", + ts::object(vec![ts::field("id", ts::string())]), + ), + ]) +} diff --git a/crates/replica_db_schema_bindings/src/typescript/types.ts b/crates/replica_db_schema_bindings/src/typescript/types.ts @@ -1,521 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type Farm = { id: string, created_at: string, updated_at: string, d_tag: string, pubkey: string, name: string, about: string | null, website: string | null, picture: string | null, banner: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; - -export type FarmGcsLocation = { id: string, created_at: string, updated_at: string, farm_id: string, gcs_location_id: string, role: string, }; - -export type FarmGcsLocationQueryBindValues = { id: string, } | { farm_id: string, } | { gcs_location_id: string, }; - -export type FarmMember = { id: string, created_at: string, updated_at: string, farm_id: string, member_pubkey: string, role: string, }; - -export type FarmMemberClaim = { id: string, created_at: string, updated_at: string, member_pubkey: string, farm_pubkey: string, }; - -export type FarmMemberClaimQueryBindValues = { id: string, } | { member_pubkey: string, } | { farm_pubkey: string, }; - -export type FarmMemberQueryBindValues = { id: string, } | { farm_id: string, } | { member_pubkey: string, }; - -export type FarmQueryBindValues = { id: string, } | { d_tag: string, } | { pubkey: string, }; - -export type FarmTag = { id: string, created_at: string, updated_at: string, farm_id: string, tag: string, }; - -export type FarmTagQueryBindValues = { id: string, } | { farm_id: string, } | { tag: string, }; - -export type GcsLocation = { id: string, created_at: string, updated_at: string, d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy: number | null, altitude: number | null, tag_0: string | null, label: string | null, area: number | null, elevation: number | null, soil: string | null, climate: string | null, gc_id: string | null, gc_name: string | null, gc_admin1_id: string | null, gc_admin1_name: string | null, gc_country_id: string | null, gc_country_name: string | null, }; - -export type GcsLocationFarmArgs = { id: string, }; - -export type GcsLocationFindManyRel = { "on_trade_product": GcsLocationTradeProductArgs } | { "off_trade_product": GcsLocationTradeProductArgs } | { "on_farm": GcsLocationFarmArgs } | { "off_farm": GcsLocationFarmArgs } | { "on_plot": GcsLocationPlotArgs } | { "off_plot": GcsLocationPlotArgs }; - -export type GcsLocationPlotArgs = { id: string, }; - -export type GcsLocationQueryBindValues = { id: string, } | { d_tag: string, } | { geohash: string, }; - -export type GcsLocationTradeProductArgs = { id: string, }; - -export type IFarmCreate = IFarmFields; - -export type IFarmCreateResolve = IResult<Farm>; - -export type IFarmDelete = IFarmFindOne; - -export type IFarmDeleteResolve = IResult<string>; - -export type IFarmFields = { d_tag: string, pubkey: string, name: string, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; - -export type IFarmFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, pubkey?: string, name?: string, about?: string, website?: string, picture?: string, banner?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; - -export type IFarmFieldsPartial = { d_tag?: string | null, pubkey?: string | null, name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; - -export type IFarmFindMany = { filter: IFarmFieldsFilter | null, }; - -export type IFarmFindManyResolve = IResultList<Farm>; - -export type IFarmFindOne = IFarmFindOneArgs; - -export type IFarmFindOneArgs = { on: FarmQueryBindValues, }; - -export type IFarmFindOneResolve = IResult<Farm>; - -export type IFarmGcsLocationCreate = IFarmGcsLocationFields; - -export type IFarmGcsLocationCreateResolve = IResult<FarmGcsLocation>; - -export type IFarmGcsLocationDelete = IFarmGcsLocationFindOne; - -export type IFarmGcsLocationDeleteResolve = IResult<string>; - -export type IFarmGcsLocationFields = { farm_id: string, gcs_location_id: string, role: string, }; - -export type IFarmGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, gcs_location_id?: string, role?: string, }; - -export type IFarmGcsLocationFieldsPartial = { farm_id?: string | null, gcs_location_id?: string | null, role?: string | null, }; - -export type IFarmGcsLocationFindMany = { filter: IFarmGcsLocationFieldsFilter | null, }; - -export type IFarmGcsLocationFindManyResolve = IResultList<FarmGcsLocation>; - -export type IFarmGcsLocationFindOne = IFarmGcsLocationFindOneArgs; - -export type IFarmGcsLocationFindOneArgs = { on: FarmGcsLocationQueryBindValues, }; - -export type IFarmGcsLocationFindOneResolve = IResult<FarmGcsLocation>; - -export type IFarmGcsLocationUpdate = { on: FarmGcsLocationQueryBindValues, fields: IFarmGcsLocationFieldsPartial, }; - -export type IFarmGcsLocationUpdateResolve = IResult<FarmGcsLocation>; - -export type IFarmMemberClaimCreate = IFarmMemberClaimFields; - -export type IFarmMemberClaimCreateResolve = IResult<FarmMemberClaim>; - -export type IFarmMemberClaimDelete = IFarmMemberClaimFindOne; - -export type IFarmMemberClaimDeleteResolve = IResult<string>; - -export type IFarmMemberClaimFields = { member_pubkey: string, farm_pubkey: string, }; - -export type IFarmMemberClaimFieldsFilter = { id?: string, created_at?: string, updated_at?: string, member_pubkey?: string, farm_pubkey?: string, }; - -export type IFarmMemberClaimFieldsPartial = { member_pubkey?: string | null, farm_pubkey?: string | null, }; - -export type IFarmMemberClaimFindMany = { filter: IFarmMemberClaimFieldsFilter | null, }; - -export type IFarmMemberClaimFindManyResolve = IResultList<FarmMemberClaim>; - -export type IFarmMemberClaimFindOne = IFarmMemberClaimFindOneArgs; - -export type IFarmMemberClaimFindOneArgs = { on: FarmMemberClaimQueryBindValues, }; - -export type IFarmMemberClaimFindOneResolve = IResult<FarmMemberClaim>; - -export type IFarmMemberClaimUpdate = { on: FarmMemberClaimQueryBindValues, fields: IFarmMemberClaimFieldsPartial, }; - -export type IFarmMemberClaimUpdateResolve = IResult<FarmMemberClaim>; - -export type IFarmMemberCreate = IFarmMemberFields; - -export type IFarmMemberCreateResolve = IResult<FarmMember>; - -export type IFarmMemberDelete = IFarmMemberFindOne; - -export type IFarmMemberDeleteResolve = IResult<string>; - -export type IFarmMemberFields = { farm_id: string, member_pubkey: string, role: string, }; - -export type IFarmMemberFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, member_pubkey?: string, role?: string, }; - -export type IFarmMemberFieldsPartial = { farm_id?: string | null, member_pubkey?: string | null, role?: string | null, }; - -export type IFarmMemberFindMany = { filter: IFarmMemberFieldsFilter | null, }; - -export type IFarmMemberFindManyResolve = IResultList<FarmMember>; - -export type IFarmMemberFindOne = IFarmMemberFindOneArgs; - -export type IFarmMemberFindOneArgs = { on: FarmMemberQueryBindValues, }; - -export type IFarmMemberFindOneResolve = IResult<FarmMember>; - -export type IFarmMemberUpdate = { on: FarmMemberQueryBindValues, fields: IFarmMemberFieldsPartial, }; - -export type IFarmMemberUpdateResolve = IResult<FarmMember>; - -export type IFarmTagCreate = IFarmTagFields; - -export type IFarmTagCreateResolve = IResult<FarmTag>; - -export type IFarmTagDelete = IFarmTagFindOne; - -export type IFarmTagDeleteResolve = IResult<string>; - -export type IFarmTagFields = { farm_id: string, tag: string, }; - -export type IFarmTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, tag?: string, }; - -export type IFarmTagFieldsPartial = { farm_id?: string | null, tag?: string | null, }; - -export type IFarmTagFindMany = { filter: IFarmTagFieldsFilter | null, }; - -export type IFarmTagFindManyResolve = IResultList<FarmTag>; - -export type IFarmTagFindOne = IFarmTagFindOneArgs; - -export type IFarmTagFindOneArgs = { on: FarmTagQueryBindValues, }; - -export type IFarmTagFindOneResolve = IResult<FarmTag>; - -export type IFarmTagUpdate = { on: FarmTagQueryBindValues, fields: IFarmTagFieldsPartial, }; - -export type IFarmTagUpdateResolve = IResult<FarmTag>; - -export type IFarmUpdate = { on: FarmQueryBindValues, fields: IFarmFieldsPartial, }; - -export type IFarmUpdateResolve = IResult<Farm>; - -export type IGcsLocationCreate = IGcsLocationFields; - -export type IGcsLocationCreateResolve = IResult<GcsLocation>; - -export type IGcsLocationDelete = IGcsLocationFindOne; - -export type IGcsLocationDeleteResolve = IResult<string>; - -export type IGcsLocationFields = { d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy?: number | null, altitude?: number | null, tag_0?: string | null, label?: string | null, area?: number | null, elevation?: number | null, soil?: string | null, climate?: string | null, gc_id?: string | null, gc_name?: string | null, gc_admin1_id?: string | null, gc_admin1_name?: string | null, gc_country_id?: string | null, gc_country_name?: string | null, }; - -export type IGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, lat?: number, lng?: number, geohash?: string, point?: string, polygon?: string, accuracy?: number, altitude?: number, tag_0?: string, label?: string, area?: number, elevation?: number, soil?: string, climate?: string, gc_id?: string, gc_name?: string, gc_admin1_id?: string, gc_admin1_name?: string, gc_country_id?: string, gc_country_name?: string, }; - -export type IGcsLocationFieldsPartial = { d_tag?: string | null, lat?: number | null, lng?: number | null, geohash?: string | null, point?: string | null, polygon?: string | null, accuracy?: number | null, altitude?: number | null, tag_0?: string | null, label?: string | null, area?: number | null, elevation?: number | null, soil?: string | null, climate?: string | null, gc_id?: string | null, gc_name?: string | null, gc_admin1_id?: string | null, gc_admin1_name?: string | null, gc_country_id?: string | null, gc_country_name?: string | null, }; - -export type IGcsLocationFindMany = { filter: IGcsLocationFieldsFilter | null, } | { rel: GcsLocationFindManyRel, }; - -export type IGcsLocationFindManyResolve = IResultList<GcsLocation>; - -export type IGcsLocationFindOne = IGcsLocationFindOneArgs | IGcsLocationFindOneRelArgs; - -export type IGcsLocationFindOneArgs = { on: GcsLocationQueryBindValues, }; - -export type IGcsLocationFindOneRelArgs = { rel: GcsLocationFindManyRel, }; - -export type IGcsLocationFindOneResolve = IResult<GcsLocation>; - -export type IGcsLocationUpdate = { on: GcsLocationQueryBindValues, fields: IGcsLocationFieldsPartial, }; - -export type IGcsLocationUpdateResolve = IResult<GcsLocation>; - -export type ILogErrorCreate = ILogErrorFields; - -export type ILogErrorCreateResolve = IResult<LogError>; - -export type ILogErrorDelete = ILogErrorFindOne; - -export type ILogErrorDeleteResolve = IResult<string>; - -export type ILogErrorFields = { error: string, message: string, stack_trace?: string | null, cause?: string | null, app_system: string, app_version: string, nostr_pubkey: string, data?: string | null, }; - -export type ILogErrorFieldsFilter = { id?: string, created_at?: string, updated_at?: string, error?: string, message?: string, stack_trace?: string, cause?: string, app_system?: string, app_version?: string, nostr_pubkey?: string, data?: string, }; - -export type ILogErrorFieldsPartial = { error?: string | null, message?: string | null, stack_trace?: string | null, cause?: string | null, app_system?: string | null, app_version?: string | null, nostr_pubkey?: string | null, data?: string | null, }; - -export type ILogErrorFindMany = { filter: ILogErrorFieldsFilter | null, }; - -export type ILogErrorFindManyResolve = IResultList<LogError>; - -export type ILogErrorFindOne = ILogErrorFindOneArgs; - -export type ILogErrorFindOneArgs = { on: LogErrorQueryBindValues, }; - -export type ILogErrorFindOneResolve = IResult<LogError>; - -export type ILogErrorUpdate = { on: LogErrorQueryBindValues, fields: ILogErrorFieldsPartial, }; - -export type ILogErrorUpdateResolve = IResult<LogError>; - -export type IMediaImageCreate = IMediaImageFields; - -export type IMediaImageCreateResolve = IResult<MediaImage>; - -export type IMediaImageDelete = IMediaImageFindOne; - -export type IMediaImageDeleteResolve = IResult<string>; - -export type IMediaImageFields = { file_path: string, mime_type: string, res_base: string, res_path: string, label?: string | null, description?: string | null, }; - -export type IMediaImageFieldsFilter = { id?: string, created_at?: string, updated_at?: string, file_path?: string, mime_type?: string, res_base?: string, res_path?: string, label?: string, description?: string, }; - -export type IMediaImageFieldsPartial = { file_path?: string | null, mime_type?: string | null, res_base?: string | null, res_path?: string | null, label?: string | null, description?: string | null, }; - -export type IMediaImageFindMany = { filter: IMediaImageFieldsFilter | null, } | { rel: MediaImageFindManyRel, }; - -export type IMediaImageFindManyResolve = IResultList<MediaImage>; - -export type IMediaImageFindOne = IMediaImageFindOneArgs | IMediaImageFindOneRelArgs; - -export type IMediaImageFindOneArgs = { on: MediaImageQueryBindValues, }; - -export type IMediaImageFindOneRelArgs = { rel: MediaImageFindManyRel, }; - -export type IMediaImageFindOneResolve = IResult<MediaImage>; - -export type IMediaImageUpdate = { on: MediaImageQueryBindValues, fields: IMediaImageFieldsPartial, }; - -export type IMediaImageUpdateResolve = IResult<MediaImage>; - -export type INostrEventStateCreate = INostrEventStateFields; - -export type INostrEventStateCreateResolve = IResult<NostrEventState>; - -export type INostrEventStateDelete = INostrEventStateFindOne; - -export type INostrEventStateDeleteResolve = IResult<string>; - -export type INostrEventStateFields = { key: string, kind: number, pubkey: string, d_tag: string, last_event_id: string, last_created_at: number, content_hash: string, }; - -export type INostrEventStateFieldsFilter = { id?: string, created_at?: string, updated_at?: string, key?: string, kind?: number, pubkey?: string, d_tag?: string, last_event_id?: string, last_created_at?: number, content_hash?: string, }; - -export type INostrEventStateFieldsPartial = { key?: string | null, kind?: number | null, pubkey?: string | null, d_tag?: string | null, last_event_id?: string | null, last_created_at?: number | null, content_hash?: string | null, }; - -export type INostrEventStateFindMany = { filter: INostrEventStateFieldsFilter | null, }; - -export type INostrEventStateFindManyResolve = IResultList<NostrEventState>; - -export type INostrEventStateFindOne = INostrEventStateFindOneArgs; - -export type INostrEventStateFindOneArgs = { on: NostrEventStateQueryBindValues, }; - -export type INostrEventStateFindOneResolve = IResult<NostrEventState>; - -export type INostrEventStateUpdate = { on: NostrEventStateQueryBindValues, fields: INostrEventStateFieldsPartial, }; - -export type INostrEventStateUpdateResolve = IResult<NostrEventState>; - -export type INostrProfileCreate = INostrProfileFields; - -export type INostrProfileCreateResolve = IResult<NostrProfile>; - -export type INostrProfileDelete = INostrProfileFindOne; - -export type INostrProfileDeleteResolve = IResult<string>; - -export type INostrProfileFields = { public_key: string, profile_type: string, name: string, display_name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, nip05?: string | null, lud06?: string | null, lud16?: string | null, }; - -export type INostrProfileFieldsFilter = { id?: string, created_at?: string, updated_at?: string, public_key?: string, profile_type?: string, name?: string, display_name?: string, about?: string, website?: string, picture?: string, banner?: string, nip05?: string, lud06?: string, lud16?: string, }; - -export type INostrProfileFieldsPartial = { public_key?: string | null, profile_type?: string | null, name?: string | null, display_name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, nip05?: string | null, lud06?: string | null, lud16?: string | null, }; - -export type INostrProfileFindMany = { filter: INostrProfileFieldsFilter | null, } | { rel: NostrProfileFindManyRel, }; - -export type INostrProfileFindManyResolve = IResultList<NostrProfile>; - -export type INostrProfileFindOne = INostrProfileFindOneArgs | INostrProfileFindOneRelArgs; - -export type INostrProfileFindOneArgs = { on: NostrProfileQueryBindValues, }; - -export type INostrProfileFindOneRelArgs = { rel: NostrProfileFindManyRel, }; - -export type INostrProfileFindOneResolve = IResult<NostrProfile>; - -export type INostrProfileRelayRelation = { nostr_profile: NostrProfileQueryBindValues, nostr_relay: NostrRelayQueryBindValues, }; - -export type INostrProfileRelayResolve = IResultPass; - -export type INostrProfileUpdate = { on: NostrProfileQueryBindValues, fields: INostrProfileFieldsPartial, }; - -export type INostrProfileUpdateResolve = IResult<NostrProfile>; - -export type INostrRelayCreate = INostrRelayFields; - -export type INostrRelayCreateResolve = IResult<NostrRelay>; - -export type INostrRelayDelete = INostrRelayFindOne; - -export type INostrRelayDeleteResolve = IResult<string>; - -export type INostrRelayFields = { url: string, relay_id?: string | null, name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: string | null, software?: string | null, version?: string | null, data?: string | null, }; - -export type INostrRelayFieldsFilter = { id?: string, created_at?: string, updated_at?: string, url?: string, relay_id?: string, name?: string, description?: string, pubkey?: string, contact?: string, supported_nips?: string, software?: string, version?: string, data?: string, }; - -export type INostrRelayFieldsPartial = { url?: string | null, relay_id?: string | null, name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: string | null, software?: string | null, version?: string | null, data?: string | null, }; - -export type INostrRelayFindMany = { filter: INostrRelayFieldsFilter | null, } | { rel: NostrRelayFindManyRel, }; - -export type INostrRelayFindManyResolve = IResultList<NostrRelay>; - -export type INostrRelayFindOne = INostrRelayFindOneArgs | INostrRelayFindOneRelArgs; - -export type INostrRelayFindOneArgs = { on: NostrRelayQueryBindValues, }; - -export type INostrRelayFindOneRelArgs = { rel: NostrRelayFindManyRel, }; - -export type INostrRelayFindOneResolve = IResult<NostrRelay>; - -export type INostrRelayUpdate = { on: NostrRelayQueryBindValues, fields: INostrRelayFieldsPartial, }; - -export type INostrRelayUpdateResolve = IResult<NostrRelay>; - -export type IPlotCreate = IPlotFields; - -export type IPlotCreateResolve = IResult<Plot>; - -export type IPlotDelete = IPlotFindOne; - -export type IPlotDeleteResolve = IResult<string>; - -export type IPlotFields = { d_tag: string, farm_id: string, name: string, about?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; - -export type IPlotFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, farm_id?: string, name?: string, about?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; - -export type IPlotFieldsPartial = { d_tag?: string | null, farm_id?: string | null, name?: string | null, about?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; - -export type IPlotFindMany = { filter: IPlotFieldsFilter | null, }; - -export type IPlotFindManyResolve = IResultList<Plot>; - -export type IPlotFindOne = IPlotFindOneArgs; - -export type IPlotFindOneArgs = { on: PlotQueryBindValues, }; - -export type IPlotFindOneResolve = IResult<Plot>; - -export type IPlotGcsLocationCreate = IPlotGcsLocationFields; - -export type IPlotGcsLocationCreateResolve = IResult<PlotGcsLocation>; - -export type IPlotGcsLocationDelete = IPlotGcsLocationFindOne; - -export type IPlotGcsLocationDeleteResolve = IResult<string>; - -export type IPlotGcsLocationFields = { plot_id: string, gcs_location_id: string, role: string, }; - -export type IPlotGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, gcs_location_id?: string, role?: string, }; - -export type IPlotGcsLocationFieldsPartial = { plot_id?: string | null, gcs_location_id?: string | null, role?: string | null, }; - -export type IPlotGcsLocationFindMany = { filter: IPlotGcsLocationFieldsFilter | null, }; - -export type IPlotGcsLocationFindManyResolve = IResultList<PlotGcsLocation>; - -export type IPlotGcsLocationFindOne = IPlotGcsLocationFindOneArgs; - -export type IPlotGcsLocationFindOneArgs = { on: PlotGcsLocationQueryBindValues, }; - -export type IPlotGcsLocationFindOneResolve = IResult<PlotGcsLocation>; - -export type IPlotGcsLocationUpdate = { on: PlotGcsLocationQueryBindValues, fields: IPlotGcsLocationFieldsPartial, }; - -export type IPlotGcsLocationUpdateResolve = IResult<PlotGcsLocation>; - -export type IPlotTagCreate = IPlotTagFields; - -export type IPlotTagCreateResolve = IResult<PlotTag>; - -export type IPlotTagDelete = IPlotTagFindOne; - -export type IPlotTagDeleteResolve = IResult<string>; - -export type IPlotTagFields = { plot_id: string, tag: string, }; - -export type IPlotTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, tag?: string, }; - -export type IPlotTagFieldsPartial = { plot_id?: string | null, tag?: string | null, }; - -export type IPlotTagFindMany = { filter: IPlotTagFieldsFilter | null, }; - -export type IPlotTagFindManyResolve = IResultList<PlotTag>; - -export type IPlotTagFindOne = IPlotTagFindOneArgs; - -export type IPlotTagFindOneArgs = { on: PlotTagQueryBindValues, }; - -export type IPlotTagFindOneResolve = IResult<PlotTag>; - -export type IPlotTagUpdate = { on: PlotTagQueryBindValues, fields: IPlotTagFieldsPartial, }; - -export type IPlotTagUpdateResolve = IResult<PlotTag>; - -export type IPlotUpdate = { on: PlotQueryBindValues, fields: IPlotFieldsPartial, }; - -export type IPlotUpdateResolve = IResult<Plot>; - -export type ITradeProductCreate = ITradeProductFields; - -export type ITradeProductCreateResolve = IResult<TradeProduct>; - -export type ITradeProductDelete = ITradeProductFindOne; - -export type ITradeProductDeleteResolve = IResult<string>; - -export type ITradeProductFields = { key: string, category: string, title: string, summary: string, process: string, lot: string, profile: string, year: bigint, qty_amt: number, qty_amt_exact: string, qty_unit: string, qty_label?: string | null, qty_avail?: number | null, price_amt: number, price_amt_exact: string, price_currency: string, price_qty_amt: number, price_qty_amt_exact: string, price_qty_unit: string, listing_addr?: string | null, primary_bin_id?: string | null, verified_primary_bin_id?: string | null, notes?: string | null, }; - -export type ITradeProductFieldsFilter = { id?: string, created_at?: string, updated_at?: string, key?: string, category?: string, title?: string, summary?: string, process?: string, lot?: string, profile?: string, year?: bigint, qty_amt?: number, qty_amt_exact?: string, qty_unit?: string, qty_label?: string, qty_avail?: bigint, price_amt?: number, price_amt_exact?: string, price_currency?: string, price_qty_amt?: number, price_qty_amt_exact?: string, price_qty_unit?: string, listing_addr?: string, primary_bin_id?: string, verified_primary_bin_id?: string, notes?: string, }; - -export type ITradeProductFieldsPartial = { key?: string | null, category?: string | null, title?: string | null, summary?: string | null, process?: string | null, lot?: string | null, profile?: string | null, year?: number | null, qty_amt?: number | null, qty_amt_exact?: string | null, qty_unit?: string | null, qty_label?: string | null, qty_avail?: number | null, price_amt?: number | null, price_amt_exact?: string | null, price_currency?: string | null, price_qty_amt?: number | null, price_qty_amt_exact?: string | null, price_qty_unit?: string | null, listing_addr?: string | null, primary_bin_id?: string | null, verified_primary_bin_id?: string | null, notes?: string | null, }; - -export type ITradeProductFindMany = { filter: ITradeProductFieldsFilter | null, }; - -export type ITradeProductFindManyResolve = IResultList<TradeProduct>; - -export type ITradeProductFindOne = ITradeProductFindOneArgs; - -export type ITradeProductFindOneArgs = { on: TradeProductQueryBindValues, }; - -export type ITradeProductFindOneResolve = IResult<TradeProduct>; - -export type ITradeProductLocationRelation = { trade_product: TradeProductQueryBindValues, gcs_location: GcsLocationQueryBindValues, }; - -export type ITradeProductLocationResolve = IResultPass; - -export type ITradeProductMediaRelation = { trade_product: TradeProductQueryBindValues, media_image: MediaImageQueryBindValues, }; - -export type ITradeProductMediaResolve = IResultPass; - -export type ITradeProductUpdate = { on: TradeProductQueryBindValues, fields: ITradeProductFieldsPartial, }; - -export type ITradeProductUpdateResolve = IResult<TradeProduct>; - -export type LogError = { id: string, created_at: string, updated_at: string, error: string, message: string, stack_trace: string | null, cause: string | null, app_system: string, app_version: string, nostr_pubkey: string, data: string | null, }; - -export type LogErrorQueryBindValues = { id: string, } | { nostr_pubkey: string, }; - -export type MediaImage = { id: string, created_at: string, updated_at: string, file_path: string, mime_type: string, res_base: string, res_path: string, label: string | null, description: string | null, }; - -export type MediaImageFindManyRel = { "on_trade_product": MediaImageTradeProductArgs } | { "off_trade_product": MediaImageTradeProductArgs }; - -export type MediaImageQueryBindValues = { id: string, } | { file_path: string, }; - -export type MediaImageTradeProductArgs = { id: string, }; - -export type NostrEventState = { id: string, created_at: string, updated_at: string, key: string, kind: number, pubkey: string, d_tag: string, last_event_id: string, last_created_at: number, content_hash: string, }; - -export type NostrEventStateQueryBindValues = { id: string, } | { key: string, }; - -export type NostrProfile = { id: string, created_at: string, updated_at: string, public_key: string, profile_type: string, name: string, display_name: string | null, about: string | null, website: string | null, picture: string | null, banner: string | null, nip05: string | null, lud06: string | null, lud16: string | null, }; - -export type NostrProfileFindManyRel = { "on_relay": NostrProfileRelayArgs } | { "off_relay": NostrProfileRelayArgs }; - -export type NostrProfileQueryBindValues = { id: string, } | { public_key: string, }; - -export type NostrProfileRelayArgs = { id: string, }; - -export type NostrRelay = { id: string, created_at: string, updated_at: string, url: string, relay_id: string | null, name: string | null, description: string | null, pubkey: string | null, contact: string | null, supported_nips: string | null, software: string | null, version: string | null, data: string | null, }; - -export type NostrRelayFindManyRel = { "on_profile": NostrRelayProfileArgs } | { "off_profile": NostrRelayProfileArgs }; - -export type NostrRelayProfileArgs = { public_key: string, }; - -export type NostrRelayQueryBindValues = { id: string, } | { url: string, }; - -export type Plot = { id: string, created_at: string, updated_at: string, d_tag: string, farm_id: string, name: string, about: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; - -export type PlotGcsLocation = { id: string, created_at: string, updated_at: string, plot_id: string, gcs_location_id: string, role: string, }; - -export type PlotGcsLocationQueryBindValues = { id: string, } | { plot_id: string, } | { gcs_location_id: string, }; - -export type PlotQueryBindValues = { id: string, } | { d_tag: string, } | { farm_id: string, }; - -export type PlotTag = { id: string, created_at: string, updated_at: string, plot_id: string, tag: string, }; - -export type PlotTagQueryBindValues = { id: string, } | { plot_id: string, } | { tag: string, }; - -export type TradeProduct = { id: string, created_at: string, updated_at: string, key: string, category: string, title: string, summary: string, process: string, lot: string, profile: string, year: bigint, qty_amt: number, qty_amt_exact: string | null, qty_unit: string, qty_label: string | null, qty_avail: bigint | null, price_amt: number, price_amt_exact: string | null, price_currency: string, price_qty_amt: number, price_qty_amt_exact: string | null, price_qty_unit: string, listing_addr: string | null, primary_bin_id: string | null, verified_primary_bin_id: string | null, notes: string | null, }; - -export type TradeProductQueryBindValues = { id: string, }; diff --git a/crates/trade_bindings/Cargo.toml b/crates/trade_bindings/Cargo.toml @@ -9,4 +9,5 @@ homepage.workspace = true publish = false [dependencies] +radroots_sdk_binding_model = { path = "../binding_model" } radroots_trade = { workspace = true } diff --git a/crates/trade_bindings/src/lib.rs b/crates/trade_bindings/src/lib.rs @@ -1,15 +1,18 @@ pub use radroots_trade as upstream; -pub const TYPES_TS: &str = include_str!("typescript/types.ts"); +mod model; + +pub use model::types_module; #[cfg(test)] mod tests { - use super::TYPES_TS; + use super::types_module; #[test] fn preserves_trade_type_exports() { - assert!(TYPES_TS.contains("export type RadrootsTradeListingTotal")); - assert!(TYPES_TS.contains("export type RadrootsTradeOrderWorkflowProjection")); - assert!(TYPES_TS.contains("export type RadrootsTradeMarketplaceOrderSummary")); + let rendered = types_module().render(); + assert!(rendered.contains("export type RadrootsTradeListingTotal")); + assert!(rendered.contains("export type RadrootsTradeOrderWorkflowProjection")); + assert!(rendered.contains("export type RadrootsTradeMarketplaceOrderSummary")); } } diff --git a/crates/trade_bindings/src/model.rs b/crates/trade_bindings/src/model.rs @@ -0,0 +1,809 @@ +use radroots_sdk_binding_model as ts; + +pub fn types_module() -> ts::TsModule { + ts::module(vec![ + ts::type_alias( + "RadrootsFarmRef", + ts::object(vec![ + ts::field("pubkey", ts::string()), + ts::field("d_tag", ts::string()), + ]), + ), + ts::type_alias( + "RadrootsListing", + ts::object(vec![ + ts::field("d_tag", ts::string()), + ts::field("farm", ts::reference("RadrootsFarmRef")), + ts::field("product", ts::reference("RadrootsListingProduct")), + ts::field("primary_bin_id", ts::string()), + ts::field("bins", ts::array(ts::reference("RadrootsListingBin"))), + ts::optional_field( + "resource_area", + ts::union(vec![ts::reference("RadrootsResourceAreaRef"), ts::null()]), + ), + ts::optional_field( + "plot", + ts::union(vec![ts::reference("RadrootsPlotRef"), ts::null()]), + ), + ts::optional_field( + "discounts", + ts::union(vec![ + ts::array(ts::reference("RadrootsCoreDiscount")), + ts::null(), + ]), + ), + ts::optional_field( + "inventory_available", + ts::union(vec![ts::reference("RadrootsCoreDecimal"), ts::null()]), + ), + ts::optional_field( + "availability", + ts::union(vec![ + ts::reference("RadrootsListingAvailability"), + ts::null(), + ]), + ), + ts::optional_field( + "delivery_method", + ts::union(vec![ + ts::reference("RadrootsListingDeliveryMethod"), + ts::null(), + ]), + ), + ts::optional_field( + "location", + ts::union(vec![ts::reference("RadrootsListingLocation"), ts::null()]), + ), + ts::optional_field( + "images", + ts::union(vec![ + ts::array(ts::reference("RadrootsListingImage")), + ts::null(), + ]), + ), + ]), + ), + ts::type_alias( + "RadrootsListingAvailability", + ts::union(vec![ + ts::object(vec![ + ts::field("kind", ts::string_literal("window")), + ts::field( + "amount", + ts::object(vec![ + ts::optional_field("start", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("end", ts::union(vec![ts::number(), ts::null()])), + ]), + ), + ]), + ts::object(vec![ + ts::field("kind", ts::string_literal("status")), + ts::field( + "amount", + ts::object(vec![ts::field( + "status", + ts::reference("RadrootsListingStatus"), + )]), + ), + ]), + ]), + ), + ts::type_alias( + "RadrootsListingBin", + ts::object(vec![ + ts::field("bin_id", ts::string()), + ts::field("quantity", ts::reference("RadrootsCoreQuantity")), + ts::field( + "price_per_canonical_unit", + ts::reference("RadrootsCoreQuantityPrice"), + ), + ts::optional_field( + "display_amount", + ts::union(vec![ts::reference("RadrootsCoreDecimal"), ts::null()]), + ), + ts::optional_field( + "display_unit", + ts::union(vec![ts::reference("RadrootsCoreUnit"), ts::null()]), + ), + ts::optional_field("display_label", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "display_price", + ts::union(vec![ts::reference("RadrootsCoreMoney"), ts::null()]), + ), + ts::optional_field( + "display_price_unit", + ts::union(vec![ts::reference("RadrootsCoreUnit"), ts::null()]), + ), + ]), + ), + ts::type_alias( + "RadrootsListingDeliveryMethod", + ts::union(vec![ + ts::object(vec![ts::field("kind", ts::string_literal("pickup"))]), + ts::object(vec![ts::field( + "kind", + ts::string_literal("local_delivery"), + )]), + ts::object(vec![ts::field("kind", ts::string_literal("shipping"))]), + ts::object(vec![ + ts::field("kind", ts::string_literal("other")), + ts::field( + "amount", + ts::object(vec![ts::field("method", ts::string())]), + ), + ]), + ]), + ), + ts::type_alias( + "RadrootsListingLocation", + ts::object(vec![ + ts::field("primary", ts::string()), + ts::optional_field("city", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("region", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("country", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lat", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("lng", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("geohash", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "RadrootsListingProduct", + ts::object(vec![ + ts::field("key", ts::string()), + ts::field("title", ts::string()), + ts::field("category", ts::string()), + ts::optional_field("summary", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("process", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("lot", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("location", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("profile", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("year", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "RadrootsListingStatus", + ts::union(vec![ + ts::object(vec![ts::field("kind", ts::string_literal("active"))]), + ts::object(vec![ts::field("kind", ts::string_literal("sold"))]), + ts::object(vec![ + ts::field("kind", ts::string_literal("other")), + ts::field("amount", ts::object(vec![ts::field("value", ts::string())])), + ]), + ]), + ), + ts::type_alias( + "RadrootsTradeFacetCount", + ts::object(vec![ + ts::field("key", ts::string()), + ts::field("count", ts::number()), + ]), + ), + ts::type_alias( + "RadrootsTradeFulfillmentException", + ts::object(vec![ + ts::field("code", ts::string()), + ts::field( + "severity", + ts::reference("RadrootsTradeFulfillmentExceptionSeverity"), + ), + ts::field( + "status", + ts::reference("RadrootsTradeFulfillmentExceptionStatus"), + ), + ts::optional_field("source", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("notes", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "RadrootsTradeFulfillmentExceptionSeverity", + ts::union(vec![ + ts::string_literal("notice"), + ts::string_literal("warning"), + ts::string_literal("blocking"), + ]), + ), + ts::type_alias( + "RadrootsTradeFulfillmentExceptionStatus", + ts::union(vec![ + ts::string_literal("open"), + ts::string_literal("monitoring"), + ts::string_literal("resolved"), + ]), + ), + ts::type_alias( + "RadrootsTradeListing", + ts::object(vec![ + ts::field("listing_id", ts::string()), + ts::field("listing_addr", ts::string()), + ts::field("seller_pubkey", ts::string()), + ts::field("title", ts::string()), + ts::field("description", ts::string()), + ts::field("product_type", ts::string()), + ts::field("primary_bin_id", ts::string()), + ts::field("bin_quantity", ts::reference("RadrootsCoreQuantity")), + ts::field("unit", ts::reference("RadrootsCoreUnit")), + ts::field("unit_price", ts::reference("RadrootsCoreMoney")), + ts::field("inventory_available", ts::reference("RadrootsCoreDecimal")), + ts::field("availability", ts::reference("RadrootsListingAvailability")), + ts::field("location", ts::reference("RadrootsListingLocation")), + ts::field( + "delivery_method", + ts::reference("RadrootsListingDeliveryMethod"), + ), + ts::field("listing", ts::reference("RadrootsListing")), + ]), + ), + ts::type_alias( + "RadrootsTradeListingBackofficeOverlay", + ts::object(vec![ + ts::field("listing_addr", ts::string()), + ts::optional_field( + "review_queue", + ts::union(vec![ + ts::reference("RadrootsTradeReviewQueueEntry"), + ts::null(), + ]), + ), + ts::field( + "moderation_flags", + ts::array(ts::reference("RadrootsTradeModerationFlag")), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeListingBackofficeQuery", + ts::object(vec![ + ts::field("listing", ts::reference("RadrootsTradeListingQuery")), + ts::optional_field( + "requires_review", + ts::union(vec![ts::boolean(), ts::null()]), + ), + ts::optional_field( + "has_open_moderation_flags", + ts::union(vec![ts::boolean(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeListingBackofficeView", + ts::object(vec![ + ts::field("listing", ts::reference("RadrootsTradeListingProjection")), + ts::optional_field( + "marketplace", + ts::union(vec![ + ts::reference("RadrootsTradeMarketplaceListingSummary"), + ts::null(), + ]), + ), + ts::optional_field( + "overlay", + ts::union(vec![ + ts::reference("RadrootsTradeListingBackofficeOverlay"), + ts::null(), + ]), + ), + ts::field("requires_review", ts::boolean()), + ts::field("open_moderation_flag_count", ts::number()), + ]), + ), + ts::type_alias( + "RadrootsTradeListingBinProjection", + ts::object(vec![ + ts::field("bin", ts::reference("RadrootsListingBin")), + ts::field("one_bin_total", ts::reference("RadrootsTradeListingTotal")), + ]), + ), + ts::type_alias( + "RadrootsTradeListingFacets", + ts::object(vec![ + ts::field( + "seller_pubkeys", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "farm_pubkeys", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "farm_ids", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "product_keys", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "product_categories", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "listing_statuses", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeListingMarketStatus", + ts::union(vec![ + ts::string_literal("unknown"), + ts::string_literal("window"), + ts::string_literal("active"), + ts::string_literal("sold"), + ts::object(vec![ts::field( + "other", + ts::object(vec![ts::field("value", ts::string())]), + )]), + ]), + ), + ts::type_alias( + "RadrootsTradeListingProjection", + ts::object(vec![ + ts::field("listing_addr", ts::string()), + ts::field("seller_pubkey", ts::string()), + ts::field("listing_id", ts::string()), + ts::field("farm", ts::reference("RadrootsFarmRef")), + ts::field("product", ts::reference("RadrootsListingProduct")), + ts::field("primary_bin_id", ts::string()), + ts::field( + "bins", + ts::array(ts::reference("RadrootsTradeListingBinProjection")), + ), + ts::optional_field( + "resource_area", + ts::union(vec![ts::reference("RadrootsResourceAreaRef"), ts::null()]), + ), + ts::optional_field( + "plot", + ts::union(vec![ts::reference("RadrootsPlotRef"), ts::null()]), + ), + ts::optional_field( + "discounts", + ts::union(vec![ + ts::array(ts::reference("RadrootsCoreDiscount")), + ts::null(), + ]), + ), + ts::optional_field( + "inventory_available", + ts::union(vec![ts::reference("RadrootsCoreDecimal"), ts::null()]), + ), + ts::optional_field( + "availability", + ts::union(vec![ + ts::reference("RadrootsListingAvailability"), + ts::null(), + ]), + ), + ts::optional_field( + "delivery_method", + ts::union(vec![ + ts::reference("RadrootsListingDeliveryMethod"), + ts::null(), + ]), + ), + ts::optional_field( + "location", + ts::union(vec![ts::reference("RadrootsListingLocation"), ts::null()]), + ), + ts::optional_field( + "images", + ts::union(vec![ + ts::array(ts::reference("RadrootsListingImage")), + ts::null(), + ]), + ), + ts::field("order_count", ts::number()), + ts::field("open_order_count", ts::number()), + ts::field("terminal_order_count", ts::number()), + ]), + ), + ts::type_alias( + "RadrootsTradeListingQuery", + ts::object(vec![ + ts::optional_field("seller_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("farm_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("farm_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("product_key", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "product_category", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field( + "listing_status", + ts::union(vec![ + ts::reference("RadrootsTradeListingMarketStatus"), + ts::null(), + ]), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeListingSort", + ts::object(vec![ + ts::field("field", ts::reference("RadrootsTradeListingSortField")), + ts::field("direction", ts::reference("RadrootsTradeSortDirection")), + ]), + ), + ts::type_alias( + "RadrootsTradeListingSortField", + ts::union(vec![ + ts::string_literal("listing_addr"), + ts::string_literal("product_title"), + ts::string_literal("product_category"), + ts::string_literal("seller_pubkey"), + ts::string_literal("inventory_available"), + ts::string_literal("open_order_count"), + ts::string_literal("total_order_count"), + ]), + ), + ts::type_alias( + "RadrootsTradeListingSubtotal", + ts::object(vec![ + ts::field("price_amount", ts::reference("RadrootsCoreMoney")), + ts::field("price_currency", ts::reference("RadrootsCoreCurrency")), + ts::field("quantity_amount", ts::reference("RadrootsCoreDecimal")), + ts::field("quantity_unit", ts::reference("RadrootsCoreUnit")), + ]), + ), + ts::type_alias( + "RadrootsTradeListingTotal", + ts::object(vec![ + ts::field("price_amount", ts::reference("RadrootsCoreMoney")), + ts::field("price_currency", ts::reference("RadrootsCoreCurrency")), + ts::field("quantity_amount", ts::reference("RadrootsCoreDecimal")), + ts::field("quantity_unit", ts::reference("RadrootsCoreUnit")), + ]), + ), + ts::type_alias( + "RadrootsTradeMarketplaceListingSummary", + ts::object(vec![ + ts::field("listing_addr", ts::string()), + ts::field("seller_pubkey", ts::string()), + ts::field("farm_pubkey", ts::string()), + ts::field("farm_id", ts::string()), + ts::field("product_key", ts::string()), + ts::field("product_title", ts::string()), + ts::field("product_category", ts::string()), + ts::optional_field("product_summary", ts::union(vec![ts::string(), ts::null()])), + ts::field( + "listing_status", + ts::reference("RadrootsTradeListingMarketStatus"), + ), + ts::optional_field( + "location_primary", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field( + "inventory_available", + ts::union(vec![ts::reference("RadrootsCoreDecimal"), ts::null()]), + ), + ts::field("primary_bin_id", ts::string()), + ts::optional_field( + "primary_bin_label", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::field( + "primary_bin_total", + ts::reference("RadrootsTradeListingTotal"), + ), + ts::field("order_count", ts::number()), + ts::field("open_order_count", ts::number()), + ts::field("terminal_order_count", ts::number()), + ]), + ), + ts::type_alias( + "RadrootsTradeMarketplaceOrderSummary", + ts::object(vec![ + ts::field("order_id", ts::string()), + ts::field("listing_addr", ts::string()), + ts::field("buyer_pubkey", ts::string()), + ts::field("seller_pubkey", ts::string()), + ts::field("status", ts::reference("RadrootsTradeOrderStatus")), + ts::field( + "last_message_type", + ts::reference("RadrootsTradeMessageType"), + ), + ts::field("item_count", ts::number()), + ts::field("total_bin_count", ts::number()), + ts::field("has_requested_discounts", ts::boolean()), + ts::optional_field("last_reason", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "RadrootsTradeMessageType", + ts::union(vec![ + ts::string_literal("listing_validate_request"), + ts::string_literal("listing_validate_result"), + ts::string_literal("order_request"), + ts::string_literal("order_response"), + ts::string_literal("order_revision"), + ts::string_literal("order_revision_accept"), + ts::string_literal("order_revision_decline"), + ts::string_literal("question"), + ts::string_literal("answer"), + ts::string_literal("discount_request"), + ts::string_literal("discount_offer"), + ts::string_literal("discount_accept"), + ts::string_literal("discount_decline"), + ts::string_literal("cancel"), + ts::string_literal("fulfillment_update"), + ts::string_literal("receipt"), + ]), + ), + ts::type_alias( + "RadrootsTradeModerationFlag", + ts::object(vec![ + ts::field("code", ts::string()), + ts::field("severity", ts::reference("RadrootsTradeModerationSeverity")), + ts::field("status", ts::reference("RadrootsTradeModerationStatus")), + ts::optional_field("source", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("reason", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "RadrootsTradeModerationSeverity", + ts::union(vec![ + ts::string_literal("notice"), + ts::string_literal("warning"), + ts::string_literal("block"), + ]), + ), + ts::type_alias( + "RadrootsTradeModerationStatus", + ts::union(vec![ + ts::string_literal("open"), + ts::string_literal("snoozed"), + ts::string_literal("resolved"), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderBackofficeOverlay", + ts::object(vec![ + ts::field("order_id", ts::string()), + ts::optional_field( + "review_queue", + ts::union(vec![ + ts::reference("RadrootsTradeReviewQueueEntry"), + ts::null(), + ]), + ), + ts::field( + "moderation_flags", + ts::array(ts::reference("RadrootsTradeModerationFlag")), + ), + ts::field( + "fulfillment_exceptions", + ts::array(ts::reference("RadrootsTradeFulfillmentException")), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderBackofficeQuery", + ts::object(vec![ + ts::field("order", ts::reference("RadrootsTradeOrderQuery")), + ts::optional_field( + "requires_review", + ts::union(vec![ts::boolean(), ts::null()]), + ), + ts::optional_field( + "has_open_moderation_flags", + ts::union(vec![ts::boolean(), ts::null()]), + ), + ts::optional_field( + "has_open_fulfillment_exceptions", + ts::union(vec![ts::boolean(), ts::null()]), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderBackofficeView", + ts::object(vec![ + ts::field( + "order", + ts::reference("RadrootsTradeOrderWorkflowProjection"), + ), + ts::field( + "marketplace", + ts::reference("RadrootsTradeMarketplaceOrderSummary"), + ), + ts::optional_field( + "overlay", + ts::union(vec![ + ts::reference("RadrootsTradeOrderBackofficeOverlay"), + ts::null(), + ]), + ), + ts::field("requires_review", ts::boolean()), + ts::field("open_moderation_flag_count", ts::number()), + ts::field("open_fulfillment_exception_count", ts::number()), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderFacets", + ts::object(vec![ + ts::field( + "buyer_pubkeys", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "seller_pubkeys", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "listing_addrs", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ts::field( + "statuses", + ts::array(ts::reference("RadrootsTradeFacetCount")), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderQuery", + ts::object(vec![ + ts::optional_field("listing_addr", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("buyer_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("seller_pubkey", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "status", + ts::union(vec![ts::reference("RadrootsTradeOrderStatus"), ts::null()]), + ), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderSort", + ts::object(vec![ + ts::field("field", ts::reference("RadrootsTradeOrderSortField")), + ts::field("direction", ts::reference("RadrootsTradeSortDirection")), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderSortField", + ts::union(vec![ + ts::string_literal("order_id"), + ts::string_literal("listing_addr"), + ts::string_literal("buyer_pubkey"), + ts::string_literal("seller_pubkey"), + ts::string_literal("status"), + ts::string_literal("last_message_type"), + ts::string_literal("total_bin_count"), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderStatus", + ts::union(vec![ + ts::string_literal("draft"), + ts::string_literal("validated"), + ts::string_literal("requested"), + ts::string_literal("questioned"), + ts::string_literal("revised"), + ts::string_literal("accepted"), + ts::string_literal("declined"), + ts::string_literal("cancelled"), + ts::string_literal("fulfilled"), + ts::string_literal("completed"), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderWorkflowMessage", + ts::object(vec![ + ts::field("event_id", ts::string()), + ts::field("actor_pubkey", ts::string()), + ts::field("counterparty_pubkey", ts::string()), + ts::field("listing_addr", ts::string()), + ts::optional_field("order_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "listing_event", + ts::union(vec![ts::reference("RadrootsNostrEventPtr"), ts::null()]), + ), + ts::optional_field("root_event_id", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field("prev_event_id", ts::union(vec![ts::string(), ts::null()])), + ts::field("payload", ts::reference("RadrootsTradeMessagePayload")), + ]), + ), + ts::type_alias( + "RadrootsTradeOrderWorkflowProjection", + ts::object(vec![ + ts::field("order_id", ts::string()), + ts::field("listing_addr", ts::string()), + ts::field("buyer_pubkey", ts::string()), + ts::field("seller_pubkey", ts::string()), + ts::field("items", ts::array(ts::reference("RadrootsTradeOrderItem"))), + ts::optional_field( + "requested_discounts", + ts::union(vec![ + ts::array(ts::reference("RadrootsTradeOrderEconomicLine")), + ts::null(), + ]), + ), + ts::field("status", ts::reference("RadrootsTradeOrderStatus")), + ts::optional_field( + "listing_snapshot", + ts::union(vec![ts::reference("RadrootsNostrEventPtr"), ts::null()]), + ), + ts::field("root_event_id", ts::string()), + ts::field("last_event_id", ts::string()), + ts::optional_field( + "last_discount_request", + ts::union(vec![ts::reference("RadrootsCoreDiscountValue"), ts::null()]), + ), + ts::optional_field( + "last_discount_offer", + ts::union(vec![ts::reference("RadrootsCoreDiscountValue"), ts::null()]), + ), + ts::optional_field( + "accepted_discount", + ts::union(vec![ts::reference("RadrootsCoreDiscountValue"), ts::null()]), + ), + ts::optional_field( + "last_fulfillment_status", + ts::union(vec![ + ts::reference("RadrootsTradeFulfillmentStatus"), + ts::null(), + ]), + ), + ts::optional_field( + "receipt_acknowledged", + ts::union(vec![ts::boolean(), ts::null()]), + ), + ts::optional_field("receipt_at", ts::union(vec![ts::number(), ts::null()])), + ts::optional_field("last_reason", ts::union(vec![ts::string(), ts::null()])), + ts::optional_field( + "last_discount_decline_reason", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::field("question_count", ts::number()), + ts::field("answer_count", ts::number()), + ts::field("revision_count", ts::number()), + ts::field("discount_request_count", ts::number()), + ts::field("discount_offer_count", ts::number()), + ts::field("discount_accept_count", ts::number()), + ts::field("discount_decline_count", ts::number()), + ts::field("cancellation_count", ts::number()), + ts::field("fulfillment_update_count", ts::number()), + ts::field("receipt_count", ts::number()), + ts::field( + "last_message_type", + ts::reference("RadrootsTradeMessageType"), + ), + ts::field("last_actor_pubkey", ts::string()), + ]), + ), + ts::type_alias( + "RadrootsTradeReviewPriority", + ts::union(vec![ + ts::string_literal("low"), + ts::string_literal("normal"), + ts::string_literal("high"), + ts::string_literal("critical"), + ]), + ), + ts::type_alias( + "RadrootsTradeReviewQueueEntry", + ts::object(vec![ + ts::field("queue", ts::string()), + ts::field("priority", ts::reference("RadrootsTradeReviewPriority")), + ts::field("status", ts::reference("RadrootsTradeReviewStatus")), + ts::optional_field( + "assigned_operator", + ts::union(vec![ts::string(), ts::null()]), + ), + ts::optional_field("reason", ts::union(vec![ts::string(), ts::null()])), + ]), + ), + ts::type_alias( + "RadrootsTradeReviewStatus", + ts::union(vec![ + ts::string_literal("queued"), + ts::string_literal("in_progress"), + ts::string_literal("blocked"), + ts::string_literal("resolved"), + ]), + ), + ts::type_alias( + "RadrootsTradeSortDirection", + ts::union(vec![ts::string_literal("asc"), ts::string_literal("desc")]), + ), + ]) +} diff --git a/crates/trade_bindings/src/typescript/types.ts b/crates/trade_bindings/src/typescript/types.ts @@ -1,91 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. - -export type RadrootsFarmRef = { pubkey: string, d_tag: string, }; - -export type RadrootsListing = { d_tag: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: Array<RadrootsListingBin>, resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: RadrootsCoreDiscount[] | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: RadrootsListingImage[] | null, }; - -export type RadrootsListingAvailability = { "kind": "window", "amount": { start?: number | null, end?: number | null, } } | { "kind": "status", "amount": { status: RadrootsListingStatus, } }; - -export type RadrootsListingBin = { bin_id: string, quantity: RadrootsCoreQuantity, price_per_canonical_unit: RadrootsCoreQuantityPrice, display_amount?: RadrootsCoreDecimal | null, display_unit?: RadrootsCoreUnit | null, display_label?: string | null, display_price?: RadrootsCoreMoney | null, display_price_unit?: RadrootsCoreUnit | null, }; - -export type RadrootsListingDeliveryMethod = { "kind": "pickup" } | { "kind": "local_delivery" } | { "kind": "shipping" } | { "kind": "other", "amount": { method: string, } }; - -export type RadrootsListingLocation = { primary: string, city?: string | null, region?: string | null, country?: string | null, lat?: number | null, lng?: number | null, geohash?: string | null, }; - -export type RadrootsListingProduct = { key: string, title: string, category: string, summary?: string | null, process?: string | null, lot?: string | null, location?: string | null, profile?: string | null, year?: string | null, }; - -export type RadrootsListingStatus = { "kind": "active" } | { "kind": "sold" } | { "kind": "other", "amount": { value: string, } }; - -export type RadrootsTradeFacetCount = { key: string, count: number, }; - -export type RadrootsTradeFulfillmentException = { code: string, severity: RadrootsTradeFulfillmentExceptionSeverity, status: RadrootsTradeFulfillmentExceptionStatus, source?: string | null, notes?: string | null, }; - -export type RadrootsTradeFulfillmentExceptionSeverity = "notice" | "warning" | "blocking"; - -export type RadrootsTradeFulfillmentExceptionStatus = "open" | "monitoring" | "resolved"; - -export type RadrootsTradeListing = { listing_id: string, listing_addr: string, seller_pubkey: string, title: string, description: string, product_type: string, primary_bin_id: string, bin_quantity: RadrootsCoreQuantity, unit: RadrootsCoreUnit, unit_price: RadrootsCoreMoney, inventory_available: RadrootsCoreDecimal, availability: RadrootsListingAvailability, location: RadrootsListingLocation, delivery_method: RadrootsListingDeliveryMethod, listing: RadrootsListing, }; - -export type RadrootsTradeListingBackofficeOverlay = { listing_addr: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: RadrootsTradeModerationFlag[], }; - -export type RadrootsTradeListingBackofficeQuery = { listing: RadrootsTradeListingQuery, requires_review?: boolean | null, has_open_moderation_flags?: boolean | null, }; - -export type RadrootsTradeListingBackofficeView = { listing: RadrootsTradeListingProjection, marketplace?: RadrootsTradeMarketplaceListingSummary | null, overlay?: RadrootsTradeListingBackofficeOverlay | null, requires_review: boolean, open_moderation_flag_count: number, }; - -export type RadrootsTradeListingBinProjection = { bin: RadrootsListingBin, one_bin_total: RadrootsTradeListingTotal, }; - -export type RadrootsTradeListingFacets = { seller_pubkeys: RadrootsTradeFacetCount[], farm_pubkeys: RadrootsTradeFacetCount[], farm_ids: RadrootsTradeFacetCount[], product_keys: RadrootsTradeFacetCount[], product_categories: RadrootsTradeFacetCount[], listing_statuses: RadrootsTradeFacetCount[], }; - -export type RadrootsTradeListingMarketStatus = "unknown" | "window" | "active" | "sold" | { "other": { value: string, } }; - -export type RadrootsTradeListingProjection = { listing_addr: string, seller_pubkey: string, listing_id: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: RadrootsTradeListingBinProjection[], resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: RadrootsCoreDiscount[] | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: RadrootsListingImage[] | null, order_count: number, open_order_count: number, terminal_order_count: number, }; - -export type RadrootsTradeListingQuery = { seller_pubkey?: string | null, farm_pubkey?: string | null, farm_id?: string | null, product_key?: string | null, product_category?: string | null, listing_status?: RadrootsTradeListingMarketStatus | null, }; - -export type RadrootsTradeListingSort = { field: RadrootsTradeListingSortField, direction: RadrootsTradeSortDirection, }; - -export type RadrootsTradeListingSortField = "listing_addr" | "product_title" | "product_category" | "seller_pubkey" | "inventory_available" | "open_order_count" | "total_order_count"; - -export type RadrootsTradeListingSubtotal = { price_amount: RadrootsCoreMoney, price_currency: RadrootsCoreCurrency, quantity_amount: RadrootsCoreDecimal, quantity_unit: RadrootsCoreUnit, }; - -export type RadrootsTradeListingTotal = { price_amount: RadrootsCoreMoney, price_currency: RadrootsCoreCurrency, quantity_amount: RadrootsCoreDecimal, quantity_unit: RadrootsCoreUnit, }; - -export type RadrootsTradeMarketplaceListingSummary = { listing_addr: string, seller_pubkey: string, farm_pubkey: string, farm_id: string, product_key: string, product_title: string, product_category: string, product_summary?: string | null, listing_status: RadrootsTradeListingMarketStatus, location_primary?: string | null, inventory_available?: RadrootsCoreDecimal | null, primary_bin_id: string, primary_bin_label?: string | null, primary_bin_total: RadrootsTradeListingTotal, order_count: number, open_order_count: number, terminal_order_count: number, }; - -export type RadrootsTradeMarketplaceOrderSummary = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, status: RadrootsTradeOrderStatus, last_message_type: RadrootsTradeMessageType, item_count: number, total_bin_count: number, has_requested_discounts: boolean, last_reason?: string | null, }; - -export type RadrootsTradeMessageType = "listing_validate_request" | "listing_validate_result" | "order_request" | "order_response" | "order_revision" | "order_revision_accept" | "order_revision_decline" | "question" | "answer" | "discount_request" | "discount_offer" | "discount_accept" | "discount_decline" | "cancel" | "fulfillment_update" | "receipt"; - -export type RadrootsTradeModerationFlag = { code: string, severity: RadrootsTradeModerationSeverity, status: RadrootsTradeModerationStatus, source?: string | null, reason?: string | null, }; - -export type RadrootsTradeModerationSeverity = "notice" | "warning" | "block"; - -export type RadrootsTradeModerationStatus = "open" | "snoozed" | "resolved"; - -export type RadrootsTradeOrderBackofficeOverlay = { order_id: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: RadrootsTradeModerationFlag[], fulfillment_exceptions: RadrootsTradeFulfillmentException[], }; - -export type RadrootsTradeOrderBackofficeQuery = { order: RadrootsTradeOrderQuery, requires_review?: boolean | null, has_open_moderation_flags?: boolean | null, has_open_fulfillment_exceptions?: boolean | null, }; - -export type RadrootsTradeOrderBackofficeView = { order: RadrootsTradeOrderWorkflowProjection, marketplace: RadrootsTradeMarketplaceOrderSummary, overlay?: RadrootsTradeOrderBackofficeOverlay | null, requires_review: boolean, open_moderation_flag_count: number, open_fulfillment_exception_count: number, }; - -export type RadrootsTradeOrderFacets = { buyer_pubkeys: RadrootsTradeFacetCount[], seller_pubkeys: RadrootsTradeFacetCount[], listing_addrs: RadrootsTradeFacetCount[], statuses: RadrootsTradeFacetCount[], }; - -export type RadrootsTradeOrderQuery = { listing_addr?: string | null, buyer_pubkey?: string | null, seller_pubkey?: string | null, status?: RadrootsTradeOrderStatus | null, }; - -export type RadrootsTradeOrderSort = { field: RadrootsTradeOrderSortField, direction: RadrootsTradeSortDirection, }; - -export type RadrootsTradeOrderSortField = "order_id" | "listing_addr" | "buyer_pubkey" | "seller_pubkey" | "status" | "last_message_type" | "total_bin_count"; - -export type RadrootsTradeOrderStatus = "draft" | "validated" | "requested" | "questioned" | "revised" | "accepted" | "declined" | "cancelled" | "fulfilled" | "completed"; - -export type RadrootsTradeOrderWorkflowMessage = { event_id: string, actor_pubkey: string, counterparty_pubkey: string, listing_addr: string, order_id?: string | null, listing_event?: RadrootsNostrEventPtr | null, root_event_id?: string | null, prev_event_id?: string | null, payload: RadrootsTradeMessagePayload, }; - -export type RadrootsTradeOrderWorkflowProjection = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, items: RadrootsTradeOrderItem[], requested_discounts?: RadrootsTradeOrderEconomicLine[] | null, status: RadrootsTradeOrderStatus, listing_snapshot?: RadrootsNostrEventPtr | null, root_event_id: string, last_event_id: string, last_discount_request?: RadrootsCoreDiscountValue | null, last_discount_offer?: RadrootsCoreDiscountValue | null, accepted_discount?: RadrootsCoreDiscountValue | null, last_fulfillment_status?: RadrootsTradeFulfillmentStatus | null, receipt_acknowledged?: bool | null, receipt_at?: number | null, last_reason?: string | null, last_discount_decline_reason?: string | null, question_count: number, answer_count: number, revision_count: number, discount_request_count: number, discount_offer_count: number, discount_accept_count: number, discount_decline_count: number, cancellation_count: number, fulfillment_update_count: number, receipt_count: number, last_message_type: RadrootsTradeMessageType, last_actor_pubkey: string, }; - -export type RadrootsTradeReviewPriority = "low" | "normal" | "high" | "critical"; - -export type RadrootsTradeReviewQueueEntry = { queue: string, priority: RadrootsTradeReviewPriority, status: RadrootsTradeReviewStatus, assigned_operator?: string | null, reason?: string | null, }; - -export type RadrootsTradeReviewStatus = "queued" | "in_progress" | "blocked" | "resolved"; - -export type RadrootsTradeSortDirection = "asc" | "desc"; diff --git a/crates/xtask/src/output.rs b/crates/xtask/src/output.rs @@ -2,10 +2,7 @@ use crate::{ manifest::manifest_file_name, manifest::package_manifest, package_matrix::{PackageSpec, package_specs}, - ts::{ - generated_constants_file, generated_header, generated_kinds_file, generated_types_file, - strip_legacy_generated_header, - }, + ts::{generated_constants_file, generated_header, generated_kinds_file, generated_types_file}, }; use radroots_sdk_binding_model::TsModule; @@ -22,20 +19,13 @@ pub struct GeneratedFile { pub contents: String, } -#[allow(dead_code)] pub enum TsSource { - Text(&'static str), Module(TsModule), } impl TsSource { - fn text(value: &'static str) -> Self { - Self::Text(value) - } - fn render(&self) -> String { match self { - Self::Text(value) => strip_legacy_generated_header(value), Self::Module(module) => module.render(), } } @@ -112,8 +102,8 @@ pub fn package_outputs() -> Vec<PackageOutput> { }, PackageOutput { spec: spec_by_key("replica_db_schema"), - types_ts: Some(TsSource::text( - radroots_replica_db_schema_bindings::TYPES_TS, + types_ts: Some(TsSource::Module( + radroots_replica_db_schema_bindings::types_module(), )), types_imports_ts: Some(REPLICA_DB_SCHEMA_TYPES_IMPORTS_TS), constants_ts: None, @@ -121,7 +111,7 @@ pub fn package_outputs() -> Vec<PackageOutput> { }, PackageOutput { spec: spec_by_key("trade"), - types_ts: Some(TsSource::text(radroots_trade_bindings::TYPES_TS)), + types_ts: Some(TsSource::Module(radroots_trade_bindings::types_module())), types_imports_ts: Some(TRADE_TYPES_IMPORTS_TS), constants_ts: None, kinds_ts: None, @@ -196,8 +186,6 @@ import type { RadrootsTradeOrderItem, } from "@radroots/events-bindings"; -type bool = boolean; - "#; fn render_manifest(spec: PackageSpec) -> String { @@ -234,7 +222,7 @@ mod tests { #[test] fn renders_sdk_header() { let output = render_ts( - &TsSource::text("// legacy\n\nexport type A = string;\n"), + &TsSource::Module(module(vec![type_alias("A", string())])), None, ); assert!(output.starts_with("// @generated by cargo xtask generate ts")); @@ -244,13 +232,13 @@ mod tests { #[test] fn renders_import_prelude_after_header() { let output = render_ts( - &TsSource::text("export type A = B;\n"), + &TsSource::Module(module(vec![type_alias("A", string())])), Some("import type { B } from \"b\";\n\n"), ); assert!(output.starts_with( "// @generated by cargo xtask generate ts\n// Do not edit by hand.\nimport type" )); - assert!(output.contains("export type A = B;")); + assert!(output.contains("export type A = string;")); } #[test] diff --git a/crates/xtask/src/ts.rs b/crates/xtask/src/ts.rs @@ -14,23 +14,10 @@ pub fn generated_kinds_file() -> &'static str { "kinds.ts" } -pub fn normalize_lf(value: &str) -> String { - value.replace("\r\n", "\n") -} - -pub fn strip_legacy_generated_header(value: &str) -> String { - let normalized = normalize_lf(value); - normalized - .strip_prefix("// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n\n") - .unwrap_or(&normalized) - .to_owned() -} - #[cfg(test)] mod tests { use super::{ generated_constants_file, generated_header, generated_kinds_file, generated_types_file, - normalize_lf, strip_legacy_generated_header, }; #[test] @@ -47,18 +34,4 @@ mod tests { assert_eq!(generated_constants_file(), "constants.ts"); assert_eq!(generated_kinds_file(), "kinds.ts"); } - - #[test] - fn normalizes_line_endings() { - assert_eq!(normalize_lf("a\r\nb\n"), "a\nb\n"); - } - - #[test] - fn strips_legacy_ts_rs_header() { - let source = "// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.\n\nexport type A = string;\n"; - assert_eq!( - strip_legacy_generated_header(source), - "export type A = string;\n" - ); - } } diff --git a/packages/replica-db-schema-bindings/src/generated/types.ts b/packages/replica-db-schema-bindings/src/generated/types.ts @@ -30,7 +30,7 @@ export type GcsLocation = { id: string, created_at: string, updated_at: string, export type GcsLocationFarmArgs = { id: string, }; -export type GcsLocationFindManyRel = { "on_trade_product": GcsLocationTradeProductArgs } | { "off_trade_product": GcsLocationTradeProductArgs } | { "on_farm": GcsLocationFarmArgs } | { "off_farm": GcsLocationFarmArgs } | { "on_plot": GcsLocationPlotArgs } | { "off_plot": GcsLocationPlotArgs }; +export type GcsLocationFindManyRel = { on_trade_product: GcsLocationTradeProductArgs, } | { off_trade_product: GcsLocationTradeProductArgs, } | { on_farm: GcsLocationFarmArgs, } | { off_farm: GcsLocationFarmArgs, } | { on_plot: GcsLocationPlotArgs, } | { off_plot: GcsLocationPlotArgs, }; export type GcsLocationPlotArgs = { id: string, }; @@ -484,7 +484,7 @@ export type LogErrorQueryBindValues = { id: string, } | { nostr_pubkey: string, export type MediaImage = { id: string, created_at: string, updated_at: string, file_path: string, mime_type: string, res_base: string, res_path: string, label: string | null, description: string | null, }; -export type MediaImageFindManyRel = { "on_trade_product": MediaImageTradeProductArgs } | { "off_trade_product": MediaImageTradeProductArgs }; +export type MediaImageFindManyRel = { on_trade_product: MediaImageTradeProductArgs, } | { off_trade_product: MediaImageTradeProductArgs, }; export type MediaImageQueryBindValues = { id: string, } | { file_path: string, }; @@ -496,7 +496,7 @@ export type NostrEventStateQueryBindValues = { id: string, } | { key: string, }; export type NostrProfile = { id: string, created_at: string, updated_at: string, public_key: string, profile_type: string, name: string, display_name: string | null, about: string | null, website: string | null, picture: string | null, banner: string | null, nip05: string | null, lud06: string | null, lud16: string | null, }; -export type NostrProfileFindManyRel = { "on_relay": NostrProfileRelayArgs } | { "off_relay": NostrProfileRelayArgs }; +export type NostrProfileFindManyRel = { on_relay: NostrProfileRelayArgs, } | { off_relay: NostrProfileRelayArgs, }; export type NostrProfileQueryBindValues = { id: string, } | { public_key: string, }; @@ -504,7 +504,7 @@ export type NostrProfileRelayArgs = { id: string, }; export type NostrRelay = { id: string, created_at: string, updated_at: string, url: string, relay_id: string | null, name: string | null, description: string | null, pubkey: string | null, contact: string | null, supported_nips: string | null, software: string | null, version: string | null, data: string | null, }; -export type NostrRelayFindManyRel = { "on_profile": NostrRelayProfileArgs } | { "off_profile": NostrRelayProfileArgs }; +export type NostrRelayFindManyRel = { on_profile: NostrRelayProfileArgs, } | { off_profile: NostrRelayProfileArgs, }; export type NostrRelayProfileArgs = { public_key: string, }; diff --git a/packages/trade-bindings/src/generated/types.ts b/packages/trade-bindings/src/generated/types.ts @@ -21,23 +21,21 @@ import type { RadrootsTradeOrderItem, } from "@radroots/events-bindings"; -type bool = boolean; - export type RadrootsFarmRef = { pubkey: string, d_tag: string, }; -export type RadrootsListing = { d_tag: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: Array<RadrootsListingBin>, resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: RadrootsCoreDiscount[] | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: RadrootsListingImage[] | null, }; +export type RadrootsListing = { d_tag: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: Array<RadrootsListingBin>, resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: Array<RadrootsCoreDiscount> | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: Array<RadrootsListingImage> | null, }; -export type RadrootsListingAvailability = { "kind": "window", "amount": { start?: number | null, end?: number | null, } } | { "kind": "status", "amount": { status: RadrootsListingStatus, } }; +export type RadrootsListingAvailability = { kind: "window", amount: { start?: number | null, end?: number | null, }, } | { kind: "status", amount: { status: RadrootsListingStatus, }, }; export type RadrootsListingBin = { bin_id: string, quantity: RadrootsCoreQuantity, price_per_canonical_unit: RadrootsCoreQuantityPrice, display_amount?: RadrootsCoreDecimal | null, display_unit?: RadrootsCoreUnit | null, display_label?: string | null, display_price?: RadrootsCoreMoney | null, display_price_unit?: RadrootsCoreUnit | null, }; -export type RadrootsListingDeliveryMethod = { "kind": "pickup" } | { "kind": "local_delivery" } | { "kind": "shipping" } | { "kind": "other", "amount": { method: string, } }; +export type RadrootsListingDeliveryMethod = { kind: "pickup", } | { kind: "local_delivery", } | { kind: "shipping", } | { kind: "other", amount: { method: string, }, }; export type RadrootsListingLocation = { primary: string, city?: string | null, region?: string | null, country?: string | null, lat?: number | null, lng?: number | null, geohash?: string | null, }; export type RadrootsListingProduct = { key: string, title: string, category: string, summary?: string | null, process?: string | null, lot?: string | null, location?: string | null, profile?: string | null, year?: string | null, }; -export type RadrootsListingStatus = { "kind": "active" } | { "kind": "sold" } | { "kind": "other", "amount": { value: string, } }; +export type RadrootsListingStatus = { kind: "active", } | { kind: "sold", } | { kind: "other", amount: { value: string, }, }; export type RadrootsTradeFacetCount = { key: string, count: number, }; @@ -49,7 +47,7 @@ export type RadrootsTradeFulfillmentExceptionStatus = "open" | "monitoring" | "r export type RadrootsTradeListing = { listing_id: string, listing_addr: string, seller_pubkey: string, title: string, description: string, product_type: string, primary_bin_id: string, bin_quantity: RadrootsCoreQuantity, unit: RadrootsCoreUnit, unit_price: RadrootsCoreMoney, inventory_available: RadrootsCoreDecimal, availability: RadrootsListingAvailability, location: RadrootsListingLocation, delivery_method: RadrootsListingDeliveryMethod, listing: RadrootsListing, }; -export type RadrootsTradeListingBackofficeOverlay = { listing_addr: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: RadrootsTradeModerationFlag[], }; +export type RadrootsTradeListingBackofficeOverlay = { listing_addr: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: Array<RadrootsTradeModerationFlag>, }; export type RadrootsTradeListingBackofficeQuery = { listing: RadrootsTradeListingQuery, requires_review?: boolean | null, has_open_moderation_flags?: boolean | null, }; @@ -57,11 +55,11 @@ export type RadrootsTradeListingBackofficeView = { listing: RadrootsTradeListing export type RadrootsTradeListingBinProjection = { bin: RadrootsListingBin, one_bin_total: RadrootsTradeListingTotal, }; -export type RadrootsTradeListingFacets = { seller_pubkeys: RadrootsTradeFacetCount[], farm_pubkeys: RadrootsTradeFacetCount[], farm_ids: RadrootsTradeFacetCount[], product_keys: RadrootsTradeFacetCount[], product_categories: RadrootsTradeFacetCount[], listing_statuses: RadrootsTradeFacetCount[], }; +export type RadrootsTradeListingFacets = { seller_pubkeys: Array<RadrootsTradeFacetCount>, farm_pubkeys: Array<RadrootsTradeFacetCount>, farm_ids: Array<RadrootsTradeFacetCount>, product_keys: Array<RadrootsTradeFacetCount>, product_categories: Array<RadrootsTradeFacetCount>, listing_statuses: Array<RadrootsTradeFacetCount>, }; -export type RadrootsTradeListingMarketStatus = "unknown" | "window" | "active" | "sold" | { "other": { value: string, } }; +export type RadrootsTradeListingMarketStatus = "unknown" | "window" | "active" | "sold" | { other: { value: string, }, }; -export type RadrootsTradeListingProjection = { listing_addr: string, seller_pubkey: string, listing_id: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: RadrootsTradeListingBinProjection[], resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: RadrootsCoreDiscount[] | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: RadrootsListingImage[] | null, order_count: number, open_order_count: number, terminal_order_count: number, }; +export type RadrootsTradeListingProjection = { listing_addr: string, seller_pubkey: string, listing_id: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: Array<RadrootsTradeListingBinProjection>, resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: Array<RadrootsCoreDiscount> | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: Array<RadrootsListingImage> | null, order_count: number, open_order_count: number, terminal_order_count: number, }; export type RadrootsTradeListingQuery = { seller_pubkey?: string | null, farm_pubkey?: string | null, farm_id?: string | null, product_key?: string | null, product_category?: string | null, listing_status?: RadrootsTradeListingMarketStatus | null, }; @@ -85,13 +83,13 @@ export type RadrootsTradeModerationSeverity = "notice" | "warning" | "block"; export type RadrootsTradeModerationStatus = "open" | "snoozed" | "resolved"; -export type RadrootsTradeOrderBackofficeOverlay = { order_id: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: RadrootsTradeModerationFlag[], fulfillment_exceptions: RadrootsTradeFulfillmentException[], }; +export type RadrootsTradeOrderBackofficeOverlay = { order_id: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: Array<RadrootsTradeModerationFlag>, fulfillment_exceptions: Array<RadrootsTradeFulfillmentException>, }; export type RadrootsTradeOrderBackofficeQuery = { order: RadrootsTradeOrderQuery, requires_review?: boolean | null, has_open_moderation_flags?: boolean | null, has_open_fulfillment_exceptions?: boolean | null, }; export type RadrootsTradeOrderBackofficeView = { order: RadrootsTradeOrderWorkflowProjection, marketplace: RadrootsTradeMarketplaceOrderSummary, overlay?: RadrootsTradeOrderBackofficeOverlay | null, requires_review: boolean, open_moderation_flag_count: number, open_fulfillment_exception_count: number, }; -export type RadrootsTradeOrderFacets = { buyer_pubkeys: RadrootsTradeFacetCount[], seller_pubkeys: RadrootsTradeFacetCount[], listing_addrs: RadrootsTradeFacetCount[], statuses: RadrootsTradeFacetCount[], }; +export type RadrootsTradeOrderFacets = { buyer_pubkeys: Array<RadrootsTradeFacetCount>, seller_pubkeys: Array<RadrootsTradeFacetCount>, listing_addrs: Array<RadrootsTradeFacetCount>, statuses: Array<RadrootsTradeFacetCount>, }; export type RadrootsTradeOrderQuery = { listing_addr?: string | null, buyer_pubkey?: string | null, seller_pubkey?: string | null, status?: RadrootsTradeOrderStatus | null, }; @@ -103,7 +101,7 @@ export type RadrootsTradeOrderStatus = "draft" | "validated" | "requested" | "qu export type RadrootsTradeOrderWorkflowMessage = { event_id: string, actor_pubkey: string, counterparty_pubkey: string, listing_addr: string, order_id?: string | null, listing_event?: RadrootsNostrEventPtr | null, root_event_id?: string | null, prev_event_id?: string | null, payload: RadrootsTradeMessagePayload, }; -export type RadrootsTradeOrderWorkflowProjection = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, items: RadrootsTradeOrderItem[], requested_discounts?: RadrootsTradeOrderEconomicLine[] | null, status: RadrootsTradeOrderStatus, listing_snapshot?: RadrootsNostrEventPtr | null, root_event_id: string, last_event_id: string, last_discount_request?: RadrootsCoreDiscountValue | null, last_discount_offer?: RadrootsCoreDiscountValue | null, accepted_discount?: RadrootsCoreDiscountValue | null, last_fulfillment_status?: RadrootsTradeFulfillmentStatus | null, receipt_acknowledged?: bool | null, receipt_at?: number | null, last_reason?: string | null, last_discount_decline_reason?: string | null, question_count: number, answer_count: number, revision_count: number, discount_request_count: number, discount_offer_count: number, discount_accept_count: number, discount_decline_count: number, cancellation_count: number, fulfillment_update_count: number, receipt_count: number, last_message_type: RadrootsTradeMessageType, last_actor_pubkey: string, }; +export type RadrootsTradeOrderWorkflowProjection = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, items: Array<RadrootsTradeOrderItem>, requested_discounts?: Array<RadrootsTradeOrderEconomicLine> | null, status: RadrootsTradeOrderStatus, listing_snapshot?: RadrootsNostrEventPtr | null, root_event_id: string, last_event_id: string, last_discount_request?: RadrootsCoreDiscountValue | null, last_discount_offer?: RadrootsCoreDiscountValue | null, accepted_discount?: RadrootsCoreDiscountValue | null, last_fulfillment_status?: RadrootsTradeFulfillmentStatus | null, receipt_acknowledged?: boolean | null, receipt_at?: number | null, last_reason?: string | null, last_discount_decline_reason?: string | null, question_count: number, answer_count: number, revision_count: number, discount_request_count: number, discount_offer_count: number, discount_accept_count: number, discount_decline_count: number, cancellation_count: number, fulfillment_update_count: number, receipt_count: number, last_message_type: RadrootsTradeMessageType, last_actor_pubkey: string, }; export type RadrootsTradeReviewPriority = "low" | "normal" | "high" | "critical";