sdk

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

commit 3802788108a3823ab133074031d499cb415e799e
parent 54a92213c851bef0d107c4a06688dc97426ac5ce
Author: triesap <tyson@radroots.org>
Date:   Wed, 24 Jun 2026 09:04:55 +0000

replica: render schema bindings from dto registry

Replace the hand-authored replica binding model with a source-owned dto registry exported by radroots_replica_db_schema.

Teach xtask to render untagged DTO enums and route the replica package through TsSource::DtoRegistry.

Regenerate @radroots/replica-db-schema-bindings so JSON partial fields, nullable find-one results, NostrEventHead, and bigint policy match source.

Validate with cargo fmt/check/test, xtask generate/check, and build/typecheck for the affected TypeScript packages.

Diffstat:
MCargo.lock | 3++-
Mcrates/replica_db_schema_bindings/Cargo.toml | 4++--
Mcrates/replica_db_schema_bindings/src/lib.rs | 27++++++++++++++++++---------
Dcrates/replica_db_schema_bindings/src/model.rs | 1943-------------------------------------------------------------------------------
Mpackages/replica-db-schema-bindings/src/generated/types.ts | 200++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Mtools/xtask/src/dto_render.rs | 116++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mtools/xtask/src/dto_roots.rs | 47+++++++++++++++++++++++++++++++++++++++++++++++
Mtools/xtask/src/output.rs | 29+++++++++++++++++++++++++++--
8 files changed, 331 insertions(+), 2038 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -1939,6 +1939,7 @@ dependencies = [ name = "radroots_replica_db_schema" version = "0.1.0-alpha.2" dependencies = [ + "dto_bindgen_core", "radroots_types", "serde", "serde_json", @@ -1948,8 +1949,8 @@ dependencies = [ name = "radroots_replica_db_schema_bindings" version = "0.1.0" dependencies = [ + "dto_bindgen_core", "radroots_replica_db_schema", - "radroots_sdk_binding_model", ] [[package]] diff --git a/crates/replica_db_schema_bindings/Cargo.toml b/crates/replica_db_schema_bindings/Cargo.toml @@ -9,5 +9,5 @@ homepage.workspace = true publish = false [dependencies] -radroots_sdk_binding_model = { path = "../binding_model" } -radroots_replica_db_schema = { workspace = true } +dto_bindgen_core = { workspace = true } +radroots_replica_db_schema = { workspace = true, features = ["dto-bindgen"] } diff --git a/crates/replica_db_schema_bindings/src/lib.rs b/crates/replica_db_schema_bindings/src/lib.rs @@ -1,18 +1,27 @@ pub use radroots_replica_db_schema as upstream; -mod model; - -pub use model::types_module; +pub fn dto_registry() -> dto_bindgen_core::Registry { + upstream::dto::dto_registry() +} #[cfg(test)] mod tests { - use super::types_module; + use super::dto_registry; #[test] - fn preserves_replica_schema_exports() { - let rendered = types_module().render(); - assert!(rendered.contains("export type Farm")); - assert!(rendered.contains("export type GcsLocation")); - assert!(rendered.contains("export type IGcsLocationFindManyResolve")); + fn preserves_replica_schema_registry_exports() { + let registry = dto_registry(); + let actual = registry + .types_by_id + .values() + .map(|type_def| match type_def { + dto_bindgen_core::TypeDef::Struct(def) => def.export_name.as_str(), + dto_bindgen_core::TypeDef::Enum(def) => def.export_name.as_str(), + }) + .collect::<Vec<_>>(); + + assert!(actual.contains(&"Farm")); + assert!(actual.contains(&"GcsLocation")); + assert!(actual.contains(&"IGcsLocationFindManyResolve")); } } diff --git a/crates/replica_db_schema_bindings/src/model.rs b/crates/replica_db_schema_bindings/src/model.rs @@ -1,1943 +0,0 @@ -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/packages/replica-db-schema-bindings/src/generated/types.ts b/packages/replica-db-schema-bindings/src/generated/types.ts @@ -50,9 +50,11 @@ export type IFarmFields = { d_tag: string, pubkey: string, name: string, about?: 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 IFarmFieldsPartial = { d_tag?: ReplicaDbJsonValue | null, pubkey?: ReplicaDbJsonValue | null, name?: ReplicaDbJsonValue | null, about?: ReplicaDbJsonValue | null, website?: ReplicaDbJsonValue | null, picture?: ReplicaDbJsonValue | null, banner?: ReplicaDbJsonValue | null, location_primary?: ReplicaDbJsonValue | null, location_city?: ReplicaDbJsonValue | null, location_region?: ReplicaDbJsonValue | null, location_country?: ReplicaDbJsonValue | null, }; -export type IFarmFindMany = { filter: IFarmFieldsFilter | null, }; +export type IFarmFindMany = IFarmFindManyArgs; + +export type IFarmFindManyArgs = { filter: IFarmFieldsFilter | null, }; export type IFarmFindManyResolve = IResultList<Farm>; @@ -60,7 +62,7 @@ export type IFarmFindOne = IFarmFindOneArgs; export type IFarmFindOneArgs = { on: FarmQueryBindValues, }; -export type IFarmFindOneResolve = IResult<Farm>; +export type IFarmFindOneResolve = IResult<Farm | null>; export type IFarmGcsLocationCreate = IFarmGcsLocationFields; @@ -74,9 +76,11 @@ export type IFarmGcsLocationFields = { farm_id: string, gcs_location_id: 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 IFarmGcsLocationFieldsPartial = { farm_id?: ReplicaDbJsonValue | null, gcs_location_id?: ReplicaDbJsonValue | null, role?: ReplicaDbJsonValue | null, }; + +export type IFarmGcsLocationFindMany = IFarmGcsLocationFindManyArgs; -export type IFarmGcsLocationFindMany = { filter: IFarmGcsLocationFieldsFilter | null, }; +export type IFarmGcsLocationFindManyArgs = { filter: IFarmGcsLocationFieldsFilter | null, }; export type IFarmGcsLocationFindManyResolve = IResultList<FarmGcsLocation>; @@ -84,9 +88,11 @@ export type IFarmGcsLocationFindOne = IFarmGcsLocationFindOneArgs; export type IFarmGcsLocationFindOneArgs = { on: FarmGcsLocationQueryBindValues, }; -export type IFarmGcsLocationFindOneResolve = IResult<FarmGcsLocation>; +export type IFarmGcsLocationFindOneResolve = IResult<FarmGcsLocation | null>; -export type IFarmGcsLocationUpdate = { on: FarmGcsLocationQueryBindValues, fields: IFarmGcsLocationFieldsPartial, }; +export type IFarmGcsLocationUpdate = IFarmGcsLocationUpdateArgs; + +export type IFarmGcsLocationUpdateArgs = { on: FarmGcsLocationQueryBindValues, fields: IFarmGcsLocationFieldsPartial, }; export type IFarmGcsLocationUpdateResolve = IResult<FarmGcsLocation>; @@ -102,9 +108,11 @@ export type IFarmMemberClaimFields = { member_pubkey: string, farm_pubkey: strin 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 IFarmMemberClaimFieldsPartial = { member_pubkey?: ReplicaDbJsonValue | null, farm_pubkey?: ReplicaDbJsonValue | null, }; + +export type IFarmMemberClaimFindMany = IFarmMemberClaimFindManyArgs; -export type IFarmMemberClaimFindMany = { filter: IFarmMemberClaimFieldsFilter | null, }; +export type IFarmMemberClaimFindManyArgs = { filter: IFarmMemberClaimFieldsFilter | null, }; export type IFarmMemberClaimFindManyResolve = IResultList<FarmMemberClaim>; @@ -112,9 +120,11 @@ export type IFarmMemberClaimFindOne = IFarmMemberClaimFindOneArgs; export type IFarmMemberClaimFindOneArgs = { on: FarmMemberClaimQueryBindValues, }; -export type IFarmMemberClaimFindOneResolve = IResult<FarmMemberClaim>; +export type IFarmMemberClaimFindOneResolve = IResult<FarmMemberClaim | null>; -export type IFarmMemberClaimUpdate = { on: FarmMemberClaimQueryBindValues, fields: IFarmMemberClaimFieldsPartial, }; +export type IFarmMemberClaimUpdate = IFarmMemberClaimUpdateArgs; + +export type IFarmMemberClaimUpdateArgs = { on: FarmMemberClaimQueryBindValues, fields: IFarmMemberClaimFieldsPartial, }; export type IFarmMemberClaimUpdateResolve = IResult<FarmMemberClaim>; @@ -130,9 +140,11 @@ export type IFarmMemberFields = { farm_id: string, member_pubkey: string, role: 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 IFarmMemberFieldsPartial = { farm_id?: ReplicaDbJsonValue | null, member_pubkey?: ReplicaDbJsonValue | null, role?: ReplicaDbJsonValue | null, }; + +export type IFarmMemberFindMany = IFarmMemberFindManyArgs; -export type IFarmMemberFindMany = { filter: IFarmMemberFieldsFilter | null, }; +export type IFarmMemberFindManyArgs = { filter: IFarmMemberFieldsFilter | null, }; export type IFarmMemberFindManyResolve = IResultList<FarmMember>; @@ -140,9 +152,11 @@ export type IFarmMemberFindOne = IFarmMemberFindOneArgs; export type IFarmMemberFindOneArgs = { on: FarmMemberQueryBindValues, }; -export type IFarmMemberFindOneResolve = IResult<FarmMember>; +export type IFarmMemberFindOneResolve = IResult<FarmMember | null>; -export type IFarmMemberUpdate = { on: FarmMemberQueryBindValues, fields: IFarmMemberFieldsPartial, }; +export type IFarmMemberUpdate = IFarmMemberUpdateArgs; + +export type IFarmMemberUpdateArgs = { on: FarmMemberQueryBindValues, fields: IFarmMemberFieldsPartial, }; export type IFarmMemberUpdateResolve = IResult<FarmMember>; @@ -158,9 +172,11 @@ 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 IFarmTagFieldsPartial = { farm_id?: ReplicaDbJsonValue | null, tag?: ReplicaDbJsonValue | null, }; + +export type IFarmTagFindMany = IFarmTagFindManyArgs; -export type IFarmTagFindMany = { filter: IFarmTagFieldsFilter | null, }; +export type IFarmTagFindManyArgs = { filter: IFarmTagFieldsFilter | null, }; export type IFarmTagFindManyResolve = IResultList<FarmTag>; @@ -168,13 +184,17 @@ export type IFarmTagFindOne = IFarmTagFindOneArgs; export type IFarmTagFindOneArgs = { on: FarmTagQueryBindValues, }; -export type IFarmTagFindOneResolve = IResult<FarmTag>; +export type IFarmTagFindOneResolve = IResult<FarmTag | null>; -export type IFarmTagUpdate = { on: FarmTagQueryBindValues, fields: IFarmTagFieldsPartial, }; +export type IFarmTagUpdate = IFarmTagUpdateArgs; + +export type IFarmTagUpdateArgs = { on: FarmTagQueryBindValues, fields: IFarmTagFieldsPartial, }; export type IFarmTagUpdateResolve = IResult<FarmTag>; -export type IFarmUpdate = { on: FarmQueryBindValues, fields: IFarmFieldsPartial, }; +export type IFarmUpdate = IFarmUpdateArgs; + +export type IFarmUpdateArgs = { on: FarmQueryBindValues, fields: IFarmFieldsPartial, }; export type IFarmUpdateResolve = IResult<Farm>; @@ -190,9 +210,7 @@ export type IGcsLocationFields = { d_tag: string, lat: number, lng: number, geoh 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 IGcsLocationFieldsPartial = { d_tag?: ReplicaDbJsonValue | null, lat?: ReplicaDbJsonValue | null, lng?: ReplicaDbJsonValue | null, geohash?: ReplicaDbJsonValue | null, point?: ReplicaDbJsonValue | null, polygon?: ReplicaDbJsonValue | null, accuracy?: ReplicaDbJsonValue | null, altitude?: ReplicaDbJsonValue | null, tag_0?: ReplicaDbJsonValue | null, label?: ReplicaDbJsonValue | null, area?: ReplicaDbJsonValue | null, elevation?: ReplicaDbJsonValue | null, soil?: ReplicaDbJsonValue | null, climate?: ReplicaDbJsonValue | null, gc_id?: ReplicaDbJsonValue | null, gc_name?: ReplicaDbJsonValue | null, gc_admin1_id?: ReplicaDbJsonValue | null, gc_admin1_name?: ReplicaDbJsonValue | null, gc_country_id?: ReplicaDbJsonValue | null, gc_country_name?: ReplicaDbJsonValue | null, }; export type IGcsLocationFindManyResolve = IResultList<GcsLocation>; @@ -202,9 +220,11 @@ export type IGcsLocationFindOneArgs = { on: GcsLocationQueryBindValues, }; export type IGcsLocationFindOneRelArgs = { rel: GcsLocationFindManyRel, }; -export type IGcsLocationFindOneResolve = IResult<GcsLocation>; +export type IGcsLocationFindOneResolve = IResult<GcsLocation | null>; + +export type IGcsLocationUpdate = IGcsLocationUpdateArgs; -export type IGcsLocationUpdate = { on: GcsLocationQueryBindValues, fields: IGcsLocationFieldsPartial, }; +export type IGcsLocationUpdateArgs = { on: GcsLocationQueryBindValues, fields: IGcsLocationFieldsPartial, }; export type IGcsLocationUpdateResolve = IResult<GcsLocation>; @@ -220,9 +240,11 @@ export type ILogErrorFields = { error: string, message: string, stack_trace?: st 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 ILogErrorFieldsPartial = { error?: ReplicaDbJsonValue | null, message?: ReplicaDbJsonValue | null, stack_trace?: ReplicaDbJsonValue | null, cause?: ReplicaDbJsonValue | null, app_system?: ReplicaDbJsonValue | null, app_version?: ReplicaDbJsonValue | null, nostr_pubkey?: ReplicaDbJsonValue | null, data?: ReplicaDbJsonValue | null, }; -export type ILogErrorFindMany = { filter: ILogErrorFieldsFilter | null, }; +export type ILogErrorFindMany = ILogErrorFindManyArgs; + +export type ILogErrorFindManyArgs = { filter: ILogErrorFieldsFilter | null, }; export type ILogErrorFindManyResolve = IResultList<LogError>; @@ -230,9 +252,11 @@ export type ILogErrorFindOne = ILogErrorFindOneArgs; export type ILogErrorFindOneArgs = { on: LogErrorQueryBindValues, }; -export type ILogErrorFindOneResolve = IResult<LogError>; +export type ILogErrorFindOneResolve = IResult<LogError | null>; + +export type ILogErrorUpdate = ILogErrorUpdateArgs; -export type ILogErrorUpdate = { on: LogErrorQueryBindValues, fields: ILogErrorFieldsPartial, }; +export type ILogErrorUpdateArgs = { on: LogErrorQueryBindValues, fields: ILogErrorFieldsPartial, }; export type ILogErrorUpdateResolve = IResult<LogError>; @@ -248,9 +272,7 @@ export type IMediaImageFields = { file_path: string, mime_type: string, res_base 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 IMediaImageFieldsPartial = { file_path?: ReplicaDbJsonValue | null, mime_type?: ReplicaDbJsonValue | null, res_base?: ReplicaDbJsonValue | null, res_path?: ReplicaDbJsonValue | null, label?: ReplicaDbJsonValue | null, description?: ReplicaDbJsonValue | null, }; export type IMediaImageFindManyResolve = IResultList<MediaImage>; @@ -260,39 +282,45 @@ export type IMediaImageFindOneArgs = { on: MediaImageQueryBindValues, }; export type IMediaImageFindOneRelArgs = { rel: MediaImageFindManyRel, }; -export type IMediaImageFindOneResolve = IResult<MediaImage>; +export type IMediaImageFindOneResolve = IResult<MediaImage | null>; + +export type IMediaImageUpdate = IMediaImageUpdateArgs; -export type IMediaImageUpdate = { on: MediaImageQueryBindValues, fields: IMediaImageFieldsPartial, }; +export type IMediaImageUpdateArgs = { on: MediaImageQueryBindValues, fields: IMediaImageFieldsPartial, }; export type IMediaImageUpdateResolve = IResult<MediaImage>; -export type INostrEventStateCreate = INostrEventStateFields; +export type INostrEventHeadCreate = INostrEventHeadFields; -export type INostrEventStateCreateResolve = IResult<NostrEventState>; +export type INostrEventHeadCreateResolve = IResult<NostrEventHead>; -export type INostrEventStateDelete = INostrEventStateFindOne; +export type INostrEventHeadDelete = INostrEventHeadFindOne; -export type INostrEventStateDeleteResolve = IResult<string>; +export type INostrEventHeadDeleteResolve = 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 INostrEventHeadFields = { 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 INostrEventHeadFieldsFilter = { 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 INostrEventHeadFieldsPartial = { key?: ReplicaDbJsonValue | null, kind?: ReplicaDbJsonValue | null, pubkey?: ReplicaDbJsonValue | null, d_tag?: ReplicaDbJsonValue | null, last_event_id?: ReplicaDbJsonValue | null, last_created_at?: ReplicaDbJsonValue | null, content_hash?: ReplicaDbJsonValue | null, }; -export type INostrEventStateFindMany = { filter: INostrEventStateFieldsFilter | null, }; +export type INostrEventHeadFindMany = INostrEventHeadFindManyArgs; -export type INostrEventStateFindManyResolve = IResultList<NostrEventState>; +export type INostrEventHeadFindManyArgs = { filter: INostrEventHeadFieldsFilter | null, }; -export type INostrEventStateFindOne = INostrEventStateFindOneArgs; +export type INostrEventHeadFindManyResolve = IResultList<NostrEventHead>; -export type INostrEventStateFindOneArgs = { on: NostrEventStateQueryBindValues, }; +export type INostrEventHeadFindOne = INostrEventHeadFindOneArgs; -export type INostrEventStateFindOneResolve = IResult<NostrEventState>; +export type INostrEventHeadFindOneArgs = { on: NostrEventHeadQueryBindValues, }; -export type INostrEventStateUpdate = { on: NostrEventStateQueryBindValues, fields: INostrEventStateFieldsPartial, }; +export type INostrEventHeadFindOneResolve = IResult<NostrEventHead | null>; -export type INostrEventStateUpdateResolve = IResult<NostrEventState>; +export type INostrEventHeadUpdate = INostrEventHeadUpdateArgs; + +export type INostrEventHeadUpdateArgs = { on: NostrEventHeadQueryBindValues, fields: INostrEventHeadFieldsPartial, }; + +export type INostrEventHeadUpdateResolve = IResult<NostrEventHead>; export type INostrProfileCreate = INostrProfileFields; @@ -306,9 +334,7 @@ export type INostrProfileFields = { public_key: string, profile_type: string, na 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 INostrProfileFieldsPartial = { public_key?: ReplicaDbJsonValue | null, profile_type?: ReplicaDbJsonValue | null, name?: ReplicaDbJsonValue | null, display_name?: ReplicaDbJsonValue | null, about?: ReplicaDbJsonValue | null, website?: ReplicaDbJsonValue | null, picture?: ReplicaDbJsonValue | null, banner?: ReplicaDbJsonValue | null, nip05?: ReplicaDbJsonValue | null, lud06?: ReplicaDbJsonValue | null, lud16?: ReplicaDbJsonValue | null, }; export type INostrProfileFindManyResolve = IResultList<NostrProfile>; @@ -318,13 +344,15 @@ export type INostrProfileFindOneArgs = { on: NostrProfileQueryBindValues, }; export type INostrProfileFindOneRelArgs = { rel: NostrProfileFindManyRel, }; -export type INostrProfileFindOneResolve = IResult<NostrProfile>; +export type INostrProfileFindOneResolve = IResult<NostrProfile | null>; export type INostrProfileRelayRelation = { nostr_profile: NostrProfileQueryBindValues, nostr_relay: NostrRelayQueryBindValues, }; export type INostrProfileRelayResolve = IResultPass; -export type INostrProfileUpdate = { on: NostrProfileQueryBindValues, fields: INostrProfileFieldsPartial, }; +export type INostrProfileUpdate = INostrProfileUpdateArgs; + +export type INostrProfileUpdateArgs = { on: NostrProfileQueryBindValues, fields: INostrProfileFieldsPartial, }; export type INostrProfileUpdateResolve = IResult<NostrProfile>; @@ -340,9 +368,7 @@ export type INostrRelayFields = { url: string, relay_id?: string | null, name?: 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 INostrRelayFieldsPartial = { url?: ReplicaDbJsonValue | null, relay_id?: ReplicaDbJsonValue | null, name?: ReplicaDbJsonValue | null, description?: ReplicaDbJsonValue | null, pubkey?: ReplicaDbJsonValue | null, contact?: ReplicaDbJsonValue | null, supported_nips?: ReplicaDbJsonValue | null, software?: ReplicaDbJsonValue | null, version?: ReplicaDbJsonValue | null, data?: ReplicaDbJsonValue | null, }; export type INostrRelayFindManyResolve = IResultList<NostrRelay>; @@ -352,9 +378,11 @@ export type INostrRelayFindOneArgs = { on: NostrRelayQueryBindValues, }; export type INostrRelayFindOneRelArgs = { rel: NostrRelayFindManyRel, }; -export type INostrRelayFindOneResolve = IResult<NostrRelay>; +export type INostrRelayFindOneResolve = IResult<NostrRelay | null>; + +export type INostrRelayUpdate = INostrRelayUpdateArgs; -export type INostrRelayUpdate = { on: NostrRelayQueryBindValues, fields: INostrRelayFieldsPartial, }; +export type INostrRelayUpdateArgs = { on: NostrRelayQueryBindValues, fields: INostrRelayFieldsPartial, }; export type INostrRelayUpdateResolve = IResult<NostrRelay>; @@ -370,9 +398,11 @@ export type IPlotFields = { d_tag: string, farm_id: string, name: string, about? 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 IPlotFieldsPartial = { d_tag?: ReplicaDbJsonValue | null, farm_id?: ReplicaDbJsonValue | null, name?: ReplicaDbJsonValue | null, about?: ReplicaDbJsonValue | null, location_primary?: ReplicaDbJsonValue | null, location_city?: ReplicaDbJsonValue | null, location_region?: ReplicaDbJsonValue | null, location_country?: ReplicaDbJsonValue | null, }; -export type IPlotFindMany = { filter: IPlotFieldsFilter | null, }; +export type IPlotFindMany = IPlotFindManyArgs; + +export type IPlotFindManyArgs = { filter: IPlotFieldsFilter | null, }; export type IPlotFindManyResolve = IResultList<Plot>; @@ -380,7 +410,7 @@ export type IPlotFindOne = IPlotFindOneArgs; export type IPlotFindOneArgs = { on: PlotQueryBindValues, }; -export type IPlotFindOneResolve = IResult<Plot>; +export type IPlotFindOneResolve = IResult<Plot | null>; export type IPlotGcsLocationCreate = IPlotGcsLocationFields; @@ -394,9 +424,11 @@ export type IPlotGcsLocationFields = { plot_id: string, gcs_location_id: 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 IPlotGcsLocationFieldsPartial = { plot_id?: ReplicaDbJsonValue | null, gcs_location_id?: ReplicaDbJsonValue | null, role?: ReplicaDbJsonValue | null, }; + +export type IPlotGcsLocationFindMany = IPlotGcsLocationFindManyArgs; -export type IPlotGcsLocationFindMany = { filter: IPlotGcsLocationFieldsFilter | null, }; +export type IPlotGcsLocationFindManyArgs = { filter: IPlotGcsLocationFieldsFilter | null, }; export type IPlotGcsLocationFindManyResolve = IResultList<PlotGcsLocation>; @@ -404,9 +436,11 @@ export type IPlotGcsLocationFindOne = IPlotGcsLocationFindOneArgs; export type IPlotGcsLocationFindOneArgs = { on: PlotGcsLocationQueryBindValues, }; -export type IPlotGcsLocationFindOneResolve = IResult<PlotGcsLocation>; +export type IPlotGcsLocationFindOneResolve = IResult<PlotGcsLocation | null>; -export type IPlotGcsLocationUpdate = { on: PlotGcsLocationQueryBindValues, fields: IPlotGcsLocationFieldsPartial, }; +export type IPlotGcsLocationUpdate = IPlotGcsLocationUpdateArgs; + +export type IPlotGcsLocationUpdateArgs = { on: PlotGcsLocationQueryBindValues, fields: IPlotGcsLocationFieldsPartial, }; export type IPlotGcsLocationUpdateResolve = IResult<PlotGcsLocation>; @@ -422,9 +456,11 @@ 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 IPlotTagFieldsPartial = { plot_id?: ReplicaDbJsonValue | null, tag?: ReplicaDbJsonValue | null, }; + +export type IPlotTagFindMany = IPlotTagFindManyArgs; -export type IPlotTagFindMany = { filter: IPlotTagFieldsFilter | null, }; +export type IPlotTagFindManyArgs = { filter: IPlotTagFieldsFilter | null, }; export type IPlotTagFindManyResolve = IResultList<PlotTag>; @@ -432,13 +468,17 @@ export type IPlotTagFindOne = IPlotTagFindOneArgs; export type IPlotTagFindOneArgs = { on: PlotTagQueryBindValues, }; -export type IPlotTagFindOneResolve = IResult<PlotTag>; +export type IPlotTagFindOneResolve = IResult<PlotTag | null>; -export type IPlotTagUpdate = { on: PlotTagQueryBindValues, fields: IPlotTagFieldsPartial, }; +export type IPlotTagUpdate = IPlotTagUpdateArgs; + +export type IPlotTagUpdateArgs = { on: PlotTagQueryBindValues, fields: IPlotTagFieldsPartial, }; export type IPlotTagUpdateResolve = IResult<PlotTag>; -export type IPlotUpdate = { on: PlotQueryBindValues, fields: IPlotFieldsPartial, }; +export type IPlotUpdate = IPlotUpdateArgs; + +export type IPlotUpdateArgs = { on: PlotQueryBindValues, fields: IPlotFieldsPartial, }; export type IPlotUpdateResolve = IResult<Plot>; @@ -450,13 +490,15 @@ 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 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?: bigint | 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 ITradeProductFieldsPartial = { key?: ReplicaDbJsonValue | null, category?: ReplicaDbJsonValue | null, title?: ReplicaDbJsonValue | null, summary?: ReplicaDbJsonValue | null, process?: ReplicaDbJsonValue | null, lot?: ReplicaDbJsonValue | null, profile?: ReplicaDbJsonValue | null, year?: ReplicaDbJsonValue | null, qty_amt?: ReplicaDbJsonValue | null, qty_amt_exact?: ReplicaDbJsonValue | null, qty_unit?: ReplicaDbJsonValue | null, qty_label?: ReplicaDbJsonValue | null, qty_avail?: ReplicaDbJsonValue | null, price_amt?: ReplicaDbJsonValue | null, price_amt_exact?: ReplicaDbJsonValue | null, price_currency?: ReplicaDbJsonValue | null, price_qty_amt?: ReplicaDbJsonValue | null, price_qty_amt_exact?: ReplicaDbJsonValue | null, price_qty_unit?: ReplicaDbJsonValue | null, listing_addr?: ReplicaDbJsonValue | null, primary_bin_id?: ReplicaDbJsonValue | null, verified_primary_bin_id?: ReplicaDbJsonValue | null, notes?: ReplicaDbJsonValue | null, }; -export type ITradeProductFindMany = { filter: ITradeProductFieldsFilter | null, }; +export type ITradeProductFindMany = ITradeProductFindManyArgs; + +export type ITradeProductFindManyArgs = { filter: ITradeProductFieldsFilter | null, }; export type ITradeProductFindManyResolve = IResultList<TradeProduct>; @@ -464,7 +506,7 @@ export type ITradeProductFindOne = ITradeProductFindOneArgs; export type ITradeProductFindOneArgs = { on: TradeProductQueryBindValues, }; -export type ITradeProductFindOneResolve = IResult<TradeProduct>; +export type ITradeProductFindOneResolve = IResult<TradeProduct | null>; export type ITradeProductLocationRelation = { trade_product: TradeProductQueryBindValues, gcs_location: GcsLocationQueryBindValues, }; @@ -474,7 +516,9 @@ export type ITradeProductMediaRelation = { trade_product: TradeProductQueryBindV export type ITradeProductMediaResolve = IResultPass; -export type ITradeProductUpdate = { on: TradeProductQueryBindValues, fields: ITradeProductFieldsPartial, }; +export type ITradeProductUpdate = ITradeProductUpdateArgs; + +export type ITradeProductUpdateArgs = { on: TradeProductQueryBindValues, fields: ITradeProductFieldsPartial, }; export type ITradeProductUpdateResolve = IResult<TradeProduct>; @@ -490,9 +534,9 @@ 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 NostrEventHead = { 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 NostrEventHeadQueryBindValues = { 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, }; @@ -522,6 +566,8 @@ export type PlotTag = { id: string, created_at: string, updated_at: string, plot export type PlotTagQueryBindValues = { id: string, } | { plot_id: string, } | { tag: string, }; +export type ReplicaDbJsonValue = null | boolean | number | string | Array<ReplicaDbJsonValue> | { [key: string]: ReplicaDbJsonValue }; + 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/tools/xtask/src/dto_render.rs b/tools/xtask/src/dto_render.rs @@ -161,13 +161,57 @@ fn render_enum( EnumRepr::Adjacent { tag, content } => { render_tagged_enum(def, tag, Some(content.as_str()), registry, options, imports) } - EnumRepr::Untagged => Err(format!( - "unsupported enum representation for {}", - enum_type_name(def) - )), + EnumRepr::Untagged => render_untagged_enum(def, registry, options, imports), } } +fn render_untagged_enum( + def: &EnumDef, + registry: &Registry, + options: &DtoRegistryRenderOptions, + imports: &mut BTreeMap<String, BTreeSet<String>>, +) -> Result<String, String> { + let variants = def + .variants + .iter() + .map(|variant| render_untagged_variant(def, variant, registry, options, imports)) + .collect::<Result<Vec<_>, _>>()?; + Ok(format!( + "export type {} = {};", + enum_type_name(def), + render_union(variants) + )) +} + +fn render_untagged_variant( + def: &EnumDef, + variant: &VariantDef, + registry: &Registry, + options: &DtoRegistryRenderOptions, + imports: &mut BTreeMap<String, BTreeSet<String>>, +) -> Result<String, String> { + let rendered: Result<String, String> = match &variant.shape { + VariantShape::Unit => Ok("undefined".to_owned()), + VariantShape::Newtype(ty) => render_type_ref(ty, None, registry, options, imports), + VariantShape::Tuple(items) => { + let rendered = items + .iter() + .map(|item| render_type_ref(item, None, registry, options, imports)) + .collect::<Result<Vec<_>, _>>()?; + Ok(format!("[{}]", rendered.join(", "))) + } + VariantShape::Struct(fields) => render_object_fields(fields, registry, options, imports), + }; + + rendered.map_err(|error| { + format!( + "{error} while rendering untagged enum {}.{}", + enum_type_name(def), + variant.rust_name + ) + }) +} + fn render_external_enum( def: &EnumDef, registry: &Registry, @@ -729,6 +773,70 @@ mod tests { } #[test] + fn renders_untagged_object_unions() { + let mut registry = Registry::new(); + registry.register_type( + RustTypeId::new("sdk", "Query"), + TypeDef::Enum( + EnumDef::new("Query", "Query", EnumRepr::Untagged, span()) + .with_variant(VariantDef::new( + "ById", + "byId", + VariantShape::Struct(vec![field("id", "id", TypeRef::String)]), + span(), + )) + .with_variant(VariantDef::new( + "BySlug", + "bySlug", + VariantShape::Struct(vec![field("slug", "slug", TypeRef::String)]), + span(), + )), + ), + ); + + let rendered = render_registry_types(&registry, &DtoRegistryRenderOptions::default()) + .expect("registry renders"); + + assert_eq!( + rendered.body_ts(), + "export type Query = { id: string, } | { slug: string, };" + ); + } + + #[test] + fn renders_untagged_newtype_aliases() { + let mut registry = Registry::new(); + registry.register_type( + RustTypeId::new("sdk", "FindOneResolve"), + TypeDef::Enum( + EnumDef::new( + "FindOneResolve", + "FindOneResolve", + EnumRepr::Untagged, + span(), + ) + .with_variant(VariantDef::new( + "Alias", + "alias", + VariantShape::Newtype(TypeRef::Override(TargetOverride::new( + BackendId::TypeScript, + "IResult<Farm | null>", + ))), + span(), + )), + ), + ); + + let rendered = render_registry_types(&registry, &DtoRegistryRenderOptions::default()) + .expect("registry renders"); + + assert_eq!( + rendered.body_ts(), + "export type FindOneResolve = IResult<Farm | null>;" + ); + } + + #[test] fn requires_explicit_large_integer_policy() { let mut registry = Registry::new(); registry.register_type( diff --git a/tools/xtask/src/dto_roots.rs b/tools/xtask/src/dto_roots.rs @@ -165,6 +165,13 @@ pub fn events_indexed_types_module() -> Result<DtoTypesModule, String> { )) } +pub fn replica_db_schema_types_module() -> Result<DtoTypesModule, String> { + render_registry_types( + &radroots_replica_db_schema_bindings::dto_registry(), + &DtoRegistryRenderOptions::default(), + ) +} + pub fn trade_types_module() -> Result<DtoTypesModule, String> { let root_set = package_root_set("trade").ok_or_else(|| "missing trade DTO roots".to_owned())?; let registry = root_set.registry(); @@ -330,6 +337,8 @@ mod tests { include_str!("../../../packages/events-bindings/src/generated/types.ts"); const EVENTS_INDEXED_BINDINGS_TYPES_TS: &str = include_str!("../../../packages/events-indexed-bindings/src/generated/types.ts"); + const REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS: &str = + include_str!("../../../packages/replica-db-schema-bindings/src/generated/types.ts"); const TRADE_BINDINGS_TYPES_TS: &str = include_str!("../../../packages/trade-bindings/src/generated/types.ts"); const EVENTS_TYPE_INVENTORY: &[&str] = &[ @@ -556,6 +565,37 @@ mod tests { } #[test] + fn replica_db_schema_generated_types_preserve_source_schema_contracts() { + let actual = type_inventory(REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS); + let trade_product_filter = type_declaration( + REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS, + "ITradeProductFieldsFilter", + ); + let trade_product_partial = type_declaration( + REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS, + "ITradeProductFieldsPartial", + ); + + assert!(actual.contains(&"Farm")); + assert!(actual.contains(&"GcsLocation")); + assert!(actual.contains(&"NostrEventHead")); + assert!(actual.contains(&"ReplicaDbJsonValue")); + assert!(actual.contains(&"ITradeProductFieldsPartial")); + assert!(!actual.contains(&"NostrEventState")); + assert!(REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS.contains( + "export type ReplicaDbJsonValue = null | boolean | number | string | Array<ReplicaDbJsonValue> | { [key: string]: ReplicaDbJsonValue };" + )); + assert!( + REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS + .contains("export type IFarmFindOneResolve = IResult<Farm | null>;") + ); + assert!(trade_product_filter.contains("year?: bigint")); + assert!(trade_product_filter.contains("qty_avail?: bigint")); + assert!(trade_product_partial.contains("year?: ReplicaDbJsonValue | null")); + assert!(trade_product_partial.contains("qty_avail?: ReplicaDbJsonValue | null")); + } + + #[test] fn trade_package_imports_source_owned_support_types() { assert!(TRADE_BINDINGS_TYPES_TS.contains("from \"@radroots/core-bindings\"")); assert!(TRADE_BINDINGS_TYPES_TS.contains("from \"@radroots/events-bindings\"")); @@ -577,4 +617,11 @@ mod tests { .map(|rest| rest.split([' ', '<']).next().expect("type name")) .collect() } + + fn type_declaration<'a>(types_ts: &'a str, name: &str) -> &'a str { + types_ts + .lines() + .find(|line| line.starts_with(&format!("export type {name} = "))) + .unwrap_or_else(|| panic!("missing type declaration for {name}")) + } } diff --git a/tools/xtask/src/output.rs b/tools/xtask/src/output.rs @@ -114,8 +114,8 @@ pub fn package_outputs() -> Result<Vec<PackageOutput>, String> { }, PackageOutput { spec: spec_by_key("replica_db_schema"), - types_ts: Some(TsSource::Module( - radroots_replica_db_schema_bindings::types_module(), + types_ts: Some(TsSource::DtoRegistry( + dto_roots::replica_db_schema_types_module()?, )), types_imports_ts: Some(REPLICA_DB_SCHEMA_TYPES_IMPORTS_TS), constants_ts: None, @@ -207,6 +207,8 @@ mod tests { const TRADE_BINDINGS_TYPES_TS: &str = include_str!("../../../packages/trade-bindings/src/generated/types.ts"); + const REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS: &str = + include_str!("../../../packages/replica-db-schema-bindings/src/generated/types.ts"); #[test] fn renders_sdk_header() { @@ -311,4 +313,27 @@ mod tests { assert_eq!(types.contents, TRADE_BINDINGS_TYPES_TS); } + + #[test] + fn replica_db_schema_output_uses_dto_registry_and_matches_checked_in_types() { + let output = package_outputs() + .expect("package outputs") + .into_iter() + .find(|output| output.spec.key == "replica_db_schema") + .expect("replica_db_schema output"); + + assert!(matches!(output.types_ts, Some(TsSource::DtoRegistry(_)))); + assert_eq!( + output.types_imports_ts, + Some(super::REPLICA_DB_SCHEMA_TYPES_IMPORTS_TS) + ); + + let types = output + .files() + .into_iter() + .find(|file| file.relative_path == "src/generated/types.ts") + .expect("types file"); + + assert_eq!(types.contents, REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS); + } }