dto.rs (85535B)
1 use dto_bindgen_core::{ 2 BackendId, DefaultKind, EnumDef, EnumRepr, FieldDef, FieldPresence, GenericParam, IdentName, 3 Primitive, Registry, RustTypeId, SerializePresence, SourceSpan, StructDef, TargetFieldNames, 4 TargetOverride, TypeDef, TypeRef, VariantDef, VariantShape, WireFieldNames, 5 }; 6 7 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 8 enum TypeSpec { 9 Object { 10 name: &'static str, 11 fields: &'static [FieldSpec], 12 }, 13 Union { 14 name: &'static str, 15 variants: &'static [VariantSpec], 16 }, 17 Alias { 18 name: &'static str, 19 target: &'static str, 20 }, 21 } 22 23 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 24 enum VariantSpec { 25 Object(&'static [FieldSpec]), 26 Ref(&'static str), 27 } 28 29 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 30 struct FieldSpec { 31 name: &'static str, 32 target: &'static str, 33 optional: bool, 34 nullable: bool, 35 } 36 37 impl FieldSpec { 38 const fn required(name: &'static str, target: &'static str) -> Self { 39 Self { 40 name, 41 target, 42 optional: false, 43 nullable: false, 44 } 45 } 46 47 const fn nullable(name: &'static str, target: &'static str) -> Self { 48 Self { 49 name, 50 target, 51 optional: false, 52 nullable: true, 53 } 54 } 55 56 const fn optional(name: &'static str, target: &'static str) -> Self { 57 Self { 58 name, 59 target, 60 optional: true, 61 nullable: false, 62 } 63 } 64 65 const fn optional_nullable(name: &'static str, target: &'static str) -> Self { 66 Self { 67 name, 68 target, 69 optional: true, 70 nullable: true, 71 } 72 } 73 } 74 75 pub fn dto_registry() -> Registry { 76 let mut registry = Registry::new(); 77 register_result_contracts(&mut registry); 78 for spec in TYPE_SPECS { 79 let name = spec.name(); 80 let type_id = registry.register_type( 81 RustTypeId::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"), name), 82 spec.type_def(), 83 ); 84 registry.mark_root(type_id); 85 } 86 registry 87 } 88 89 pub fn type_inventory() -> Vec<&'static str> { 90 RESULT_CONTRACT_NAMES 91 .iter() 92 .copied() 93 .chain(TYPE_SPECS.iter().map(TypeSpec::name)) 94 .collect() 95 } 96 97 impl TypeSpec { 98 fn name(&self) -> &'static str { 99 match self { 100 Self::Object { name, .. } | Self::Union { name, .. } | Self::Alias { name, .. } => name, 101 } 102 } 103 104 fn type_def(&self) -> TypeDef { 105 match self { 106 Self::Object { name, fields } => TypeDef::Struct(object_def(name, fields)), 107 Self::Union { name, variants } => TypeDef::Enum(union_def(name, variants)), 108 Self::Alias { name, target } => TypeDef::Enum(alias_def(name, target)), 109 } 110 } 111 } 112 113 fn object_def(name: &str, fields: &[FieldSpec]) -> StructDef { 114 let mut def = StructDef::new(name, name, source_span()); 115 for field in fields { 116 def = def.with_field(field_def(field)); 117 } 118 def 119 } 120 121 fn register_result_contracts(registry: &mut Registry) { 122 for (name, field_name, field_ty) in [ 123 ( 124 "ReplicaSchemaError", 125 "error", 126 TypeRef::GenericParam("T".to_owned()), 127 ), 128 ( 129 "ReplicaSchemaResult", 130 "result", 131 TypeRef::GenericParam("T".to_owned()), 132 ), 133 ( 134 "ReplicaSchemaResultList", 135 "results", 136 TypeRef::vec(TypeRef::GenericParam("T".to_owned())), 137 ), 138 ] { 139 let mut def = StructDef::new(name, name, source_span()) 140 .with_field(typed_field_def(field_name, field_ty)); 141 def.generics.push(GenericParam::new("T")); 142 let type_id = registry.register_type( 143 RustTypeId::new(env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"), name), 144 TypeDef::Struct(def), 145 ); 146 registry.mark_root(type_id); 147 } 148 149 let type_id = registry.register_type( 150 RustTypeId::new( 151 env!("CARGO_PKG_NAME"), 152 env!("CARGO_PKG_NAME"), 153 "ReplicaSchemaResultPass", 154 ), 155 TypeDef::Struct( 156 StructDef::new( 157 "ReplicaSchemaResultPass", 158 "ReplicaSchemaResultPass", 159 source_span(), 160 ) 161 .with_field(typed_field_def("pass", TypeRef::Primitive(Primitive::Bool))), 162 ), 163 ); 164 registry.mark_root(type_id); 165 } 166 167 fn union_def(name: &str, variants: &[VariantSpec]) -> EnumDef { 168 let mut def = EnumDef::new(name, name, EnumRepr::Untagged, source_span()); 169 for (index, variant) in variants.iter().enumerate() { 170 def = def.with_variant(match variant { 171 VariantSpec::Object(fields) => VariantDef::new( 172 format!("Variant{index}"), 173 format!("variant{index}"), 174 VariantShape::Struct(fields.iter().map(field_def).collect()), 175 source_span(), 176 ), 177 VariantSpec::Ref(target) => VariantDef::new( 178 format!("Variant{index}"), 179 format!("variant{index}"), 180 VariantShape::Newtype(ts_ref(target)), 181 source_span(), 182 ), 183 }); 184 } 185 def 186 } 187 188 fn alias_def(name: &str, target: &str) -> EnumDef { 189 EnumDef::new(name, name, EnumRepr::Untagged, source_span()).with_variant(VariantDef::new( 190 "Alias", 191 "alias", 192 VariantShape::Newtype(ts_ref(target)), 193 source_span(), 194 )) 195 } 196 197 fn field_def(field: &FieldSpec) -> FieldDef { 198 typed_field_def(field.name, ts_ref(field.target)) 199 .with_presence(field_presence(field.optional, field.nullable)) 200 } 201 202 fn typed_field_def(name: &str, ty: TypeRef) -> FieldDef { 203 FieldDef::new( 204 IdentName::new(name), 205 WireFieldNames::same(name), 206 TargetFieldNames::new(name, name), 207 ty, 208 source_span(), 209 ) 210 } 211 212 fn field_presence(optional: bool, nullable: bool) -> FieldPresence { 213 match (optional, nullable) { 214 (false, false) => FieldPresence::required(), 215 (false, true) => FieldPresence::nullable_required(), 216 (true, true) => FieldPresence::optional_nullable(), 217 (true, false) => FieldPresence { 218 nullable: false, 219 required_on_deserialize: false, 220 default: Some(DefaultKind::NoneValue), 221 serialize_presence: SerializePresence::Always, 222 }, 223 } 224 } 225 226 fn ts_ref(target: &str) -> TypeRef { 227 TypeRef::Override(TargetOverride::new(BackendId::TypeScript, target)) 228 } 229 230 fn source_span() -> SourceSpan { 231 SourceSpan::new(file!(), line!(), column!()) 232 } 233 234 const RESULT_CONTRACT_NAMES: &[&str] = &[ 235 "ReplicaSchemaError", 236 "ReplicaSchemaResult", 237 "ReplicaSchemaResultList", 238 "ReplicaSchemaResultPass", 239 ]; 240 241 const TYPE_SPECS: &[TypeSpec] = &[ 242 TypeSpec::Object { 243 name: "Farm", 244 fields: &[ 245 FieldSpec::required("id", "string"), 246 FieldSpec::required("created_at", "string"), 247 FieldSpec::required("updated_at", "string"), 248 FieldSpec::required("d_tag", "string"), 249 FieldSpec::required("pubkey", "string"), 250 FieldSpec::required("name", "string"), 251 FieldSpec::nullable("about", "string"), 252 FieldSpec::nullable("website", "string"), 253 FieldSpec::nullable("picture", "string"), 254 FieldSpec::nullable("banner", "string"), 255 FieldSpec::nullable("location_primary", "string"), 256 FieldSpec::nullable("location_city", "string"), 257 FieldSpec::nullable("location_region", "string"), 258 FieldSpec::nullable("location_country", "string"), 259 ], 260 }, 261 TypeSpec::Object { 262 name: "FarmGcsLocation", 263 fields: &[ 264 FieldSpec::required("id", "string"), 265 FieldSpec::required("created_at", "string"), 266 FieldSpec::required("updated_at", "string"), 267 FieldSpec::required("farm_id", "string"), 268 FieldSpec::required("gcs_location_id", "string"), 269 FieldSpec::required("role", "string"), 270 ], 271 }, 272 TypeSpec::Union { 273 name: "FarmGcsLocationQueryBindValues", 274 variants: &[ 275 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 276 VariantSpec::Object(&[FieldSpec::required("farm_id", "string")]), 277 VariantSpec::Object(&[FieldSpec::required("gcs_location_id", "string")]), 278 ], 279 }, 280 TypeSpec::Object { 281 name: "FarmMember", 282 fields: &[ 283 FieldSpec::required("id", "string"), 284 FieldSpec::required("created_at", "string"), 285 FieldSpec::required("updated_at", "string"), 286 FieldSpec::required("farm_id", "string"), 287 FieldSpec::required("member_pubkey", "string"), 288 FieldSpec::required("role", "string"), 289 ], 290 }, 291 TypeSpec::Object { 292 name: "FarmMemberClaim", 293 fields: &[ 294 FieldSpec::required("id", "string"), 295 FieldSpec::required("created_at", "string"), 296 FieldSpec::required("updated_at", "string"), 297 FieldSpec::required("member_pubkey", "string"), 298 FieldSpec::required("farm_pubkey", "string"), 299 ], 300 }, 301 TypeSpec::Union { 302 name: "FarmMemberClaimQueryBindValues", 303 variants: &[ 304 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 305 VariantSpec::Object(&[FieldSpec::required("member_pubkey", "string")]), 306 VariantSpec::Object(&[FieldSpec::required("farm_pubkey", "string")]), 307 ], 308 }, 309 TypeSpec::Union { 310 name: "FarmMemberQueryBindValues", 311 variants: &[ 312 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 313 VariantSpec::Object(&[FieldSpec::required("farm_id", "string")]), 314 VariantSpec::Object(&[FieldSpec::required("member_pubkey", "string")]), 315 ], 316 }, 317 TypeSpec::Union { 318 name: "FarmQueryBindValues", 319 variants: &[ 320 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 321 VariantSpec::Object(&[FieldSpec::required("d_tag", "string")]), 322 VariantSpec::Object(&[FieldSpec::required("pubkey", "string")]), 323 ], 324 }, 325 TypeSpec::Object { 326 name: "FarmTag", 327 fields: &[ 328 FieldSpec::required("id", "string"), 329 FieldSpec::required("created_at", "string"), 330 FieldSpec::required("updated_at", "string"), 331 FieldSpec::required("farm_id", "string"), 332 FieldSpec::required("tag", "string"), 333 ], 334 }, 335 TypeSpec::Union { 336 name: "FarmTagQueryBindValues", 337 variants: &[ 338 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 339 VariantSpec::Object(&[FieldSpec::required("farm_id", "string")]), 340 VariantSpec::Object(&[FieldSpec::required("tag", "string")]), 341 ], 342 }, 343 TypeSpec::Object { 344 name: "GcsLocation", 345 fields: &[ 346 FieldSpec::required("id", "string"), 347 FieldSpec::required("created_at", "string"), 348 FieldSpec::required("updated_at", "string"), 349 FieldSpec::required("d_tag", "string"), 350 FieldSpec::required("lat", "number"), 351 FieldSpec::required("lng", "number"), 352 FieldSpec::required("geohash", "string"), 353 FieldSpec::required("point", "string"), 354 FieldSpec::required("polygon", "string"), 355 FieldSpec::nullable("accuracy", "number"), 356 FieldSpec::nullable("altitude", "number"), 357 FieldSpec::nullable("tag_0", "string"), 358 FieldSpec::nullable("label", "string"), 359 FieldSpec::nullable("area", "number"), 360 FieldSpec::nullable("elevation", "number"), 361 FieldSpec::nullable("soil", "string"), 362 FieldSpec::nullable("climate", "string"), 363 FieldSpec::nullable("gc_id", "string"), 364 FieldSpec::nullable("gc_name", "string"), 365 FieldSpec::nullable("gc_admin1_id", "string"), 366 FieldSpec::nullable("gc_admin1_name", "string"), 367 FieldSpec::nullable("gc_country_id", "string"), 368 FieldSpec::nullable("gc_country_name", "string"), 369 ], 370 }, 371 TypeSpec::Object { 372 name: "GcsLocationFarmArgs", 373 fields: &[FieldSpec::required("id", "string")], 374 }, 375 TypeSpec::Union { 376 name: "GcsLocationFindManyRel", 377 variants: &[ 378 VariantSpec::Object(&[FieldSpec::required( 379 "on_trade_product", 380 "GcsLocationTradeProductArgs", 381 )]), 382 VariantSpec::Object(&[FieldSpec::required( 383 "off_trade_product", 384 "GcsLocationTradeProductArgs", 385 )]), 386 VariantSpec::Object(&[FieldSpec::required("on_farm", "GcsLocationFarmArgs")]), 387 VariantSpec::Object(&[FieldSpec::required("off_farm", "GcsLocationFarmArgs")]), 388 VariantSpec::Object(&[FieldSpec::required("on_plot", "GcsLocationPlotArgs")]), 389 VariantSpec::Object(&[FieldSpec::required("off_plot", "GcsLocationPlotArgs")]), 390 ], 391 }, 392 TypeSpec::Object { 393 name: "GcsLocationPlotArgs", 394 fields: &[FieldSpec::required("id", "string")], 395 }, 396 TypeSpec::Union { 397 name: "GcsLocationQueryBindValues", 398 variants: &[ 399 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 400 VariantSpec::Object(&[FieldSpec::required("d_tag", "string")]), 401 VariantSpec::Object(&[FieldSpec::required("geohash", "string")]), 402 ], 403 }, 404 TypeSpec::Object { 405 name: "GcsLocationTradeProductArgs", 406 fields: &[FieldSpec::required("id", "string")], 407 }, 408 TypeSpec::Alias { 409 name: "IFarmCreate", 410 target: "IFarmFields", 411 }, 412 TypeSpec::Alias { 413 name: "IFarmCreateResolve", 414 target: "ReplicaSchemaResult<Farm>", 415 }, 416 TypeSpec::Alias { 417 name: "IFarmDelete", 418 target: "IFarmFindOne", 419 }, 420 TypeSpec::Alias { 421 name: "IFarmDeleteResolve", 422 target: "ReplicaSchemaResult<string>", 423 }, 424 TypeSpec::Object { 425 name: "IFarmFields", 426 fields: &[ 427 FieldSpec::required("d_tag", "string"), 428 FieldSpec::required("pubkey", "string"), 429 FieldSpec::required("name", "string"), 430 FieldSpec::optional_nullable("about", "string"), 431 FieldSpec::optional_nullable("website", "string"), 432 FieldSpec::optional_nullable("picture", "string"), 433 FieldSpec::optional_nullable("banner", "string"), 434 FieldSpec::optional_nullable("location_primary", "string"), 435 FieldSpec::optional_nullable("location_city", "string"), 436 FieldSpec::optional_nullable("location_region", "string"), 437 FieldSpec::optional_nullable("location_country", "string"), 438 ], 439 }, 440 TypeSpec::Object { 441 name: "IFarmFieldsFilter", 442 fields: &[ 443 FieldSpec::optional("id", "string"), 444 FieldSpec::optional("created_at", "string"), 445 FieldSpec::optional("updated_at", "string"), 446 FieldSpec::optional("d_tag", "string"), 447 FieldSpec::optional("pubkey", "string"), 448 FieldSpec::optional("name", "string"), 449 FieldSpec::optional("about", "string"), 450 FieldSpec::optional("website", "string"), 451 FieldSpec::optional("picture", "string"), 452 FieldSpec::optional("banner", "string"), 453 FieldSpec::optional("location_primary", "string"), 454 FieldSpec::optional("location_city", "string"), 455 FieldSpec::optional("location_region", "string"), 456 FieldSpec::optional("location_country", "string"), 457 ], 458 }, 459 TypeSpec::Object { 460 name: "IFarmFieldsPartial", 461 fields: &[ 462 FieldSpec::optional_nullable("d_tag", "ReplicaStoreJsonValue"), 463 FieldSpec::optional_nullable("pubkey", "ReplicaStoreJsonValue"), 464 FieldSpec::optional_nullable("name", "ReplicaStoreJsonValue"), 465 FieldSpec::optional_nullable("about", "ReplicaStoreJsonValue"), 466 FieldSpec::optional_nullable("website", "ReplicaStoreJsonValue"), 467 FieldSpec::optional_nullable("picture", "ReplicaStoreJsonValue"), 468 FieldSpec::optional_nullable("banner", "ReplicaStoreJsonValue"), 469 FieldSpec::optional_nullable("location_primary", "ReplicaStoreJsonValue"), 470 FieldSpec::optional_nullable("location_city", "ReplicaStoreJsonValue"), 471 FieldSpec::optional_nullable("location_region", "ReplicaStoreJsonValue"), 472 FieldSpec::optional_nullable("location_country", "ReplicaStoreJsonValue"), 473 ], 474 }, 475 TypeSpec::Alias { 476 name: "IFarmFindMany", 477 target: "IFarmFindManyArgs", 478 }, 479 TypeSpec::Object { 480 name: "IFarmFindManyArgs", 481 fields: &[FieldSpec::nullable("filter", "IFarmFieldsFilter")], 482 }, 483 TypeSpec::Alias { 484 name: "IFarmFindManyResolve", 485 target: "ReplicaSchemaResultList<Farm>", 486 }, 487 TypeSpec::Union { 488 name: "IFarmFindOne", 489 variants: &[VariantSpec::Ref("IFarmFindOneArgs")], 490 }, 491 TypeSpec::Object { 492 name: "IFarmFindOneArgs", 493 fields: &[FieldSpec::required("on", "FarmQueryBindValues")], 494 }, 495 TypeSpec::Alias { 496 name: "IFarmFindOneResolve", 497 target: "ReplicaSchemaResult<Farm | null>", 498 }, 499 TypeSpec::Alias { 500 name: "IFarmGcsLocationCreate", 501 target: "IFarmGcsLocationFields", 502 }, 503 TypeSpec::Alias { 504 name: "IFarmGcsLocationCreateResolve", 505 target: "ReplicaSchemaResult<FarmGcsLocation>", 506 }, 507 TypeSpec::Alias { 508 name: "IFarmGcsLocationDelete", 509 target: "IFarmGcsLocationFindOne", 510 }, 511 TypeSpec::Alias { 512 name: "IFarmGcsLocationDeleteResolve", 513 target: "ReplicaSchemaResult<string>", 514 }, 515 TypeSpec::Object { 516 name: "IFarmGcsLocationFields", 517 fields: &[ 518 FieldSpec::required("farm_id", "string"), 519 FieldSpec::required("gcs_location_id", "string"), 520 FieldSpec::required("role", "string"), 521 ], 522 }, 523 TypeSpec::Object { 524 name: "IFarmGcsLocationFieldsFilter", 525 fields: &[ 526 FieldSpec::optional("id", "string"), 527 FieldSpec::optional("created_at", "string"), 528 FieldSpec::optional("updated_at", "string"), 529 FieldSpec::optional("farm_id", "string"), 530 FieldSpec::optional("gcs_location_id", "string"), 531 FieldSpec::optional("role", "string"), 532 ], 533 }, 534 TypeSpec::Object { 535 name: "IFarmGcsLocationFieldsPartial", 536 fields: &[ 537 FieldSpec::optional_nullable("farm_id", "ReplicaStoreJsonValue"), 538 FieldSpec::optional_nullable("gcs_location_id", "ReplicaStoreJsonValue"), 539 FieldSpec::optional_nullable("role", "ReplicaStoreJsonValue"), 540 ], 541 }, 542 TypeSpec::Alias { 543 name: "IFarmGcsLocationFindMany", 544 target: "IFarmGcsLocationFindManyArgs", 545 }, 546 TypeSpec::Object { 547 name: "IFarmGcsLocationFindManyArgs", 548 fields: &[FieldSpec::nullable( 549 "filter", 550 "IFarmGcsLocationFieldsFilter", 551 )], 552 }, 553 TypeSpec::Alias { 554 name: "IFarmGcsLocationFindManyResolve", 555 target: "ReplicaSchemaResultList<FarmGcsLocation>", 556 }, 557 TypeSpec::Union { 558 name: "IFarmGcsLocationFindOne", 559 variants: &[VariantSpec::Ref("IFarmGcsLocationFindOneArgs")], 560 }, 561 TypeSpec::Object { 562 name: "IFarmGcsLocationFindOneArgs", 563 fields: &[FieldSpec::required("on", "FarmGcsLocationQueryBindValues")], 564 }, 565 TypeSpec::Alias { 566 name: "IFarmGcsLocationFindOneResolve", 567 target: "ReplicaSchemaResult<FarmGcsLocation | null>", 568 }, 569 TypeSpec::Alias { 570 name: "IFarmGcsLocationUpdate", 571 target: "IFarmGcsLocationUpdateArgs", 572 }, 573 TypeSpec::Object { 574 name: "IFarmGcsLocationUpdateArgs", 575 fields: &[ 576 FieldSpec::required("on", "FarmGcsLocationQueryBindValues"), 577 FieldSpec::required("fields", "IFarmGcsLocationFieldsPartial"), 578 ], 579 }, 580 TypeSpec::Alias { 581 name: "IFarmGcsLocationUpdateResolve", 582 target: "ReplicaSchemaResult<FarmGcsLocation>", 583 }, 584 TypeSpec::Alias { 585 name: "IFarmMemberClaimCreate", 586 target: "IFarmMemberClaimFields", 587 }, 588 TypeSpec::Alias { 589 name: "IFarmMemberClaimCreateResolve", 590 target: "ReplicaSchemaResult<FarmMemberClaim>", 591 }, 592 TypeSpec::Alias { 593 name: "IFarmMemberClaimDelete", 594 target: "IFarmMemberClaimFindOne", 595 }, 596 TypeSpec::Alias { 597 name: "IFarmMemberClaimDeleteResolve", 598 target: "ReplicaSchemaResult<string>", 599 }, 600 TypeSpec::Object { 601 name: "IFarmMemberClaimFields", 602 fields: &[ 603 FieldSpec::required("member_pubkey", "string"), 604 FieldSpec::required("farm_pubkey", "string"), 605 ], 606 }, 607 TypeSpec::Object { 608 name: "IFarmMemberClaimFieldsFilter", 609 fields: &[ 610 FieldSpec::optional("id", "string"), 611 FieldSpec::optional("created_at", "string"), 612 FieldSpec::optional("updated_at", "string"), 613 FieldSpec::optional("member_pubkey", "string"), 614 FieldSpec::optional("farm_pubkey", "string"), 615 ], 616 }, 617 TypeSpec::Object { 618 name: "IFarmMemberClaimFieldsPartial", 619 fields: &[ 620 FieldSpec::optional_nullable("member_pubkey", "ReplicaStoreJsonValue"), 621 FieldSpec::optional_nullable("farm_pubkey", "ReplicaStoreJsonValue"), 622 ], 623 }, 624 TypeSpec::Alias { 625 name: "IFarmMemberClaimFindMany", 626 target: "IFarmMemberClaimFindManyArgs", 627 }, 628 TypeSpec::Object { 629 name: "IFarmMemberClaimFindManyArgs", 630 fields: &[FieldSpec::nullable( 631 "filter", 632 "IFarmMemberClaimFieldsFilter", 633 )], 634 }, 635 TypeSpec::Alias { 636 name: "IFarmMemberClaimFindManyResolve", 637 target: "ReplicaSchemaResultList<FarmMemberClaim>", 638 }, 639 TypeSpec::Union { 640 name: "IFarmMemberClaimFindOne", 641 variants: &[VariantSpec::Ref("IFarmMemberClaimFindOneArgs")], 642 }, 643 TypeSpec::Object { 644 name: "IFarmMemberClaimFindOneArgs", 645 fields: &[FieldSpec::required("on", "FarmMemberClaimQueryBindValues")], 646 }, 647 TypeSpec::Alias { 648 name: "IFarmMemberClaimFindOneResolve", 649 target: "ReplicaSchemaResult<FarmMemberClaim | null>", 650 }, 651 TypeSpec::Alias { 652 name: "IFarmMemberClaimUpdate", 653 target: "IFarmMemberClaimUpdateArgs", 654 }, 655 TypeSpec::Object { 656 name: "IFarmMemberClaimUpdateArgs", 657 fields: &[ 658 FieldSpec::required("on", "FarmMemberClaimQueryBindValues"), 659 FieldSpec::required("fields", "IFarmMemberClaimFieldsPartial"), 660 ], 661 }, 662 TypeSpec::Alias { 663 name: "IFarmMemberClaimUpdateResolve", 664 target: "ReplicaSchemaResult<FarmMemberClaim>", 665 }, 666 TypeSpec::Alias { 667 name: "IFarmMemberCreate", 668 target: "IFarmMemberFields", 669 }, 670 TypeSpec::Alias { 671 name: "IFarmMemberCreateResolve", 672 target: "ReplicaSchemaResult<FarmMember>", 673 }, 674 TypeSpec::Alias { 675 name: "IFarmMemberDelete", 676 target: "IFarmMemberFindOne", 677 }, 678 TypeSpec::Alias { 679 name: "IFarmMemberDeleteResolve", 680 target: "ReplicaSchemaResult<string>", 681 }, 682 TypeSpec::Object { 683 name: "IFarmMemberFields", 684 fields: &[ 685 FieldSpec::required("farm_id", "string"), 686 FieldSpec::required("member_pubkey", "string"), 687 FieldSpec::required("role", "string"), 688 ], 689 }, 690 TypeSpec::Object { 691 name: "IFarmMemberFieldsFilter", 692 fields: &[ 693 FieldSpec::optional("id", "string"), 694 FieldSpec::optional("created_at", "string"), 695 FieldSpec::optional("updated_at", "string"), 696 FieldSpec::optional("farm_id", "string"), 697 FieldSpec::optional("member_pubkey", "string"), 698 FieldSpec::optional("role", "string"), 699 ], 700 }, 701 TypeSpec::Object { 702 name: "IFarmMemberFieldsPartial", 703 fields: &[ 704 FieldSpec::optional_nullable("farm_id", "ReplicaStoreJsonValue"), 705 FieldSpec::optional_nullable("member_pubkey", "ReplicaStoreJsonValue"), 706 FieldSpec::optional_nullable("role", "ReplicaStoreJsonValue"), 707 ], 708 }, 709 TypeSpec::Alias { 710 name: "IFarmMemberFindMany", 711 target: "IFarmMemberFindManyArgs", 712 }, 713 TypeSpec::Object { 714 name: "IFarmMemberFindManyArgs", 715 fields: &[FieldSpec::nullable("filter", "IFarmMemberFieldsFilter")], 716 }, 717 TypeSpec::Alias { 718 name: "IFarmMemberFindManyResolve", 719 target: "ReplicaSchemaResultList<FarmMember>", 720 }, 721 TypeSpec::Union { 722 name: "IFarmMemberFindOne", 723 variants: &[VariantSpec::Ref("IFarmMemberFindOneArgs")], 724 }, 725 TypeSpec::Object { 726 name: "IFarmMemberFindOneArgs", 727 fields: &[FieldSpec::required("on", "FarmMemberQueryBindValues")], 728 }, 729 TypeSpec::Alias { 730 name: "IFarmMemberFindOneResolve", 731 target: "ReplicaSchemaResult<FarmMember | null>", 732 }, 733 TypeSpec::Alias { 734 name: "IFarmMemberUpdate", 735 target: "IFarmMemberUpdateArgs", 736 }, 737 TypeSpec::Object { 738 name: "IFarmMemberUpdateArgs", 739 fields: &[ 740 FieldSpec::required("on", "FarmMemberQueryBindValues"), 741 FieldSpec::required("fields", "IFarmMemberFieldsPartial"), 742 ], 743 }, 744 TypeSpec::Alias { 745 name: "IFarmMemberUpdateResolve", 746 target: "ReplicaSchemaResult<FarmMember>", 747 }, 748 TypeSpec::Alias { 749 name: "IFarmTagCreate", 750 target: "IFarmTagFields", 751 }, 752 TypeSpec::Alias { 753 name: "IFarmTagCreateResolve", 754 target: "ReplicaSchemaResult<FarmTag>", 755 }, 756 TypeSpec::Alias { 757 name: "IFarmTagDelete", 758 target: "IFarmTagFindOne", 759 }, 760 TypeSpec::Alias { 761 name: "IFarmTagDeleteResolve", 762 target: "ReplicaSchemaResult<string>", 763 }, 764 TypeSpec::Object { 765 name: "IFarmTagFields", 766 fields: &[ 767 FieldSpec::required("farm_id", "string"), 768 FieldSpec::required("tag", "string"), 769 ], 770 }, 771 TypeSpec::Object { 772 name: "IFarmTagFieldsFilter", 773 fields: &[ 774 FieldSpec::optional("id", "string"), 775 FieldSpec::optional("created_at", "string"), 776 FieldSpec::optional("updated_at", "string"), 777 FieldSpec::optional("farm_id", "string"), 778 FieldSpec::optional("tag", "string"), 779 ], 780 }, 781 TypeSpec::Object { 782 name: "IFarmTagFieldsPartial", 783 fields: &[ 784 FieldSpec::optional_nullable("farm_id", "ReplicaStoreJsonValue"), 785 FieldSpec::optional_nullable("tag", "ReplicaStoreJsonValue"), 786 ], 787 }, 788 TypeSpec::Alias { 789 name: "IFarmTagFindMany", 790 target: "IFarmTagFindManyArgs", 791 }, 792 TypeSpec::Object { 793 name: "IFarmTagFindManyArgs", 794 fields: &[FieldSpec::nullable("filter", "IFarmTagFieldsFilter")], 795 }, 796 TypeSpec::Alias { 797 name: "IFarmTagFindManyResolve", 798 target: "ReplicaSchemaResultList<FarmTag>", 799 }, 800 TypeSpec::Union { 801 name: "IFarmTagFindOne", 802 variants: &[VariantSpec::Ref("IFarmTagFindOneArgs")], 803 }, 804 TypeSpec::Object { 805 name: "IFarmTagFindOneArgs", 806 fields: &[FieldSpec::required("on", "FarmTagQueryBindValues")], 807 }, 808 TypeSpec::Alias { 809 name: "IFarmTagFindOneResolve", 810 target: "ReplicaSchemaResult<FarmTag | null>", 811 }, 812 TypeSpec::Alias { 813 name: "IFarmTagUpdate", 814 target: "IFarmTagUpdateArgs", 815 }, 816 TypeSpec::Object { 817 name: "IFarmTagUpdateArgs", 818 fields: &[ 819 FieldSpec::required("on", "FarmTagQueryBindValues"), 820 FieldSpec::required("fields", "IFarmTagFieldsPartial"), 821 ], 822 }, 823 TypeSpec::Alias { 824 name: "IFarmTagUpdateResolve", 825 target: "ReplicaSchemaResult<FarmTag>", 826 }, 827 TypeSpec::Alias { 828 name: "IFarmUpdate", 829 target: "IFarmUpdateArgs", 830 }, 831 TypeSpec::Object { 832 name: "IFarmUpdateArgs", 833 fields: &[ 834 FieldSpec::required("on", "FarmQueryBindValues"), 835 FieldSpec::required("fields", "IFarmFieldsPartial"), 836 ], 837 }, 838 TypeSpec::Alias { 839 name: "IFarmUpdateResolve", 840 target: "ReplicaSchemaResult<Farm>", 841 }, 842 TypeSpec::Alias { 843 name: "IGcsLocationCreate", 844 target: "IGcsLocationFields", 845 }, 846 TypeSpec::Alias { 847 name: "IGcsLocationCreateResolve", 848 target: "ReplicaSchemaResult<GcsLocation>", 849 }, 850 TypeSpec::Alias { 851 name: "IGcsLocationDelete", 852 target: "IGcsLocationFindOne", 853 }, 854 TypeSpec::Alias { 855 name: "IGcsLocationDeleteResolve", 856 target: "ReplicaSchemaResult<string>", 857 }, 858 TypeSpec::Object { 859 name: "IGcsLocationFields", 860 fields: &[ 861 FieldSpec::required("d_tag", "string"), 862 FieldSpec::required("lat", "number"), 863 FieldSpec::required("lng", "number"), 864 FieldSpec::required("geohash", "string"), 865 FieldSpec::required("point", "string"), 866 FieldSpec::required("polygon", "string"), 867 FieldSpec::optional_nullable("accuracy", "number"), 868 FieldSpec::optional_nullable("altitude", "number"), 869 FieldSpec::optional_nullable("tag_0", "string"), 870 FieldSpec::optional_nullable("label", "string"), 871 FieldSpec::optional_nullable("area", "number"), 872 FieldSpec::optional_nullable("elevation", "number"), 873 FieldSpec::optional_nullable("soil", "string"), 874 FieldSpec::optional_nullable("climate", "string"), 875 FieldSpec::optional_nullable("gc_id", "string"), 876 FieldSpec::optional_nullable("gc_name", "string"), 877 FieldSpec::optional_nullable("gc_admin1_id", "string"), 878 FieldSpec::optional_nullable("gc_admin1_name", "string"), 879 FieldSpec::optional_nullable("gc_country_id", "string"), 880 FieldSpec::optional_nullable("gc_country_name", "string"), 881 ], 882 }, 883 TypeSpec::Object { 884 name: "IGcsLocationFieldsFilter", 885 fields: &[ 886 FieldSpec::optional("id", "string"), 887 FieldSpec::optional("created_at", "string"), 888 FieldSpec::optional("updated_at", "string"), 889 FieldSpec::optional("d_tag", "string"), 890 FieldSpec::optional("lat", "number"), 891 FieldSpec::optional("lng", "number"), 892 FieldSpec::optional("geohash", "string"), 893 FieldSpec::optional("point", "string"), 894 FieldSpec::optional("polygon", "string"), 895 FieldSpec::optional("accuracy", "number"), 896 FieldSpec::optional("altitude", "number"), 897 FieldSpec::optional("tag_0", "string"), 898 FieldSpec::optional("label", "string"), 899 FieldSpec::optional("area", "number"), 900 FieldSpec::optional("elevation", "number"), 901 FieldSpec::optional("soil", "string"), 902 FieldSpec::optional("climate", "string"), 903 FieldSpec::optional("gc_id", "string"), 904 FieldSpec::optional("gc_name", "string"), 905 FieldSpec::optional("gc_admin1_id", "string"), 906 FieldSpec::optional("gc_admin1_name", "string"), 907 FieldSpec::optional("gc_country_id", "string"), 908 FieldSpec::optional("gc_country_name", "string"), 909 ], 910 }, 911 TypeSpec::Object { 912 name: "IGcsLocationFieldsPartial", 913 fields: &[ 914 FieldSpec::optional_nullable("d_tag", "ReplicaStoreJsonValue"), 915 FieldSpec::optional_nullable("lat", "ReplicaStoreJsonValue"), 916 FieldSpec::optional_nullable("lng", "ReplicaStoreJsonValue"), 917 FieldSpec::optional_nullable("geohash", "ReplicaStoreJsonValue"), 918 FieldSpec::optional_nullable("point", "ReplicaStoreJsonValue"), 919 FieldSpec::optional_nullable("polygon", "ReplicaStoreJsonValue"), 920 FieldSpec::optional_nullable("accuracy", "ReplicaStoreJsonValue"), 921 FieldSpec::optional_nullable("altitude", "ReplicaStoreJsonValue"), 922 FieldSpec::optional_nullable("tag_0", "ReplicaStoreJsonValue"), 923 FieldSpec::optional_nullable("label", "ReplicaStoreJsonValue"), 924 FieldSpec::optional_nullable("area", "ReplicaStoreJsonValue"), 925 FieldSpec::optional_nullable("elevation", "ReplicaStoreJsonValue"), 926 FieldSpec::optional_nullable("soil", "ReplicaStoreJsonValue"), 927 FieldSpec::optional_nullable("climate", "ReplicaStoreJsonValue"), 928 FieldSpec::optional_nullable("gc_id", "ReplicaStoreJsonValue"), 929 FieldSpec::optional_nullable("gc_name", "ReplicaStoreJsonValue"), 930 FieldSpec::optional_nullable("gc_admin1_id", "ReplicaStoreJsonValue"), 931 FieldSpec::optional_nullable("gc_admin1_name", "ReplicaStoreJsonValue"), 932 FieldSpec::optional_nullable("gc_country_id", "ReplicaStoreJsonValue"), 933 FieldSpec::optional_nullable("gc_country_name", "ReplicaStoreJsonValue"), 934 ], 935 }, 936 TypeSpec::Union { 937 name: "IGcsLocationFindMany", 938 variants: &[ 939 VariantSpec::Object(&[FieldSpec::nullable("filter", "IGcsLocationFieldsFilter")]), 940 VariantSpec::Object(&[FieldSpec::required("rel", "GcsLocationFindManyRel")]), 941 ], 942 }, 943 TypeSpec::Alias { 944 name: "IGcsLocationFindManyResolve", 945 target: "ReplicaSchemaResultList<GcsLocation>", 946 }, 947 TypeSpec::Union { 948 name: "IGcsLocationFindOne", 949 variants: &[ 950 VariantSpec::Ref("IGcsLocationFindOneArgs"), 951 VariantSpec::Ref("IGcsLocationFindOneRelArgs"), 952 ], 953 }, 954 TypeSpec::Object { 955 name: "IGcsLocationFindOneArgs", 956 fields: &[FieldSpec::required("on", "GcsLocationQueryBindValues")], 957 }, 958 TypeSpec::Object { 959 name: "IGcsLocationFindOneRelArgs", 960 fields: &[FieldSpec::required("rel", "GcsLocationFindManyRel")], 961 }, 962 TypeSpec::Alias { 963 name: "IGcsLocationFindOneResolve", 964 target: "ReplicaSchemaResult<GcsLocation | null>", 965 }, 966 TypeSpec::Alias { 967 name: "IGcsLocationUpdate", 968 target: "IGcsLocationUpdateArgs", 969 }, 970 TypeSpec::Object { 971 name: "IGcsLocationUpdateArgs", 972 fields: &[ 973 FieldSpec::required("on", "GcsLocationQueryBindValues"), 974 FieldSpec::required("fields", "IGcsLocationFieldsPartial"), 975 ], 976 }, 977 TypeSpec::Alias { 978 name: "IGcsLocationUpdateResolve", 979 target: "ReplicaSchemaResult<GcsLocation>", 980 }, 981 TypeSpec::Alias { 982 name: "ILogErrorCreate", 983 target: "ILogErrorFields", 984 }, 985 TypeSpec::Alias { 986 name: "ILogErrorCreateResolve", 987 target: "ReplicaSchemaResult<LogError>", 988 }, 989 TypeSpec::Alias { 990 name: "ILogErrorDelete", 991 target: "ILogErrorFindOne", 992 }, 993 TypeSpec::Alias { 994 name: "ILogErrorDeleteResolve", 995 target: "ReplicaSchemaResult<string>", 996 }, 997 TypeSpec::Object { 998 name: "ILogErrorFields", 999 fields: &[ 1000 FieldSpec::required("error", "string"), 1001 FieldSpec::required("message", "string"), 1002 FieldSpec::optional_nullable("stack_trace", "string"), 1003 FieldSpec::optional_nullable("cause", "string"), 1004 FieldSpec::required("app_system", "string"), 1005 FieldSpec::required("app_version", "string"), 1006 FieldSpec::required("nostr_pubkey", "string"), 1007 FieldSpec::optional_nullable("data", "string"), 1008 ], 1009 }, 1010 TypeSpec::Object { 1011 name: "ILogErrorFieldsFilter", 1012 fields: &[ 1013 FieldSpec::optional("id", "string"), 1014 FieldSpec::optional("created_at", "string"), 1015 FieldSpec::optional("updated_at", "string"), 1016 FieldSpec::optional("error", "string"), 1017 FieldSpec::optional("message", "string"), 1018 FieldSpec::optional("stack_trace", "string"), 1019 FieldSpec::optional("cause", "string"), 1020 FieldSpec::optional("app_system", "string"), 1021 FieldSpec::optional("app_version", "string"), 1022 FieldSpec::optional("nostr_pubkey", "string"), 1023 FieldSpec::optional("data", "string"), 1024 ], 1025 }, 1026 TypeSpec::Object { 1027 name: "ILogErrorFieldsPartial", 1028 fields: &[ 1029 FieldSpec::optional_nullable("error", "ReplicaStoreJsonValue"), 1030 FieldSpec::optional_nullable("message", "ReplicaStoreJsonValue"), 1031 FieldSpec::optional_nullable("stack_trace", "ReplicaStoreJsonValue"), 1032 FieldSpec::optional_nullable("cause", "ReplicaStoreJsonValue"), 1033 FieldSpec::optional_nullable("app_system", "ReplicaStoreJsonValue"), 1034 FieldSpec::optional_nullable("app_version", "ReplicaStoreJsonValue"), 1035 FieldSpec::optional_nullable("nostr_pubkey", "ReplicaStoreJsonValue"), 1036 FieldSpec::optional_nullable("data", "ReplicaStoreJsonValue"), 1037 ], 1038 }, 1039 TypeSpec::Alias { 1040 name: "ILogErrorFindMany", 1041 target: "ILogErrorFindManyArgs", 1042 }, 1043 TypeSpec::Object { 1044 name: "ILogErrorFindManyArgs", 1045 fields: &[FieldSpec::nullable("filter", "ILogErrorFieldsFilter")], 1046 }, 1047 TypeSpec::Alias { 1048 name: "ILogErrorFindManyResolve", 1049 target: "ReplicaSchemaResultList<LogError>", 1050 }, 1051 TypeSpec::Union { 1052 name: "ILogErrorFindOne", 1053 variants: &[VariantSpec::Ref("ILogErrorFindOneArgs")], 1054 }, 1055 TypeSpec::Object { 1056 name: "ILogErrorFindOneArgs", 1057 fields: &[FieldSpec::required("on", "LogErrorQueryBindValues")], 1058 }, 1059 TypeSpec::Alias { 1060 name: "ILogErrorFindOneResolve", 1061 target: "ReplicaSchemaResult<LogError | null>", 1062 }, 1063 TypeSpec::Alias { 1064 name: "ILogErrorUpdate", 1065 target: "ILogErrorUpdateArgs", 1066 }, 1067 TypeSpec::Object { 1068 name: "ILogErrorUpdateArgs", 1069 fields: &[ 1070 FieldSpec::required("on", "LogErrorQueryBindValues"), 1071 FieldSpec::required("fields", "ILogErrorFieldsPartial"), 1072 ], 1073 }, 1074 TypeSpec::Alias { 1075 name: "ILogErrorUpdateResolve", 1076 target: "ReplicaSchemaResult<LogError>", 1077 }, 1078 TypeSpec::Alias { 1079 name: "IMediaImageCreate", 1080 target: "IMediaImageFields", 1081 }, 1082 TypeSpec::Alias { 1083 name: "IMediaImageCreateResolve", 1084 target: "ReplicaSchemaResult<MediaImage>", 1085 }, 1086 TypeSpec::Alias { 1087 name: "IMediaImageDelete", 1088 target: "IMediaImageFindOne", 1089 }, 1090 TypeSpec::Alias { 1091 name: "IMediaImageDeleteResolve", 1092 target: "ReplicaSchemaResult<string>", 1093 }, 1094 TypeSpec::Object { 1095 name: "IMediaImageFields", 1096 fields: &[ 1097 FieldSpec::required("file_path", "string"), 1098 FieldSpec::required("mime_type", "string"), 1099 FieldSpec::required("res_base", "string"), 1100 FieldSpec::required("res_path", "string"), 1101 FieldSpec::optional_nullable("label", "string"), 1102 FieldSpec::optional_nullable("description", "string"), 1103 ], 1104 }, 1105 TypeSpec::Object { 1106 name: "IMediaImageFieldsFilter", 1107 fields: &[ 1108 FieldSpec::optional("id", "string"), 1109 FieldSpec::optional("created_at", "string"), 1110 FieldSpec::optional("updated_at", "string"), 1111 FieldSpec::optional("file_path", "string"), 1112 FieldSpec::optional("mime_type", "string"), 1113 FieldSpec::optional("res_base", "string"), 1114 FieldSpec::optional("res_path", "string"), 1115 FieldSpec::optional("label", "string"), 1116 FieldSpec::optional("description", "string"), 1117 ], 1118 }, 1119 TypeSpec::Object { 1120 name: "IMediaImageFieldsPartial", 1121 fields: &[ 1122 FieldSpec::optional_nullable("file_path", "ReplicaStoreJsonValue"), 1123 FieldSpec::optional_nullable("mime_type", "ReplicaStoreJsonValue"), 1124 FieldSpec::optional_nullable("res_base", "ReplicaStoreJsonValue"), 1125 FieldSpec::optional_nullable("res_path", "ReplicaStoreJsonValue"), 1126 FieldSpec::optional_nullable("label", "ReplicaStoreJsonValue"), 1127 FieldSpec::optional_nullable("description", "ReplicaStoreJsonValue"), 1128 ], 1129 }, 1130 TypeSpec::Union { 1131 name: "IMediaImageFindMany", 1132 variants: &[ 1133 VariantSpec::Object(&[FieldSpec::nullable("filter", "IMediaImageFieldsFilter")]), 1134 VariantSpec::Object(&[FieldSpec::required("rel", "MediaImageFindManyRel")]), 1135 ], 1136 }, 1137 TypeSpec::Alias { 1138 name: "IMediaImageFindManyResolve", 1139 target: "ReplicaSchemaResultList<MediaImage>", 1140 }, 1141 TypeSpec::Union { 1142 name: "IMediaImageFindOne", 1143 variants: &[ 1144 VariantSpec::Ref("IMediaImageFindOneArgs"), 1145 VariantSpec::Ref("IMediaImageFindOneRelArgs"), 1146 ], 1147 }, 1148 TypeSpec::Object { 1149 name: "IMediaImageFindOneArgs", 1150 fields: &[FieldSpec::required("on", "MediaImageQueryBindValues")], 1151 }, 1152 TypeSpec::Object { 1153 name: "IMediaImageFindOneRelArgs", 1154 fields: &[FieldSpec::required("rel", "MediaImageFindManyRel")], 1155 }, 1156 TypeSpec::Alias { 1157 name: "IMediaImageFindOneResolve", 1158 target: "ReplicaSchemaResult<MediaImage | null>", 1159 }, 1160 TypeSpec::Alias { 1161 name: "IMediaImageUpdate", 1162 target: "IMediaImageUpdateArgs", 1163 }, 1164 TypeSpec::Object { 1165 name: "IMediaImageUpdateArgs", 1166 fields: &[ 1167 FieldSpec::required("on", "MediaImageQueryBindValues"), 1168 FieldSpec::required("fields", "IMediaImageFieldsPartial"), 1169 ], 1170 }, 1171 TypeSpec::Alias { 1172 name: "IMediaImageUpdateResolve", 1173 target: "ReplicaSchemaResult<MediaImage>", 1174 }, 1175 TypeSpec::Alias { 1176 name: "INostrEventHeadCreate", 1177 target: "INostrEventHeadFields", 1178 }, 1179 TypeSpec::Alias { 1180 name: "INostrEventHeadCreateResolve", 1181 target: "ReplicaSchemaResult<NostrEventHead>", 1182 }, 1183 TypeSpec::Alias { 1184 name: "INostrEventHeadDelete", 1185 target: "INostrEventHeadFindOne", 1186 }, 1187 TypeSpec::Alias { 1188 name: "INostrEventHeadDeleteResolve", 1189 target: "ReplicaSchemaResult<string>", 1190 }, 1191 TypeSpec::Object { 1192 name: "INostrEventHeadFields", 1193 fields: &[ 1194 FieldSpec::required("key", "string"), 1195 FieldSpec::required("kind", "number"), 1196 FieldSpec::required("pubkey", "string"), 1197 FieldSpec::required("d_tag", "string"), 1198 FieldSpec::required("last_event_id", "string"), 1199 FieldSpec::required("last_created_at", "number"), 1200 FieldSpec::required("content_hash", "string"), 1201 ], 1202 }, 1203 TypeSpec::Object { 1204 name: "INostrEventHeadFieldsFilter", 1205 fields: &[ 1206 FieldSpec::optional("id", "string"), 1207 FieldSpec::optional("created_at", "string"), 1208 FieldSpec::optional("updated_at", "string"), 1209 FieldSpec::optional("key", "string"), 1210 FieldSpec::optional("kind", "number"), 1211 FieldSpec::optional("pubkey", "string"), 1212 FieldSpec::optional("d_tag", "string"), 1213 FieldSpec::optional("last_event_id", "string"), 1214 FieldSpec::optional("last_created_at", "number"), 1215 FieldSpec::optional("content_hash", "string"), 1216 ], 1217 }, 1218 TypeSpec::Object { 1219 name: "INostrEventHeadFieldsPartial", 1220 fields: &[ 1221 FieldSpec::optional_nullable("key", "ReplicaStoreJsonValue"), 1222 FieldSpec::optional_nullable("kind", "ReplicaStoreJsonValue"), 1223 FieldSpec::optional_nullable("pubkey", "ReplicaStoreJsonValue"), 1224 FieldSpec::optional_nullable("d_tag", "ReplicaStoreJsonValue"), 1225 FieldSpec::optional_nullable("last_event_id", "ReplicaStoreJsonValue"), 1226 FieldSpec::optional_nullable("last_created_at", "ReplicaStoreJsonValue"), 1227 FieldSpec::optional_nullable("content_hash", "ReplicaStoreJsonValue"), 1228 ], 1229 }, 1230 TypeSpec::Alias { 1231 name: "INostrEventHeadFindMany", 1232 target: "INostrEventHeadFindManyArgs", 1233 }, 1234 TypeSpec::Object { 1235 name: "INostrEventHeadFindManyArgs", 1236 fields: &[FieldSpec::nullable("filter", "INostrEventHeadFieldsFilter")], 1237 }, 1238 TypeSpec::Alias { 1239 name: "INostrEventHeadFindManyResolve", 1240 target: "ReplicaSchemaResultList<NostrEventHead>", 1241 }, 1242 TypeSpec::Union { 1243 name: "INostrEventHeadFindOne", 1244 variants: &[VariantSpec::Ref("INostrEventHeadFindOneArgs")], 1245 }, 1246 TypeSpec::Object { 1247 name: "INostrEventHeadFindOneArgs", 1248 fields: &[FieldSpec::required("on", "NostrEventHeadQueryBindValues")], 1249 }, 1250 TypeSpec::Alias { 1251 name: "INostrEventHeadFindOneResolve", 1252 target: "ReplicaSchemaResult<NostrEventHead | null>", 1253 }, 1254 TypeSpec::Alias { 1255 name: "INostrEventHeadUpdate", 1256 target: "INostrEventHeadUpdateArgs", 1257 }, 1258 TypeSpec::Object { 1259 name: "INostrEventHeadUpdateArgs", 1260 fields: &[ 1261 FieldSpec::required("on", "NostrEventHeadQueryBindValues"), 1262 FieldSpec::required("fields", "INostrEventHeadFieldsPartial"), 1263 ], 1264 }, 1265 TypeSpec::Alias { 1266 name: "INostrEventHeadUpdateResolve", 1267 target: "ReplicaSchemaResult<NostrEventHead>", 1268 }, 1269 TypeSpec::Alias { 1270 name: "INostrProfileCreate", 1271 target: "INostrProfileFields", 1272 }, 1273 TypeSpec::Alias { 1274 name: "INostrProfileCreateResolve", 1275 target: "ReplicaSchemaResult<NostrProfile>", 1276 }, 1277 TypeSpec::Alias { 1278 name: "INostrProfileDelete", 1279 target: "INostrProfileFindOne", 1280 }, 1281 TypeSpec::Alias { 1282 name: "INostrProfileDeleteResolve", 1283 target: "ReplicaSchemaResult<string>", 1284 }, 1285 TypeSpec::Object { 1286 name: "INostrProfileFields", 1287 fields: &[ 1288 FieldSpec::required("public_key", "string"), 1289 FieldSpec::required("profile_type", "string"), 1290 FieldSpec::required("name", "string"), 1291 FieldSpec::optional_nullable("display_name", "string"), 1292 FieldSpec::optional_nullable("about", "string"), 1293 FieldSpec::optional_nullable("website", "string"), 1294 FieldSpec::optional_nullable("picture", "string"), 1295 FieldSpec::optional_nullable("banner", "string"), 1296 FieldSpec::optional_nullable("nip05", "string"), 1297 FieldSpec::optional_nullable("lud06", "string"), 1298 FieldSpec::optional_nullable("lud16", "string"), 1299 ], 1300 }, 1301 TypeSpec::Object { 1302 name: "INostrProfileFieldsFilter", 1303 fields: &[ 1304 FieldSpec::optional("id", "string"), 1305 FieldSpec::optional("created_at", "string"), 1306 FieldSpec::optional("updated_at", "string"), 1307 FieldSpec::optional("public_key", "string"), 1308 FieldSpec::optional("profile_type", "string"), 1309 FieldSpec::optional("name", "string"), 1310 FieldSpec::optional("display_name", "string"), 1311 FieldSpec::optional("about", "string"), 1312 FieldSpec::optional("website", "string"), 1313 FieldSpec::optional("picture", "string"), 1314 FieldSpec::optional("banner", "string"), 1315 FieldSpec::optional("nip05", "string"), 1316 FieldSpec::optional("lud06", "string"), 1317 FieldSpec::optional("lud16", "string"), 1318 ], 1319 }, 1320 TypeSpec::Object { 1321 name: "INostrProfileFieldsPartial", 1322 fields: &[ 1323 FieldSpec::optional_nullable("public_key", "ReplicaStoreJsonValue"), 1324 FieldSpec::optional_nullable("profile_type", "ReplicaStoreJsonValue"), 1325 FieldSpec::optional_nullable("name", "ReplicaStoreJsonValue"), 1326 FieldSpec::optional_nullable("display_name", "ReplicaStoreJsonValue"), 1327 FieldSpec::optional_nullable("about", "ReplicaStoreJsonValue"), 1328 FieldSpec::optional_nullable("website", "ReplicaStoreJsonValue"), 1329 FieldSpec::optional_nullable("picture", "ReplicaStoreJsonValue"), 1330 FieldSpec::optional_nullable("banner", "ReplicaStoreJsonValue"), 1331 FieldSpec::optional_nullable("nip05", "ReplicaStoreJsonValue"), 1332 FieldSpec::optional_nullable("lud06", "ReplicaStoreJsonValue"), 1333 FieldSpec::optional_nullable("lud16", "ReplicaStoreJsonValue"), 1334 ], 1335 }, 1336 TypeSpec::Union { 1337 name: "INostrProfileFindMany", 1338 variants: &[ 1339 VariantSpec::Object(&[FieldSpec::nullable("filter", "INostrProfileFieldsFilter")]), 1340 VariantSpec::Object(&[FieldSpec::required("rel", "NostrProfileFindManyRel")]), 1341 ], 1342 }, 1343 TypeSpec::Alias { 1344 name: "INostrProfileFindManyResolve", 1345 target: "ReplicaSchemaResultList<NostrProfile>", 1346 }, 1347 TypeSpec::Union { 1348 name: "INostrProfileFindOne", 1349 variants: &[ 1350 VariantSpec::Ref("INostrProfileFindOneArgs"), 1351 VariantSpec::Ref("INostrProfileFindOneRelArgs"), 1352 ], 1353 }, 1354 TypeSpec::Object { 1355 name: "INostrProfileFindOneArgs", 1356 fields: &[FieldSpec::required("on", "NostrProfileQueryBindValues")], 1357 }, 1358 TypeSpec::Object { 1359 name: "INostrProfileFindOneRelArgs", 1360 fields: &[FieldSpec::required("rel", "NostrProfileFindManyRel")], 1361 }, 1362 TypeSpec::Alias { 1363 name: "INostrProfileFindOneResolve", 1364 target: "ReplicaSchemaResult<NostrProfile | null>", 1365 }, 1366 TypeSpec::Object { 1367 name: "INostrProfileRelayRelation", 1368 fields: &[ 1369 FieldSpec::required("nostr_profile", "NostrProfileQueryBindValues"), 1370 FieldSpec::required("nostr_relay", "NostrRelayQueryBindValues"), 1371 ], 1372 }, 1373 TypeSpec::Alias { 1374 name: "INostrProfileRelayResolve", 1375 target: "ReplicaSchemaResultPass", 1376 }, 1377 TypeSpec::Alias { 1378 name: "INostrProfileUpdate", 1379 target: "INostrProfileUpdateArgs", 1380 }, 1381 TypeSpec::Object { 1382 name: "INostrProfileUpdateArgs", 1383 fields: &[ 1384 FieldSpec::required("on", "NostrProfileQueryBindValues"), 1385 FieldSpec::required("fields", "INostrProfileFieldsPartial"), 1386 ], 1387 }, 1388 TypeSpec::Alias { 1389 name: "INostrProfileUpdateResolve", 1390 target: "ReplicaSchemaResult<NostrProfile>", 1391 }, 1392 TypeSpec::Alias { 1393 name: "INostrRelayCreate", 1394 target: "INostrRelayFields", 1395 }, 1396 TypeSpec::Alias { 1397 name: "INostrRelayCreateResolve", 1398 target: "ReplicaSchemaResult<NostrRelay>", 1399 }, 1400 TypeSpec::Alias { 1401 name: "INostrRelayDelete", 1402 target: "INostrRelayFindOne", 1403 }, 1404 TypeSpec::Alias { 1405 name: "INostrRelayDeleteResolve", 1406 target: "ReplicaSchemaResult<string>", 1407 }, 1408 TypeSpec::Object { 1409 name: "INostrRelayFields", 1410 fields: &[ 1411 FieldSpec::required("url", "string"), 1412 FieldSpec::optional_nullable("relay_id", "string"), 1413 FieldSpec::optional_nullable("name", "string"), 1414 FieldSpec::optional_nullable("description", "string"), 1415 FieldSpec::optional_nullable("pubkey", "string"), 1416 FieldSpec::optional_nullable("contact", "string"), 1417 FieldSpec::optional_nullable("supported_nips", "string"), 1418 FieldSpec::optional_nullable("software", "string"), 1419 FieldSpec::optional_nullable("version", "string"), 1420 FieldSpec::optional_nullable("data", "string"), 1421 ], 1422 }, 1423 TypeSpec::Object { 1424 name: "INostrRelayFieldsFilter", 1425 fields: &[ 1426 FieldSpec::optional("id", "string"), 1427 FieldSpec::optional("created_at", "string"), 1428 FieldSpec::optional("updated_at", "string"), 1429 FieldSpec::optional("url", "string"), 1430 FieldSpec::optional("relay_id", "string"), 1431 FieldSpec::optional("name", "string"), 1432 FieldSpec::optional("description", "string"), 1433 FieldSpec::optional("pubkey", "string"), 1434 FieldSpec::optional("contact", "string"), 1435 FieldSpec::optional("supported_nips", "string"), 1436 FieldSpec::optional("software", "string"), 1437 FieldSpec::optional("version", "string"), 1438 FieldSpec::optional("data", "string"), 1439 ], 1440 }, 1441 TypeSpec::Object { 1442 name: "INostrRelayFieldsPartial", 1443 fields: &[ 1444 FieldSpec::optional_nullable("url", "ReplicaStoreJsonValue"), 1445 FieldSpec::optional_nullable("relay_id", "ReplicaStoreJsonValue"), 1446 FieldSpec::optional_nullable("name", "ReplicaStoreJsonValue"), 1447 FieldSpec::optional_nullable("description", "ReplicaStoreJsonValue"), 1448 FieldSpec::optional_nullable("pubkey", "ReplicaStoreJsonValue"), 1449 FieldSpec::optional_nullable("contact", "ReplicaStoreJsonValue"), 1450 FieldSpec::optional_nullable("supported_nips", "ReplicaStoreJsonValue"), 1451 FieldSpec::optional_nullable("software", "ReplicaStoreJsonValue"), 1452 FieldSpec::optional_nullable("version", "ReplicaStoreJsonValue"), 1453 FieldSpec::optional_nullable("data", "ReplicaStoreJsonValue"), 1454 ], 1455 }, 1456 TypeSpec::Union { 1457 name: "INostrRelayFindMany", 1458 variants: &[ 1459 VariantSpec::Object(&[FieldSpec::nullable("filter", "INostrRelayFieldsFilter")]), 1460 VariantSpec::Object(&[FieldSpec::required("rel", "NostrRelayFindManyRel")]), 1461 ], 1462 }, 1463 TypeSpec::Alias { 1464 name: "INostrRelayFindManyResolve", 1465 target: "ReplicaSchemaResultList<NostrRelay>", 1466 }, 1467 TypeSpec::Union { 1468 name: "INostrRelayFindOne", 1469 variants: &[ 1470 VariantSpec::Ref("INostrRelayFindOneArgs"), 1471 VariantSpec::Ref("INostrRelayFindOneRelArgs"), 1472 ], 1473 }, 1474 TypeSpec::Object { 1475 name: "INostrRelayFindOneArgs", 1476 fields: &[FieldSpec::required("on", "NostrRelayQueryBindValues")], 1477 }, 1478 TypeSpec::Object { 1479 name: "INostrRelayFindOneRelArgs", 1480 fields: &[FieldSpec::required("rel", "NostrRelayFindManyRel")], 1481 }, 1482 TypeSpec::Alias { 1483 name: "INostrRelayFindOneResolve", 1484 target: "ReplicaSchemaResult<NostrRelay | null>", 1485 }, 1486 TypeSpec::Alias { 1487 name: "INostrRelayUpdate", 1488 target: "INostrRelayUpdateArgs", 1489 }, 1490 TypeSpec::Object { 1491 name: "INostrRelayUpdateArgs", 1492 fields: &[ 1493 FieldSpec::required("on", "NostrRelayQueryBindValues"), 1494 FieldSpec::required("fields", "INostrRelayFieldsPartial"), 1495 ], 1496 }, 1497 TypeSpec::Alias { 1498 name: "INostrRelayUpdateResolve", 1499 target: "ReplicaSchemaResult<NostrRelay>", 1500 }, 1501 TypeSpec::Alias { 1502 name: "IPlotCreate", 1503 target: "IPlotFields", 1504 }, 1505 TypeSpec::Alias { 1506 name: "IPlotCreateResolve", 1507 target: "ReplicaSchemaResult<Plot>", 1508 }, 1509 TypeSpec::Alias { 1510 name: "IPlotDelete", 1511 target: "IPlotFindOne", 1512 }, 1513 TypeSpec::Alias { 1514 name: "IPlotDeleteResolve", 1515 target: "ReplicaSchemaResult<string>", 1516 }, 1517 TypeSpec::Object { 1518 name: "IPlotFields", 1519 fields: &[ 1520 FieldSpec::required("d_tag", "string"), 1521 FieldSpec::required("farm_id", "string"), 1522 FieldSpec::required("name", "string"), 1523 FieldSpec::optional_nullable("about", "string"), 1524 FieldSpec::optional_nullable("location_primary", "string"), 1525 FieldSpec::optional_nullable("location_city", "string"), 1526 FieldSpec::optional_nullable("location_region", "string"), 1527 FieldSpec::optional_nullable("location_country", "string"), 1528 ], 1529 }, 1530 TypeSpec::Object { 1531 name: "IPlotFieldsFilter", 1532 fields: &[ 1533 FieldSpec::optional("id", "string"), 1534 FieldSpec::optional("created_at", "string"), 1535 FieldSpec::optional("updated_at", "string"), 1536 FieldSpec::optional("d_tag", "string"), 1537 FieldSpec::optional("farm_id", "string"), 1538 FieldSpec::optional("name", "string"), 1539 FieldSpec::optional("about", "string"), 1540 FieldSpec::optional("location_primary", "string"), 1541 FieldSpec::optional("location_city", "string"), 1542 FieldSpec::optional("location_region", "string"), 1543 FieldSpec::optional("location_country", "string"), 1544 ], 1545 }, 1546 TypeSpec::Object { 1547 name: "IPlotFieldsPartial", 1548 fields: &[ 1549 FieldSpec::optional_nullable("d_tag", "ReplicaStoreJsonValue"), 1550 FieldSpec::optional_nullable("farm_id", "ReplicaStoreJsonValue"), 1551 FieldSpec::optional_nullable("name", "ReplicaStoreJsonValue"), 1552 FieldSpec::optional_nullable("about", "ReplicaStoreJsonValue"), 1553 FieldSpec::optional_nullable("location_primary", "ReplicaStoreJsonValue"), 1554 FieldSpec::optional_nullable("location_city", "ReplicaStoreJsonValue"), 1555 FieldSpec::optional_nullable("location_region", "ReplicaStoreJsonValue"), 1556 FieldSpec::optional_nullable("location_country", "ReplicaStoreJsonValue"), 1557 ], 1558 }, 1559 TypeSpec::Alias { 1560 name: "IPlotFindMany", 1561 target: "IPlotFindManyArgs", 1562 }, 1563 TypeSpec::Object { 1564 name: "IPlotFindManyArgs", 1565 fields: &[FieldSpec::nullable("filter", "IPlotFieldsFilter")], 1566 }, 1567 TypeSpec::Alias { 1568 name: "IPlotFindManyResolve", 1569 target: "ReplicaSchemaResultList<Plot>", 1570 }, 1571 TypeSpec::Union { 1572 name: "IPlotFindOne", 1573 variants: &[VariantSpec::Ref("IPlotFindOneArgs")], 1574 }, 1575 TypeSpec::Object { 1576 name: "IPlotFindOneArgs", 1577 fields: &[FieldSpec::required("on", "PlotQueryBindValues")], 1578 }, 1579 TypeSpec::Alias { 1580 name: "IPlotFindOneResolve", 1581 target: "ReplicaSchemaResult<Plot | null>", 1582 }, 1583 TypeSpec::Alias { 1584 name: "IPlotGcsLocationCreate", 1585 target: "IPlotGcsLocationFields", 1586 }, 1587 TypeSpec::Alias { 1588 name: "IPlotGcsLocationCreateResolve", 1589 target: "ReplicaSchemaResult<PlotGcsLocation>", 1590 }, 1591 TypeSpec::Alias { 1592 name: "IPlotGcsLocationDelete", 1593 target: "IPlotGcsLocationFindOne", 1594 }, 1595 TypeSpec::Alias { 1596 name: "IPlotGcsLocationDeleteResolve", 1597 target: "ReplicaSchemaResult<string>", 1598 }, 1599 TypeSpec::Object { 1600 name: "IPlotGcsLocationFields", 1601 fields: &[ 1602 FieldSpec::required("plot_id", "string"), 1603 FieldSpec::required("gcs_location_id", "string"), 1604 FieldSpec::required("role", "string"), 1605 ], 1606 }, 1607 TypeSpec::Object { 1608 name: "IPlotGcsLocationFieldsFilter", 1609 fields: &[ 1610 FieldSpec::optional("id", "string"), 1611 FieldSpec::optional("created_at", "string"), 1612 FieldSpec::optional("updated_at", "string"), 1613 FieldSpec::optional("plot_id", "string"), 1614 FieldSpec::optional("gcs_location_id", "string"), 1615 FieldSpec::optional("role", "string"), 1616 ], 1617 }, 1618 TypeSpec::Object { 1619 name: "IPlotGcsLocationFieldsPartial", 1620 fields: &[ 1621 FieldSpec::optional_nullable("plot_id", "ReplicaStoreJsonValue"), 1622 FieldSpec::optional_nullable("gcs_location_id", "ReplicaStoreJsonValue"), 1623 FieldSpec::optional_nullable("role", "ReplicaStoreJsonValue"), 1624 ], 1625 }, 1626 TypeSpec::Alias { 1627 name: "IPlotGcsLocationFindMany", 1628 target: "IPlotGcsLocationFindManyArgs", 1629 }, 1630 TypeSpec::Object { 1631 name: "IPlotGcsLocationFindManyArgs", 1632 fields: &[FieldSpec::nullable( 1633 "filter", 1634 "IPlotGcsLocationFieldsFilter", 1635 )], 1636 }, 1637 TypeSpec::Alias { 1638 name: "IPlotGcsLocationFindManyResolve", 1639 target: "ReplicaSchemaResultList<PlotGcsLocation>", 1640 }, 1641 TypeSpec::Union { 1642 name: "IPlotGcsLocationFindOne", 1643 variants: &[VariantSpec::Ref("IPlotGcsLocationFindOneArgs")], 1644 }, 1645 TypeSpec::Object { 1646 name: "IPlotGcsLocationFindOneArgs", 1647 fields: &[FieldSpec::required("on", "PlotGcsLocationQueryBindValues")], 1648 }, 1649 TypeSpec::Alias { 1650 name: "IPlotGcsLocationFindOneResolve", 1651 target: "ReplicaSchemaResult<PlotGcsLocation | null>", 1652 }, 1653 TypeSpec::Alias { 1654 name: "IPlotGcsLocationUpdate", 1655 target: "IPlotGcsLocationUpdateArgs", 1656 }, 1657 TypeSpec::Object { 1658 name: "IPlotGcsLocationUpdateArgs", 1659 fields: &[ 1660 FieldSpec::required("on", "PlotGcsLocationQueryBindValues"), 1661 FieldSpec::required("fields", "IPlotGcsLocationFieldsPartial"), 1662 ], 1663 }, 1664 TypeSpec::Alias { 1665 name: "IPlotGcsLocationUpdateResolve", 1666 target: "ReplicaSchemaResult<PlotGcsLocation>", 1667 }, 1668 TypeSpec::Alias { 1669 name: "IPlotTagCreate", 1670 target: "IPlotTagFields", 1671 }, 1672 TypeSpec::Alias { 1673 name: "IPlotTagCreateResolve", 1674 target: "ReplicaSchemaResult<PlotTag>", 1675 }, 1676 TypeSpec::Alias { 1677 name: "IPlotTagDelete", 1678 target: "IPlotTagFindOne", 1679 }, 1680 TypeSpec::Alias { 1681 name: "IPlotTagDeleteResolve", 1682 target: "ReplicaSchemaResult<string>", 1683 }, 1684 TypeSpec::Object { 1685 name: "IPlotTagFields", 1686 fields: &[ 1687 FieldSpec::required("plot_id", "string"), 1688 FieldSpec::required("tag", "string"), 1689 ], 1690 }, 1691 TypeSpec::Object { 1692 name: "IPlotTagFieldsFilter", 1693 fields: &[ 1694 FieldSpec::optional("id", "string"), 1695 FieldSpec::optional("created_at", "string"), 1696 FieldSpec::optional("updated_at", "string"), 1697 FieldSpec::optional("plot_id", "string"), 1698 FieldSpec::optional("tag", "string"), 1699 ], 1700 }, 1701 TypeSpec::Object { 1702 name: "IPlotTagFieldsPartial", 1703 fields: &[ 1704 FieldSpec::optional_nullable("plot_id", "ReplicaStoreJsonValue"), 1705 FieldSpec::optional_nullable("tag", "ReplicaStoreJsonValue"), 1706 ], 1707 }, 1708 TypeSpec::Alias { 1709 name: "IPlotTagFindMany", 1710 target: "IPlotTagFindManyArgs", 1711 }, 1712 TypeSpec::Object { 1713 name: "IPlotTagFindManyArgs", 1714 fields: &[FieldSpec::nullable("filter", "IPlotTagFieldsFilter")], 1715 }, 1716 TypeSpec::Alias { 1717 name: "IPlotTagFindManyResolve", 1718 target: "ReplicaSchemaResultList<PlotTag>", 1719 }, 1720 TypeSpec::Union { 1721 name: "IPlotTagFindOne", 1722 variants: &[VariantSpec::Ref("IPlotTagFindOneArgs")], 1723 }, 1724 TypeSpec::Object { 1725 name: "IPlotTagFindOneArgs", 1726 fields: &[FieldSpec::required("on", "PlotTagQueryBindValues")], 1727 }, 1728 TypeSpec::Alias { 1729 name: "IPlotTagFindOneResolve", 1730 target: "ReplicaSchemaResult<PlotTag | null>", 1731 }, 1732 TypeSpec::Alias { 1733 name: "IPlotTagUpdate", 1734 target: "IPlotTagUpdateArgs", 1735 }, 1736 TypeSpec::Object { 1737 name: "IPlotTagUpdateArgs", 1738 fields: &[ 1739 FieldSpec::required("on", "PlotTagQueryBindValues"), 1740 FieldSpec::required("fields", "IPlotTagFieldsPartial"), 1741 ], 1742 }, 1743 TypeSpec::Alias { 1744 name: "IPlotTagUpdateResolve", 1745 target: "ReplicaSchemaResult<PlotTag>", 1746 }, 1747 TypeSpec::Alias { 1748 name: "IPlotUpdate", 1749 target: "IPlotUpdateArgs", 1750 }, 1751 TypeSpec::Object { 1752 name: "IPlotUpdateArgs", 1753 fields: &[ 1754 FieldSpec::required("on", "PlotQueryBindValues"), 1755 FieldSpec::required("fields", "IPlotFieldsPartial"), 1756 ], 1757 }, 1758 TypeSpec::Alias { 1759 name: "IPlotUpdateResolve", 1760 target: "ReplicaSchemaResult<Plot>", 1761 }, 1762 TypeSpec::Alias { 1763 name: "ITradeProductCreate", 1764 target: "ITradeProductFields", 1765 }, 1766 TypeSpec::Alias { 1767 name: "ITradeProductCreateResolve", 1768 target: "ReplicaSchemaResult<TradeProduct>", 1769 }, 1770 TypeSpec::Alias { 1771 name: "ITradeProductDelete", 1772 target: "ITradeProductFindOne", 1773 }, 1774 TypeSpec::Alias { 1775 name: "ITradeProductDeleteResolve", 1776 target: "ReplicaSchemaResult<string>", 1777 }, 1778 TypeSpec::Object { 1779 name: "ITradeProductFields", 1780 fields: &[ 1781 FieldSpec::required("key", "string"), 1782 FieldSpec::required("category", "string"), 1783 FieldSpec::required("title", "string"), 1784 FieldSpec::required("summary", "string"), 1785 FieldSpec::required("process", "string"), 1786 FieldSpec::required("lot", "string"), 1787 FieldSpec::required("profile", "string"), 1788 FieldSpec::required("year", "bigint"), 1789 FieldSpec::required("qty_amt", "number"), 1790 FieldSpec::required("qty_amt_exact", "string"), 1791 FieldSpec::required("qty_unit", "string"), 1792 FieldSpec::optional_nullable("qty_label", "string"), 1793 FieldSpec::optional_nullable("qty_avail", "bigint"), 1794 FieldSpec::required("price_amt", "number"), 1795 FieldSpec::required("price_amt_exact", "string"), 1796 FieldSpec::required("price_currency", "string"), 1797 FieldSpec::required("price_qty_amt", "number"), 1798 FieldSpec::required("price_qty_amt_exact", "string"), 1799 FieldSpec::required("price_qty_unit", "string"), 1800 FieldSpec::optional_nullable("listing_addr", "string"), 1801 FieldSpec::optional_nullable("primary_bin_id", "string"), 1802 FieldSpec::optional_nullable("verified_primary_bin_id", "string"), 1803 FieldSpec::optional_nullable("notes", "string"), 1804 ], 1805 }, 1806 TypeSpec::Object { 1807 name: "ITradeProductFieldsFilter", 1808 fields: &[ 1809 FieldSpec::optional("id", "string"), 1810 FieldSpec::optional("created_at", "string"), 1811 FieldSpec::optional("updated_at", "string"), 1812 FieldSpec::optional("key", "string"), 1813 FieldSpec::optional("category", "string"), 1814 FieldSpec::optional("title", "string"), 1815 FieldSpec::optional("summary", "string"), 1816 FieldSpec::optional("process", "string"), 1817 FieldSpec::optional("lot", "string"), 1818 FieldSpec::optional("profile", "string"), 1819 FieldSpec::optional("year", "bigint"), 1820 FieldSpec::optional("qty_amt", "number"), 1821 FieldSpec::optional("qty_amt_exact", "string"), 1822 FieldSpec::optional("qty_unit", "string"), 1823 FieldSpec::optional("qty_label", "string"), 1824 FieldSpec::optional("qty_avail", "bigint"), 1825 FieldSpec::optional("price_amt", "number"), 1826 FieldSpec::optional("price_amt_exact", "string"), 1827 FieldSpec::optional("price_currency", "string"), 1828 FieldSpec::optional("price_qty_amt", "number"), 1829 FieldSpec::optional("price_qty_amt_exact", "string"), 1830 FieldSpec::optional("price_qty_unit", "string"), 1831 FieldSpec::optional("listing_addr", "string"), 1832 FieldSpec::optional("primary_bin_id", "string"), 1833 FieldSpec::optional("verified_primary_bin_id", "string"), 1834 FieldSpec::optional("notes", "string"), 1835 ], 1836 }, 1837 TypeSpec::Object { 1838 name: "ITradeProductFieldsPartial", 1839 fields: &[ 1840 FieldSpec::optional_nullable("key", "ReplicaStoreJsonValue"), 1841 FieldSpec::optional_nullable("category", "ReplicaStoreJsonValue"), 1842 FieldSpec::optional_nullable("title", "ReplicaStoreJsonValue"), 1843 FieldSpec::optional_nullable("summary", "ReplicaStoreJsonValue"), 1844 FieldSpec::optional_nullable("process", "ReplicaStoreJsonValue"), 1845 FieldSpec::optional_nullable("lot", "ReplicaStoreJsonValue"), 1846 FieldSpec::optional_nullable("profile", "ReplicaStoreJsonValue"), 1847 FieldSpec::optional_nullable("year", "ReplicaStoreJsonValue"), 1848 FieldSpec::optional_nullable("qty_amt", "ReplicaStoreJsonValue"), 1849 FieldSpec::optional_nullable("qty_amt_exact", "ReplicaStoreJsonValue"), 1850 FieldSpec::optional_nullable("qty_unit", "ReplicaStoreJsonValue"), 1851 FieldSpec::optional_nullable("qty_label", "ReplicaStoreJsonValue"), 1852 FieldSpec::optional_nullable("qty_avail", "ReplicaStoreJsonValue"), 1853 FieldSpec::optional_nullable("price_amt", "ReplicaStoreJsonValue"), 1854 FieldSpec::optional_nullable("price_amt_exact", "ReplicaStoreJsonValue"), 1855 FieldSpec::optional_nullable("price_currency", "ReplicaStoreJsonValue"), 1856 FieldSpec::optional_nullable("price_qty_amt", "ReplicaStoreJsonValue"), 1857 FieldSpec::optional_nullable("price_qty_amt_exact", "ReplicaStoreJsonValue"), 1858 FieldSpec::optional_nullable("price_qty_unit", "ReplicaStoreJsonValue"), 1859 FieldSpec::optional_nullable("listing_addr", "ReplicaStoreJsonValue"), 1860 FieldSpec::optional_nullable("primary_bin_id", "ReplicaStoreJsonValue"), 1861 FieldSpec::optional_nullable("verified_primary_bin_id", "ReplicaStoreJsonValue"), 1862 FieldSpec::optional_nullable("notes", "ReplicaStoreJsonValue"), 1863 ], 1864 }, 1865 TypeSpec::Alias { 1866 name: "ITradeProductFindMany", 1867 target: "ITradeProductFindManyArgs", 1868 }, 1869 TypeSpec::Object { 1870 name: "ITradeProductFindManyArgs", 1871 fields: &[FieldSpec::nullable("filter", "ITradeProductFieldsFilter")], 1872 }, 1873 TypeSpec::Alias { 1874 name: "ITradeProductFindManyResolve", 1875 target: "ReplicaSchemaResultList<TradeProduct>", 1876 }, 1877 TypeSpec::Union { 1878 name: "ITradeProductFindOne", 1879 variants: &[VariantSpec::Ref("ITradeProductFindOneArgs")], 1880 }, 1881 TypeSpec::Object { 1882 name: "ITradeProductFindOneArgs", 1883 fields: &[FieldSpec::required("on", "TradeProductQueryBindValues")], 1884 }, 1885 TypeSpec::Alias { 1886 name: "ITradeProductFindOneResolve", 1887 target: "ReplicaSchemaResult<TradeProduct | null>", 1888 }, 1889 TypeSpec::Object { 1890 name: "ITradeProductLocationRelation", 1891 fields: &[ 1892 FieldSpec::required("trade_product", "TradeProductQueryBindValues"), 1893 FieldSpec::required("gcs_location", "GcsLocationQueryBindValues"), 1894 ], 1895 }, 1896 TypeSpec::Alias { 1897 name: "ITradeProductLocationResolve", 1898 target: "ReplicaSchemaResultPass", 1899 }, 1900 TypeSpec::Object { 1901 name: "ITradeProductMediaRelation", 1902 fields: &[ 1903 FieldSpec::required("trade_product", "TradeProductQueryBindValues"), 1904 FieldSpec::required("media_image", "MediaImageQueryBindValues"), 1905 ], 1906 }, 1907 TypeSpec::Alias { 1908 name: "ITradeProductMediaResolve", 1909 target: "ReplicaSchemaResultPass", 1910 }, 1911 TypeSpec::Alias { 1912 name: "ITradeProductUpdate", 1913 target: "ITradeProductUpdateArgs", 1914 }, 1915 TypeSpec::Object { 1916 name: "ITradeProductUpdateArgs", 1917 fields: &[ 1918 FieldSpec::required("on", "TradeProductQueryBindValues"), 1919 FieldSpec::required("fields", "ITradeProductFieldsPartial"), 1920 ], 1921 }, 1922 TypeSpec::Alias { 1923 name: "ITradeProductUpdateResolve", 1924 target: "ReplicaSchemaResult<TradeProduct>", 1925 }, 1926 TypeSpec::Object { 1927 name: "LogError", 1928 fields: &[ 1929 FieldSpec::required("id", "string"), 1930 FieldSpec::required("created_at", "string"), 1931 FieldSpec::required("updated_at", "string"), 1932 FieldSpec::required("error", "string"), 1933 FieldSpec::required("message", "string"), 1934 FieldSpec::nullable("stack_trace", "string"), 1935 FieldSpec::nullable("cause", "string"), 1936 FieldSpec::required("app_system", "string"), 1937 FieldSpec::required("app_version", "string"), 1938 FieldSpec::required("nostr_pubkey", "string"), 1939 FieldSpec::nullable("data", "string"), 1940 ], 1941 }, 1942 TypeSpec::Union { 1943 name: "LogErrorQueryBindValues", 1944 variants: &[ 1945 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 1946 VariantSpec::Object(&[FieldSpec::required("nostr_pubkey", "string")]), 1947 ], 1948 }, 1949 TypeSpec::Object { 1950 name: "MediaImage", 1951 fields: &[ 1952 FieldSpec::required("id", "string"), 1953 FieldSpec::required("created_at", "string"), 1954 FieldSpec::required("updated_at", "string"), 1955 FieldSpec::required("file_path", "string"), 1956 FieldSpec::required("mime_type", "string"), 1957 FieldSpec::required("res_base", "string"), 1958 FieldSpec::required("res_path", "string"), 1959 FieldSpec::nullable("label", "string"), 1960 FieldSpec::nullable("description", "string"), 1961 ], 1962 }, 1963 TypeSpec::Union { 1964 name: "MediaImageFindManyRel", 1965 variants: &[ 1966 VariantSpec::Object(&[FieldSpec::required( 1967 "on_trade_product", 1968 "MediaImageTradeProductArgs", 1969 )]), 1970 VariantSpec::Object(&[FieldSpec::required( 1971 "off_trade_product", 1972 "MediaImageTradeProductArgs", 1973 )]), 1974 ], 1975 }, 1976 TypeSpec::Union { 1977 name: "MediaImageQueryBindValues", 1978 variants: &[ 1979 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 1980 VariantSpec::Object(&[FieldSpec::required("file_path", "string")]), 1981 ], 1982 }, 1983 TypeSpec::Object { 1984 name: "MediaImageTradeProductArgs", 1985 fields: &[FieldSpec::required("id", "string")], 1986 }, 1987 TypeSpec::Object { 1988 name: "NostrEventHead", 1989 fields: &[ 1990 FieldSpec::required("id", "string"), 1991 FieldSpec::required("created_at", "string"), 1992 FieldSpec::required("updated_at", "string"), 1993 FieldSpec::required("key", "string"), 1994 FieldSpec::required("kind", "number"), 1995 FieldSpec::required("pubkey", "string"), 1996 FieldSpec::required("d_tag", "string"), 1997 FieldSpec::required("last_event_id", "string"), 1998 FieldSpec::required("last_created_at", "number"), 1999 FieldSpec::required("content_hash", "string"), 2000 ], 2001 }, 2002 TypeSpec::Union { 2003 name: "NostrEventHeadQueryBindValues", 2004 variants: &[ 2005 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 2006 VariantSpec::Object(&[FieldSpec::required("key", "string")]), 2007 ], 2008 }, 2009 TypeSpec::Object { 2010 name: "NostrProfile", 2011 fields: &[ 2012 FieldSpec::required("id", "string"), 2013 FieldSpec::required("created_at", "string"), 2014 FieldSpec::required("updated_at", "string"), 2015 FieldSpec::required("public_key", "string"), 2016 FieldSpec::required("profile_type", "string"), 2017 FieldSpec::required("name", "string"), 2018 FieldSpec::nullable("display_name", "string"), 2019 FieldSpec::nullable("about", "string"), 2020 FieldSpec::nullable("website", "string"), 2021 FieldSpec::nullable("picture", "string"), 2022 FieldSpec::nullable("banner", "string"), 2023 FieldSpec::nullable("nip05", "string"), 2024 FieldSpec::nullable("lud06", "string"), 2025 FieldSpec::nullable("lud16", "string"), 2026 ], 2027 }, 2028 TypeSpec::Union { 2029 name: "NostrProfileFindManyRel", 2030 variants: &[ 2031 VariantSpec::Object(&[FieldSpec::required("on_relay", "NostrProfileRelayArgs")]), 2032 VariantSpec::Object(&[FieldSpec::required("off_relay", "NostrProfileRelayArgs")]), 2033 ], 2034 }, 2035 TypeSpec::Union { 2036 name: "NostrProfileQueryBindValues", 2037 variants: &[ 2038 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 2039 VariantSpec::Object(&[FieldSpec::required("public_key", "string")]), 2040 ], 2041 }, 2042 TypeSpec::Object { 2043 name: "NostrProfileRelayArgs", 2044 fields: &[FieldSpec::required("id", "string")], 2045 }, 2046 TypeSpec::Object { 2047 name: "NostrRelay", 2048 fields: &[ 2049 FieldSpec::required("id", "string"), 2050 FieldSpec::required("created_at", "string"), 2051 FieldSpec::required("updated_at", "string"), 2052 FieldSpec::required("url", "string"), 2053 FieldSpec::nullable("relay_id", "string"), 2054 FieldSpec::nullable("name", "string"), 2055 FieldSpec::nullable("description", "string"), 2056 FieldSpec::nullable("pubkey", "string"), 2057 FieldSpec::nullable("contact", "string"), 2058 FieldSpec::nullable("supported_nips", "string"), 2059 FieldSpec::nullable("software", "string"), 2060 FieldSpec::nullable("version", "string"), 2061 FieldSpec::nullable("data", "string"), 2062 ], 2063 }, 2064 TypeSpec::Union { 2065 name: "NostrRelayFindManyRel", 2066 variants: &[ 2067 VariantSpec::Object(&[FieldSpec::required("on_profile", "NostrRelayProfileArgs")]), 2068 VariantSpec::Object(&[FieldSpec::required("off_profile", "NostrRelayProfileArgs")]), 2069 ], 2070 }, 2071 TypeSpec::Object { 2072 name: "NostrRelayProfileArgs", 2073 fields: &[FieldSpec::required("public_key", "string")], 2074 }, 2075 TypeSpec::Union { 2076 name: "NostrRelayQueryBindValues", 2077 variants: &[ 2078 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 2079 VariantSpec::Object(&[FieldSpec::required("url", "string")]), 2080 ], 2081 }, 2082 TypeSpec::Object { 2083 name: "Plot", 2084 fields: &[ 2085 FieldSpec::required("id", "string"), 2086 FieldSpec::required("created_at", "string"), 2087 FieldSpec::required("updated_at", "string"), 2088 FieldSpec::required("d_tag", "string"), 2089 FieldSpec::required("farm_id", "string"), 2090 FieldSpec::required("name", "string"), 2091 FieldSpec::nullable("about", "string"), 2092 FieldSpec::nullable("location_primary", "string"), 2093 FieldSpec::nullable("location_city", "string"), 2094 FieldSpec::nullable("location_region", "string"), 2095 FieldSpec::nullable("location_country", "string"), 2096 ], 2097 }, 2098 TypeSpec::Object { 2099 name: "PlotGcsLocation", 2100 fields: &[ 2101 FieldSpec::required("id", "string"), 2102 FieldSpec::required("created_at", "string"), 2103 FieldSpec::required("updated_at", "string"), 2104 FieldSpec::required("plot_id", "string"), 2105 FieldSpec::required("gcs_location_id", "string"), 2106 FieldSpec::required("role", "string"), 2107 ], 2108 }, 2109 TypeSpec::Union { 2110 name: "PlotGcsLocationQueryBindValues", 2111 variants: &[ 2112 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 2113 VariantSpec::Object(&[FieldSpec::required("plot_id", "string")]), 2114 VariantSpec::Object(&[FieldSpec::required("gcs_location_id", "string")]), 2115 ], 2116 }, 2117 TypeSpec::Union { 2118 name: "PlotQueryBindValues", 2119 variants: &[ 2120 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 2121 VariantSpec::Object(&[FieldSpec::required("d_tag", "string")]), 2122 VariantSpec::Object(&[FieldSpec::required("farm_id", "string")]), 2123 ], 2124 }, 2125 TypeSpec::Object { 2126 name: "PlotTag", 2127 fields: &[ 2128 FieldSpec::required("id", "string"), 2129 FieldSpec::required("created_at", "string"), 2130 FieldSpec::required("updated_at", "string"), 2131 FieldSpec::required("plot_id", "string"), 2132 FieldSpec::required("tag", "string"), 2133 ], 2134 }, 2135 TypeSpec::Union { 2136 name: "PlotTagQueryBindValues", 2137 variants: &[ 2138 VariantSpec::Object(&[FieldSpec::required("id", "string")]), 2139 VariantSpec::Object(&[FieldSpec::required("plot_id", "string")]), 2140 VariantSpec::Object(&[FieldSpec::required("tag", "string")]), 2141 ], 2142 }, 2143 TypeSpec::Alias { 2144 name: "ReplicaStoreJsonValue", 2145 target: "null | boolean | number | string | Array<ReplicaStoreJsonValue> | { [key: string]: ReplicaStoreJsonValue }", 2146 }, 2147 TypeSpec::Object { 2148 name: "TradeProduct", 2149 fields: &[ 2150 FieldSpec::required("id", "string"), 2151 FieldSpec::required("created_at", "string"), 2152 FieldSpec::required("updated_at", "string"), 2153 FieldSpec::required("key", "string"), 2154 FieldSpec::required("category", "string"), 2155 FieldSpec::required("title", "string"), 2156 FieldSpec::required("summary", "string"), 2157 FieldSpec::required("process", "string"), 2158 FieldSpec::required("lot", "string"), 2159 FieldSpec::required("profile", "string"), 2160 FieldSpec::required("year", "bigint"), 2161 FieldSpec::required("qty_amt", "number"), 2162 FieldSpec::nullable("qty_amt_exact", "string"), 2163 FieldSpec::required("qty_unit", "string"), 2164 FieldSpec::nullable("qty_label", "string"), 2165 FieldSpec::nullable("qty_avail", "bigint"), 2166 FieldSpec::required("price_amt", "number"), 2167 FieldSpec::nullable("price_amt_exact", "string"), 2168 FieldSpec::required("price_currency", "string"), 2169 FieldSpec::required("price_qty_amt", "number"), 2170 FieldSpec::nullable("price_qty_amt_exact", "string"), 2171 FieldSpec::required("price_qty_unit", "string"), 2172 FieldSpec::nullable("listing_addr", "string"), 2173 FieldSpec::nullable("primary_bin_id", "string"), 2174 FieldSpec::nullable("verified_primary_bin_id", "string"), 2175 FieldSpec::nullable("notes", "string"), 2176 ], 2177 }, 2178 TypeSpec::Union { 2179 name: "TradeProductQueryBindValues", 2180 variants: &[VariantSpec::Object(&[FieldSpec::required("id", "string")])], 2181 }, 2182 ]; 2183 2184 #[cfg(test)] 2185 mod tests { 2186 use super::{FieldSpec, TYPE_SPECS, TypeSpec, VariantSpec, dto_registry, type_inventory}; 2187 2188 #[test] 2189 fn registry_exports_known_schema_types() { 2190 let registry = dto_registry(); 2191 assert!(!registry.has_errors(), "{:?}", registry.diagnostics); 2192 assert!(type_inventory().contains(&"Farm")); 2193 assert!(type_inventory().contains(&"NostrEventHead")); 2194 assert!(type_inventory().contains(&"ReplicaStoreJsonValue")); 2195 } 2196 2197 #[test] 2198 fn source_find_one_resolves_preserve_nullable_result() { 2199 assert!(TYPE_SPECS.iter().any(|spec| matches!( 2200 spec, 2201 TypeSpec::Alias { 2202 name: "IFarmFindOneResolve", 2203 target: "ReplicaSchemaResult<Farm | null>" 2204 } 2205 ))); 2206 } 2207 2208 #[test] 2209 fn relation_find_many_inputs_preserve_filter_and_rel_variants() { 2210 for (name, filter, rel) in [ 2211 ( 2212 "IGcsLocationFindMany", 2213 "IGcsLocationFieldsFilter", 2214 "GcsLocationFindManyRel", 2215 ), 2216 ( 2217 "IMediaImageFindMany", 2218 "IMediaImageFieldsFilter", 2219 "MediaImageFindManyRel", 2220 ), 2221 ( 2222 "INostrProfileFindMany", 2223 "INostrProfileFieldsFilter", 2224 "NostrProfileFindManyRel", 2225 ), 2226 ( 2227 "INostrRelayFindMany", 2228 "INostrRelayFieldsFilter", 2229 "NostrRelayFindManyRel", 2230 ), 2231 ] { 2232 assert!(TYPE_SPECS.iter().any(|spec| matches!( 2233 spec, 2234 TypeSpec::Union { name: actual_name, variants } 2235 if *actual_name == name 2236 && variants.len() == 2 2237 && matches!(variants[0], VariantSpec::Object(fields) if fields.len() == 1 && fields[0] == FieldSpec::nullable("filter", filter)) 2238 && matches!(variants[1], VariantSpec::Object(fields) if fields.len() == 1 && fields[0] == FieldSpec::required("rel", rel)) 2239 ))); 2240 } 2241 } 2242 2243 #[test] 2244 fn serde_json_value_policy_is_explicit() { 2245 assert!(TYPE_SPECS.iter().any(|spec| matches!( 2246 spec, 2247 TypeSpec::Alias { name: "ReplicaStoreJsonValue", target } if target.contains("[key: string]: ReplicaStoreJsonValue") 2248 ))); 2249 assert!(TYPE_SPECS.iter().any(|spec| matches!( 2250 spec, 2251 TypeSpec::Object { name: "ITradeProductFieldsPartial", fields } if fields.iter().any(|field| field.name == "year" && field.target == "ReplicaStoreJsonValue" && field.optional && field.nullable) 2252 ))); 2253 } 2254 2255 #[test] 2256 fn trade_product_large_integer_policy_is_explicit() { 2257 assert!(TYPE_SPECS.iter().any(|spec| matches!( 2258 spec, 2259 TypeSpec::Object { name: "TradeProduct", fields } if fields.iter().any(|field| field.name == "year" && field.target == "bigint") 2260 ))); 2261 assert!(TYPE_SPECS.iter().any(|spec| matches!( 2262 spec, 2263 TypeSpec::Object { name: "ITradeProductFieldsFilter", fields } if fields.iter().any(|field| field.name == "qty_avail" && field.target == "bigint" && field.optional) 2264 ))); 2265 } 2266 }