commit 7d94a98261a1507a581c5ed6da1920f5b45e6dd2 parent edf40a100590de728fe9ee5677b37d29f61bc40c Author: triesap <tyson@radroots.org> Date: Sat, 11 Jul 2026 23:56:26 +0000 crate-surface: rename SDK binding packages - rename SDK binding and WASM crates to final event and replica surfaces - regenerate TypeScript packages, provenance, and package metadata - update xtask package matrix, WASM declarations, and SDK contracts - remove retired types binding and replica db package surfaces without aliases Diffstat:
99 files changed, 2534 insertions(+), 2458 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock @@ -1783,6 +1783,14 @@ dependencies = [ ] [[package]] +name = "radroots_event_bindings" +version = "0.1.0" +dependencies = [ + "dto_bindgen_backend_ts", + "radroots_event", +] + +[[package]] name = "radroots_event_codec" version = "0.1.0-alpha.2" dependencies = [ @@ -1796,53 +1804,45 @@ dependencies = [ ] [[package]] -name = "radroots_event_index" +name = "radroots_event_codec_wasm" version = "0.1.0-alpha.2" dependencies = [ - "dto_bindgen", - "dto_bindgen_core", + "nostr", + "radroots_core", + "radroots_event", + "radroots_event_codec", "serde", + "serde_json", + "wasm-bindgen", ] [[package]] -name = "radroots_event_store" +name = "radroots_event_index" version = "0.1.0-alpha.2" dependencies = [ - "radroots_event", - "radroots_nostr", - "radroots_transport", + "dto_bindgen", + "dto_bindgen_core", "serde", - "serde_json", - "sqlx", - "thiserror 1.0.69", ] [[package]] -name = "radroots_events_bindings" +name = "radroots_event_index_bindings" version = "0.1.0" dependencies = [ - "dto_bindgen_backend_ts", - "radroots_event", + "radroots_event_index", ] [[package]] -name = "radroots_events_codec_wasm" +name = "radroots_event_store" version = "0.1.0-alpha.2" dependencies = [ - "nostr", - "radroots_core", "radroots_event", - "radroots_event_codec", + "radroots_nostr", + "radroots_transport", "serde", "serde_json", - "wasm-bindgen", -] - -[[package]] -name = "radroots_events_indexed_bindings" -version = "0.1.0" -dependencies = [ - "radroots_event_index", + "sqlx", + "thiserror 1.0.69", ] [[package]] @@ -1966,41 +1966,41 @@ dependencies = [ ] [[package]] -name = "radroots_replica_db" +name = "radroots_replica_schema" version = "0.1.0-alpha.2" dependencies = [ - "hex", - "radroots_replica_db_schema", - "radroots_sql_core", + "dto_bindgen_core", "serde", "serde_json", - "sha2", ] [[package]] -name = "radroots_replica_db_schema" -version = "0.1.0-alpha.2" +name = "radroots_replica_schema_bindings" +version = "0.1.0" dependencies = [ "dto_bindgen_core", - "serde", - "serde_json", + "radroots_replica_schema", ] [[package]] -name = "radroots_replica_db_schema_bindings" -version = "0.1.0" +name = "radroots_replica_store" +version = "0.1.0-alpha.2" dependencies = [ - "dto_bindgen_core", - "radroots_replica_db_schema", + "hex", + "radroots_replica_schema", + "radroots_sql_core", + "serde", + "serde_json", + "sha2", ] [[package]] -name = "radroots_replica_db_wasm" +name = "radroots_replica_store_wasm" version = "0.1.0-alpha.2" dependencies = [ "js-sys", - "radroots_replica_db", - "radroots_replica_db_schema", + "radroots_replica_schema", + "radroots_replica_store", "radroots_replica_sync", "radroots_sdk_sql_wasm_runtime", "radroots_sql_core", @@ -2020,8 +2020,8 @@ dependencies = [ "radroots_core", "radroots_event", "radroots_event_codec", - "radroots_replica_db", - "radroots_replica_db_schema", + "radroots_replica_schema", + "radroots_replica_store", "radroots_sql_core", "serde", "serde_json", @@ -2092,8 +2092,8 @@ dependencies = [ "radroots_nostr_connect", "radroots_nostr_signer", "radroots_outbox", - "radroots_replica_db", - "radroots_replica_db_schema", + "radroots_replica_schema", + "radroots_replica_store", "radroots_replica_sync", "radroots_runtime_paths", "radroots_sql_core", @@ -2133,10 +2133,10 @@ dependencies = [ "flate2", "radroots_core", "radroots_event", + "radroots_event_bindings", "radroots_event_index", - "radroots_events_bindings", "radroots_identity_bindings", - "radroots_replica_db_schema_bindings", + "radroots_replica_schema_bindings", "radroots_trade_bindings", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml @@ -1,12 +1,12 @@ [workspace] members = [ "crates/core_bindings", - "crates/events_codec_wasm", - "crates/events_bindings", - "crates/events_indexed_bindings", + "crates/event_codec_wasm", + "crates/event_bindings", + "crates/event_index_bindings", "crates/identity_bindings", - "crates/replica_db_wasm", - "crates/replica_db_schema_bindings", + "crates/replica_store_wasm", + "crates/replica_schema_bindings", "crates/replica_sync_wasm", "crates/sdk", "crates/sql_wasm_runtime", @@ -46,12 +46,12 @@ radroots_transport = { path = "../lib/crates/transport", version = "0.1.0-alpha. radroots_transport_publish_protocol = { path = "../lib/crates/transport_publish_protocol", version = "0.1.0-alpha.2", default-features = false } radroots_transport_nostr = { path = "../lib/crates/transport_nostr", version = "0.1.0-alpha.2", default-features = false } radroots_transport_reticulum = { path = "../lib/crates/transport_reticulum", version = "0.1.0-alpha.2", default-features = false } -radroots_replica_db = { path = "../lib/crates/replica_db", version = "0.1.0-alpha.2", default-features = false } -radroots_replica_db_schema = { path = "../lib/crates/replica_db_schema", version = "0.1.0-alpha.2", default-features = false } +radroots_replica_store = { path = "../lib/crates/replica_store", version = "0.1.0-alpha.2", default-features = false } +radroots_replica_schema = { path = "../lib/crates/replica_schema", version = "0.1.0-alpha.2", default-features = false } radroots_replica_sync = { path = "../lib/crates/replica_sync", version = "0.1.0-alpha.2", default-features = false } radroots_runtime_paths = { path = "../lib/crates/runtime_paths", version = "0.1.0-alpha.2", default-features = false } radroots_sdk_sql_wasm_runtime = { path = "crates/sql_wasm_runtime", version = "0.1.0-alpha.2" } -radroots_sp1_guest_trade = { path = "../lib/crates/sp1_guest_trade", version = "0.1.0-alpha.2", default-features = false } +radroots_trade_sp1_guest = { path = "../lib/crates/trade_sp1_guest", version = "0.1.0-alpha.2", default-features = false } radroots_sql_core = { path = "../lib/crates/sql_core", version = "0.1.0-alpha.2", default-features = false } radroots_trade = { path = "../lib/crates/trade", version = "0.1.0-alpha.2", default-features = false, features = [ "serde_json", diff --git a/contracts/coverage.toml b/contracts/coverage.toml @@ -10,7 +10,7 @@ wasm_target = "wasm32-unknown-unknown" [report] output = "target/sdk-coverage/summary.json" -ignore_filename_regex = "(/target/|/\\.cargo/registry/|/Cellar/rust/|/crates/.+_bindings/|/crates/replica_db_wasm/src/wasm_impl.rs|/tools/xtask/src/(check|contracts|coverage|fs|generate|main|output|package_matrix|wasm)\\.rs)" +ignore_filename_regex = "(/target/|/\\.cargo/registry/|/Cellar/rust/|/crates/.+_bindings/|/crates/replica_store_wasm/src/wasm_impl.rs|/tools/xtask/src/(check|contracts|coverage|fs|generate|main|output|package_matrix|wasm)\\.rs)" [scopes.radroots_sdk] paths = ["crates/sdk/src/**"] @@ -20,8 +20,8 @@ threshold = 98.0 paths = ["tools/xtask/src/coverage_policy.rs"] threshold = 100.0 -[scopes.events_codec_wasm] -paths = ["crates/events_codec_wasm/src/**"] +[scopes.event_codec_wasm] +paths = ["crates/event_codec_wasm/src/**"] threshold = 100.0 [scopes.sql_wasm_runtime] @@ -32,8 +32,8 @@ threshold = 100.0 paths = ["crates/replica_sync_wasm/src/**"] threshold = 100.0 -[scopes.replica_db_snapshot] -paths = ["crates/replica_db_wasm/src/snapshot.rs"] +[scopes.replica_store_snapshot] +paths = ["crates/replica_store_wasm/src/snapshot.rs"] threshold = 100.0 [generated] @@ -50,7 +50,7 @@ paths = ["crates/*_bindings/**"] reason = "binding crates are generator-owned source facades with behavior covered by xtask generator tests" [exclusions.wasm_glue_bootstrap] -paths = ["crates/replica_db_wasm/src/wasm_impl.rs"] +paths = ["crates/replica_store_wasm/src/wasm_impl.rs"] reason = "temporary bootstrap exclusion for the generated-style DB wrapper forwarding file while exported snapshot policy and sync parsing behavior are covered natively" [exclusions.xtask_command_glue] diff --git a/contracts/exports/go.toml b/contracts/exports/go.toml @@ -4,7 +4,7 @@ repository = "sdk-go" [packages] "radroots_core" = "github.com/radrootslabs/sdk-go" -"radroots_events" = "github.com/radrootslabs/sdk-go" +"radroots_event" = "github.com/radrootslabs/sdk-go" "radroots_trade" = "github.com/radrootslabs/sdk-go" "radroots_identity" = "github.com/radrootslabs/sdk-go" diff --git a/contracts/exports/kotlin.toml b/contracts/exports/kotlin.toml @@ -4,7 +4,7 @@ repository = "sdk-kotlin" [packages] "radroots_core" = "radroots.sdk" -"radroots_events" = "radroots.sdk" +"radroots_event" = "radroots.sdk" "radroots_trade" = "radroots.sdk" "radroots_identity" = "radroots.sdk" diff --git a/contracts/exports/py.toml b/contracts/exports/py.toml @@ -4,7 +4,7 @@ repository = "sdk-python" [packages] "radroots_core" = "radroots_sdk" -"radroots_events" = "radroots_sdk" +"radroots_event" = "radroots_sdk" "radroots_trade" = "radroots_sdk" "radroots_identity" = "radroots_sdk" diff --git a/contracts/exports/swift.toml b/contracts/exports/swift.toml @@ -4,7 +4,7 @@ repository = "sdk-swift" [packages] "radroots_core" = "RadrootsSDK" -"radroots_events" = "RadrootsSDK" +"radroots_event" = "RadrootsSDK" "radroots_trade" = "RadrootsSDK" "radroots_identity" = "RadrootsSDK" diff --git a/contracts/exports/ts.toml b/contracts/exports/ts.toml @@ -4,13 +4,13 @@ repository = "sdk-typescript" [packages] "radroots_core" = "@radroots/core-bindings" -"radroots_events" = "@radroots/events-bindings" -"radroots_events_indexed" = "@radroots/events-indexed-bindings" +"radroots_event" = "@radroots/event-bindings" +"radroots_event_index" = "@radroots/event-index-bindings" "radroots_identity" = "@radroots/identity-bindings" -"radroots_replica_db_schema" = "@radroots/replica-db-schema-bindings" +"radroots_replica_schema" = "@radroots/replica-schema-bindings" "radroots_trade" = "@radroots/trade-bindings" -"radroots_events_codec_wasm" = "@radroots/events-codec-wasm" -"radroots_replica_db_wasm" = "@radroots/replica-db-wasm" +"radroots_event_codec_wasm" = "@radroots/event-codec-wasm" +"radroots_replica_store_wasm" = "@radroots/replica-store-wasm" "radroots_replica_sync_wasm" = "@radroots/replica-sync-wasm" [artifacts] diff --git a/contracts/packages/ts.toml b/contracts/packages/ts.toml @@ -16,19 +16,19 @@ crate_dir = "crates/core_bindings" package = "@radroots/core-bindings" package_dir = "packages/core-bindings" -[npm_packages.events] +[npm_packages.event] kind = "bindings" -crate_name = "radroots_events_bindings" -crate_dir = "crates/events_bindings" -package = "@radroots/events-bindings" -package_dir = "packages/events-bindings" +crate_name = "radroots_event_bindings" +crate_dir = "crates/event_bindings" +package = "@radroots/event-bindings" +package_dir = "packages/event-bindings" -[npm_packages.events_indexed] +[npm_packages.event_index] kind = "bindings" -crate_name = "radroots_events_indexed_bindings" -crate_dir = "crates/events_indexed_bindings" -package = "@radroots/events-indexed-bindings" -package_dir = "packages/events-indexed-bindings" +crate_name = "radroots_event_index_bindings" +crate_dir = "crates/event_index_bindings" +package = "@radroots/event-index-bindings" +package_dir = "packages/event-index-bindings" [npm_packages.identity] kind = "bindings" @@ -37,12 +37,12 @@ crate_dir = "crates/identity_bindings" package = "@radroots/identity-bindings" package_dir = "packages/identity-bindings" -[npm_packages.replica_db_schema] +[npm_packages.replica_schema] kind = "bindings" -crate_name = "radroots_replica_db_schema_bindings" -crate_dir = "crates/replica_db_schema_bindings" -package = "@radroots/replica-db-schema-bindings" -package_dir = "packages/replica-db-schema-bindings" +crate_name = "radroots_replica_schema_bindings" +crate_dir = "crates/replica_schema_bindings" +package = "@radroots/replica-schema-bindings" +package_dir = "packages/replica-schema-bindings" [npm_packages.trade] kind = "bindings" @@ -51,23 +51,23 @@ crate_dir = "crates/trade_bindings" package = "@radroots/trade-bindings" package_dir = "packages/trade-bindings" -[npm_packages.events_codec] +[npm_packages.event_codec] kind = "wasm" -crate_name = "radroots_events_codec_wasm" -crate_dir = "crates/events_codec_wasm" -package = "@radroots/events-codec-wasm" -package_dir = "packages/events-codec-wasm" -out_name = "radroots_events_codec_wasm" -out_dir = "../../packages/events-codec-wasm/dist" +crate_name = "radroots_event_codec_wasm" +crate_dir = "crates/event_codec_wasm" +package = "@radroots/event-codec-wasm" +package_dir = "packages/event-codec-wasm" +out_name = "radroots_event_codec_wasm" +out_dir = "../../packages/event-codec-wasm/dist" -[npm_packages.replica_db] +[npm_packages.replica_store] kind = "wasm" -crate_name = "radroots_replica_db_wasm" -crate_dir = "crates/replica_db_wasm" -package = "@radroots/replica-db-wasm" -package_dir = "packages/replica-db-wasm" -out_name = "radroots_replica_db_wasm" -out_dir = "../../packages/replica-db-wasm/dist" +crate_name = "radroots_replica_store_wasm" +crate_dir = "crates/replica_store_wasm" +package = "@radroots/replica-store-wasm" +package_dir = "packages/replica-store-wasm" +out_name = "radroots_replica_store_wasm" +out_dir = "../../packages/replica-store-wasm/dist" [npm_packages.replica_sync] kind = "wasm" diff --git a/contracts/provenance/typescript/event.json b/contracts/provenance/typescript/event.json @@ -0,0 +1,6 @@ +{ + "crate": "radroots_event_bindings", + "generated": true, + "generator": "radroots_sdk_xtask", + "package": "@radroots/event-bindings" +} diff --git a/contracts/provenance/typescript/event_index.json b/contracts/provenance/typescript/event_index.json @@ -0,0 +1,6 @@ +{ + "crate": "radroots_event_index_bindings", + "generated": true, + "generator": "radroots_sdk_xtask", + "package": "@radroots/event-index-bindings" +} diff --git a/contracts/provenance/typescript/events.json b/contracts/provenance/typescript/events.json @@ -1,6 +0,0 @@ -{ - "crate": "radroots_events_bindings", - "generated": true, - "generator": "radroots_sdk_xtask", - "package": "@radroots/events-bindings" -} diff --git a/contracts/provenance/typescript/events_indexed.json b/contracts/provenance/typescript/events_indexed.json @@ -1,6 +0,0 @@ -{ - "crate": "radroots_events_indexed_bindings", - "generated": true, - "generator": "radroots_sdk_xtask", - "package": "@radroots/events-indexed-bindings" -} diff --git a/contracts/provenance/typescript/replica_db_schema.json b/contracts/provenance/typescript/replica_db_schema.json @@ -1,6 +0,0 @@ -{ - "crate": "radroots_replica_db_schema_bindings", - "generated": true, - "generator": "radroots_sdk_xtask", - "package": "@radroots/replica-db-schema-bindings" -} diff --git a/contracts/provenance/typescript/replica_schema.json b/contracts/provenance/typescript/replica_schema.json @@ -0,0 +1,6 @@ +{ + "crate": "radroots_replica_schema_bindings", + "generated": true, + "generator": "radroots_sdk_xtask", + "package": "@radroots/replica-schema-bindings" +} diff --git a/crates/event_bindings/Cargo.toml b/crates/event_bindings/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "radroots_event_bindings" +description = "Generated bindings for Radroots event contracts" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +publish = false + +[dependencies] +dto_bindgen_backend_ts = { workspace = true } +radroots_event = { workspace = true } diff --git a/crates/events_bindings/src/lib.rs b/crates/event_bindings/src/lib.rs diff --git a/crates/events_bindings/src/model.rs b/crates/event_bindings/src/model.rs diff --git a/crates/event_codec_wasm/Cargo.toml b/crates/event_codec_wasm/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "radroots_event_codec_wasm" +publish = false +version = "0.1.0-alpha.2" +edition.workspace = true +authors = ["Tyson Lupul <tyson@radroots.org>"] +rust-version.workspace = true +license.workspace = true +description = "WASM boundary for Radroots event codecs" +repository.workspace = true +homepage.workspace = true +readme = "README" + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +radroots_event = { workspace = true, default-features = false, features = [ + "std", + "serde", + "knowledge-nip54", +] } +radroots_event_codec = { workspace = true, default-features = false, features = [ + "std", + "serde_json", + "nostr", + "knowledge-nip54", + "contract-manifest", +] } +serde = { workspace = true } +serde_json = { workspace = true } +wasm-bindgen = { workspace = true } + +[dev-dependencies] +nostr = { workspace = true } +radroots_core = { workspace = true, default-features = false, features = [ + "std", +] } diff --git a/crates/event_codec_wasm/README b/crates/event_codec_wasm/README @@ -0,0 +1,24 @@ +# radroots_event_codec_wasm + +This is the README for `radroots_event_codec_wasm`, which provides WebAssembly +bindings for `radroots_event_codec` in the `radroots` core libraries. + +## Overview + + * wasm-bindgen entry points for event content and tag encoding and decoding; + * specialized tag helpers for farm, list, job, message, plot, and reaction + event families; + * JSON and `JsValue` boundaries built around `serde-wasm-bindgen` and base64 + helpers; + * built as `cdylib` and `rlib` artifacts for wasm consumers. + +## Copyright + +Except as otherwise noted, all files in the `radroots_event_codec_wasm` +distribution are + + Copyright (c) 2026 Tyson Lupul + +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see LICENSE included in the `radroots_event_codec_wasm` +distribution. diff --git a/crates/events_codec_wasm/src/lib.rs b/crates/event_codec_wasm/src/lib.rs diff --git a/crates/event_index_bindings/Cargo.toml b/crates/event_index_bindings/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "radroots_event_index_bindings" +description = "Generated bindings for indexed Radroots events" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +publish = false + +[dependencies] +radroots_event_index = { workspace = true } diff --git a/crates/event_index_bindings/src/lib.rs b/crates/event_index_bindings/src/lib.rs @@ -0,0 +1,22 @@ +pub use radroots_event_index as upstream; + +pub const TYPE_EXPORTS: &[&str] = &[ + "RadrootsEventIndexShardId", + "RadrootsEventIndexIdRange", + "RadrootsEventIndexShardMetadata", + "RadrootsEventIndexManifest", + "RadrootsEventIndexShardCheckpoint", + "RadrootsEventIndexIndexCheckpoint", +]; + +#[cfg(test)] +mod tests { + use super::TYPE_EXPORTS; + + #[test] + fn exports_indexed_manifest_and_checkpoint_types() { + assert!(TYPE_EXPORTS.contains(&"RadrootsEventIndexManifest")); + assert!(TYPE_EXPORTS.contains(&"RadrootsEventIndexIndexCheckpoint")); + assert!(TYPE_EXPORTS.contains(&"RadrootsEventIndexShardId")); + } +} diff --git a/crates/events_bindings/Cargo.toml b/crates/events_bindings/Cargo.toml @@ -1,14 +0,0 @@ -[package] -name = "radroots_events_bindings" -description = "Generated bindings for Radroots event contracts" -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -repository.workspace = true -homepage.workspace = true -publish = false - -[dependencies] -dto_bindgen_backend_ts = { workspace = true } -radroots_event = { workspace = true } diff --git a/crates/events_codec_wasm/Cargo.toml b/crates/events_codec_wasm/Cargo.toml @@ -1,38 +0,0 @@ -[package] -name = "radroots_events_codec_wasm" -publish = false -version = "0.1.0-alpha.2" -edition.workspace = true -authors = ["Tyson Lupul <tyson@radroots.org>"] -rust-version.workspace = true -license.workspace = true -description = "WASM boundary for Radroots event codecs" -repository.workspace = true -homepage.workspace = true -readme = "README" - -[lib] -crate-type = ["cdylib", "rlib"] - -[dependencies] -radroots_event = { workspace = true, default-features = false, features = [ - "std", - "serde", - "knowledge-nip54", -] } -radroots_event_codec = { workspace = true, default-features = false, features = [ - "std", - "serde_json", - "nostr", - "knowledge-nip54", - "contract-manifest", -] } -serde = { workspace = true } -serde_json = { workspace = true } -wasm-bindgen = { workspace = true } - -[dev-dependencies] -nostr = { workspace = true } -radroots_core = { workspace = true, default-features = false, features = [ - "std", -] } diff --git a/crates/events_codec_wasm/README b/crates/events_codec_wasm/README @@ -1,24 +0,0 @@ -# radroots_events_codec_wasm - -This is the README for `radroots_events_codec_wasm`, which provides WebAssembly -bindings for `radroots_events_codec` in the `radroots` core libraries. - -## Overview - - * wasm-bindgen entry points for event content and tag encoding and decoding; - * specialized tag helpers for farm, list, job, message, plot, and reaction - event families; - * JSON and `JsValue` boundaries built around `serde-wasm-bindgen` and base64 - helpers; - * built as `cdylib` and `rlib` artifacts for wasm consumers. - -## Copyright - -Except as otherwise noted, all files in the `radroots_events_codec_wasm` -distribution are - - Copyright (c) 2026 Tyson Lupul - -For information on usage and redistribution, and for a DISCLAIMER OF ALL -WARRANTIES, see LICENSE included in the `radroots_events_codec_wasm` -distribution. diff --git a/crates/events_indexed_bindings/Cargo.toml b/crates/events_indexed_bindings/Cargo.toml @@ -1,13 +0,0 @@ -[package] -name = "radroots_events_indexed_bindings" -description = "Generated bindings for indexed Radroots events" -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -repository.workspace = true -homepage.workspace = true -publish = false - -[dependencies] -radroots_event_index = { workspace = true } diff --git a/crates/events_indexed_bindings/src/lib.rs b/crates/events_indexed_bindings/src/lib.rs @@ -1,22 +0,0 @@ -pub use radroots_event_index as upstream; - -pub const TYPE_EXPORTS: &[&str] = &[ - "RadrootsEventsIndexedShardId", - "RadrootsEventsIndexedIdRange", - "RadrootsEventsIndexedShardMetadata", - "RadrootsEventsIndexedManifest", - "RadrootsEventsIndexedShardCheckpoint", - "RadrootsEventsIndexedIndexCheckpoint", -]; - -#[cfg(test)] -mod tests { - use super::TYPE_EXPORTS; - - #[test] - fn exports_indexed_manifest_and_checkpoint_types() { - assert!(TYPE_EXPORTS.contains(&"RadrootsEventsIndexedManifest")); - assert!(TYPE_EXPORTS.contains(&"RadrootsEventsIndexedIndexCheckpoint")); - assert!(TYPE_EXPORTS.contains(&"RadrootsEventsIndexedShardId")); - } -} diff --git a/crates/replica_db_schema_bindings/Cargo.toml b/crates/replica_db_schema_bindings/Cargo.toml @@ -1,14 +0,0 @@ -[package] -name = "radroots_replica_db_schema_bindings" -description = "Generated bindings for Radroots replica schemas" -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -repository.workspace = true -homepage.workspace = true -publish = false - -[dependencies] -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,31 +0,0 @@ -pub use radroots_replica_db_schema as upstream; - -pub fn dto_registry() -> dto_bindgen_core::Registry { - upstream::dto::dto_registry() -} - -#[cfg(test)] -mod tests { - use super::dto_registry; - - #[test] - 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(&"IGcsLocationFindMany")); - assert!(actual.contains(&"IGcsLocationFindManyResolve")); - assert!(actual.contains(&"IMediaImageFindMany")); - assert!(actual.contains(&"INostrProfileFindMany")); - assert!(actual.contains(&"INostrRelayFindMany")); - } -} diff --git a/crates/replica_db_wasm/Cargo.toml b/crates/replica_db_wasm/Cargo.toml @@ -1,33 +0,0 @@ -[package] -name = "radroots_replica_db_wasm" -publish = false -version = "0.1.0-alpha.2" -edition.workspace = true -authors = ["Tyson Lupul <tyson@radroots.org>"] -rust-version.workspace = true -license.workspace = true -description = "WASM boundary for Radroots replica database access" -repository.workspace = true -homepage.workspace = true -readme = "README" - -[lib] -crate-type = ["cdylib", "rlib"] - -[dependencies] -radroots_sql_core = { workspace = true, features = ["web"] } -radroots_sdk_sql_wasm_runtime = { workspace = true } -radroots_replica_db = { workspace = true } -radroots_replica_db_schema = { workspace = true } -radroots_replica_sync = { workspace = true, features = ["std"] } -js-sys = { workspace = true } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } -serde-wasm-bindgen = { workspace = true } -wasm-bindgen = { workspace = true } - -[dev-dependencies] -wasm-bindgen-test = { workspace = true } - -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } diff --git a/crates/replica_db_wasm/README b/crates/replica_db_wasm/README @@ -1,25 +0,0 @@ -# radroots_replica_db_wasm - -This is the README for `radroots_replica_db_wasm`, which provides WebAssembly -bindings for `radroots_replica_db` in the `radroots` core libraries. - -## Overview - - * a wasm32-only wrapper around the replica database runtime surface; - * integration with `radroots_sql_wasm_core` for browser and worker SQL - execution; - * a small target-specific entry point layer rather than a separate database - implementation; - * intended for JavaScript-facing callers that need the replica database APIs - in wasm builds. - -## Copyright - -Except as otherwise noted, all files in the `radroots_replica_db_wasm` -distribution are - - Copyright (c) 2026 Tyson Lupul - -For information on usage and redistribution, and for a DISCLAIMER OF ALL -WARRANTIES, see LICENSE included in the `radroots_replica_db_wasm` -distribution. diff --git a/crates/replica_db_wasm/src/snapshot.rs b/crates/replica_db_wasm/src/snapshot.rs @@ -1,87 +0,0 @@ -use radroots_replica_db::ReplicaDbExportManifestRs; - -pub const EXPORT_MANIFEST_FIELD: &str = "manifest_rs"; -pub const EXPORT_DB_BYTES_FIELD: &str = "db_bytes"; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct ExportManifestSummary { - pub export_version: String, - pub replica_db_version: String, - pub backup_format_version: String, - pub schema_hash: String, - pub schema_table_count: usize, - pub migration_count: usize, - pub table_count_count: usize, -} - -pub fn synced_export_error(pending_count: usize, expected_count: usize) -> Option<String> { - if pending_count == 0 { - None - } else { - Some(format!( - "replica db export requires synced state (pending {pending_count}/{expected_count})" - )) - } -} - -pub fn export_manifest_summary(manifest: &ReplicaDbExportManifestRs) -> ExportManifestSummary { - ExportManifestSummary { - export_version: manifest.export_version.clone(), - replica_db_version: manifest.replica_db_version.clone(), - backup_format_version: manifest.backup_format_version.clone(), - schema_hash: manifest.schema_hash.clone(), - schema_table_count: manifest.schema.len(), - migration_count: manifest.migrations.len(), - table_count_count: manifest.table_counts.len(), - } -} - -#[cfg(test)] -mod tests { - use super::{ - EXPORT_DB_BYTES_FIELD, EXPORT_MANIFEST_FIELD, export_manifest_summary, synced_export_error, - }; - - fn manifest() -> radroots_replica_db::ReplicaDbExportManifestRs { - radroots_replica_db::ReplicaDbExportManifestRs { - export_version: "1".to_owned(), - replica_db_version: "0.1.0".to_owned(), - backup_format_version: "1".to_owned(), - schema_hash: "schema-hash".to_owned(), - schema: Vec::new(), - migrations: Vec::new(), - table_counts: Vec::new(), - } - } - - #[test] - fn export_snapshot_field_names_are_stable() { - assert_eq!(EXPORT_MANIFEST_FIELD, "manifest_rs"); - assert_eq!(EXPORT_DB_BYTES_FIELD, "db_bytes"); - } - - #[test] - fn synced_export_error_allows_empty_pending_queue() { - assert_eq!(synced_export_error(0, 4), None); - } - - #[test] - fn synced_export_error_reports_pending_and_expected_counts() { - assert_eq!( - synced_export_error(2, 4).expect("error"), - "replica db export requires synced state (pending 2/4)" - ); - } - - #[test] - fn export_manifest_summary_preserves_versions_and_counts() { - let summary = export_manifest_summary(&manifest()); - assert_eq!(summary.export_version, "1"); - assert_eq!(summary.replica_db_version, "0.1.0"); - assert_eq!(summary.backup_format_version, "1"); - assert_eq!(summary.schema_hash, "schema-hash"); - assert_eq!(summary.schema_table_count, 0); - assert_eq!(summary.migration_count, 0); - assert_eq!(summary.table_count_count, 0); - } -} diff --git a/crates/replica_db_wasm/src/wasm_impl.rs b/crates/replica_db_wasm/src/wasm_impl.rs @@ -1,896 +0,0 @@ -use crate::{ - snapshot::{EXPORT_DB_BYTES_FIELD, EXPORT_MANIFEST_FIELD, synced_export_error}, - utils::value_to_js, -}; -use radroots_replica_db::migrations; -use radroots_replica_db::{ReplicaDbExportManifestRs, export_manifest}; -use radroots_replica_sync::radroots_replica_sync_status; -use radroots_sdk_sql_wasm_runtime::parse_json; -use radroots_sdk_sql_wasm_runtime::{ - WasmSqlExecutor, err_js, export_bytes, export_lock_begin, export_lock_end, - with_export_lock_bypass, -}; -use wasm_bindgen::JsValue; -use wasm_bindgen::prelude::*; - -use radroots_replica_db_schema::farm::{ - IFarmCreate, IFarmDelete, IFarmFindMany, IFarmFindOne, IFarmUpdate, -}; - -use radroots_replica_db_schema::farm_gcs_location::{ - IFarmGcsLocationCreate, IFarmGcsLocationDelete, IFarmGcsLocationFindMany, - IFarmGcsLocationFindOne, IFarmGcsLocationUpdate, -}; - -use radroots_replica_db_schema::farm_member::{ - IFarmMemberCreate, IFarmMemberDelete, IFarmMemberFindMany, IFarmMemberFindOne, - IFarmMemberUpdate, -}; - -use radroots_replica_db_schema::farm_member_claim::{ - IFarmMemberClaimCreate, IFarmMemberClaimDelete, IFarmMemberClaimFindMany, - IFarmMemberClaimFindOne, IFarmMemberClaimUpdate, -}; - -use radroots_replica_db_schema::farm_tag::{ - IFarmTagCreate, IFarmTagDelete, IFarmTagFindMany, IFarmTagFindOne, IFarmTagUpdate, -}; - -use radroots_replica_db_schema::gcs_location::{ - IGcsLocationCreate, IGcsLocationDelete, IGcsLocationFindMany, IGcsLocationFindOne, - IGcsLocationUpdate, -}; - -use radroots_replica_db_schema::log_error::{ - ILogErrorCreate, ILogErrorDelete, ILogErrorFindMany, ILogErrorFindOne, ILogErrorUpdate, -}; - -use radroots_replica_db_schema::media_image::{ - IMediaImageCreate, IMediaImageDelete, IMediaImageFindMany, IMediaImageFindOne, - IMediaImageUpdate, -}; - -use radroots_replica_db_schema::nostr_profile::{ - INostrProfileCreate, INostrProfileDelete, INostrProfileFindMany, INostrProfileFindOne, - INostrProfileUpdate, -}; - -use radroots_replica_db_schema::nostr_event_head::{ - INostrEventHeadCreate, INostrEventHeadDelete, INostrEventHeadFindMany, INostrEventHeadFindOne, - INostrEventHeadUpdate, -}; - -use radroots_replica_db_schema::nostr_relay::{ - INostrRelayCreate, INostrRelayDelete, INostrRelayFindMany, INostrRelayFindOne, - INostrRelayUpdate, -}; - -use radroots_replica_db_schema::trade_product::{ - ITradeProductCreate, ITradeProductDelete, ITradeProductFindMany, ITradeProductFindOne, - ITradeProductUpdate, -}; - -use radroots_replica_db_schema::plot::{ - IPlotCreate, IPlotDelete, IPlotFindMany, IPlotFindOne, IPlotUpdate, -}; - -use radroots_replica_db_schema::plot_gcs_location::{ - IPlotGcsLocationCreate, IPlotGcsLocationDelete, IPlotGcsLocationFindMany, - IPlotGcsLocationFindOne, IPlotGcsLocationUpdate, -}; - -use radroots_replica_db_schema::plot_tag::{ - IPlotTagCreate, IPlotTagDelete, IPlotTagFindMany, IPlotTagFindOne, IPlotTagUpdate, -}; - -use radroots_replica_db_schema::nostr_profile_relay::INostrProfileRelayRelation; - -use radroots_replica_db_schema::trade_product_location::ITradeProductLocationRelation; - -use radroots_replica_db_schema::trade_product_media::ITradeProductMediaRelation; - -#[wasm_bindgen(js_name = replica_db_run_migrations)] -pub fn replica_db_run_migrations() -> Result<(), JsValue> { - let exec = WasmSqlExecutor::new(); - migrations::run_all_up(&exec).map_err(err_js) -} - -#[wasm_bindgen(js_name = replica_db_reset_database)] -pub fn replica_db_reset_database() -> Result<(), JsValue> { - let exec = WasmSqlExecutor::new(); - migrations::run_all_down(&exec).map_err(err_js) -} - -#[wasm_bindgen(js_name = replica_db_export_json)] -pub fn replica_db_export_json() -> Result<JsValue, JsValue> { - let exec = WasmSqlExecutor::new(); - let dump = radroots_replica_db::backup::export_database_backup(&exec).map_err(err_js)?; - value_to_js(dump) -} - -#[wasm_bindgen(js_name = replica_db_import_json)] -pub fn replica_db_import_json(dump_json: &str) -> Result<(), JsValue> { - let exec = WasmSqlExecutor::new(); - radroots_replica_db::backup::restore_database_backup_json(&exec, dump_json).map_err(err_js) -} - -#[wasm_bindgen(js_name = replica_db_export_begin)] -pub fn replica_db_export_begin() -> Result<JsValue, JsValue> { - export_lock_begin().map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let result = with_export_lock_bypass(|| export_snapshot(&exec)); - match result { - Ok(value) => Ok(value), - Err(err) => { - export_lock_end(); - Err(err) - } - } -} - -#[wasm_bindgen(js_name = replica_db_export_finish)] -pub fn replica_db_export_finish() -> Result<(), JsValue> { - export_lock_end(); - Ok(()) -} - -fn export_snapshot(exec: &WasmSqlExecutor) -> Result<JsValue, JsValue> { - let status = radroots_replica_sync_status(exec).map_err(|err| { - err_js(radroots_sql_core::SqlError::InvalidArgument( - err.to_string(), - )) - })?; - if let Some(message) = synced_export_error(status.pending_count, status.expected_count) { - return Err(err_js(radroots_sql_core::SqlError::InvalidArgument( - message, - ))); - } - let manifest = export_manifest(exec).map_err(err_js)?; - export_snapshot_value(manifest) -} - -fn export_snapshot_value(manifest: ReplicaDbExportManifestRs) -> Result<JsValue, JsValue> { - let bytes_js = export_bytes(); - export_snapshot_value_with_bytes(manifest, bytes_js) -} - -fn export_snapshot_value_with_bytes( - manifest: ReplicaDbExportManifestRs, - bytes_js: JsValue, -) -> Result<JsValue, JsValue> { - let manifest_js = serde_wasm_bindgen::to_value(&manifest).map_err(|err| { - err_js(radroots_sql_core::SqlError::SerializationError( - err.to_string(), - )) - })?; - let obj = js_sys::Object::new(); - js_sys::Reflect::set( - &obj, - &JsValue::from_str(EXPORT_MANIFEST_FIELD), - &manifest_js, - ) - .map_err(|_| err_js(radroots_sql_core::SqlError::Internal))?; - js_sys::Reflect::set(&obj, &JsValue::from_str(EXPORT_DB_BYTES_FIELD), &bytes_js) - .map_err(|_| err_js(radroots_sql_core::SqlError::Internal))?; - Ok(JsValue::from(obj)) -} - -#[cfg(all(test, target_arch = "wasm32"))] -mod tests { - use super::export_snapshot_value_with_bytes; - use js_sys::{Reflect, Uint8Array}; - use wasm_bindgen::JsValue; - - #[wasm_bindgen_test::wasm_bindgen_test] - fn export_snapshot_value_includes_fields() { - let manifest = radroots_replica_db::ReplicaDbExportManifestRs { - export_version: "1".to_string(), - replica_db_version: "0.0.0".to_string(), - backup_format_version: "0.0.0".to_string(), - schema_hash: "hash".to_string(), - schema: Vec::new(), - migrations: Vec::new(), - table_counts: Vec::new(), - }; - let bytes = Uint8Array::new_with_length(2); - let js = - export_snapshot_value_with_bytes(manifest, JsValue::from(bytes)).expect("snapshot"); - let manifest_rs = - Reflect::get(&js, &JsValue::from_str("manifest_rs")).expect("manifest_rs"); - let db_bytes = Reflect::get(&js, &JsValue::from_str("db_bytes")).expect("db_bytes"); - assert!(manifest_rs.is_object()); - assert!(db_bytes.is_object()); - } -} - -#[wasm_bindgen(js_name = replica_db_farm_create)] -pub fn replica_db_farm_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_find_one)] -pub fn replica_db_farm_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_find_many)] -pub fn replica_db_farm_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_update)] -pub fn replica_db_farm_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_delete)] -pub fn replica_db_farm_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_create)] -pub fn replica_db_plot_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_find_one)] -pub fn replica_db_plot_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_find_many)] -pub fn replica_db_plot_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_update)] -pub fn replica_db_plot_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_delete)] -pub fn replica_db_plot_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_gcs_location_create)] -pub fn replica_db_gcs_location_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IGcsLocationCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::gcs_location::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_gcs_location_find_one)] -pub fn replica_db_gcs_location_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IGcsLocationFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::gcs_location::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_gcs_location_find_many)] -pub fn replica_db_gcs_location_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IGcsLocationFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::gcs_location::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_gcs_location_update)] -pub fn replica_db_gcs_location_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IGcsLocationUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::gcs_location::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_gcs_location_delete)] -pub fn replica_db_gcs_location_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IGcsLocationDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::gcs_location::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_gcs_location_create)] -pub fn replica_db_farm_gcs_location_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmGcsLocationCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_gcs_location::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_gcs_location_find_one)] -pub fn replica_db_farm_gcs_location_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmGcsLocationFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_gcs_location::find_one(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_gcs_location_find_many)] -pub fn replica_db_farm_gcs_location_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmGcsLocationFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_gcs_location::find_many(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_gcs_location_update)] -pub fn replica_db_farm_gcs_location_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmGcsLocationUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_gcs_location::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_gcs_location_delete)] -pub fn replica_db_farm_gcs_location_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmGcsLocationDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_gcs_location::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_gcs_location_create)] -pub fn replica_db_plot_gcs_location_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotGcsLocationCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::plot_gcs_location::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_gcs_location_find_one)] -pub fn replica_db_plot_gcs_location_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotGcsLocationFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_gcs_location::find_one(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_gcs_location_find_many)] -pub fn replica_db_plot_gcs_location_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotGcsLocationFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_gcs_location::find_many(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_gcs_location_update)] -pub fn replica_db_plot_gcs_location_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotGcsLocationUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::plot_gcs_location::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_gcs_location_delete)] -pub fn replica_db_plot_gcs_location_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotGcsLocationDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::plot_gcs_location::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_tag_create)] -pub fn replica_db_farm_tag_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmTagCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_tag::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_tag_find_one)] -pub fn replica_db_farm_tag_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmTagFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_tag::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_tag_find_many)] -pub fn replica_db_farm_tag_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmTagFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_tag::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_tag_update)] -pub fn replica_db_farm_tag_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmTagUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_tag::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_tag_delete)] -pub fn replica_db_farm_tag_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmTagDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_tag::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_tag_create)] -pub fn replica_db_plot_tag_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotTagCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_tag::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_tag_find_one)] -pub fn replica_db_plot_tag_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotTagFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_tag::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_tag_find_many)] -pub fn replica_db_plot_tag_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotTagFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_tag::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_tag_update)] -pub fn replica_db_plot_tag_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotTagUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_tag::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_plot_tag_delete)] -pub fn replica_db_plot_tag_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IPlotTagDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::plot_tag::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_create)] -pub fn replica_db_farm_member_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_member::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_find_one)] -pub fn replica_db_farm_member_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_member::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_find_many)] -pub fn replica_db_farm_member_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_member::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_update)] -pub fn replica_db_farm_member_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_member::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_delete)] -pub fn replica_db_farm_member_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_member::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_claim_create)] -pub fn replica_db_farm_member_claim_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberClaimCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_member_claim::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_claim_find_one)] -pub fn replica_db_farm_member_claim_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberClaimFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_member_claim::find_one(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_claim_find_many)] -pub fn replica_db_farm_member_claim_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberClaimFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::farm_member_claim::find_many(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_claim_update)] -pub fn replica_db_farm_member_claim_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberClaimUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_member_claim::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_farm_member_claim_delete)] -pub fn replica_db_farm_member_claim_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IFarmMemberClaimDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::farm_member_claim::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_log_error_create)] -pub fn replica_db_log_error_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ILogErrorCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::log_error::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_log_error_find_one)] -pub fn replica_db_log_error_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ILogErrorFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::log_error::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_log_error_find_many)] -pub fn replica_db_log_error_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ILogErrorFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::log_error::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_log_error_update)] -pub fn replica_db_log_error_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ILogErrorUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::log_error::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_log_error_delete)] -pub fn replica_db_log_error_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ILogErrorDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::log_error::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_media_image_create)] -pub fn replica_db_media_image_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IMediaImageCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::media_image::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_media_image_find_one)] -pub fn replica_db_media_image_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IMediaImageFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::media_image::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_media_image_find_many)] -pub fn replica_db_media_image_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IMediaImageFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::media_image::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_media_image_update)] -pub fn replica_db_media_image_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IMediaImageUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::media_image::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_media_image_delete)] -pub fn replica_db_media_image_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: IMediaImageDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::media_image::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_create)] -pub fn replica_db_nostr_profile_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_find_one)] -pub fn replica_db_nostr_profile_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_find_many)] -pub fn replica_db_nostr_profile_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_update)] -pub fn replica_db_nostr_profile_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_delete)] -pub fn replica_db_nostr_profile_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_event_head_create)] -pub fn replica_db_nostr_event_head_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrEventHeadCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_event_head::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_event_head_find_one)] -pub fn replica_db_nostr_event_head_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrEventHeadFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_event_head::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_event_head_find_many)] -pub fn replica_db_nostr_event_head_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrEventHeadFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::nostr_event_head::find_many(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_event_head_update)] -pub fn replica_db_nostr_event_head_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrEventHeadUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_event_head::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_event_head_delete)] -pub fn replica_db_nostr_event_head_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrEventHeadDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_event_head::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_relay_create)] -pub fn replica_db_nostr_relay_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrRelayCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::nostr_relay::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_relay_find_one)] -pub fn replica_db_nostr_relay_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrRelayFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_relay::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_relay_find_many)] -pub fn replica_db_nostr_relay_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrRelayFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_relay::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_relay_update)] -pub fn replica_db_nostr_relay_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrRelayUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::nostr_relay::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_relay_delete)] -pub fn replica_db_nostr_relay_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrRelayDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::nostr_relay::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_create)] -pub fn replica_db_trade_product_create(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductCreate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product::create(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_find_one)] -pub fn replica_db_trade_product_find_one(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductFindOne = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_find_many)] -pub fn replica_db_trade_product_find_many(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductFindMany = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_update)] -pub fn replica_db_trade_product_update(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductUpdate = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product::update(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_delete)] -pub fn replica_db_trade_product_delete(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductDelete = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product::delete(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_relay_set)] -pub fn replica_db_nostr_profile_relay_set(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileRelayRelation = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile_relay::set(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_nostr_profile_relay_unset)] -pub fn replica_db_nostr_profile_relay_unset(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: INostrProfileRelayRelation = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::nostr_profile_relay::unset(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_location_set)] -pub fn replica_db_trade_product_location_set(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductLocationRelation = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::trade_product_location::set(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_location_unset)] -pub fn replica_db_trade_product_location_unset(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductLocationRelation = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = radroots_replica_db::trade_product_location::unset(&exec, &opts) - .map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_media_set)] -pub fn replica_db_trade_product_media_set(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductMediaRelation = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product_media::set(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} - -#[wasm_bindgen(js_name = replica_db_trade_product_media_unset)] -pub fn replica_db_trade_product_media_unset(opts_json: &str) -> Result<JsValue, JsValue> { - let opts: ITradeProductMediaRelation = parse_json(opts_json).map_err(err_js)?; - let exec = WasmSqlExecutor::new(); - let out = - radroots_replica_db::trade_product_media::unset(&exec, &opts).map_err(|e| err_js(e.err))?; - value_to_js(out) -} diff --git a/crates/replica_schema_bindings/Cargo.toml b/crates/replica_schema_bindings/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "radroots_replica_schema_bindings" +description = "Generated bindings for Radroots replica schemas" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +repository.workspace = true +homepage.workspace = true +publish = false + +[dependencies] +dto_bindgen_core = { workspace = true } +radroots_replica_schema = { workspace = true, features = ["dto-bindgen"] } diff --git a/crates/replica_schema_bindings/src/lib.rs b/crates/replica_schema_bindings/src/lib.rs @@ -0,0 +1,31 @@ +pub use radroots_replica_schema as upstream; + +pub fn dto_registry() -> dto_bindgen_core::Registry { + upstream::dto::dto_registry() +} + +#[cfg(test)] +mod tests { + use super::dto_registry; + + #[test] + 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(&"IGcsLocationFindMany")); + assert!(actual.contains(&"IGcsLocationFindManyResolve")); + assert!(actual.contains(&"IMediaImageFindMany")); + assert!(actual.contains(&"INostrProfileFindMany")); + assert!(actual.contains(&"INostrRelayFindMany")); + } +} diff --git a/crates/replica_store_wasm/Cargo.toml b/crates/replica_store_wasm/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "radroots_replica_store_wasm" +publish = false +version = "0.1.0-alpha.2" +edition.workspace = true +authors = ["Tyson Lupul <tyson@radroots.org>"] +rust-version.workspace = true +license.workspace = true +description = "WASM boundary for Radroots replica store access" +repository.workspace = true +homepage.workspace = true +readme = "README" + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +radroots_sql_core = { workspace = true, features = ["web"] } +radroots_sdk_sql_wasm_runtime = { workspace = true } +radroots_replica_store = { workspace = true } +radroots_replica_schema = { workspace = true } +radroots_replica_sync = { workspace = true, features = ["std"] } +js-sys = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +serde-wasm-bindgen = { workspace = true } +wasm-bindgen = { workspace = true } + +[dev-dependencies] +wasm-bindgen-test = { workspace = true } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] } diff --git a/crates/replica_store_wasm/README b/crates/replica_store_wasm/README @@ -0,0 +1,25 @@ +# radroots_replica_store_wasm + +This is the README for `radroots_replica_store_wasm`, which provides WebAssembly +bindings for `radroots_replica_store` in the `radroots` core libraries. + +## Overview + + * a wasm32-only wrapper around the replica store runtime surface; + * integration with `radroots_sql_wasm_core` for browser and worker SQL + execution; + * a small target-specific entry point layer rather than a separate database + implementation; + * intended for JavaScript-facing callers that need the replica store APIs + in wasm builds. + +## Copyright + +Except as otherwise noted, all files in the `radroots_replica_store_wasm` +distribution are + + Copyright (c) 2026 Tyson Lupul + +For information on usage and redistribution, and for a DISCLAIMER OF ALL +WARRANTIES, see LICENSE included in the `radroots_replica_store_wasm` +distribution. diff --git a/crates/replica_db_wasm/src/lib.rs b/crates/replica_store_wasm/src/lib.rs diff --git a/crates/replica_store_wasm/src/snapshot.rs b/crates/replica_store_wasm/src/snapshot.rs @@ -0,0 +1,87 @@ +use radroots_replica_store::ReplicaStoreExportManifestRs; + +pub const EXPORT_MANIFEST_FIELD: &str = "manifest_rs"; +pub const EXPORT_DB_BYTES_FIELD: &str = "db_bytes"; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ExportManifestSummary { + pub export_version: String, + pub replica_store_version: String, + pub backup_format_version: String, + pub schema_hash: String, + pub schema_table_count: usize, + pub migration_count: usize, + pub table_count_count: usize, +} + +pub fn synced_export_error(pending_count: usize, expected_count: usize) -> Option<String> { + if pending_count == 0 { + None + } else { + Some(format!( + "replica store export requires synced state (pending {pending_count}/{expected_count})" + )) + } +} + +pub fn export_manifest_summary(manifest: &ReplicaStoreExportManifestRs) -> ExportManifestSummary { + ExportManifestSummary { + export_version: manifest.export_version.clone(), + replica_store_version: manifest.replica_store_version.clone(), + backup_format_version: manifest.backup_format_version.clone(), + schema_hash: manifest.schema_hash.clone(), + schema_table_count: manifest.schema.len(), + migration_count: manifest.migrations.len(), + table_count_count: manifest.table_counts.len(), + } +} + +#[cfg(test)] +mod tests { + use super::{ + EXPORT_DB_BYTES_FIELD, EXPORT_MANIFEST_FIELD, export_manifest_summary, synced_export_error, + }; + + fn manifest() -> radroots_replica_store::ReplicaStoreExportManifestRs { + radroots_replica_store::ReplicaStoreExportManifestRs { + export_version: "1".to_owned(), + replica_store_version: "0.1.0".to_owned(), + backup_format_version: "1".to_owned(), + schema_hash: "schema-hash".to_owned(), + schema: Vec::new(), + migrations: Vec::new(), + table_counts: Vec::new(), + } + } + + #[test] + fn export_snapshot_field_names_are_stable() { + assert_eq!(EXPORT_MANIFEST_FIELD, "manifest_rs"); + assert_eq!(EXPORT_DB_BYTES_FIELD, "db_bytes"); + } + + #[test] + fn synced_export_error_allows_empty_pending_queue() { + assert_eq!(synced_export_error(0, 4), None); + } + + #[test] + fn synced_export_error_reports_pending_and_expected_counts() { + assert_eq!( + synced_export_error(2, 4).expect("error"), + "replica store export requires synced state (pending 2/4)" + ); + } + + #[test] + fn export_manifest_summary_preserves_versions_and_counts() { + let summary = export_manifest_summary(&manifest()); + assert_eq!(summary.export_version, "1"); + assert_eq!(summary.replica_store_version, "0.1.0"); + assert_eq!(summary.backup_format_version, "1"); + assert_eq!(summary.schema_hash, "schema-hash"); + assert_eq!(summary.schema_table_count, 0); + assert_eq!(summary.migration_count, 0); + assert_eq!(summary.table_count_count, 0); + } +} diff --git a/crates/replica_db_wasm/src/utils.rs b/crates/replica_store_wasm/src/utils.rs diff --git a/crates/replica_store_wasm/src/wasm_impl.rs b/crates/replica_store_wasm/src/wasm_impl.rs @@ -0,0 +1,914 @@ +use crate::{ + snapshot::{EXPORT_DB_BYTES_FIELD, EXPORT_MANIFEST_FIELD, synced_export_error}, + utils::value_to_js, +}; +use radroots_replica_store::migrations; +use radroots_replica_store::{ReplicaStoreExportManifestRs, export_manifest}; +use radroots_replica_sync::radroots_replica_sync_status; +use radroots_sdk_sql_wasm_runtime::parse_json; +use radroots_sdk_sql_wasm_runtime::{ + WasmSqlExecutor, err_js, export_bytes, export_lock_begin, export_lock_end, + with_export_lock_bypass, +}; +use wasm_bindgen::JsValue; +use wasm_bindgen::prelude::*; + +use radroots_replica_schema::farm::{ + IFarmCreate, IFarmDelete, IFarmFindMany, IFarmFindOne, IFarmUpdate, +}; + +use radroots_replica_schema::farm_gcs_location::{ + IFarmGcsLocationCreate, IFarmGcsLocationDelete, IFarmGcsLocationFindMany, + IFarmGcsLocationFindOne, IFarmGcsLocationUpdate, +}; + +use radroots_replica_schema::farm_member::{ + IFarmMemberCreate, IFarmMemberDelete, IFarmMemberFindMany, IFarmMemberFindOne, + IFarmMemberUpdate, +}; + +use radroots_replica_schema::farm_member_claim::{ + IFarmMemberClaimCreate, IFarmMemberClaimDelete, IFarmMemberClaimFindMany, + IFarmMemberClaimFindOne, IFarmMemberClaimUpdate, +}; + +use radroots_replica_schema::farm_tag::{ + IFarmTagCreate, IFarmTagDelete, IFarmTagFindMany, IFarmTagFindOne, IFarmTagUpdate, +}; + +use radroots_replica_schema::gcs_location::{ + IGcsLocationCreate, IGcsLocationDelete, IGcsLocationFindMany, IGcsLocationFindOne, + IGcsLocationUpdate, +}; + +use radroots_replica_schema::log_error::{ + ILogErrorCreate, ILogErrorDelete, ILogErrorFindMany, ILogErrorFindOne, ILogErrorUpdate, +}; + +use radroots_replica_schema::media_image::{ + IMediaImageCreate, IMediaImageDelete, IMediaImageFindMany, IMediaImageFindOne, + IMediaImageUpdate, +}; + +use radroots_replica_schema::nostr_profile::{ + INostrProfileCreate, INostrProfileDelete, INostrProfileFindMany, INostrProfileFindOne, + INostrProfileUpdate, +}; + +use radroots_replica_schema::nostr_event_head::{ + INostrEventHeadCreate, INostrEventHeadDelete, INostrEventHeadFindMany, INostrEventHeadFindOne, + INostrEventHeadUpdate, +}; + +use radroots_replica_schema::nostr_relay::{ + INostrRelayCreate, INostrRelayDelete, INostrRelayFindMany, INostrRelayFindOne, + INostrRelayUpdate, +}; + +use radroots_replica_schema::trade_product::{ + ITradeProductCreate, ITradeProductDelete, ITradeProductFindMany, ITradeProductFindOne, + ITradeProductUpdate, +}; + +use radroots_replica_schema::plot::{ + IPlotCreate, IPlotDelete, IPlotFindMany, IPlotFindOne, IPlotUpdate, +}; + +use radroots_replica_schema::plot_gcs_location::{ + IPlotGcsLocationCreate, IPlotGcsLocationDelete, IPlotGcsLocationFindMany, + IPlotGcsLocationFindOne, IPlotGcsLocationUpdate, +}; + +use radroots_replica_schema::plot_tag::{ + IPlotTagCreate, IPlotTagDelete, IPlotTagFindMany, IPlotTagFindOne, IPlotTagUpdate, +}; + +use radroots_replica_schema::nostr_profile_relay::INostrProfileRelayRelation; + +use radroots_replica_schema::trade_product_location::ITradeProductLocationRelation; + +use radroots_replica_schema::trade_product_media::ITradeProductMediaRelation; + +#[wasm_bindgen(js_name = replica_store_run_migrations)] +pub fn replica_store_run_migrations() -> Result<(), JsValue> { + let exec = WasmSqlExecutor::new(); + migrations::run_all_up(&exec).map_err(err_js) +} + +#[wasm_bindgen(js_name = replica_store_reset_database)] +pub fn replica_store_reset_database() -> Result<(), JsValue> { + let exec = WasmSqlExecutor::new(); + migrations::run_all_down(&exec).map_err(err_js) +} + +#[wasm_bindgen(js_name = replica_store_export_json)] +pub fn replica_store_export_json() -> Result<JsValue, JsValue> { + let exec = WasmSqlExecutor::new(); + let dump = radroots_replica_store::backup::export_database_backup(&exec).map_err(err_js)?; + value_to_js(dump) +} + +#[wasm_bindgen(js_name = replica_store_import_json)] +pub fn replica_store_import_json(dump_json: &str) -> Result<(), JsValue> { + let exec = WasmSqlExecutor::new(); + radroots_replica_store::backup::restore_database_backup_json(&exec, dump_json).map_err(err_js) +} + +#[wasm_bindgen(js_name = replica_store_export_begin)] +pub fn replica_store_export_begin() -> Result<JsValue, JsValue> { + export_lock_begin().map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let result = with_export_lock_bypass(|| export_snapshot(&exec)); + match result { + Ok(value) => Ok(value), + Err(err) => { + export_lock_end(); + Err(err) + } + } +} + +#[wasm_bindgen(js_name = replica_store_export_finish)] +pub fn replica_store_export_finish() -> Result<(), JsValue> { + export_lock_end(); + Ok(()) +} + +fn export_snapshot(exec: &WasmSqlExecutor) -> Result<JsValue, JsValue> { + let status = radroots_replica_sync_status(exec).map_err(|err| { + err_js(radroots_sql_core::SqlError::InvalidArgument( + err.to_string(), + )) + })?; + if let Some(message) = synced_export_error(status.pending_count, status.expected_count) { + return Err(err_js(radroots_sql_core::SqlError::InvalidArgument( + message, + ))); + } + let manifest = export_manifest(exec).map_err(err_js)?; + export_snapshot_value(manifest) +} + +fn export_snapshot_value(manifest: ReplicaStoreExportManifestRs) -> Result<JsValue, JsValue> { + let bytes_js = export_bytes(); + export_snapshot_value_with_bytes(manifest, bytes_js) +} + +fn export_snapshot_value_with_bytes( + manifest: ReplicaStoreExportManifestRs, + bytes_js: JsValue, +) -> Result<JsValue, JsValue> { + let manifest_js = serde_wasm_bindgen::to_value(&manifest).map_err(|err| { + err_js(radroots_sql_core::SqlError::SerializationError( + err.to_string(), + )) + })?; + let obj = js_sys::Object::new(); + js_sys::Reflect::set( + &obj, + &JsValue::from_str(EXPORT_MANIFEST_FIELD), + &manifest_js, + ) + .map_err(|_| err_js(radroots_sql_core::SqlError::Internal))?; + js_sys::Reflect::set(&obj, &JsValue::from_str(EXPORT_DB_BYTES_FIELD), &bytes_js) + .map_err(|_| err_js(radroots_sql_core::SqlError::Internal))?; + Ok(JsValue::from(obj)) +} + +#[cfg(all(test, target_arch = "wasm32"))] +mod tests { + use super::export_snapshot_value_with_bytes; + use js_sys::{Reflect, Uint8Array}; + use wasm_bindgen::JsValue; + + #[wasm_bindgen_test::wasm_bindgen_test] + fn export_snapshot_value_includes_fields() { + let manifest = radroots_replica_store::ReplicaStoreExportManifestRs { + export_version: "1".to_string(), + replica_store_version: "0.0.0".to_string(), + backup_format_version: "0.0.0".to_string(), + schema_hash: "hash".to_string(), + schema: Vec::new(), + migrations: Vec::new(), + table_counts: Vec::new(), + }; + let bytes = Uint8Array::new_with_length(2); + let js = + export_snapshot_value_with_bytes(manifest, JsValue::from(bytes)).expect("snapshot"); + let manifest_rs = + Reflect::get(&js, &JsValue::from_str("manifest_rs")).expect("manifest_rs"); + let db_bytes = Reflect::get(&js, &JsValue::from_str("db_bytes")).expect("db_bytes"); + assert!(manifest_rs.is_object()); + assert!(db_bytes.is_object()); + } +} + +#[wasm_bindgen(js_name = replica_store_farm_create)] +pub fn replica_store_farm_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_find_one)] +pub fn replica_store_farm_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_find_many)] +pub fn replica_store_farm_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_update)] +pub fn replica_store_farm_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_delete)] +pub fn replica_store_farm_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_create)] +pub fn replica_store_plot_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_find_one)] +pub fn replica_store_plot_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_find_many)] +pub fn replica_store_plot_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_update)] +pub fn replica_store_plot_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_delete)] +pub fn replica_store_plot_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_gcs_location_create)] +pub fn replica_store_gcs_location_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IGcsLocationCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::gcs_location::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_gcs_location_find_one)] +pub fn replica_store_gcs_location_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IGcsLocationFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::gcs_location::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_gcs_location_find_many)] +pub fn replica_store_gcs_location_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IGcsLocationFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::gcs_location::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_gcs_location_update)] +pub fn replica_store_gcs_location_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IGcsLocationUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::gcs_location::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_gcs_location_delete)] +pub fn replica_store_gcs_location_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IGcsLocationDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::gcs_location::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_gcs_location_create)] +pub fn replica_store_farm_gcs_location_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmGcsLocationCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_gcs_location::create(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_gcs_location_find_one)] +pub fn replica_store_farm_gcs_location_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmGcsLocationFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_gcs_location::find_one(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_gcs_location_find_many)] +pub fn replica_store_farm_gcs_location_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmGcsLocationFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_gcs_location::find_many(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_gcs_location_update)] +pub fn replica_store_farm_gcs_location_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmGcsLocationUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_gcs_location::update(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_gcs_location_delete)] +pub fn replica_store_farm_gcs_location_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmGcsLocationDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_gcs_location::delete(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_gcs_location_create)] +pub fn replica_store_plot_gcs_location_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotGcsLocationCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_gcs_location::create(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_gcs_location_find_one)] +pub fn replica_store_plot_gcs_location_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotGcsLocationFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_gcs_location::find_one(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_gcs_location_find_many)] +pub fn replica_store_plot_gcs_location_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotGcsLocationFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_gcs_location::find_many(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_gcs_location_update)] +pub fn replica_store_plot_gcs_location_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotGcsLocationUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_gcs_location::update(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_gcs_location_delete)] +pub fn replica_store_plot_gcs_location_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotGcsLocationDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_gcs_location::delete(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_tag_create)] +pub fn replica_store_farm_tag_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmTagCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_tag::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_tag_find_one)] +pub fn replica_store_farm_tag_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmTagFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_tag::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_tag_find_many)] +pub fn replica_store_farm_tag_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmTagFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_tag::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_tag_update)] +pub fn replica_store_farm_tag_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmTagUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_tag::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_tag_delete)] +pub fn replica_store_farm_tag_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmTagDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_tag::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_tag_create)] +pub fn replica_store_plot_tag_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotTagCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_tag::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_tag_find_one)] +pub fn replica_store_plot_tag_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotTagFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::plot_tag::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_tag_find_many)] +pub fn replica_store_plot_tag_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotTagFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::plot_tag::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_tag_update)] +pub fn replica_store_plot_tag_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotTagUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_tag::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_plot_tag_delete)] +pub fn replica_store_plot_tag_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IPlotTagDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::plot_tag::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_create)] +pub fn replica_store_farm_member_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_member::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_find_one)] +pub fn replica_store_farm_member_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_member::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_find_many)] +pub fn replica_store_farm_member_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_member::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_update)] +pub fn replica_store_farm_member_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_member::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_delete)] +pub fn replica_store_farm_member_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::farm_member::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_claim_create)] +pub fn replica_store_farm_member_claim_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberClaimCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_member_claim::create(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_claim_find_one)] +pub fn replica_store_farm_member_claim_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberClaimFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_member_claim::find_one(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_claim_find_many)] +pub fn replica_store_farm_member_claim_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberClaimFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_member_claim::find_many(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_claim_update)] +pub fn replica_store_farm_member_claim_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberClaimUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_member_claim::update(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_farm_member_claim_delete)] +pub fn replica_store_farm_member_claim_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IFarmMemberClaimDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::farm_member_claim::delete(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_log_error_create)] +pub fn replica_store_log_error_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ILogErrorCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::log_error::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_log_error_find_one)] +pub fn replica_store_log_error_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ILogErrorFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::log_error::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_log_error_find_many)] +pub fn replica_store_log_error_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ILogErrorFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::log_error::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_log_error_update)] +pub fn replica_store_log_error_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ILogErrorUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::log_error::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_log_error_delete)] +pub fn replica_store_log_error_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ILogErrorDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::log_error::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_media_image_create)] +pub fn replica_store_media_image_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IMediaImageCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::media_image::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_media_image_find_one)] +pub fn replica_store_media_image_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IMediaImageFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::media_image::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_media_image_find_many)] +pub fn replica_store_media_image_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IMediaImageFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::media_image::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_media_image_update)] +pub fn replica_store_media_image_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IMediaImageUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::media_image::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_media_image_delete)] +pub fn replica_store_media_image_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: IMediaImageDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::media_image::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_create)] +pub fn replica_store_nostr_profile_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_profile::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_find_one)] +pub fn replica_store_nostr_profile_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_profile::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_find_many)] +pub fn replica_store_nostr_profile_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_profile::find_many(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_update)] +pub fn replica_store_nostr_profile_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_profile::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_delete)] +pub fn replica_store_nostr_profile_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_profile::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_event_head_create)] +pub fn replica_store_nostr_event_head_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrEventHeadCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_event_head::create(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_event_head_find_one)] +pub fn replica_store_nostr_event_head_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrEventHeadFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_event_head::find_one(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_event_head_find_many)] +pub fn replica_store_nostr_event_head_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrEventHeadFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_event_head::find_many(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_event_head_update)] +pub fn replica_store_nostr_event_head_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrEventHeadUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_event_head::update(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_event_head_delete)] +pub fn replica_store_nostr_event_head_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrEventHeadDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_event_head::delete(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_relay_create)] +pub fn replica_store_nostr_relay_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrRelayCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_relay::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_relay_find_one)] +pub fn replica_store_nostr_relay_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrRelayFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_relay::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_relay_find_many)] +pub fn replica_store_nostr_relay_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrRelayFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_relay::find_many(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_relay_update)] +pub fn replica_store_nostr_relay_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrRelayUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_relay::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_relay_delete)] +pub fn replica_store_nostr_relay_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrRelayDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::nostr_relay::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_create)] +pub fn replica_store_trade_product_create(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductCreate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::trade_product::create(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_find_one)] +pub fn replica_store_trade_product_find_one(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductFindOne = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::trade_product::find_one(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_find_many)] +pub fn replica_store_trade_product_find_many(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductFindMany = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::trade_product::find_many(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_update)] +pub fn replica_store_trade_product_update(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductUpdate = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::trade_product::update(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_delete)] +pub fn replica_store_trade_product_delete(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductDelete = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = + radroots_replica_store::trade_product::delete(&exec, &opts).map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_relay_set)] +pub fn replica_store_nostr_profile_relay_set(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileRelayRelation = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_profile_relay::set(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_nostr_profile_relay_unset)] +pub fn replica_store_nostr_profile_relay_unset(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: INostrProfileRelayRelation = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::nostr_profile_relay::unset(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_location_set)] +pub fn replica_store_trade_product_location_set(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductLocationRelation = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::trade_product_location::set(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_location_unset)] +pub fn replica_store_trade_product_location_unset(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductLocationRelation = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::trade_product_location::unset(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_media_set)] +pub fn replica_store_trade_product_media_set(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductMediaRelation = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::trade_product_media::set(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} + +#[wasm_bindgen(js_name = replica_store_trade_product_media_unset)] +pub fn replica_store_trade_product_media_unset(opts_json: &str) -> Result<JsValue, JsValue> { + let opts: ITradeProductMediaRelation = parse_json(opts_json).map_err(err_js)?; + let exec = WasmSqlExecutor::new(); + let out = radroots_replica_store::trade_product_media::unset(&exec, &opts) + .map_err(|e| err_js(e.err))?; + value_to_js(out) +} diff --git a/crates/sdk/Cargo.toml b/crates/sdk/Cargo.toml @@ -187,10 +187,10 @@ nostr = { workspace = true } radroots_core = { workspace = true, default-features = false, features = [ "std", ] } -radroots_replica_db = { workspace = true, default-features = false, features = [ +radroots_replica_store = { workspace = true, default-features = false, features = [ "native", ] } -radroots_replica_db_schema = { workspace = true } +radroots_replica_schema = { workspace = true } radroots_replica_sync = { workspace = true, features = ["std"] } radroots_sql_core = { workspace = true, features = ["native"] } radroots_nostr = { workspace = true, default-features = false, features = [ diff --git a/crates/sdk/tests/replica_ingest.rs b/crates/sdk/tests/replica_ingest.rs @@ -1,6 +1,6 @@ use radroots_event::{RadrootsEventEnvelope, farm::RadrootsFarm}; -use radroots_replica_db::ReplicaSql; -use radroots_replica_db_schema::farm::IFarmFindMany; +use radroots_replica_schema::farm::IFarmFindMany; +use radroots_replica_store::ReplicaSql; use radroots_replica_sync::{RadrootsReplicaIngestOutcome, radroots_replica_ingest_event}; use radroots_sql_core::{SqlExecutor, SqliteExecutor}; use tempfile::{TempDir, tempdir}; diff --git a/crates/sdk/tests/runtime_foundation.rs b/crates/sdk/tests/runtime_foundation.rs @@ -1047,7 +1047,7 @@ fn sdk_examples_stay_on_product_api_boundary() { for (name, example) in examples { assert!(!example.contains("WireEventParts"), "{name}"); assert!(!example.contains("protocol::wire"), "{name}"); - assert!(!example.contains("events_codec::wire"), "{name}"); + assert!(!example.contains("event_codec::wire"), "{name}"); assert!(!example.contains(".as_wire_parts("), "{name}"); assert!(!example.contains(".into_wire_parts("), "{name}"); } diff --git a/crates/sdk/tests/source_boundary.rs b/crates/sdk/tests/source_boundary.rs @@ -1904,8 +1904,8 @@ fn sdk_transport_policy_sources_reject_configured_profile_and_proxy_relay_bridge "src", "tests", "examples", - "packages/events-bindings/src", - "packages/events-codec-js/src", + "packages/event-bindings/src", + "packages/event-codec-js/src", ] { let root = manifest_dir.join(relative_path); if !root.exists() { diff --git a/packages/events-bindings/LICENSE-APACHE b/packages/event-bindings/LICENSE-APACHE diff --git a/packages/events-bindings/LICENSE-MIT b/packages/event-bindings/LICENSE-MIT diff --git a/packages/event-bindings/README.md b/packages/event-bindings/README.md @@ -0,0 +1,9 @@ +# @radroots/event-bindings + +TypeScript bindings for radroots_event + +This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. + +## License + +Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/event-bindings/package.json b/packages/event-bindings/package.json @@ -0,0 +1,39 @@ +{ + "name": "@radroots/event-bindings", + "version": "0.1.0", + "description": "TypeScript bindings for radroots_event", + "license": "MIT OR Apache-2.0", + "homepage": "https://radroots.org", + "repository": { + "type": "git", + "url": "git+https://github.com/radrootslabs/sdk.git", + "directory": "packages/event-bindings" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "sideEffects": false, + "files": [ + "dist", + "README.md", + "LICENSE-MIT", + "LICENSE-APACHE" + ], + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "typecheck": "tsc -p tsconfig.json --noEmit" + }, + "dependencies": { + "@radroots/core-bindings": "workspace:^" + } +} diff --git a/packages/events-bindings/src/generated/constants.ts b/packages/event-bindings/src/generated/constants.ts diff --git a/packages/events-bindings/src/generated/kinds.ts b/packages/event-bindings/src/generated/kinds.ts diff --git a/packages/events-bindings/src/generated/types.ts b/packages/event-bindings/src/generated/types.ts diff --git a/packages/events-bindings/src/index.ts b/packages/event-bindings/src/index.ts diff --git a/packages/events-bindings/tsconfig.json b/packages/event-bindings/tsconfig.json diff --git a/packages/events-codec-wasm/LICENSE-APACHE b/packages/event-codec-wasm/LICENSE-APACHE diff --git a/packages/events-codec-wasm/LICENSE-MIT b/packages/event-codec-wasm/LICENSE-MIT diff --git a/packages/event-codec-wasm/README.md b/packages/event-codec-wasm/README.md @@ -0,0 +1,9 @@ +# @radroots/event-codec-wasm + +WebAssembly bindings for radroots_event_codec + +This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. + +## License + +Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/event-codec-wasm/package.json b/packages/event-codec-wasm/package.json @@ -0,0 +1,36 @@ +{ + "name": "@radroots/event-codec-wasm", + "version": "0.1.0", + "description": "WebAssembly bindings for radroots_event_codec", + "license": "MIT OR Apache-2.0", + "homepage": "https://radroots.org", + "repository": { + "type": "git", + "url": "git+https://github.com/radrootslabs/sdk.git", + "directory": "packages/event-codec-wasm" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "sideEffects": false, + "files": [ + "dist", + "README.md", + "LICENSE-MIT", + "LICENSE-APACHE" + ], + "main": "./dist/radroots_event_codec_wasm.js", + "types": "./dist/radroots_event_codec_wasm.d.ts", + "exports": { + ".": { + "types": "./dist/radroots_event_codec_wasm.d.ts", + "import": "./dist/radroots_event_codec_wasm.js", + "default": "./dist/radroots_event_codec_wasm.js" + } + }, + "scripts": { + "build": "cd ../.. && cargo xtask generate wasm --package event_codec", + "typecheck": "tsc --noEmit --strict --module NodeNext --moduleResolution NodeNext --target ES2022 dist/radroots_event_codec_wasm.d.ts dist/radroots_event_codec_wasm_bg.wasm.d.ts" + } +} diff --git a/packages/events-indexed-bindings/LICENSE-APACHE b/packages/event-index-bindings/LICENSE-APACHE diff --git a/packages/events-indexed-bindings/LICENSE-MIT b/packages/event-index-bindings/LICENSE-MIT diff --git a/packages/event-index-bindings/README.md b/packages/event-index-bindings/README.md @@ -0,0 +1,9 @@ +# @radroots/event-index-bindings + +TypeScript bindings for radroots_event_index + +This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. + +## License + +Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/event-index-bindings/package.json b/packages/event-index-bindings/package.json @@ -0,0 +1,36 @@ +{ + "name": "@radroots/event-index-bindings", + "version": "0.1.0", + "description": "TypeScript bindings for radroots_event_index", + "license": "MIT OR Apache-2.0", + "homepage": "https://radroots.org", + "repository": { + "type": "git", + "url": "git+https://github.com/radrootslabs/sdk.git", + "directory": "packages/event-index-bindings" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "sideEffects": false, + "files": [ + "dist", + "README.md", + "LICENSE-MIT", + "LICENSE-APACHE" + ], + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "typecheck": "tsc -p tsconfig.json --noEmit" + } +} diff --git a/packages/events-indexed-bindings/src/generated/types.ts b/packages/event-index-bindings/src/generated/types.ts diff --git a/packages/events-indexed-bindings/src/index.ts b/packages/event-index-bindings/src/index.ts diff --git a/packages/events-indexed-bindings/tsconfig.json b/packages/event-index-bindings/tsconfig.json diff --git a/packages/events-bindings/README.md b/packages/events-bindings/README.md @@ -1,9 +0,0 @@ -# @radroots/events-bindings - -TypeScript bindings for radroots_events - -This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. - -## License - -Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/events-bindings/package.json b/packages/events-bindings/package.json @@ -1,39 +0,0 @@ -{ - "name": "@radroots/events-bindings", - "version": "0.1.0", - "description": "TypeScript bindings for radroots_events", - "license": "MIT OR Apache-2.0", - "homepage": "https://radroots.org", - "repository": { - "type": "git", - "url": "git+https://github.com/radrootslabs/sdk.git", - "directory": "packages/events-bindings" - }, - "publishConfig": { - "access": "public" - }, - "type": "module", - "sideEffects": false, - "files": [ - "dist", - "README.md", - "LICENSE-MIT", - "LICENSE-APACHE" - ], - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "default": "./dist/index.js" - } - }, - "scripts": { - "build": "tsc -p tsconfig.json", - "typecheck": "tsc -p tsconfig.json --noEmit" - }, - "dependencies": { - "@radroots/core-bindings": "workspace:^" - } -} diff --git a/packages/events-codec-wasm/README.md b/packages/events-codec-wasm/README.md @@ -1,9 +0,0 @@ -# @radroots/events-codec-wasm - -WebAssembly bindings for radroots_events_codec - -This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. - -## License - -Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/events-codec-wasm/package.json b/packages/events-codec-wasm/package.json @@ -1,36 +0,0 @@ -{ - "name": "@radroots/events-codec-wasm", - "version": "0.1.0", - "description": "WebAssembly bindings for radroots_events_codec", - "license": "MIT OR Apache-2.0", - "homepage": "https://radroots.org", - "repository": { - "type": "git", - "url": "git+https://github.com/radrootslabs/sdk.git", - "directory": "packages/events-codec-wasm" - }, - "publishConfig": { - "access": "public" - }, - "type": "module", - "sideEffects": false, - "files": [ - "dist", - "README.md", - "LICENSE-MIT", - "LICENSE-APACHE" - ], - "main": "./dist/radroots_events_codec_wasm.js", - "types": "./dist/radroots_events_codec_wasm.d.ts", - "exports": { - ".": { - "types": "./dist/radroots_events_codec_wasm.d.ts", - "import": "./dist/radroots_events_codec_wasm.js", - "default": "./dist/radroots_events_codec_wasm.js" - } - }, - "scripts": { - "build": "cd ../.. && cargo xtask generate wasm --package events_codec", - "typecheck": "tsc --noEmit --strict --module NodeNext --moduleResolution NodeNext --target ES2022 dist/radroots_events_codec_wasm.d.ts dist/radroots_events_codec_wasm_bg.wasm.d.ts" - } -} diff --git a/packages/events-indexed-bindings/README.md b/packages/events-indexed-bindings/README.md @@ -1,9 +0,0 @@ -# @radroots/events-indexed-bindings - -TypeScript bindings for radroots_events_indexed - -This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. - -## License - -Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/events-indexed-bindings/package.json b/packages/events-indexed-bindings/package.json @@ -1,36 +0,0 @@ -{ - "name": "@radroots/events-indexed-bindings", - "version": "0.1.0", - "description": "TypeScript bindings for radroots_events_indexed", - "license": "MIT OR Apache-2.0", - "homepage": "https://radroots.org", - "repository": { - "type": "git", - "url": "git+https://github.com/radrootslabs/sdk.git", - "directory": "packages/events-indexed-bindings" - }, - "publishConfig": { - "access": "public" - }, - "type": "module", - "sideEffects": false, - "files": [ - "dist", - "README.md", - "LICENSE-MIT", - "LICENSE-APACHE" - ], - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "default": "./dist/index.js" - } - }, - "scripts": { - "build": "tsc -p tsconfig.json", - "typecheck": "tsc -p tsconfig.json --noEmit" - } -} diff --git a/packages/replica-db-schema-bindings/README.md b/packages/replica-db-schema-bindings/README.md @@ -1,9 +0,0 @@ -# @radroots/replica-db-schema-bindings - -TypeScript bindings for radroots_replica_db_schema - -This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. - -## License - -Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/replica-db-schema-bindings/package.json b/packages/replica-db-schema-bindings/package.json @@ -1,36 +0,0 @@ -{ - "name": "@radroots/replica-db-schema-bindings", - "version": "0.1.0", - "description": "TypeScript bindings for radroots_replica_db_schema", - "license": "MIT OR Apache-2.0", - "homepage": "https://radroots.org", - "repository": { - "type": "git", - "url": "git+https://github.com/radrootslabs/sdk.git", - "directory": "packages/replica-db-schema-bindings" - }, - "publishConfig": { - "access": "public" - }, - "type": "module", - "sideEffects": false, - "files": [ - "dist", - "README.md", - "LICENSE-MIT", - "LICENSE-APACHE" - ], - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "default": "./dist/index.js" - } - }, - "scripts": { - "build": "tsc -p tsconfig.json", - "typecheck": "tsc -p tsconfig.json --noEmit" - } -} diff --git a/packages/replica-db-schema-bindings/src/generated/types.ts b/packages/replica-db-schema-bindings/src/generated/types.ts @@ -1,583 +0,0 @@ -// @generated by cargo xtask generate ts -// Do not edit by hand. -export type Farm = { id: string, created_at: string, updated_at: string, d_tag: string, pubkey: string, name: string, about: string | null, website: string | null, picture: string | null, banner: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; - -export type FarmGcsLocation = { id: string, created_at: string, updated_at: string, farm_id: string, gcs_location_id: string, role: string, }; - -export type FarmGcsLocationQueryBindValues = { id: string, } | { farm_id: string, } | { gcs_location_id: string, }; - -export type FarmMember = { id: string, created_at: string, updated_at: string, farm_id: string, member_pubkey: string, role: string, }; - -export type FarmMemberClaim = { id: string, created_at: string, updated_at: string, member_pubkey: string, farm_pubkey: string, }; - -export type FarmMemberClaimQueryBindValues = { id: string, } | { member_pubkey: string, } | { farm_pubkey: string, }; - -export type FarmMemberQueryBindValues = { id: string, } | { farm_id: string, } | { member_pubkey: string, }; - -export type FarmQueryBindValues = { id: string, } | { d_tag: string, } | { pubkey: string, }; - -export type FarmTag = { id: string, created_at: string, updated_at: string, farm_id: string, tag: string, }; - -export type FarmTagQueryBindValues = { id: string, } | { farm_id: string, } | { tag: string, }; - -export type GcsLocation = { id: string, created_at: string, updated_at: string, d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy: number | null, altitude: number | null, tag_0: string | null, label: string | null, area: number | null, elevation: number | null, soil: string | null, climate: string | null, gc_id: string | null, gc_name: string | null, gc_admin1_id: string | null, gc_admin1_name: string | null, gc_country_id: string | null, gc_country_name: string | null, }; - -export type GcsLocationFarmArgs = { id: string, }; - -export type GcsLocationFindManyRel = { on_trade_product: GcsLocationTradeProductArgs, } | { off_trade_product: GcsLocationTradeProductArgs, } | { on_farm: GcsLocationFarmArgs, } | { off_farm: GcsLocationFarmArgs, } | { on_plot: GcsLocationPlotArgs, } | { off_plot: GcsLocationPlotArgs, }; - -export type GcsLocationPlotArgs = { id: string, }; - -export type GcsLocationQueryBindValues = { id: string, } | { d_tag: string, } | { geohash: string, }; - -export type GcsLocationTradeProductArgs = { id: string, }; - -export type IFarmCreate = IFarmFields; - -export type IFarmCreateResolve = ReplicaSchemaResult<Farm>; - -export type IFarmDelete = IFarmFindOne; - -export type IFarmDeleteResolve = ReplicaSchemaResult<string>; - -export type IFarmFields = { d_tag: string, pubkey: string, name: string, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; - -export type IFarmFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, pubkey?: string, name?: string, about?: string, website?: string, picture?: string, banner?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; - -export type IFarmFieldsPartial = { d_tag?: 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 = IFarmFindManyArgs; - -export type IFarmFindManyArgs = { filter: IFarmFieldsFilter | null, }; - -export type IFarmFindManyResolve = ReplicaSchemaResultList<Farm>; - -export type IFarmFindOne = IFarmFindOneArgs; - -export type IFarmFindOneArgs = { on: FarmQueryBindValues, }; - -export type IFarmFindOneResolve = ReplicaSchemaResult<Farm | null>; - -export type IFarmGcsLocationCreate = IFarmGcsLocationFields; - -export type IFarmGcsLocationCreateResolve = ReplicaSchemaResult<FarmGcsLocation>; - -export type IFarmGcsLocationDelete = IFarmGcsLocationFindOne; - -export type IFarmGcsLocationDeleteResolve = ReplicaSchemaResult<string>; - -export type IFarmGcsLocationFields = { farm_id: string, gcs_location_id: string, role: string, }; - -export type IFarmGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, gcs_location_id?: string, role?: string, }; - -export type IFarmGcsLocationFieldsPartial = { farm_id?: ReplicaDbJsonValue | null, gcs_location_id?: ReplicaDbJsonValue | null, role?: ReplicaDbJsonValue | null, }; - -export type IFarmGcsLocationFindMany = IFarmGcsLocationFindManyArgs; - -export type IFarmGcsLocationFindManyArgs = { filter: IFarmGcsLocationFieldsFilter | null, }; - -export type IFarmGcsLocationFindManyResolve = ReplicaSchemaResultList<FarmGcsLocation>; - -export type IFarmGcsLocationFindOne = IFarmGcsLocationFindOneArgs; - -export type IFarmGcsLocationFindOneArgs = { on: FarmGcsLocationQueryBindValues, }; - -export type IFarmGcsLocationFindOneResolve = ReplicaSchemaResult<FarmGcsLocation | null>; - -export type IFarmGcsLocationUpdate = IFarmGcsLocationUpdateArgs; - -export type IFarmGcsLocationUpdateArgs = { on: FarmGcsLocationQueryBindValues, fields: IFarmGcsLocationFieldsPartial, }; - -export type IFarmGcsLocationUpdateResolve = ReplicaSchemaResult<FarmGcsLocation>; - -export type IFarmMemberClaimCreate = IFarmMemberClaimFields; - -export type IFarmMemberClaimCreateResolve = ReplicaSchemaResult<FarmMemberClaim>; - -export type IFarmMemberClaimDelete = IFarmMemberClaimFindOne; - -export type IFarmMemberClaimDeleteResolve = ReplicaSchemaResult<string>; - -export type IFarmMemberClaimFields = { member_pubkey: string, farm_pubkey: string, }; - -export type IFarmMemberClaimFieldsFilter = { id?: string, created_at?: string, updated_at?: string, member_pubkey?: string, farm_pubkey?: string, }; - -export type IFarmMemberClaimFieldsPartial = { member_pubkey?: ReplicaDbJsonValue | null, farm_pubkey?: ReplicaDbJsonValue | null, }; - -export type IFarmMemberClaimFindMany = IFarmMemberClaimFindManyArgs; - -export type IFarmMemberClaimFindManyArgs = { filter: IFarmMemberClaimFieldsFilter | null, }; - -export type IFarmMemberClaimFindManyResolve = ReplicaSchemaResultList<FarmMemberClaim>; - -export type IFarmMemberClaimFindOne = IFarmMemberClaimFindOneArgs; - -export type IFarmMemberClaimFindOneArgs = { on: FarmMemberClaimQueryBindValues, }; - -export type IFarmMemberClaimFindOneResolve = ReplicaSchemaResult<FarmMemberClaim | null>; - -export type IFarmMemberClaimUpdate = IFarmMemberClaimUpdateArgs; - -export type IFarmMemberClaimUpdateArgs = { on: FarmMemberClaimQueryBindValues, fields: IFarmMemberClaimFieldsPartial, }; - -export type IFarmMemberClaimUpdateResolve = ReplicaSchemaResult<FarmMemberClaim>; - -export type IFarmMemberCreate = IFarmMemberFields; - -export type IFarmMemberCreateResolve = ReplicaSchemaResult<FarmMember>; - -export type IFarmMemberDelete = IFarmMemberFindOne; - -export type IFarmMemberDeleteResolve = ReplicaSchemaResult<string>; - -export type IFarmMemberFields = { farm_id: string, member_pubkey: string, role: string, }; - -export type IFarmMemberFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, member_pubkey?: string, role?: string, }; - -export type IFarmMemberFieldsPartial = { farm_id?: ReplicaDbJsonValue | null, member_pubkey?: ReplicaDbJsonValue | null, role?: ReplicaDbJsonValue | null, }; - -export type IFarmMemberFindMany = IFarmMemberFindManyArgs; - -export type IFarmMemberFindManyArgs = { filter: IFarmMemberFieldsFilter | null, }; - -export type IFarmMemberFindManyResolve = ReplicaSchemaResultList<FarmMember>; - -export type IFarmMemberFindOne = IFarmMemberFindOneArgs; - -export type IFarmMemberFindOneArgs = { on: FarmMemberQueryBindValues, }; - -export type IFarmMemberFindOneResolve = ReplicaSchemaResult<FarmMember | null>; - -export type IFarmMemberUpdate = IFarmMemberUpdateArgs; - -export type IFarmMemberUpdateArgs = { on: FarmMemberQueryBindValues, fields: IFarmMemberFieldsPartial, }; - -export type IFarmMemberUpdateResolve = ReplicaSchemaResult<FarmMember>; - -export type IFarmTagCreate = IFarmTagFields; - -export type IFarmTagCreateResolve = ReplicaSchemaResult<FarmTag>; - -export type IFarmTagDelete = IFarmTagFindOne; - -export type IFarmTagDeleteResolve = ReplicaSchemaResult<string>; - -export type IFarmTagFields = { farm_id: string, tag: string, }; - -export type IFarmTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, tag?: string, }; - -export type IFarmTagFieldsPartial = { farm_id?: ReplicaDbJsonValue | null, tag?: ReplicaDbJsonValue | null, }; - -export type IFarmTagFindMany = IFarmTagFindManyArgs; - -export type IFarmTagFindManyArgs = { filter: IFarmTagFieldsFilter | null, }; - -export type IFarmTagFindManyResolve = ReplicaSchemaResultList<FarmTag>; - -export type IFarmTagFindOne = IFarmTagFindOneArgs; - -export type IFarmTagFindOneArgs = { on: FarmTagQueryBindValues, }; - -export type IFarmTagFindOneResolve = ReplicaSchemaResult<FarmTag | null>; - -export type IFarmTagUpdate = IFarmTagUpdateArgs; - -export type IFarmTagUpdateArgs = { on: FarmTagQueryBindValues, fields: IFarmTagFieldsPartial, }; - -export type IFarmTagUpdateResolve = ReplicaSchemaResult<FarmTag>; - -export type IFarmUpdate = IFarmUpdateArgs; - -export type IFarmUpdateArgs = { on: FarmQueryBindValues, fields: IFarmFieldsPartial, }; - -export type IFarmUpdateResolve = ReplicaSchemaResult<Farm>; - -export type IGcsLocationCreate = IGcsLocationFields; - -export type IGcsLocationCreateResolve = ReplicaSchemaResult<GcsLocation>; - -export type IGcsLocationDelete = IGcsLocationFindOne; - -export type IGcsLocationDeleteResolve = ReplicaSchemaResult<string>; - -export type IGcsLocationFields = { d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy?: number | null, altitude?: number | null, tag_0?: string | null, label?: string | null, area?: number | null, elevation?: number | null, soil?: string | null, climate?: string | null, gc_id?: string | null, gc_name?: string | null, gc_admin1_id?: string | null, gc_admin1_name?: string | null, gc_country_id?: string | null, gc_country_name?: string | null, }; - -export type IGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, lat?: number, lng?: number, geohash?: string, point?: string, polygon?: string, accuracy?: number, altitude?: number, tag_0?: string, label?: string, area?: number, elevation?: number, soil?: string, climate?: string, gc_id?: string, gc_name?: string, gc_admin1_id?: string, gc_admin1_name?: string, gc_country_id?: string, gc_country_name?: string, }; - -export type IGcsLocationFieldsPartial = { d_tag?: 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 IGcsLocationFindMany = { filter: IGcsLocationFieldsFilter | null, } | { rel: GcsLocationFindManyRel, }; - -export type IGcsLocationFindManyResolve = ReplicaSchemaResultList<GcsLocation>; - -export type IGcsLocationFindOne = IGcsLocationFindOneArgs | IGcsLocationFindOneRelArgs; - -export type IGcsLocationFindOneArgs = { on: GcsLocationQueryBindValues, }; - -export type IGcsLocationFindOneRelArgs = { rel: GcsLocationFindManyRel, }; - -export type IGcsLocationFindOneResolve = ReplicaSchemaResult<GcsLocation | null>; - -export type IGcsLocationUpdate = IGcsLocationUpdateArgs; - -export type IGcsLocationUpdateArgs = { on: GcsLocationQueryBindValues, fields: IGcsLocationFieldsPartial, }; - -export type IGcsLocationUpdateResolve = ReplicaSchemaResult<GcsLocation>; - -export type ILogErrorCreate = ILogErrorFields; - -export type ILogErrorCreateResolve = ReplicaSchemaResult<LogError>; - -export type ILogErrorDelete = ILogErrorFindOne; - -export type ILogErrorDeleteResolve = ReplicaSchemaResult<string>; - -export type ILogErrorFields = { error: string, message: string, stack_trace?: string | null, cause?: string | null, app_system: string, app_version: string, nostr_pubkey: string, data?: string | null, }; - -export type ILogErrorFieldsFilter = { id?: string, created_at?: string, updated_at?: string, error?: string, message?: string, stack_trace?: string, cause?: string, app_system?: string, app_version?: string, nostr_pubkey?: string, data?: string, }; - -export type ILogErrorFieldsPartial = { error?: 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 = ILogErrorFindManyArgs; - -export type ILogErrorFindManyArgs = { filter: ILogErrorFieldsFilter | null, }; - -export type ILogErrorFindManyResolve = ReplicaSchemaResultList<LogError>; - -export type ILogErrorFindOne = ILogErrorFindOneArgs; - -export type ILogErrorFindOneArgs = { on: LogErrorQueryBindValues, }; - -export type ILogErrorFindOneResolve = ReplicaSchemaResult<LogError | null>; - -export type ILogErrorUpdate = ILogErrorUpdateArgs; - -export type ILogErrorUpdateArgs = { on: LogErrorQueryBindValues, fields: ILogErrorFieldsPartial, }; - -export type ILogErrorUpdateResolve = ReplicaSchemaResult<LogError>; - -export type IMediaImageCreate = IMediaImageFields; - -export type IMediaImageCreateResolve = ReplicaSchemaResult<MediaImage>; - -export type IMediaImageDelete = IMediaImageFindOne; - -export type IMediaImageDeleteResolve = ReplicaSchemaResult<string>; - -export type IMediaImageFields = { file_path: string, mime_type: string, res_base: string, res_path: string, label?: string | null, description?: string | null, }; - -export type IMediaImageFieldsFilter = { id?: string, created_at?: string, updated_at?: string, file_path?: string, mime_type?: string, res_base?: string, res_path?: string, label?: string, description?: string, }; - -export type IMediaImageFieldsPartial = { file_path?: ReplicaDbJsonValue | null, mime_type?: ReplicaDbJsonValue | null, res_base?: ReplicaDbJsonValue | null, res_path?: ReplicaDbJsonValue | null, label?: ReplicaDbJsonValue | null, description?: ReplicaDbJsonValue | null, }; - -export type IMediaImageFindMany = { filter: IMediaImageFieldsFilter | null, } | { rel: MediaImageFindManyRel, }; - -export type IMediaImageFindManyResolve = ReplicaSchemaResultList<MediaImage>; - -export type IMediaImageFindOne = IMediaImageFindOneArgs | IMediaImageFindOneRelArgs; - -export type IMediaImageFindOneArgs = { on: MediaImageQueryBindValues, }; - -export type IMediaImageFindOneRelArgs = { rel: MediaImageFindManyRel, }; - -export type IMediaImageFindOneResolve = ReplicaSchemaResult<MediaImage | null>; - -export type IMediaImageUpdate = IMediaImageUpdateArgs; - -export type IMediaImageUpdateArgs = { on: MediaImageQueryBindValues, fields: IMediaImageFieldsPartial, }; - -export type IMediaImageUpdateResolve = ReplicaSchemaResult<MediaImage>; - -export type INostrEventHeadCreate = INostrEventHeadFields; - -export type INostrEventHeadCreateResolve = ReplicaSchemaResult<NostrEventHead>; - -export type INostrEventHeadDelete = INostrEventHeadFindOne; - -export type INostrEventHeadDeleteResolve = ReplicaSchemaResult<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 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 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 INostrEventHeadFindMany = INostrEventHeadFindManyArgs; - -export type INostrEventHeadFindManyArgs = { filter: INostrEventHeadFieldsFilter | null, }; - -export type INostrEventHeadFindManyResolve = ReplicaSchemaResultList<NostrEventHead>; - -export type INostrEventHeadFindOne = INostrEventHeadFindOneArgs; - -export type INostrEventHeadFindOneArgs = { on: NostrEventHeadQueryBindValues, }; - -export type INostrEventHeadFindOneResolve = ReplicaSchemaResult<NostrEventHead | null>; - -export type INostrEventHeadUpdate = INostrEventHeadUpdateArgs; - -export type INostrEventHeadUpdateArgs = { on: NostrEventHeadQueryBindValues, fields: INostrEventHeadFieldsPartial, }; - -export type INostrEventHeadUpdateResolve = ReplicaSchemaResult<NostrEventHead>; - -export type INostrProfileCreate = INostrProfileFields; - -export type INostrProfileCreateResolve = ReplicaSchemaResult<NostrProfile>; - -export type INostrProfileDelete = INostrProfileFindOne; - -export type INostrProfileDeleteResolve = ReplicaSchemaResult<string>; - -export type INostrProfileFields = { public_key: string, profile_type: string, name: string, display_name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, nip05?: string | null, lud06?: string | null, lud16?: string | null, }; - -export type INostrProfileFieldsFilter = { id?: string, created_at?: string, updated_at?: string, public_key?: string, profile_type?: string, name?: string, display_name?: string, about?: string, website?: string, picture?: string, banner?: string, nip05?: string, lud06?: string, lud16?: string, }; - -export type INostrProfileFieldsPartial = { public_key?: 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 INostrProfileFindMany = { filter: INostrProfileFieldsFilter | null, } | { rel: NostrProfileFindManyRel, }; - -export type INostrProfileFindManyResolve = ReplicaSchemaResultList<NostrProfile>; - -export type INostrProfileFindOne = INostrProfileFindOneArgs | INostrProfileFindOneRelArgs; - -export type INostrProfileFindOneArgs = { on: NostrProfileQueryBindValues, }; - -export type INostrProfileFindOneRelArgs = { rel: NostrProfileFindManyRel, }; - -export type INostrProfileFindOneResolve = ReplicaSchemaResult<NostrProfile | null>; - -export type INostrProfileRelayRelation = { nostr_profile: NostrProfileQueryBindValues, nostr_relay: NostrRelayQueryBindValues, }; - -export type INostrProfileRelayResolve = ReplicaSchemaResultPass; - -export type INostrProfileUpdate = INostrProfileUpdateArgs; - -export type INostrProfileUpdateArgs = { on: NostrProfileQueryBindValues, fields: INostrProfileFieldsPartial, }; - -export type INostrProfileUpdateResolve = ReplicaSchemaResult<NostrProfile>; - -export type INostrRelayCreate = INostrRelayFields; - -export type INostrRelayCreateResolve = ReplicaSchemaResult<NostrRelay>; - -export type INostrRelayDelete = INostrRelayFindOne; - -export type INostrRelayDeleteResolve = ReplicaSchemaResult<string>; - -export type INostrRelayFields = { url: string, relay_id?: string | null, name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: string | null, software?: string | null, version?: string | null, data?: string | null, }; - -export type INostrRelayFieldsFilter = { id?: string, created_at?: string, updated_at?: string, url?: string, relay_id?: string, name?: string, description?: string, pubkey?: string, contact?: string, supported_nips?: string, software?: string, version?: string, data?: string, }; - -export type INostrRelayFieldsPartial = { url?: 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 INostrRelayFindMany = { filter: INostrRelayFieldsFilter | null, } | { rel: NostrRelayFindManyRel, }; - -export type INostrRelayFindManyResolve = ReplicaSchemaResultList<NostrRelay>; - -export type INostrRelayFindOne = INostrRelayFindOneArgs | INostrRelayFindOneRelArgs; - -export type INostrRelayFindOneArgs = { on: NostrRelayQueryBindValues, }; - -export type INostrRelayFindOneRelArgs = { rel: NostrRelayFindManyRel, }; - -export type INostrRelayFindOneResolve = ReplicaSchemaResult<NostrRelay | null>; - -export type INostrRelayUpdate = INostrRelayUpdateArgs; - -export type INostrRelayUpdateArgs = { on: NostrRelayQueryBindValues, fields: INostrRelayFieldsPartial, }; - -export type INostrRelayUpdateResolve = ReplicaSchemaResult<NostrRelay>; - -export type IPlotCreate = IPlotFields; - -export type IPlotCreateResolve = ReplicaSchemaResult<Plot>; - -export type IPlotDelete = IPlotFindOne; - -export type IPlotDeleteResolve = ReplicaSchemaResult<string>; - -export type IPlotFields = { d_tag: string, farm_id: string, name: string, about?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; - -export type IPlotFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, farm_id?: string, name?: string, about?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; - -export type IPlotFieldsPartial = { d_tag?: 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 = IPlotFindManyArgs; - -export type IPlotFindManyArgs = { filter: IPlotFieldsFilter | null, }; - -export type IPlotFindManyResolve = ReplicaSchemaResultList<Plot>; - -export type IPlotFindOne = IPlotFindOneArgs; - -export type IPlotFindOneArgs = { on: PlotQueryBindValues, }; - -export type IPlotFindOneResolve = ReplicaSchemaResult<Plot | null>; - -export type IPlotGcsLocationCreate = IPlotGcsLocationFields; - -export type IPlotGcsLocationCreateResolve = ReplicaSchemaResult<PlotGcsLocation>; - -export type IPlotGcsLocationDelete = IPlotGcsLocationFindOne; - -export type IPlotGcsLocationDeleteResolve = ReplicaSchemaResult<string>; - -export type IPlotGcsLocationFields = { plot_id: string, gcs_location_id: string, role: string, }; - -export type IPlotGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, gcs_location_id?: string, role?: string, }; - -export type IPlotGcsLocationFieldsPartial = { plot_id?: ReplicaDbJsonValue | null, gcs_location_id?: ReplicaDbJsonValue | null, role?: ReplicaDbJsonValue | null, }; - -export type IPlotGcsLocationFindMany = IPlotGcsLocationFindManyArgs; - -export type IPlotGcsLocationFindManyArgs = { filter: IPlotGcsLocationFieldsFilter | null, }; - -export type IPlotGcsLocationFindManyResolve = ReplicaSchemaResultList<PlotGcsLocation>; - -export type IPlotGcsLocationFindOne = IPlotGcsLocationFindOneArgs; - -export type IPlotGcsLocationFindOneArgs = { on: PlotGcsLocationQueryBindValues, }; - -export type IPlotGcsLocationFindOneResolve = ReplicaSchemaResult<PlotGcsLocation | null>; - -export type IPlotGcsLocationUpdate = IPlotGcsLocationUpdateArgs; - -export type IPlotGcsLocationUpdateArgs = { on: PlotGcsLocationQueryBindValues, fields: IPlotGcsLocationFieldsPartial, }; - -export type IPlotGcsLocationUpdateResolve = ReplicaSchemaResult<PlotGcsLocation>; - -export type IPlotTagCreate = IPlotTagFields; - -export type IPlotTagCreateResolve = ReplicaSchemaResult<PlotTag>; - -export type IPlotTagDelete = IPlotTagFindOne; - -export type IPlotTagDeleteResolve = ReplicaSchemaResult<string>; - -export type IPlotTagFields = { plot_id: string, tag: string, }; - -export type IPlotTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, tag?: string, }; - -export type IPlotTagFieldsPartial = { plot_id?: ReplicaDbJsonValue | null, tag?: ReplicaDbJsonValue | null, }; - -export type IPlotTagFindMany = IPlotTagFindManyArgs; - -export type IPlotTagFindManyArgs = { filter: IPlotTagFieldsFilter | null, }; - -export type IPlotTagFindManyResolve = ReplicaSchemaResultList<PlotTag>; - -export type IPlotTagFindOne = IPlotTagFindOneArgs; - -export type IPlotTagFindOneArgs = { on: PlotTagQueryBindValues, }; - -export type IPlotTagFindOneResolve = ReplicaSchemaResult<PlotTag | null>; - -export type IPlotTagUpdate = IPlotTagUpdateArgs; - -export type IPlotTagUpdateArgs = { on: PlotTagQueryBindValues, fields: IPlotTagFieldsPartial, }; - -export type IPlotTagUpdateResolve = ReplicaSchemaResult<PlotTag>; - -export type IPlotUpdate = IPlotUpdateArgs; - -export type IPlotUpdateArgs = { on: PlotQueryBindValues, fields: IPlotFieldsPartial, }; - -export type IPlotUpdateResolve = ReplicaSchemaResult<Plot>; - -export type ITradeProductCreate = ITradeProductFields; - -export type ITradeProductCreateResolve = ReplicaSchemaResult<TradeProduct>; - -export type ITradeProductDelete = ITradeProductFindOne; - -export type ITradeProductDeleteResolve = ReplicaSchemaResult<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?: 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?: 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 = ITradeProductFindManyArgs; - -export type ITradeProductFindManyArgs = { filter: ITradeProductFieldsFilter | null, }; - -export type ITradeProductFindManyResolve = ReplicaSchemaResultList<TradeProduct>; - -export type ITradeProductFindOne = ITradeProductFindOneArgs; - -export type ITradeProductFindOneArgs = { on: TradeProductQueryBindValues, }; - -export type ITradeProductFindOneResolve = ReplicaSchemaResult<TradeProduct | null>; - -export type ITradeProductLocationRelation = { trade_product: TradeProductQueryBindValues, gcs_location: GcsLocationQueryBindValues, }; - -export type ITradeProductLocationResolve = ReplicaSchemaResultPass; - -export type ITradeProductMediaRelation = { trade_product: TradeProductQueryBindValues, media_image: MediaImageQueryBindValues, }; - -export type ITradeProductMediaResolve = ReplicaSchemaResultPass; - -export type ITradeProductUpdate = ITradeProductUpdateArgs; - -export type ITradeProductUpdateArgs = { on: TradeProductQueryBindValues, fields: ITradeProductFieldsPartial, }; - -export type ITradeProductUpdateResolve = ReplicaSchemaResult<TradeProduct>; - -export type LogError = { id: string, created_at: string, updated_at: string, error: string, message: string, stack_trace: string | null, cause: string | null, app_system: string, app_version: string, nostr_pubkey: string, data: string | null, }; - -export type LogErrorQueryBindValues = { id: string, } | { nostr_pubkey: string, }; - -export type MediaImage = { id: string, created_at: string, updated_at: string, file_path: string, mime_type: string, res_base: string, res_path: string, label: string | null, description: string | null, }; - -export type MediaImageFindManyRel = { on_trade_product: MediaImageTradeProductArgs, } | { off_trade_product: MediaImageTradeProductArgs, }; - -export type MediaImageQueryBindValues = { id: string, } | { file_path: string, }; - -export type MediaImageTradeProductArgs = { id: string, }; - -export type 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 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, }; - -export type NostrProfileFindManyRel = { on_relay: NostrProfileRelayArgs, } | { off_relay: NostrProfileRelayArgs, }; - -export type NostrProfileQueryBindValues = { id: string, } | { public_key: string, }; - -export type NostrProfileRelayArgs = { id: string, }; - -export type NostrRelay = { id: string, created_at: string, updated_at: string, url: string, relay_id: string | null, name: string | null, description: string | null, pubkey: string | null, contact: string | null, supported_nips: string | null, software: string | null, version: string | null, data: string | null, }; - -export type NostrRelayFindManyRel = { on_profile: NostrRelayProfileArgs, } | { off_profile: NostrRelayProfileArgs, }; - -export type NostrRelayProfileArgs = { public_key: string, }; - -export type NostrRelayQueryBindValues = { id: string, } | { url: string, }; - -export type Plot = { id: string, created_at: string, updated_at: string, d_tag: string, farm_id: string, name: string, about: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; - -export type PlotGcsLocation = { id: string, created_at: string, updated_at: string, plot_id: string, gcs_location_id: string, role: string, }; - -export type PlotGcsLocationQueryBindValues = { id: string, } | { plot_id: string, } | { gcs_location_id: string, }; - -export type PlotQueryBindValues = { id: string, } | { d_tag: string, } | { farm_id: string, }; - -export type PlotTag = { id: string, created_at: string, updated_at: string, plot_id: string, tag: string, }; - -export type PlotTagQueryBindValues = { id: string, } | { plot_id: string, } | { tag: string, }; - -export type ReplicaDbJsonValue = null | boolean | number | string | Array<ReplicaDbJsonValue> | { [key: string]: ReplicaDbJsonValue }; - -export type ReplicaSchemaError<T> = { err: T, }; - -export type ReplicaSchemaResult<T> = { result: T, }; - -export type ReplicaSchemaResultList<T> = { results: Array<T>, }; - -export type ReplicaSchemaResultPass = { pass: boolean, }; - -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/packages/replica-db-wasm/README.md b/packages/replica-db-wasm/README.md @@ -1,9 +0,0 @@ -# @radroots/replica-db-wasm - -WebAssembly bindings for radroots_replica_db - -This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. - -## License - -Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/replica-db-wasm/package.json b/packages/replica-db-wasm/package.json @@ -1,36 +0,0 @@ -{ - "name": "@radroots/replica-db-wasm", - "version": "0.1.0", - "description": "WebAssembly bindings for radroots_replica_db", - "license": "MIT OR Apache-2.0", - "homepage": "https://radroots.org", - "repository": { - "type": "git", - "url": "git+https://github.com/radrootslabs/sdk.git", - "directory": "packages/replica-db-wasm" - }, - "publishConfig": { - "access": "public" - }, - "type": "module", - "sideEffects": false, - "files": [ - "dist", - "README.md", - "LICENSE-MIT", - "LICENSE-APACHE" - ], - "main": "./dist/radroots_replica_db_wasm.js", - "types": "./dist/radroots_replica_db_wasm.d.ts", - "exports": { - ".": { - "types": "./dist/radroots_replica_db_wasm.d.ts", - "import": "./dist/radroots_replica_db_wasm.js", - "default": "./dist/radroots_replica_db_wasm.js" - } - }, - "scripts": { - "build": "cd ../.. && cargo xtask generate wasm --package replica_db", - "typecheck": "tsc --noEmit --strict --module NodeNext --moduleResolution NodeNext --target ES2022 dist/radroots_replica_db_wasm.d.ts dist/radroots_replica_db_wasm_bg.wasm.d.ts" - } -} diff --git a/packages/replica-db-schema-bindings/LICENSE-APACHE b/packages/replica-schema-bindings/LICENSE-APACHE diff --git a/packages/replica-db-schema-bindings/LICENSE-MIT b/packages/replica-schema-bindings/LICENSE-MIT diff --git a/packages/replica-schema-bindings/README.md b/packages/replica-schema-bindings/README.md @@ -0,0 +1,9 @@ +# @radroots/replica-schema-bindings + +TypeScript bindings for radroots_replica_schema + +This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. + +## License + +Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/replica-schema-bindings/package.json b/packages/replica-schema-bindings/package.json @@ -0,0 +1,36 @@ +{ + "name": "@radroots/replica-schema-bindings", + "version": "0.1.0", + "description": "TypeScript bindings for radroots_replica_schema", + "license": "MIT OR Apache-2.0", + "homepage": "https://radroots.org", + "repository": { + "type": "git", + "url": "git+https://github.com/radrootslabs/sdk.git", + "directory": "packages/replica-schema-bindings" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "sideEffects": false, + "files": [ + "dist", + "README.md", + "LICENSE-MIT", + "LICENSE-APACHE" + ], + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + } + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "typecheck": "tsc -p tsconfig.json --noEmit" + } +} diff --git a/packages/replica-schema-bindings/src/generated/types.ts b/packages/replica-schema-bindings/src/generated/types.ts @@ -0,0 +1,583 @@ +// @generated by cargo xtask generate ts +// Do not edit by hand. +export type Farm = { id: string, created_at: string, updated_at: string, d_tag: string, pubkey: string, name: string, about: string | null, website: string | null, picture: string | null, banner: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; + +export type FarmGcsLocation = { id: string, created_at: string, updated_at: string, farm_id: string, gcs_location_id: string, role: string, }; + +export type FarmGcsLocationQueryBindValues = { id: string, } | { farm_id: string, } | { gcs_location_id: string, }; + +export type FarmMember = { id: string, created_at: string, updated_at: string, farm_id: string, member_pubkey: string, role: string, }; + +export type FarmMemberClaim = { id: string, created_at: string, updated_at: string, member_pubkey: string, farm_pubkey: string, }; + +export type FarmMemberClaimQueryBindValues = { id: string, } | { member_pubkey: string, } | { farm_pubkey: string, }; + +export type FarmMemberQueryBindValues = { id: string, } | { farm_id: string, } | { member_pubkey: string, }; + +export type FarmQueryBindValues = { id: string, } | { d_tag: string, } | { pubkey: string, }; + +export type FarmTag = { id: string, created_at: string, updated_at: string, farm_id: string, tag: string, }; + +export type FarmTagQueryBindValues = { id: string, } | { farm_id: string, } | { tag: string, }; + +export type GcsLocation = { id: string, created_at: string, updated_at: string, d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy: number | null, altitude: number | null, tag_0: string | null, label: string | null, area: number | null, elevation: number | null, soil: string | null, climate: string | null, gc_id: string | null, gc_name: string | null, gc_admin1_id: string | null, gc_admin1_name: string | null, gc_country_id: string | null, gc_country_name: string | null, }; + +export type GcsLocationFarmArgs = { id: string, }; + +export type GcsLocationFindManyRel = { on_trade_product: GcsLocationTradeProductArgs, } | { off_trade_product: GcsLocationTradeProductArgs, } | { on_farm: GcsLocationFarmArgs, } | { off_farm: GcsLocationFarmArgs, } | { on_plot: GcsLocationPlotArgs, } | { off_plot: GcsLocationPlotArgs, }; + +export type GcsLocationPlotArgs = { id: string, }; + +export type GcsLocationQueryBindValues = { id: string, } | { d_tag: string, } | { geohash: string, }; + +export type GcsLocationTradeProductArgs = { id: string, }; + +export type IFarmCreate = IFarmFields; + +export type IFarmCreateResolve = ReplicaSchemaResult<Farm>; + +export type IFarmDelete = IFarmFindOne; + +export type IFarmDeleteResolve = ReplicaSchemaResult<string>; + +export type IFarmFields = { d_tag: string, pubkey: string, name: string, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; + +export type IFarmFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, pubkey?: string, name?: string, about?: string, website?: string, picture?: string, banner?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; + +export type IFarmFieldsPartial = { d_tag?: ReplicaStoreJsonValue | null, pubkey?: ReplicaStoreJsonValue | null, name?: ReplicaStoreJsonValue | null, about?: ReplicaStoreJsonValue | null, website?: ReplicaStoreJsonValue | null, picture?: ReplicaStoreJsonValue | null, banner?: ReplicaStoreJsonValue | null, location_primary?: ReplicaStoreJsonValue | null, location_city?: ReplicaStoreJsonValue | null, location_region?: ReplicaStoreJsonValue | null, location_country?: ReplicaStoreJsonValue | null, }; + +export type IFarmFindMany = IFarmFindManyArgs; + +export type IFarmFindManyArgs = { filter: IFarmFieldsFilter | null, }; + +export type IFarmFindManyResolve = ReplicaSchemaResultList<Farm>; + +export type IFarmFindOne = IFarmFindOneArgs; + +export type IFarmFindOneArgs = { on: FarmQueryBindValues, }; + +export type IFarmFindOneResolve = ReplicaSchemaResult<Farm | null>; + +export type IFarmGcsLocationCreate = IFarmGcsLocationFields; + +export type IFarmGcsLocationCreateResolve = ReplicaSchemaResult<FarmGcsLocation>; + +export type IFarmGcsLocationDelete = IFarmGcsLocationFindOne; + +export type IFarmGcsLocationDeleteResolve = ReplicaSchemaResult<string>; + +export type IFarmGcsLocationFields = { farm_id: string, gcs_location_id: string, role: string, }; + +export type IFarmGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, gcs_location_id?: string, role?: string, }; + +export type IFarmGcsLocationFieldsPartial = { farm_id?: ReplicaStoreJsonValue | null, gcs_location_id?: ReplicaStoreJsonValue | null, role?: ReplicaStoreJsonValue | null, }; + +export type IFarmGcsLocationFindMany = IFarmGcsLocationFindManyArgs; + +export type IFarmGcsLocationFindManyArgs = { filter: IFarmGcsLocationFieldsFilter | null, }; + +export type IFarmGcsLocationFindManyResolve = ReplicaSchemaResultList<FarmGcsLocation>; + +export type IFarmGcsLocationFindOne = IFarmGcsLocationFindOneArgs; + +export type IFarmGcsLocationFindOneArgs = { on: FarmGcsLocationQueryBindValues, }; + +export type IFarmGcsLocationFindOneResolve = ReplicaSchemaResult<FarmGcsLocation | null>; + +export type IFarmGcsLocationUpdate = IFarmGcsLocationUpdateArgs; + +export type IFarmGcsLocationUpdateArgs = { on: FarmGcsLocationQueryBindValues, fields: IFarmGcsLocationFieldsPartial, }; + +export type IFarmGcsLocationUpdateResolve = ReplicaSchemaResult<FarmGcsLocation>; + +export type IFarmMemberClaimCreate = IFarmMemberClaimFields; + +export type IFarmMemberClaimCreateResolve = ReplicaSchemaResult<FarmMemberClaim>; + +export type IFarmMemberClaimDelete = IFarmMemberClaimFindOne; + +export type IFarmMemberClaimDeleteResolve = ReplicaSchemaResult<string>; + +export type IFarmMemberClaimFields = { member_pubkey: string, farm_pubkey: string, }; + +export type IFarmMemberClaimFieldsFilter = { id?: string, created_at?: string, updated_at?: string, member_pubkey?: string, farm_pubkey?: string, }; + +export type IFarmMemberClaimFieldsPartial = { member_pubkey?: ReplicaStoreJsonValue | null, farm_pubkey?: ReplicaStoreJsonValue | null, }; + +export type IFarmMemberClaimFindMany = IFarmMemberClaimFindManyArgs; + +export type IFarmMemberClaimFindManyArgs = { filter: IFarmMemberClaimFieldsFilter | null, }; + +export type IFarmMemberClaimFindManyResolve = ReplicaSchemaResultList<FarmMemberClaim>; + +export type IFarmMemberClaimFindOne = IFarmMemberClaimFindOneArgs; + +export type IFarmMemberClaimFindOneArgs = { on: FarmMemberClaimQueryBindValues, }; + +export type IFarmMemberClaimFindOneResolve = ReplicaSchemaResult<FarmMemberClaim | null>; + +export type IFarmMemberClaimUpdate = IFarmMemberClaimUpdateArgs; + +export type IFarmMemberClaimUpdateArgs = { on: FarmMemberClaimQueryBindValues, fields: IFarmMemberClaimFieldsPartial, }; + +export type IFarmMemberClaimUpdateResolve = ReplicaSchemaResult<FarmMemberClaim>; + +export type IFarmMemberCreate = IFarmMemberFields; + +export type IFarmMemberCreateResolve = ReplicaSchemaResult<FarmMember>; + +export type IFarmMemberDelete = IFarmMemberFindOne; + +export type IFarmMemberDeleteResolve = ReplicaSchemaResult<string>; + +export type IFarmMemberFields = { farm_id: string, member_pubkey: string, role: string, }; + +export type IFarmMemberFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, member_pubkey?: string, role?: string, }; + +export type IFarmMemberFieldsPartial = { farm_id?: ReplicaStoreJsonValue | null, member_pubkey?: ReplicaStoreJsonValue | null, role?: ReplicaStoreJsonValue | null, }; + +export type IFarmMemberFindMany = IFarmMemberFindManyArgs; + +export type IFarmMemberFindManyArgs = { filter: IFarmMemberFieldsFilter | null, }; + +export type IFarmMemberFindManyResolve = ReplicaSchemaResultList<FarmMember>; + +export type IFarmMemberFindOne = IFarmMemberFindOneArgs; + +export type IFarmMemberFindOneArgs = { on: FarmMemberQueryBindValues, }; + +export type IFarmMemberFindOneResolve = ReplicaSchemaResult<FarmMember | null>; + +export type IFarmMemberUpdate = IFarmMemberUpdateArgs; + +export type IFarmMemberUpdateArgs = { on: FarmMemberQueryBindValues, fields: IFarmMemberFieldsPartial, }; + +export type IFarmMemberUpdateResolve = ReplicaSchemaResult<FarmMember>; + +export type IFarmTagCreate = IFarmTagFields; + +export type IFarmTagCreateResolve = ReplicaSchemaResult<FarmTag>; + +export type IFarmTagDelete = IFarmTagFindOne; + +export type IFarmTagDeleteResolve = ReplicaSchemaResult<string>; + +export type IFarmTagFields = { farm_id: string, tag: string, }; + +export type IFarmTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, tag?: string, }; + +export type IFarmTagFieldsPartial = { farm_id?: ReplicaStoreJsonValue | null, tag?: ReplicaStoreJsonValue | null, }; + +export type IFarmTagFindMany = IFarmTagFindManyArgs; + +export type IFarmTagFindManyArgs = { filter: IFarmTagFieldsFilter | null, }; + +export type IFarmTagFindManyResolve = ReplicaSchemaResultList<FarmTag>; + +export type IFarmTagFindOne = IFarmTagFindOneArgs; + +export type IFarmTagFindOneArgs = { on: FarmTagQueryBindValues, }; + +export type IFarmTagFindOneResolve = ReplicaSchemaResult<FarmTag | null>; + +export type IFarmTagUpdate = IFarmTagUpdateArgs; + +export type IFarmTagUpdateArgs = { on: FarmTagQueryBindValues, fields: IFarmTagFieldsPartial, }; + +export type IFarmTagUpdateResolve = ReplicaSchemaResult<FarmTag>; + +export type IFarmUpdate = IFarmUpdateArgs; + +export type IFarmUpdateArgs = { on: FarmQueryBindValues, fields: IFarmFieldsPartial, }; + +export type IFarmUpdateResolve = ReplicaSchemaResult<Farm>; + +export type IGcsLocationCreate = IGcsLocationFields; + +export type IGcsLocationCreateResolve = ReplicaSchemaResult<GcsLocation>; + +export type IGcsLocationDelete = IGcsLocationFindOne; + +export type IGcsLocationDeleteResolve = ReplicaSchemaResult<string>; + +export type IGcsLocationFields = { d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy?: number | null, altitude?: number | null, tag_0?: string | null, label?: string | null, area?: number | null, elevation?: number | null, soil?: string | null, climate?: string | null, gc_id?: string | null, gc_name?: string | null, gc_admin1_id?: string | null, gc_admin1_name?: string | null, gc_country_id?: string | null, gc_country_name?: string | null, }; + +export type IGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, lat?: number, lng?: number, geohash?: string, point?: string, polygon?: string, accuracy?: number, altitude?: number, tag_0?: string, label?: string, area?: number, elevation?: number, soil?: string, climate?: string, gc_id?: string, gc_name?: string, gc_admin1_id?: string, gc_admin1_name?: string, gc_country_id?: string, gc_country_name?: string, }; + +export type IGcsLocationFieldsPartial = { d_tag?: ReplicaStoreJsonValue | null, lat?: ReplicaStoreJsonValue | null, lng?: ReplicaStoreJsonValue | null, geohash?: ReplicaStoreJsonValue | null, point?: ReplicaStoreJsonValue | null, polygon?: ReplicaStoreJsonValue | null, accuracy?: ReplicaStoreJsonValue | null, altitude?: ReplicaStoreJsonValue | null, tag_0?: ReplicaStoreJsonValue | null, label?: ReplicaStoreJsonValue | null, area?: ReplicaStoreJsonValue | null, elevation?: ReplicaStoreJsonValue | null, soil?: ReplicaStoreJsonValue | null, climate?: ReplicaStoreJsonValue | null, gc_id?: ReplicaStoreJsonValue | null, gc_name?: ReplicaStoreJsonValue | null, gc_admin1_id?: ReplicaStoreJsonValue | null, gc_admin1_name?: ReplicaStoreJsonValue | null, gc_country_id?: ReplicaStoreJsonValue | null, gc_country_name?: ReplicaStoreJsonValue | null, }; + +export type IGcsLocationFindMany = { filter: IGcsLocationFieldsFilter | null, } | { rel: GcsLocationFindManyRel, }; + +export type IGcsLocationFindManyResolve = ReplicaSchemaResultList<GcsLocation>; + +export type IGcsLocationFindOne = IGcsLocationFindOneArgs | IGcsLocationFindOneRelArgs; + +export type IGcsLocationFindOneArgs = { on: GcsLocationQueryBindValues, }; + +export type IGcsLocationFindOneRelArgs = { rel: GcsLocationFindManyRel, }; + +export type IGcsLocationFindOneResolve = ReplicaSchemaResult<GcsLocation | null>; + +export type IGcsLocationUpdate = IGcsLocationUpdateArgs; + +export type IGcsLocationUpdateArgs = { on: GcsLocationQueryBindValues, fields: IGcsLocationFieldsPartial, }; + +export type IGcsLocationUpdateResolve = ReplicaSchemaResult<GcsLocation>; + +export type ILogErrorCreate = ILogErrorFields; + +export type ILogErrorCreateResolve = ReplicaSchemaResult<LogError>; + +export type ILogErrorDelete = ILogErrorFindOne; + +export type ILogErrorDeleteResolve = ReplicaSchemaResult<string>; + +export type ILogErrorFields = { error: string, message: string, stack_trace?: string | null, cause?: string | null, app_system: string, app_version: string, nostr_pubkey: string, data?: string | null, }; + +export type ILogErrorFieldsFilter = { id?: string, created_at?: string, updated_at?: string, error?: string, message?: string, stack_trace?: string, cause?: string, app_system?: string, app_version?: string, nostr_pubkey?: string, data?: string, }; + +export type ILogErrorFieldsPartial = { error?: ReplicaStoreJsonValue | null, message?: ReplicaStoreJsonValue | null, stack_trace?: ReplicaStoreJsonValue | null, cause?: ReplicaStoreJsonValue | null, app_system?: ReplicaStoreJsonValue | null, app_version?: ReplicaStoreJsonValue | null, nostr_pubkey?: ReplicaStoreJsonValue | null, data?: ReplicaStoreJsonValue | null, }; + +export type ILogErrorFindMany = ILogErrorFindManyArgs; + +export type ILogErrorFindManyArgs = { filter: ILogErrorFieldsFilter | null, }; + +export type ILogErrorFindManyResolve = ReplicaSchemaResultList<LogError>; + +export type ILogErrorFindOne = ILogErrorFindOneArgs; + +export type ILogErrorFindOneArgs = { on: LogErrorQueryBindValues, }; + +export type ILogErrorFindOneResolve = ReplicaSchemaResult<LogError | null>; + +export type ILogErrorUpdate = ILogErrorUpdateArgs; + +export type ILogErrorUpdateArgs = { on: LogErrorQueryBindValues, fields: ILogErrorFieldsPartial, }; + +export type ILogErrorUpdateResolve = ReplicaSchemaResult<LogError>; + +export type IMediaImageCreate = IMediaImageFields; + +export type IMediaImageCreateResolve = ReplicaSchemaResult<MediaImage>; + +export type IMediaImageDelete = IMediaImageFindOne; + +export type IMediaImageDeleteResolve = ReplicaSchemaResult<string>; + +export type IMediaImageFields = { file_path: string, mime_type: string, res_base: string, res_path: string, label?: string | null, description?: string | null, }; + +export type IMediaImageFieldsFilter = { id?: string, created_at?: string, updated_at?: string, file_path?: string, mime_type?: string, res_base?: string, res_path?: string, label?: string, description?: string, }; + +export type IMediaImageFieldsPartial = { file_path?: ReplicaStoreJsonValue | null, mime_type?: ReplicaStoreJsonValue | null, res_base?: ReplicaStoreJsonValue | null, res_path?: ReplicaStoreJsonValue | null, label?: ReplicaStoreJsonValue | null, description?: ReplicaStoreJsonValue | null, }; + +export type IMediaImageFindMany = { filter: IMediaImageFieldsFilter | null, } | { rel: MediaImageFindManyRel, }; + +export type IMediaImageFindManyResolve = ReplicaSchemaResultList<MediaImage>; + +export type IMediaImageFindOne = IMediaImageFindOneArgs | IMediaImageFindOneRelArgs; + +export type IMediaImageFindOneArgs = { on: MediaImageQueryBindValues, }; + +export type IMediaImageFindOneRelArgs = { rel: MediaImageFindManyRel, }; + +export type IMediaImageFindOneResolve = ReplicaSchemaResult<MediaImage | null>; + +export type IMediaImageUpdate = IMediaImageUpdateArgs; + +export type IMediaImageUpdateArgs = { on: MediaImageQueryBindValues, fields: IMediaImageFieldsPartial, }; + +export type IMediaImageUpdateResolve = ReplicaSchemaResult<MediaImage>; + +export type INostrEventHeadCreate = INostrEventHeadFields; + +export type INostrEventHeadCreateResolve = ReplicaSchemaResult<NostrEventHead>; + +export type INostrEventHeadDelete = INostrEventHeadFindOne; + +export type INostrEventHeadDeleteResolve = ReplicaSchemaResult<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 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 INostrEventHeadFieldsPartial = { key?: ReplicaStoreJsonValue | null, kind?: ReplicaStoreJsonValue | null, pubkey?: ReplicaStoreJsonValue | null, d_tag?: ReplicaStoreJsonValue | null, last_event_id?: ReplicaStoreJsonValue | null, last_created_at?: ReplicaStoreJsonValue | null, content_hash?: ReplicaStoreJsonValue | null, }; + +export type INostrEventHeadFindMany = INostrEventHeadFindManyArgs; + +export type INostrEventHeadFindManyArgs = { filter: INostrEventHeadFieldsFilter | null, }; + +export type INostrEventHeadFindManyResolve = ReplicaSchemaResultList<NostrEventHead>; + +export type INostrEventHeadFindOne = INostrEventHeadFindOneArgs; + +export type INostrEventHeadFindOneArgs = { on: NostrEventHeadQueryBindValues, }; + +export type INostrEventHeadFindOneResolve = ReplicaSchemaResult<NostrEventHead | null>; + +export type INostrEventHeadUpdate = INostrEventHeadUpdateArgs; + +export type INostrEventHeadUpdateArgs = { on: NostrEventHeadQueryBindValues, fields: INostrEventHeadFieldsPartial, }; + +export type INostrEventHeadUpdateResolve = ReplicaSchemaResult<NostrEventHead>; + +export type INostrProfileCreate = INostrProfileFields; + +export type INostrProfileCreateResolve = ReplicaSchemaResult<NostrProfile>; + +export type INostrProfileDelete = INostrProfileFindOne; + +export type INostrProfileDeleteResolve = ReplicaSchemaResult<string>; + +export type INostrProfileFields = { public_key: string, profile_type: string, name: string, display_name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, nip05?: string | null, lud06?: string | null, lud16?: string | null, }; + +export type INostrProfileFieldsFilter = { id?: string, created_at?: string, updated_at?: string, public_key?: string, profile_type?: string, name?: string, display_name?: string, about?: string, website?: string, picture?: string, banner?: string, nip05?: string, lud06?: string, lud16?: string, }; + +export type INostrProfileFieldsPartial = { public_key?: ReplicaStoreJsonValue | null, profile_type?: ReplicaStoreJsonValue | null, name?: ReplicaStoreJsonValue | null, display_name?: ReplicaStoreJsonValue | null, about?: ReplicaStoreJsonValue | null, website?: ReplicaStoreJsonValue | null, picture?: ReplicaStoreJsonValue | null, banner?: ReplicaStoreJsonValue | null, nip05?: ReplicaStoreJsonValue | null, lud06?: ReplicaStoreJsonValue | null, lud16?: ReplicaStoreJsonValue | null, }; + +export type INostrProfileFindMany = { filter: INostrProfileFieldsFilter | null, } | { rel: NostrProfileFindManyRel, }; + +export type INostrProfileFindManyResolve = ReplicaSchemaResultList<NostrProfile>; + +export type INostrProfileFindOne = INostrProfileFindOneArgs | INostrProfileFindOneRelArgs; + +export type INostrProfileFindOneArgs = { on: NostrProfileQueryBindValues, }; + +export type INostrProfileFindOneRelArgs = { rel: NostrProfileFindManyRel, }; + +export type INostrProfileFindOneResolve = ReplicaSchemaResult<NostrProfile | null>; + +export type INostrProfileRelayRelation = { nostr_profile: NostrProfileQueryBindValues, nostr_relay: NostrRelayQueryBindValues, }; + +export type INostrProfileRelayResolve = ReplicaSchemaResultPass; + +export type INostrProfileUpdate = INostrProfileUpdateArgs; + +export type INostrProfileUpdateArgs = { on: NostrProfileQueryBindValues, fields: INostrProfileFieldsPartial, }; + +export type INostrProfileUpdateResolve = ReplicaSchemaResult<NostrProfile>; + +export type INostrRelayCreate = INostrRelayFields; + +export type INostrRelayCreateResolve = ReplicaSchemaResult<NostrRelay>; + +export type INostrRelayDelete = INostrRelayFindOne; + +export type INostrRelayDeleteResolve = ReplicaSchemaResult<string>; + +export type INostrRelayFields = { url: string, relay_id?: string | null, name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: string | null, software?: string | null, version?: string | null, data?: string | null, }; + +export type INostrRelayFieldsFilter = { id?: string, created_at?: string, updated_at?: string, url?: string, relay_id?: string, name?: string, description?: string, pubkey?: string, contact?: string, supported_nips?: string, software?: string, version?: string, data?: string, }; + +export type INostrRelayFieldsPartial = { url?: ReplicaStoreJsonValue | null, relay_id?: ReplicaStoreJsonValue | null, name?: ReplicaStoreJsonValue | null, description?: ReplicaStoreJsonValue | null, pubkey?: ReplicaStoreJsonValue | null, contact?: ReplicaStoreJsonValue | null, supported_nips?: ReplicaStoreJsonValue | null, software?: ReplicaStoreJsonValue | null, version?: ReplicaStoreJsonValue | null, data?: ReplicaStoreJsonValue | null, }; + +export type INostrRelayFindMany = { filter: INostrRelayFieldsFilter | null, } | { rel: NostrRelayFindManyRel, }; + +export type INostrRelayFindManyResolve = ReplicaSchemaResultList<NostrRelay>; + +export type INostrRelayFindOne = INostrRelayFindOneArgs | INostrRelayFindOneRelArgs; + +export type INostrRelayFindOneArgs = { on: NostrRelayQueryBindValues, }; + +export type INostrRelayFindOneRelArgs = { rel: NostrRelayFindManyRel, }; + +export type INostrRelayFindOneResolve = ReplicaSchemaResult<NostrRelay | null>; + +export type INostrRelayUpdate = INostrRelayUpdateArgs; + +export type INostrRelayUpdateArgs = { on: NostrRelayQueryBindValues, fields: INostrRelayFieldsPartial, }; + +export type INostrRelayUpdateResolve = ReplicaSchemaResult<NostrRelay>; + +export type IPlotCreate = IPlotFields; + +export type IPlotCreateResolve = ReplicaSchemaResult<Plot>; + +export type IPlotDelete = IPlotFindOne; + +export type IPlotDeleteResolve = ReplicaSchemaResult<string>; + +export type IPlotFields = { d_tag: string, farm_id: string, name: string, about?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; + +export type IPlotFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, farm_id?: string, name?: string, about?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; + +export type IPlotFieldsPartial = { d_tag?: ReplicaStoreJsonValue | null, farm_id?: ReplicaStoreJsonValue | null, name?: ReplicaStoreJsonValue | null, about?: ReplicaStoreJsonValue | null, location_primary?: ReplicaStoreJsonValue | null, location_city?: ReplicaStoreJsonValue | null, location_region?: ReplicaStoreJsonValue | null, location_country?: ReplicaStoreJsonValue | null, }; + +export type IPlotFindMany = IPlotFindManyArgs; + +export type IPlotFindManyArgs = { filter: IPlotFieldsFilter | null, }; + +export type IPlotFindManyResolve = ReplicaSchemaResultList<Plot>; + +export type IPlotFindOne = IPlotFindOneArgs; + +export type IPlotFindOneArgs = { on: PlotQueryBindValues, }; + +export type IPlotFindOneResolve = ReplicaSchemaResult<Plot | null>; + +export type IPlotGcsLocationCreate = IPlotGcsLocationFields; + +export type IPlotGcsLocationCreateResolve = ReplicaSchemaResult<PlotGcsLocation>; + +export type IPlotGcsLocationDelete = IPlotGcsLocationFindOne; + +export type IPlotGcsLocationDeleteResolve = ReplicaSchemaResult<string>; + +export type IPlotGcsLocationFields = { plot_id: string, gcs_location_id: string, role: string, }; + +export type IPlotGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, gcs_location_id?: string, role?: string, }; + +export type IPlotGcsLocationFieldsPartial = { plot_id?: ReplicaStoreJsonValue | null, gcs_location_id?: ReplicaStoreJsonValue | null, role?: ReplicaStoreJsonValue | null, }; + +export type IPlotGcsLocationFindMany = IPlotGcsLocationFindManyArgs; + +export type IPlotGcsLocationFindManyArgs = { filter: IPlotGcsLocationFieldsFilter | null, }; + +export type IPlotGcsLocationFindManyResolve = ReplicaSchemaResultList<PlotGcsLocation>; + +export type IPlotGcsLocationFindOne = IPlotGcsLocationFindOneArgs; + +export type IPlotGcsLocationFindOneArgs = { on: PlotGcsLocationQueryBindValues, }; + +export type IPlotGcsLocationFindOneResolve = ReplicaSchemaResult<PlotGcsLocation | null>; + +export type IPlotGcsLocationUpdate = IPlotGcsLocationUpdateArgs; + +export type IPlotGcsLocationUpdateArgs = { on: PlotGcsLocationQueryBindValues, fields: IPlotGcsLocationFieldsPartial, }; + +export type IPlotGcsLocationUpdateResolve = ReplicaSchemaResult<PlotGcsLocation>; + +export type IPlotTagCreate = IPlotTagFields; + +export type IPlotTagCreateResolve = ReplicaSchemaResult<PlotTag>; + +export type IPlotTagDelete = IPlotTagFindOne; + +export type IPlotTagDeleteResolve = ReplicaSchemaResult<string>; + +export type IPlotTagFields = { plot_id: string, tag: string, }; + +export type IPlotTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, tag?: string, }; + +export type IPlotTagFieldsPartial = { plot_id?: ReplicaStoreJsonValue | null, tag?: ReplicaStoreJsonValue | null, }; + +export type IPlotTagFindMany = IPlotTagFindManyArgs; + +export type IPlotTagFindManyArgs = { filter: IPlotTagFieldsFilter | null, }; + +export type IPlotTagFindManyResolve = ReplicaSchemaResultList<PlotTag>; + +export type IPlotTagFindOne = IPlotTagFindOneArgs; + +export type IPlotTagFindOneArgs = { on: PlotTagQueryBindValues, }; + +export type IPlotTagFindOneResolve = ReplicaSchemaResult<PlotTag | null>; + +export type IPlotTagUpdate = IPlotTagUpdateArgs; + +export type IPlotTagUpdateArgs = { on: PlotTagQueryBindValues, fields: IPlotTagFieldsPartial, }; + +export type IPlotTagUpdateResolve = ReplicaSchemaResult<PlotTag>; + +export type IPlotUpdate = IPlotUpdateArgs; + +export type IPlotUpdateArgs = { on: PlotQueryBindValues, fields: IPlotFieldsPartial, }; + +export type IPlotUpdateResolve = ReplicaSchemaResult<Plot>; + +export type ITradeProductCreate = ITradeProductFields; + +export type ITradeProductCreateResolve = ReplicaSchemaResult<TradeProduct>; + +export type ITradeProductDelete = ITradeProductFindOne; + +export type ITradeProductDeleteResolve = ReplicaSchemaResult<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?: 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?: ReplicaStoreJsonValue | null, category?: ReplicaStoreJsonValue | null, title?: ReplicaStoreJsonValue | null, summary?: ReplicaStoreJsonValue | null, process?: ReplicaStoreJsonValue | null, lot?: ReplicaStoreJsonValue | null, profile?: ReplicaStoreJsonValue | null, year?: ReplicaStoreJsonValue | null, qty_amt?: ReplicaStoreJsonValue | null, qty_amt_exact?: ReplicaStoreJsonValue | null, qty_unit?: ReplicaStoreJsonValue | null, qty_label?: ReplicaStoreJsonValue | null, qty_avail?: ReplicaStoreJsonValue | null, price_amt?: ReplicaStoreJsonValue | null, price_amt_exact?: ReplicaStoreJsonValue | null, price_currency?: ReplicaStoreJsonValue | null, price_qty_amt?: ReplicaStoreJsonValue | null, price_qty_amt_exact?: ReplicaStoreJsonValue | null, price_qty_unit?: ReplicaStoreJsonValue | null, listing_addr?: ReplicaStoreJsonValue | null, primary_bin_id?: ReplicaStoreJsonValue | null, verified_primary_bin_id?: ReplicaStoreJsonValue | null, notes?: ReplicaStoreJsonValue | null, }; + +export type ITradeProductFindMany = ITradeProductFindManyArgs; + +export type ITradeProductFindManyArgs = { filter: ITradeProductFieldsFilter | null, }; + +export type ITradeProductFindManyResolve = ReplicaSchemaResultList<TradeProduct>; + +export type ITradeProductFindOne = ITradeProductFindOneArgs; + +export type ITradeProductFindOneArgs = { on: TradeProductQueryBindValues, }; + +export type ITradeProductFindOneResolve = ReplicaSchemaResult<TradeProduct | null>; + +export type ITradeProductLocationRelation = { trade_product: TradeProductQueryBindValues, gcs_location: GcsLocationQueryBindValues, }; + +export type ITradeProductLocationResolve = ReplicaSchemaResultPass; + +export type ITradeProductMediaRelation = { trade_product: TradeProductQueryBindValues, media_image: MediaImageQueryBindValues, }; + +export type ITradeProductMediaResolve = ReplicaSchemaResultPass; + +export type ITradeProductUpdate = ITradeProductUpdateArgs; + +export type ITradeProductUpdateArgs = { on: TradeProductQueryBindValues, fields: ITradeProductFieldsPartial, }; + +export type ITradeProductUpdateResolve = ReplicaSchemaResult<TradeProduct>; + +export type LogError = { id: string, created_at: string, updated_at: string, error: string, message: string, stack_trace: string | null, cause: string | null, app_system: string, app_version: string, nostr_pubkey: string, data: string | null, }; + +export type LogErrorQueryBindValues = { id: string, } | { nostr_pubkey: string, }; + +export type MediaImage = { id: string, created_at: string, updated_at: string, file_path: string, mime_type: string, res_base: string, res_path: string, label: string | null, description: string | null, }; + +export type MediaImageFindManyRel = { on_trade_product: MediaImageTradeProductArgs, } | { off_trade_product: MediaImageTradeProductArgs, }; + +export type MediaImageQueryBindValues = { id: string, } | { file_path: string, }; + +export type MediaImageTradeProductArgs = { id: string, }; + +export type 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 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, }; + +export type NostrProfileFindManyRel = { on_relay: NostrProfileRelayArgs, } | { off_relay: NostrProfileRelayArgs, }; + +export type NostrProfileQueryBindValues = { id: string, } | { public_key: string, }; + +export type NostrProfileRelayArgs = { id: string, }; + +export type NostrRelay = { id: string, created_at: string, updated_at: string, url: string, relay_id: string | null, name: string | null, description: string | null, pubkey: string | null, contact: string | null, supported_nips: string | null, software: string | null, version: string | null, data: string | null, }; + +export type NostrRelayFindManyRel = { on_profile: NostrRelayProfileArgs, } | { off_profile: NostrRelayProfileArgs, }; + +export type NostrRelayProfileArgs = { public_key: string, }; + +export type NostrRelayQueryBindValues = { id: string, } | { url: string, }; + +export type Plot = { id: string, created_at: string, updated_at: string, d_tag: string, farm_id: string, name: string, about: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; + +export type PlotGcsLocation = { id: string, created_at: string, updated_at: string, plot_id: string, gcs_location_id: string, role: string, }; + +export type PlotGcsLocationQueryBindValues = { id: string, } | { plot_id: string, } | { gcs_location_id: string, }; + +export type PlotQueryBindValues = { id: string, } | { d_tag: string, } | { farm_id: string, }; + +export type PlotTag = { id: string, created_at: string, updated_at: string, plot_id: string, tag: string, }; + +export type PlotTagQueryBindValues = { id: string, } | { plot_id: string, } | { tag: string, }; + +export type ReplicaSchemaError<T> = { err: T, }; + +export type ReplicaSchemaResult<T> = { result: T, }; + +export type ReplicaSchemaResultList<T> = { results: Array<T>, }; + +export type ReplicaSchemaResultPass = { pass: boolean, }; + +export type ReplicaStoreJsonValue = null | boolean | number | string | Array<ReplicaStoreJsonValue> | { [key: string]: ReplicaStoreJsonValue }; + +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/packages/replica-db-schema-bindings/src/index.ts b/packages/replica-schema-bindings/src/index.ts diff --git a/packages/replica-db-schema-bindings/tsconfig.json b/packages/replica-schema-bindings/tsconfig.json diff --git a/packages/replica-db-wasm/LICENSE-APACHE b/packages/replica-store-wasm/LICENSE-APACHE diff --git a/packages/replica-db-wasm/LICENSE-MIT b/packages/replica-store-wasm/LICENSE-MIT diff --git a/packages/replica-store-wasm/README.md b/packages/replica-store-wasm/README.md @@ -0,0 +1,9 @@ +# @radroots/replica-store-wasm + +WebAssembly bindings for radroots_replica_store + +This package publishes generated ESM JavaScript, TypeScript declarations, and any runtime artifacts from the Radroots SDK build pipeline. Runtime files are distributed from `dist/`; source and provenance metadata are kept outside the npm package payload. + +## License + +Licensed under either MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE`. diff --git a/packages/replica-store-wasm/package.json b/packages/replica-store-wasm/package.json @@ -0,0 +1,36 @@ +{ + "name": "@radroots/replica-store-wasm", + "version": "0.1.0", + "description": "WebAssembly bindings for radroots_replica_store", + "license": "MIT OR Apache-2.0", + "homepage": "https://radroots.org", + "repository": { + "type": "git", + "url": "git+https://github.com/radrootslabs/sdk.git", + "directory": "packages/replica-store-wasm" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "sideEffects": false, + "files": [ + "dist", + "README.md", + "LICENSE-MIT", + "LICENSE-APACHE" + ], + "main": "./dist/radroots_replica_store_wasm.js", + "types": "./dist/radroots_replica_store_wasm.d.ts", + "exports": { + ".": { + "types": "./dist/radroots_replica_store_wasm.d.ts", + "import": "./dist/radroots_replica_store_wasm.js", + "default": "./dist/radroots_replica_store_wasm.js" + } + }, + "scripts": { + "build": "cd ../.. && cargo xtask generate wasm --package replica_store", + "typecheck": "tsc --noEmit --strict --module NodeNext --moduleResolution NodeNext --target ES2022 dist/radroots_replica_store_wasm.d.ts dist/radroots_replica_store_wasm_bg.wasm.d.ts" + } +} diff --git a/packages/trade-bindings/package.json b/packages/trade-bindings/package.json @@ -35,6 +35,6 @@ }, "dependencies": { "@radroots/core-bindings": "workspace:^", - "@radroots/events-bindings": "workspace:^" + "@radroots/event-bindings": "workspace:^" } } diff --git a/packages/trade-bindings/src/generated/types.ts b/packages/trade-bindings/src/generated/types.ts @@ -1,7 +1,7 @@ // @generated by cargo xtask generate ts // Do not edit by hand. import type { RadrootsCoreCurrency, RadrootsCoreDecimal, RadrootsCoreDiscount, RadrootsCoreMoney, RadrootsCoreQuantity, RadrootsCoreUnit } from "@radroots/core-bindings"; -import type { RadrootsFarmRef, RadrootsListing, RadrootsListingAvailability, RadrootsListingBin, RadrootsListingDeliveryMethod, RadrootsListingImage, RadrootsListingProduct, RadrootsListingPublicLocation, RadrootsOrderEconomics, RadrootsOrderEventType, RadrootsOrderInventoryCommitment, RadrootsPlotRef, RadrootsResourceAreaRef } from "@radroots/events-bindings"; +import type { RadrootsFarmRef, RadrootsListing, RadrootsListingAvailability, RadrootsListingBin, RadrootsListingDeliveryMethod, RadrootsListingImage, RadrootsListingProduct, RadrootsListingPublicLocation, RadrootsOrderEconomics, RadrootsOrderEventType, RadrootsOrderInventoryCommitment, RadrootsPlotRef, RadrootsResourceAreaRef } from "@radroots/event-bindings"; export type RadrootsOrderIssue = "missing_request" | { multiple_requests: { event_ids: Array<string>, }, } | { request_payload_invalid: { event_id: string, }, } | { request_order_id_mismatch: { event_id: string, }, } | { request_author_mismatch: { event_id: string, }, } | { request_listing_address_invalid: { event_id: string, }, } | { request_seller_listing_mismatch: { event_id: string, }, } | { decision_payload_invalid: { event_id: string, }, } | { decision_order_id_mismatch: { event_id: string, }, } | { decision_author_mismatch: { event_id: string, }, } | { decision_counterparty_mismatch: { event_id: string, }, } | { decision_buyer_mismatch: { event_id: string, }, } | { decision_seller_mismatch: { event_id: string, }, } | { decision_listing_address_invalid: { event_id: string, }, } | { decision_listing_mismatch: { event_id: string, }, } | { decision_root_mismatch: { event_id: string, }, } | { decision_previous_mismatch: { event_id: string, }, } | { decision_missing_inventory_commitments: { event_id: string, }, } | { decision_inventory_commitment_mismatch: { event_id: string, }, } | { decision_missing_reason: { event_id: string, }, } | { conflicting_decisions: { event_ids: Array<string>, }, } | { revision_proposal_payload_invalid: { event_id: string, }, } | { revision_proposal_order_id_mismatch: { event_id: string, }, } | { revision_proposal_author_mismatch: { event_id: string, }, } | { revision_proposal_counterparty_mismatch: { event_id: string, }, } | { revision_proposal_buyer_mismatch: { event_id: string, }, } | { revision_proposal_seller_mismatch: { event_id: string, }, } | { revision_proposal_listing_address_invalid: { event_id: string, }, } | { revision_proposal_listing_mismatch: { event_id: string, }, } | { revision_proposal_root_mismatch: { event_id: string, }, } | { revision_proposal_previous_mismatch: { event_id: string, }, } | { revision_decision_without_proposal: { event_id: string, }, } | { revision_decision_payload_invalid: { event_id: string, }, } | { revision_decision_order_id_mismatch: { event_id: string, }, } | { revision_decision_author_mismatch: { event_id: string, }, } | { revision_decision_counterparty_mismatch: { event_id: string, }, } | { revision_decision_buyer_mismatch: { event_id: string, }, } | { revision_decision_seller_mismatch: { event_id: string, }, } | { revision_decision_listing_address_invalid: { event_id: string, }, } | { revision_decision_listing_mismatch: { event_id: string, }, } | { revision_decision_root_mismatch: { event_id: string, }, } | { revision_decision_previous_mismatch: { event_id: string, }, } | { revision_decision_revision_id_mismatch: { event_id: string, }, } | { cancellation_without_cancellable_order: { event_id: string, }, } | { cancellation_payload_invalid: { event_id: string, }, } | { cancellation_order_id_mismatch: { event_id: string, }, } | { cancellation_author_mismatch: { event_id: string, }, } | { cancellation_counterparty_mismatch: { event_id: string, }, } | { cancellation_buyer_mismatch: { event_id: string, }, } | { cancellation_seller_mismatch: { event_id: string, }, } | { cancellation_listing_address_invalid: { event_id: string, }, } | { cancellation_listing_mismatch: { event_id: string, }, } | { cancellation_root_mismatch: { event_id: string, }, } | { cancellation_previous_mismatch: { event_id: string, }, } | { forked_lifecycle: { event_ids: Array<string>, }, } | { validation_receipt_without_pending_agreement: { event_id: string, }, } | { validation_receipt_order_id_mismatch: { event_id: string, }, } | { validation_receipt_type_mismatch: { event_id: string, }, } | { validation_receipt_root_mismatch: { event_id: string, }, } | { validation_receipt_target_mismatch: { event_id: string, }, } | { validation_receipt_listing_mismatch: { event_id: string, }, } | { conflicting_validation_receipts: { event_ids: Array<string>, }, } | { deterministic_validation_failure: { event_id: string, reason: string, }, } | { stale_listing_event: { expected_event_id: string, current_event_id: string, }, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml @@ -14,21 +14,21 @@ importers: packages/core-bindings: {} - packages/events-bindings: + packages/event-bindings: dependencies: '@radroots/core-bindings': specifier: workspace:^ version: link:../core-bindings - packages/events-codec-wasm: {} + packages/event-codec-wasm: {} - packages/events-indexed-bindings: {} + packages/event-index-bindings: {} packages/identity-bindings: {} - packages/replica-db-schema-bindings: {} + packages/replica-schema-bindings: {} - packages/replica-db-wasm: {} + packages/replica-store-wasm: {} packages/replica-sync-wasm: {} @@ -37,9 +37,9 @@ importers: '@radroots/core-bindings': specifier: workspace:^ version: link:../core-bindings - '@radroots/events-bindings': + '@radroots/event-bindings': specifier: workspace:^ - version: link:../events-bindings + version: link:../event-bindings packages: diff --git a/tools/xtask/Cargo.toml b/tools/xtask/Cargo.toml @@ -18,10 +18,10 @@ dto_bindgen_backend_ts = { workspace = true } dto_bindgen_core = { workspace = true } radroots_core = { workspace = true, features = ["dto-bindgen"] } radroots_event = { workspace = true, features = ["dto-bindgen"] } -radroots_events_bindings = { path = "../../crates/events_bindings" } +radroots_event_bindings = { path = "../../crates/event_bindings" } radroots_event_index = { workspace = true, features = ["dto-bindgen"] } radroots_identity_bindings = { path = "../../crates/identity_bindings" } -radroots_replica_db_schema_bindings = { path = "../../crates/replica_db_schema_bindings" } +radroots_replica_schema_bindings = { path = "../../crates/replica_schema_bindings" } radroots_trade_bindings = { path = "../../crates/trade_bindings" } flate2 = "1" serde_json = "1" diff --git a/tools/xtask/src/check.rs b/tools/xtask/src/check.rs @@ -2141,13 +2141,13 @@ transport-reticulum-preview = [] fn consumer_smoke_script_imports_package_roots() { let script = consumer_smoke_script(&[ "@radroots/core-bindings".to_owned(), - "@radroots/events-codec-wasm".to_owned(), + "@radroots/event-codec-wasm".to_owned(), ]) .expect("smoke script renders"); assert_eq!( script, - "await import(\"@radroots/core-bindings\");\nawait import(\"@radroots/events-codec-wasm\");\n" + "await import(\"@radroots/core-bindings\");\nawait import(\"@radroots/event-codec-wasm\");\n" ); } @@ -2221,12 +2221,12 @@ transport-reticulum-preview = [] let source = package_json_value(&package_json_with_dependencies( "trade-bindings", r#""@radroots/core-bindings": "workspace:^", - "@radroots/events-bindings": "workspace:^""#, + "@radroots/event-bindings": "workspace:^""#, )); let packed = package_json_value(&package_json_with_dependencies( "trade-bindings", r#""@radroots/core-bindings": "^0.1.0", - "@radroots/events-bindings": "^0.1.0""#, + "@radroots/event-bindings": "^0.1.0""#, )); check_packed_package_json( diff --git a/tools/xtask/src/contracts.rs b/tools/xtask/src/contracts.rs @@ -575,13 +575,13 @@ repository = "sdk-typescript" [packages] "radroots_core" = "@radroots/core-bindings" -"radroots_event" = "@radroots/events-bindings" -"radroots_event_index" = "@radroots/events-indexed-bindings" +"radroots_event" = "@radroots/event-bindings" +"radroots_event_index" = "@radroots/event-index-bindings" "radroots_identity" = "@radroots/identity-bindings" -"radroots_replica_db_schema" = "@radroots/replica-db-schema-bindings" +"radroots_replica_schema" = "@radroots/replica-schema-bindings" "radroots_trade" = "@radroots/trade-bindings" -"radroots_events_codec_wasm" = "@radroots/events-codec-wasm" -"radroots_replica_db_wasm" = "@radroots/replica-db-wasm" +"radroots_event_codec_wasm" = "@radroots/event-codec-wasm" +"radroots_replica_store_wasm" = "@radroots/replica-store-wasm" "radroots_replica_sync_wasm" = "@radroots/replica-sync-wasm" [artifacts] @@ -614,19 +614,19 @@ crate_dir = "crates/core_bindings" package = "@radroots/core-bindings" package_dir = "packages/core-bindings" -[npm_packages.events] +[npm_packages.event] kind = "bindings" -crate_name = "radroots_events_bindings" -crate_dir = "crates/events_bindings" -package = "@radroots/events-bindings" -package_dir = "packages/events-bindings" +crate_name = "radroots_event_bindings" +crate_dir = "crates/event_bindings" +package = "@radroots/event-bindings" +package_dir = "packages/event-bindings" -[npm_packages.events_indexed] +[npm_packages.event_index] kind = "bindings" -crate_name = "radroots_events_indexed_bindings" -crate_dir = "crates/events_indexed_bindings" -package = "@radroots/events-indexed-bindings" -package_dir = "packages/events-indexed-bindings" +crate_name = "radroots_event_index_bindings" +crate_dir = "crates/event_index_bindings" +package = "@radroots/event-index-bindings" +package_dir = "packages/event-index-bindings" [npm_packages.identity] kind = "bindings" @@ -635,12 +635,12 @@ crate_dir = "crates/identity_bindings" package = "@radroots/identity-bindings" package_dir = "packages/identity-bindings" -[npm_packages.replica_db_schema] +[npm_packages.replica_schema] kind = "bindings" -crate_name = "radroots_replica_db_schema_bindings" -crate_dir = "crates/replica_db_schema_bindings" -package = "@radroots/replica-db-schema-bindings" -package_dir = "packages/replica-db-schema-bindings" +crate_name = "radroots_replica_schema_bindings" +crate_dir = "crates/replica_schema_bindings" +package = "@radroots/replica-schema-bindings" +package_dir = "packages/replica-schema-bindings" [npm_packages.trade] kind = "bindings" @@ -649,23 +649,23 @@ crate_dir = "crates/trade_bindings" package = "@radroots/trade-bindings" package_dir = "packages/trade-bindings" -[npm_packages.events_codec] +[npm_packages.event_codec] kind = "wasm" -crate_name = "radroots_events_codec_wasm" -crate_dir = "crates/events_codec_wasm" -package = "@radroots/events-codec-wasm" -package_dir = "packages/events-codec-wasm" -out_name = "radroots_events_codec_wasm" -out_dir = "../../packages/events-codec-wasm/dist" - -[npm_packages.replica_db] +crate_name = "radroots_event_codec_wasm" +crate_dir = "crates/event_codec_wasm" +package = "@radroots/event-codec-wasm" +package_dir = "packages/event-codec-wasm" +out_name = "radroots_event_codec_wasm" +out_dir = "../../packages/event-codec-wasm/dist" + +[npm_packages.replica_store] kind = "wasm" -crate_name = "radroots_replica_db_wasm" -crate_dir = "crates/replica_db_wasm" -package = "@radroots/replica-db-wasm" -package_dir = "packages/replica-db-wasm" -out_name = "radroots_replica_db_wasm" -out_dir = "../../packages/replica-db-wasm/dist" +crate_name = "radroots_replica_store_wasm" +crate_dir = "crates/replica_store_wasm" +package = "@radroots/replica-store-wasm" +package_dir = "packages/replica-store-wasm" +out_name = "radroots_replica_store_wasm" +out_dir = "../../packages/replica-store-wasm/dist" [npm_packages.replica_sync] kind = "wasm" diff --git a/tools/xtask/src/dto_roots.rs b/tools/xtask/src/dto_roots.rs @@ -46,8 +46,8 @@ struct DtoExternalOverride { const CORE_BINDINGS_PACKAGE_KEY: &str = "core"; const CORE_BINDINGS_PACKAGE_NAME: &str = "@radroots/core-bindings"; -const EVENTS_BINDINGS_PACKAGE_KEY: &str = "events"; -const EVENTS_BINDINGS_PACKAGE_NAME: &str = "@radroots/events-bindings"; +const EVENT_BINDINGS_PACKAGE_KEY: &str = "event"; +const EVENT_BINDINGS_PACKAGE_NAME: &str = "@radroots/event-bindings"; pub const DTO_PACKAGE_ROOTS: &[DtoPackageRootSet] = &[ DtoPackageRootSet { @@ -55,12 +55,12 @@ pub const DTO_PACKAGE_ROOTS: &[DtoPackageRootSet] = &[ roots: core_roots, }, DtoPackageRootSet { - package_key: "events", - roots: events_roots, + package_key: "event", + roots: event_roots, }, DtoPackageRootSet { - package_key: "events_indexed", - roots: events_indexed_roots, + package_key: "event_index", + roots: event_index_roots, }, DtoPackageRootSet { package_key: "trade", @@ -75,17 +75,17 @@ pub const MANUAL_DESCRIPTOR_FAMILIES: &[ManualDescriptorFamily] = &[ reason: "custom serde, string-backed newtypes, aliases, and tagged enum wire forms require source-owned manual descriptors", }, ManualDescriptorFamily { - package_key: "events", + package_key: "event", source_family: "event timestamps, counters, and optional metadata fields", reason: "large integers and source-specific optional/null policy must be explicit", }, ManualDescriptorFamily { - package_key: "events", + package_key: "event", source_family: "GeoJSON coordinate arrays", reason: "fixed-size Rust arrays must preserve tuple semantics in TypeScript", }, ManualDescriptorFamily { - package_key: "events_indexed", + package_key: "event_index", source_family: "checkpoint and index cursor fields", reason: "custom deserialization and large integers require manual descriptor policy", }, @@ -95,7 +95,7 @@ pub const MANUAL_DESCRIPTOR_FAMILIES: &[ManualDescriptorFamily] = &[ reason: "core aliases, source-owned event imports, and count-family numeric policy require explicit descriptors", }, ManualDescriptorFamily { - package_key: "replica_db_schema", + package_key: "replica_schema", source_family: "untagged query wrappers and serde_json value fields", reason: "schema query shapes are generated and not all source fields map to derive-supported DTOs", }, @@ -108,12 +108,12 @@ pub const SDK_LOCAL_WRAPPER_ALLOWANCES: &[SdkLocalWrapperAllowance] = &[ reason: "source descriptors correctly describe fields as strings, while package roots still need stable named TypeScript aliases", }, SdkLocalWrapperAllowance { - package_key: "replica_db_schema", + package_key: "replica_schema", shape_family: "generated query argument wrappers", reason: "schema operation inputs are generated package shapes rather than source-owned public DTO structs", }, SdkLocalWrapperAllowance { - package_key: "events_indexed", + package_key: "event_index", shape_family: "RadrootsEventIndexShardId package alias", reason: "source descriptors correctly describe the shard id newtype as a string, while package roots still need a stable named TypeScript alias", }, @@ -133,32 +133,32 @@ const TRADE_EXTERNAL_OVERRIDES: &[DtoExternalOverride] = &[ core_override("RadrootsCoreQuantity"), core_override("RadrootsCoreQuantityPrice"), core_override("RadrootsCoreUnit"), - events_override("RadrootsFarmRef"), - events_override("RadrootsListing"), - events_override("RadrootsListingAvailability"), - events_override("RadrootsListingBin"), - events_override("RadrootsListingDeliveryMethod"), - events_override("RadrootsListingImage"), - events_override("RadrootsListingProduct"), - events_override("RadrootsListingPublicLocation"), - events_override("RadrootsListingStatus"), - events_override("RadrootsEventPtr"), - events_override("RadrootsPlotRef"), - events_override("RadrootsResourceAreaRef"), - events_override("RadrootsOrderEconomicActor"), - events_override("RadrootsOrderEconomicEffect"), - events_override("RadrootsOrderEconomicItem"), - events_override("RadrootsOrderEconomicLine"), - events_override("RadrootsOrderEconomicLineKind"), - events_override("RadrootsOrderEconomics"), - events_override("RadrootsOrderEventType"), - events_override("RadrootsOrderInventoryCommitment"), - events_override("RadrootsOrderItem"), - events_override("RadrootsOrderPricingBasis"), + event_override("RadrootsFarmRef"), + event_override("RadrootsListing"), + event_override("RadrootsListingAvailability"), + event_override("RadrootsListingBin"), + event_override("RadrootsListingDeliveryMethod"), + event_override("RadrootsListingImage"), + event_override("RadrootsListingProduct"), + event_override("RadrootsListingPublicLocation"), + event_override("RadrootsListingStatus"), + event_override("RadrootsEventPtr"), + event_override("RadrootsPlotRef"), + event_override("RadrootsResourceAreaRef"), + event_override("RadrootsOrderEconomicActor"), + event_override("RadrootsOrderEconomicEffect"), + event_override("RadrootsOrderEconomicItem"), + event_override("RadrootsOrderEconomicLine"), + event_override("RadrootsOrderEconomicLineKind"), + event_override("RadrootsOrderEconomics"), + event_override("RadrootsOrderEventType"), + event_override("RadrootsOrderInventoryCommitment"), + event_override("RadrootsOrderItem"), + event_override("RadrootsOrderPricingBasis"), ]; const TRADE_REQUIRED_EXTERNAL_PACKAGE_IMPORTS: &[&str] = - &[CORE_BINDINGS_PACKAGE_NAME, EVENTS_BINDINGS_PACKAGE_NAME]; + &[CORE_BINDINGS_PACKAGE_NAME, EVENT_BINDINGS_PACKAGE_NAME]; pub fn package_root_set(package_key: &str) -> Option<&'static DtoPackageRootSet> { DTO_PACKAGE_ROOTS @@ -179,26 +179,25 @@ pub fn core_types_module() -> Result<DtoTypesModule, String> { )) } -pub fn events_types_module() -> Result<DtoTypesModule, String> { - let root_set = - package_root_set("events").ok_or_else(|| "missing events DTO roots".to_owned())?; +pub fn event_types_module() -> Result<DtoTypesModule, String> { + let root_set = package_root_set("event").ok_or_else(|| "missing event DTO roots".to_owned())?; let registry = root_set.registry(); let options = core_import_options(®istry, DtoRegistryRenderOptions::default())?; let rendered = render_registry_types(®istry, &options)?; - Ok(with_events_sdk_wrappers(rendered)) + Ok(with_event_sdk_wrappers(rendered)) } -pub fn events_indexed_types_module() -> Result<DtoTypesModule, String> { - let root_set = package_root_set("events_indexed") - .ok_or_else(|| "missing events-indexed DTO roots".to_owned())?; +pub fn event_index_types_module() -> Result<DtoTypesModule, String> { + let root_set = package_root_set("event_index") + .ok_or_else(|| "missing event-index DTO roots".to_owned())?; let rendered = render_registry_types(&root_set.registry(), &DtoRegistryRenderOptions::default())?; - Ok(with_events_indexed_sdk_wrappers(rendered)) + Ok(with_event_index_sdk_wrappers(rendered)) } -pub fn replica_db_schema_types_module() -> Result<DtoTypesModule, String> { +pub fn replica_schema_types_module() -> Result<DtoTypesModule, String> { render_registry_types( - &radroots_replica_db_schema_bindings::dto_registry(), + &radroots_replica_schema_bindings::dto_registry(), &DtoRegistryRenderOptions::default(), ) } @@ -216,11 +215,11 @@ fn core_roots() -> Vec<RootDescriptor> { radroots_core::dto::dto_roots().into_iter().collect() } -fn events_roots() -> Vec<RootDescriptor> { +fn event_roots() -> Vec<RootDescriptor> { radroots_event::dto::dto_roots().into_iter().collect() } -fn events_indexed_roots() -> Vec<RootDescriptor> { +fn event_index_roots() -> Vec<RootDescriptor> { radroots_event_index::dto::dto_roots().into_iter().collect() } @@ -295,8 +294,8 @@ fn generated_external_package_exports() -> Result<BTreeMap<&'static str, BTreeSe type_exports(core_types_module()?.body_ts()), ), ( - EVENTS_BINDINGS_PACKAGE_KEY, - type_exports(events_types_module()?.body_ts()), + EVENT_BINDINGS_PACKAGE_KEY, + type_exports(event_types_module()?.body_ts()), ), ])) } @@ -416,16 +415,16 @@ const fn core_override(export_name: &'static str) -> DtoExternalOverride { } } -const fn events_override(export_name: &'static str) -> DtoExternalOverride { +const fn event_override(export_name: &'static str) -> DtoExternalOverride { DtoExternalOverride { target_type: export_name, import_name: export_name, - from_package_key: EVENTS_BINDINGS_PACKAGE_KEY, - from: EVENTS_BINDINGS_PACKAGE_NAME, + from_package_key: EVENT_BINDINGS_PACKAGE_KEY, + from: EVENT_BINDINGS_PACKAGE_NAME, } } -fn with_events_sdk_wrappers(module: DtoTypesModule) -> DtoTypesModule { +fn with_event_sdk_wrappers(module: DtoTypesModule) -> DtoTypesModule { let mut declarations = module .body_ts() .split("\n\n") @@ -458,7 +457,7 @@ fn declaration_name(declaration: &str) -> &str { .unwrap_or(declaration) } -fn with_events_indexed_sdk_wrappers(module: DtoTypesModule) -> DtoTypesModule { +fn with_event_index_sdk_wrappers(module: DtoTypesModule) -> DtoTypesModule { let mut declarations = module .body_ts() .split("\n\n") @@ -524,43 +523,41 @@ mod tests { use super::{ CORE_BINDINGS_PACKAGE_KEY, CORE_BINDINGS_PACKAGE_NAME, DTO_PACKAGE_ROOTS, DtoExternalOverride, MANUAL_DESCRIPTOR_FAMILIES, SDK_LOCAL_WRAPPER_ALLOWANCES, - events_override, imported_type_inventory, package_root_set, trade_import_options, + event_override, imported_type_inventory, package_root_set, trade_import_options, type_exports, validate_external_override_target, validate_external_override_usage, with_checked_external_type, }; use dto_bindgen_backend_ts::{DtoRegistryRenderOptions, DtoTypesModule}; - const EVENTS_BINDINGS_TYPES_TS: &str = - 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 EVENT_BINDINGS_TYPES_TS: &str = + include_str!("../../../packages/event-bindings/src/generated/types.ts"); + const EVENT_INDEX_BINDINGS_TYPES_TS: &str = + include_str!("../../../packages/event-index-bindings/src/generated/types.ts"); + const REPLICA_SCHEMA_BINDINGS_TYPES_TS: &str = + include_str!("../../../packages/replica-schema-bindings/src/generated/types.ts"); const TRADE_BINDINGS_TYPES_TS: &str = include_str!("../../../packages/trade-bindings/src/generated/types.ts"); const REPLICA_SCHEMA_MODEL_SOURCES: &[&str] = &[ - include_str!("../../../../lib/crates/replica_db_schema/src/models/farm.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/farm_gcs_location.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/farm_member.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/farm_member_claim.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/farm_tag.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/gcs_location.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/log_error.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/media_image.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/nostr_event_head.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/nostr_profile.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/nostr_profile_relay.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/nostr_relay.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/plot.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/plot_gcs_location.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/plot_tag.rs"), - include_str!("../../../../lib/crates/replica_db_schema/src/models/trade_product.rs"), - include_str!( - "../../../../lib/crates/replica_db_schema/src/models/trade_product_location.rs" - ), - include_str!("../../../../lib/crates/replica_db_schema/src/models/trade_product_media.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/farm.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/farm_gcs_location.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/farm_member.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/farm_member_claim.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/farm_tag.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/gcs_location.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/log_error.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/media_image.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/nostr_event_head.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/nostr_profile.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/nostr_profile_relay.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/nostr_relay.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/plot.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/plot_gcs_location.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/plot_tag.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/trade_product.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/trade_product_location.rs"), + include_str!("../../../../lib/crates/replica_schema/src/models/trade_product_media.rs"), ]; - const EVENTS_TYPE_INVENTORY: &[&str] = &[ + const EVENT_TYPE_INVENTORY: &[&str] = &[ "JobFeedbackStatus", "JobInputType", "JobPaymentRequest", @@ -676,7 +673,7 @@ mod tests { "RadrootsWikiMergeRequest", "RadrootsWikiRedirect", ]; - const EVENTS_INDEXED_TYPE_INVENTORY: &[&str] = &[ + const EVENT_INDEX_TYPE_INVENTORY: &[&str] = &[ "RadrootsEventIndexShardId", "RadrootsEventIndexIdRange", "RadrootsEventIndexShardMetadata", @@ -737,8 +734,8 @@ mod tests { #[test] fn package_roots_are_explicit_not_discovered() { assert!(package_root_set("core").is_some()); - assert!(package_root_set("events").is_some()); - assert!(package_root_set("events_indexed").is_some()); + assert!(package_root_set("event").is_some()); + assert!(package_root_set("event_index").is_some()); assert!(package_root_set("trade").is_some()); } @@ -855,16 +852,15 @@ mod tests { #[test] fn external_override_usage_rejects_local_emission_for_imported_type() { let module = DtoTypesModule::new( - "import type { RadrootsCoreDecimal } from \"@radroots/core-bindings\";\n\nimport type { RadrootsFarmRef } from \"@radroots/events-bindings\";\n\n", + "import type { RadrootsCoreDecimal } from \"@radroots/core-bindings\";\n\nimport type { RadrootsFarmRef } from \"@radroots/event-bindings\";\n\n", "export type RadrootsFarmRef = { pubkey: string, d_tag: string, };", ); - let error = - validate_external_override_usage(&module, &[events_override("RadrootsFarmRef")]) - .expect_err("local emission of imported type must fail"); + let error = validate_external_override_usage(&module, &[event_override("RadrootsFarmRef")]) + .expect_err("local emission of imported type must fail"); assert_eq!( error, - "external DTO override `RadrootsFarmRef` from `@radroots/events-bindings` was emitted locally instead of imported" + "external DTO override `RadrootsFarmRef` from `@radroots/event-bindings` was emitted locally instead of imported" ); } @@ -893,17 +889,17 @@ mod tests { } #[test] - fn events_type_inventory_matches_current_package_surface() { - let actual = type_inventory(EVENTS_BINDINGS_TYPES_TS); + fn event_type_inventory_matches_current_package_surface() { + let actual = type_inventory(EVENT_BINDINGS_TYPES_TS); - assert_eq!(actual, EVENTS_TYPE_INVENTORY); + assert_eq!(actual, EVENT_TYPE_INVENTORY); } #[test] - fn events_indexed_type_inventory_matches_current_package_surface() { - let actual = type_inventory(EVENTS_INDEXED_BINDINGS_TYPES_TS); + fn event_index_type_inventory_matches_current_package_surface() { + let actual = type_inventory(EVENT_INDEX_BINDINGS_TYPES_TS); - assert_eq!(actual, EVENTS_INDEXED_TYPE_INVENTORY); + assert_eq!(actual, EVENT_INDEX_TYPE_INVENTORY); } #[test] @@ -914,28 +910,28 @@ mod tests { } #[test] - fn replica_db_schema_generated_types_preserve_source_schema_contracts() { - let actual = type_inventory(REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS); + fn replica_schema_generated_types_preserve_source_schema_contracts() { + let actual = type_inventory(REPLICA_SCHEMA_BINDINGS_TYPES_TS); let trade_product_filter = type_declaration( - REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS, + REPLICA_SCHEMA_BINDINGS_TYPES_TS, "ITradeProductFieldsFilter", ); let trade_product_partial = type_declaration( - REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS, + REPLICA_SCHEMA_BINDINGS_TYPES_TS, "ITradeProductFieldsPartial", ); assert!(actual.contains(&"Farm")); assert!(actual.contains(&"GcsLocation")); assert!(actual.contains(&"NostrEventHead")); - assert!(actual.contains(&"ReplicaDbJsonValue")); + assert!(actual.contains(&"ReplicaStoreJsonValue")); 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_SCHEMA_BINDINGS_TYPES_TS.contains( + "export type ReplicaStoreJsonValue = null | boolean | number | string | Array<ReplicaStoreJsonValue> | { [key: string]: ReplicaStoreJsonValue };" )); assert!( - REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS + REPLICA_SCHEMA_BINDINGS_TYPES_TS .contains("export type IFarmFindOneResolve = ReplicaSchemaResult<Farm | null>;") ); assert!(actual.contains(&"ReplicaSchemaResult")); @@ -944,13 +940,13 @@ mod tests { assert!(actual.contains(&"ReplicaSchemaError")); 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")); + assert!(trade_product_partial.contains("year?: ReplicaStoreJsonValue | null")); + assert!(trade_product_partial.contains("qty_avail?: ReplicaStoreJsonValue | null")); } #[test] - fn replica_db_schema_generated_types_match_source_public_inventory() { - let actual = type_inventory(REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS) + fn replica_schema_generated_types_match_source_public_inventory() { + let actual = type_inventory(REPLICA_SCHEMA_BINDINGS_TYPES_TS) .into_iter() .collect::<BTreeSet<_>>(); let missing = source_public_schema_type_inventory() @@ -967,22 +963,22 @@ mod tests { #[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\"")); + assert!(TRADE_BINDINGS_TYPES_TS.contains("from \"@radroots/event-bindings\"")); let imports = imported_type_inventory(TRADE_BINDINGS_TYPES_TS); assert!( imports - .get("@radroots/events-bindings") + .get("@radroots/event-bindings") .is_some_and(|names| names.contains("RadrootsOrderEventType")) ); assert!( imports - .get("@radroots/events-bindings") + .get("@radroots/event-bindings") .is_some_and(|names| names.contains("RadrootsOrderEconomics")) ); assert!( imports - .get("@radroots/events-bindings") + .get("@radroots/event-bindings") .is_some_and(|names| names.contains("RadrootsOrderInventoryCommitment")) ); diff --git a/tools/xtask/src/output.rs b/tools/xtask/src/output.rs @@ -88,19 +88,15 @@ pub fn package_outputs() -> Result<Vec<PackageOutput>, String> { kinds_ts: None, }, PackageOutput { - spec: spec_by_key("events"), - types_ts: Some(TsSource::DtoRegistry(dto_roots::events_types_module()?)), + spec: spec_by_key("event"), + types_ts: Some(TsSource::DtoRegistry(dto_roots::event_types_module()?)), types_imports: Vec::new(), - constants_ts: Some(TsSource::Module( - radroots_events_bindings::constants_module(), - )), - kinds_ts: Some(TsSource::Module(radroots_events_bindings::kinds_module())), + constants_ts: Some(TsSource::Module(radroots_event_bindings::constants_module())), + kinds_ts: Some(TsSource::Module(radroots_event_bindings::kinds_module())), }, PackageOutput { - spec: spec_by_key("events_indexed"), - types_ts: Some(TsSource::DtoRegistry( - dto_roots::events_indexed_types_module()?, - )), + spec: spec_by_key("event_index"), + types_ts: Some(TsSource::DtoRegistry(dto_roots::event_index_types_module()?)), types_imports: Vec::new(), constants_ts: None, kinds_ts: None, @@ -115,9 +111,9 @@ pub fn package_outputs() -> Result<Vec<PackageOutput>, String> { kinds_ts: None, }, PackageOutput { - spec: spec_by_key("replica_db_schema"), + spec: spec_by_key("replica_schema"), types_ts: Some(TsSource::DtoRegistry( - dto_roots::replica_db_schema_types_module()?, + dto_roots::replica_schema_types_module()?, )), types_imports: Vec::new(), constants_ts: None, @@ -194,12 +190,12 @@ 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"); - const EVENTS_BINDINGS_CONSTANTS_TS: &str = - include_str!("../../../packages/events-bindings/src/generated/constants.ts"); - const EVENTS_BINDINGS_KINDS_TS: &str = - include_str!("../../../packages/events-bindings/src/generated/kinds.ts"); + const REPLICA_SCHEMA_BINDINGS_TYPES_TS: &str = + include_str!("../../../packages/replica-schema-bindings/src/generated/types.ts"); + const EVENT_BINDINGS_CONSTANTS_TS: &str = + include_str!("../../../packages/event-bindings/src/generated/constants.ts"); + const EVENT_BINDINGS_KINDS_TS: &str = + include_str!("../../../packages/event-bindings/src/generated/kinds.ts"); const IDENTITY_BINDINGS_CONSTANTS_TS: &str = include_str!("../../../packages/identity-bindings/src/generated/constants.ts"); @@ -236,10 +232,10 @@ mod tests { .map(|output| output.spec.package_name) .collect::<Vec<_>>(); assert!(package_names.contains(&"@radroots/core-bindings")); - assert!(package_names.contains(&"@radroots/events-bindings")); - assert!(package_names.contains(&"@radroots/events-indexed-bindings")); + assert!(package_names.contains(&"@radroots/event-bindings")); + assert!(package_names.contains(&"@radroots/event-index-bindings")); assert!(package_names.contains(&"@radroots/identity-bindings")); - assert!(package_names.contains(&"@radroots/replica-db-schema-bindings")); + assert!(package_names.contains(&"@radroots/replica-schema-bindings")); assert!(package_names.contains(&"@radroots/trade-bindings")); } @@ -316,12 +312,12 @@ mod tests { } #[test] - fn replica_db_schema_output_uses_dto_registry_and_matches_checked_in_types() { + fn replica_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"); + .find(|output| output.spec.key == "replica_schema") + .expect("replica_schema output"); assert!(matches!(output.types_ts, Some(TsSource::DtoRegistry(_)))); assert!(output.types_imports.is_empty()); @@ -332,7 +328,7 @@ mod tests { .find(|file| file.relative_path == "src/generated/types.ts") .expect("types file"); - assert_eq!(types.contents, REPLICA_DB_SCHEMA_BINDINGS_TYPES_TS); + assert_eq!(types.contents, REPLICA_SCHEMA_BINDINGS_TYPES_TS); } #[test] @@ -340,8 +336,8 @@ mod tests { let output = package_outputs() .expect("package outputs") .into_iter() - .find(|output| output.spec.key == "events") - .expect("events output"); + .find(|output| output.spec.key == "event") + .expect("event output"); assert!(matches!(output.constants_ts, Some(TsSource::Module(_)))); assert!(matches!(output.kinds_ts, Some(TsSource::Module(_)))); @@ -356,8 +352,8 @@ mod tests { .find(|file| file.relative_path == "src/generated/kinds.ts") .expect("kinds file"); - assert_eq!(constants.contents, EVENTS_BINDINGS_CONSTANTS_TS); - assert_eq!(kinds.contents, EVENTS_BINDINGS_KINDS_TS); + assert_eq!(constants.contents, EVENT_BINDINGS_CONSTANTS_TS); + assert_eq!(kinds.contents, EVENT_BINDINGS_KINDS_TS); } #[test] diff --git a/tools/xtask/src/package_matrix.rs b/tools/xtask/src/package_matrix.rs @@ -29,18 +29,18 @@ pub const PACKAGE_SPECS: [PackageSpec; 6] = [ package_dir: "packages/core-bindings", }, PackageSpec { - key: "events", - crate_name: "radroots_events_bindings", - crate_dir: "crates/events_bindings", - package_name: "@radroots/events-bindings", - package_dir: "packages/events-bindings", + key: "event", + crate_name: "radroots_event_bindings", + crate_dir: "crates/event_bindings", + package_name: "@radroots/event-bindings", + package_dir: "packages/event-bindings", }, PackageSpec { - key: "events_indexed", - crate_name: "radroots_events_indexed_bindings", - crate_dir: "crates/events_indexed_bindings", - package_name: "@radroots/events-indexed-bindings", - package_dir: "packages/events-indexed-bindings", + key: "event_index", + crate_name: "radroots_event_index_bindings", + crate_dir: "crates/event_index_bindings", + package_name: "@radroots/event-index-bindings", + package_dir: "packages/event-index-bindings", }, PackageSpec { key: "identity", @@ -50,11 +50,11 @@ pub const PACKAGE_SPECS: [PackageSpec; 6] = [ package_dir: "packages/identity-bindings", }, PackageSpec { - key: "replica_db_schema", - crate_name: "radroots_replica_db_schema_bindings", - crate_dir: "crates/replica_db_schema_bindings", - package_name: "@radroots/replica-db-schema-bindings", - package_dir: "packages/replica-db-schema-bindings", + key: "replica_schema", + crate_name: "radroots_replica_schema_bindings", + crate_dir: "crates/replica_schema_bindings", + package_name: "@radroots/replica-schema-bindings", + package_dir: "packages/replica-schema-bindings", }, PackageSpec { key: "trade", @@ -67,22 +67,22 @@ pub const PACKAGE_SPECS: [PackageSpec; 6] = [ pub const WASM_PACKAGE_SPECS: [WasmPackageSpec; 3] = [ WasmPackageSpec { - key: "events_codec", - crate_name: "radroots_events_codec_wasm", - crate_dir: "crates/events_codec_wasm", - package_name: "@radroots/events-codec-wasm", - package_dir: "packages/events-codec-wasm", - out_name: "radroots_events_codec_wasm", - out_dir: "../../packages/events-codec-wasm/dist", + key: "event_codec", + crate_name: "radroots_event_codec_wasm", + crate_dir: "crates/event_codec_wasm", + package_name: "@radroots/event-codec-wasm", + package_dir: "packages/event-codec-wasm", + out_name: "radroots_event_codec_wasm", + out_dir: "../../packages/event-codec-wasm/dist", }, WasmPackageSpec { - key: "replica_db", - crate_name: "radroots_replica_db_wasm", - crate_dir: "crates/replica_db_wasm", - package_name: "@radroots/replica-db-wasm", - package_dir: "packages/replica-db-wasm", - out_name: "radroots_replica_db_wasm", - out_dir: "../../packages/replica-db-wasm/dist", + key: "replica_store", + crate_name: "radroots_replica_store_wasm", + crate_dir: "crates/replica_store_wasm", + package_name: "@radroots/replica-store-wasm", + package_dir: "packages/replica-store-wasm", + out_name: "radroots_replica_store_wasm", + out_dir: "../../packages/replica-store-wasm/dist", }, WasmPackageSpec { key: "replica_sync", @@ -191,7 +191,7 @@ mod tests { assert!( package_specs() .iter() - .any(|spec| spec.package_name == "@radroots/replica-db-schema-bindings") + .any(|spec| spec.package_name == "@radroots/replica-schema-bindings") ); } @@ -200,7 +200,7 @@ mod tests { assert!( wasm_package_specs() .iter() - .any(|spec| spec.package_name == "@radroots/replica-db-wasm") + .any(|spec| spec.package_name == "@radroots/replica-store-wasm") ); } } diff --git a/tools/xtask/src/wasm.rs b/tools/xtask/src/wasm.rs @@ -219,7 +219,7 @@ fn selected_specs(args: &[String]) -> Result<Vec<WasmPackageSpec>, String> { } fn wasm_package_requires_c_compiler(spec: WasmPackageSpec) -> bool { - spec.key == "events_codec" + spec.key == "event_codec" } fn resolve_required_path_tool(name: &str) -> Result<PathBuf, String> { @@ -708,9 +708,9 @@ mod tests { #[test] fn selects_one_spec_by_key() { - let specs = selected_specs(&["--package".to_owned(), "replica_db".to_owned()]) - .expect("replica db spec"); - assert_eq!(specs[0].package_name, "@radroots/replica-db-wasm"); + let specs = selected_specs(&["--package".to_owned(), "replica_store".to_owned()]) + .expect("replica store spec"); + assert_eq!(specs[0].package_name, "@radroots/replica-store-wasm"); } #[test] @@ -957,7 +957,7 @@ channel = "1.92.0" } #[test] - fn events_codec_wasm_requires_c_compiler() { + fn event_codec_wasm_requires_c_compiler() { assert!(wasm_package_requires_c_compiler(wasm_package_specs()[0])); assert!(!wasm_package_requires_c_compiler(wasm_package_specs()[1])); } diff --git a/tools/xtask/src/wasm_declarations.rs b/tools/xtask/src/wasm_declarations.rs @@ -134,12 +134,12 @@ pub fn declaration_files(spec: WasmPackageSpec) -> Result<Vec<WasmDeclarationFil fn inventory(spec: WasmPackageSpec) -> Result<WasmDeclarationInventory, String> { match spec.key { - "events_codec" => Ok(WasmDeclarationInventory { - public_functions: EVENTS_CODEC_FUNCTIONS, - support_exports: EVENTS_CODEC_SUPPORT_EXPORTS, + "event_codec" => Ok(WasmDeclarationInventory { + public_functions: EVENT_CODEC_FUNCTIONS, + support_exports: EVENT_CODEC_SUPPORT_EXPORTS, }), - "replica_db" => Ok(WasmDeclarationInventory { - public_functions: REPLICA_DB_FUNCTIONS, + "replica_store" => Ok(WasmDeclarationInventory { + public_functions: REPLICA_STORE_FUNCTIONS, support_exports: SQL_WASM_SUPPORT_EXPORTS, }), "replica_sync" => Ok(WasmDeclarationInventory { @@ -353,7 +353,7 @@ fn promise_of(type_expr: TypeScriptType) -> TypeScriptType { TypeScriptType::generic("Promise", vec![type_expr]) } -const EVENTS_CODEC_FUNCTIONS: &[WasmPublicFunction] = &[ +const EVENT_CODEC_FUNCTIONS: &[WasmPublicFunction] = &[ public_function!("article_tags", Some("article_json"), String, 2, 4), public_function!("calendar_date_event_tags", Some("event_json"), String, 2, 4), public_function!("calendar_event_rsvp_tags", Some("rsvp_json"), String, 2, 4), @@ -442,7 +442,7 @@ const EVENTS_CODEC_FUNCTIONS: &[WasmPublicFunction] = &[ public_function!("contract_manifest_json", None, String, 0, 4), ]; -const EVENTS_CODEC_SUPPORT_EXPORTS: &[WasmSupportExport] = &[ +const EVENT_CODEC_SUPPORT_EXPORTS: &[WasmSupportExport] = &[ memory_export!(), table_export!("__wbindgen_externrefs"), number_function_export!("__wbindgen_malloc", 2), @@ -452,447 +452,513 @@ const EVENTS_CODEC_SUPPORT_EXPORTS: &[WasmSupportExport] = &[ void_function_export!("__wbindgen_start", 0), ]; -const REPLICA_DB_FUNCTIONS: &[WasmPublicFunction] = &[ - public_function!("replica_db_export_begin", None, Any, 0, 3), - public_function!("replica_db_export_finish", None, Void, 0, 2), - public_function!("replica_db_export_json", None, Any, 0, 3), - public_function!("replica_db_farm_create", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_farm_delete", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_farm_find_many", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_farm_find_one", Some("opts_json"), Any, 2, 3), +const REPLICA_STORE_FUNCTIONS: &[WasmPublicFunction] = &[ + public_function!("replica_store_export_begin", None, Any, 0, 3), + public_function!("replica_store_export_finish", None, Void, 0, 2), + public_function!("replica_store_export_json", None, Any, 0, 3), + public_function!("replica_store_farm_create", Some("opts_json"), Any, 2, 3), + public_function!("replica_store_farm_delete", Some("opts_json"), Any, 2, 3), + public_function!("replica_store_farm_find_many", Some("opts_json"), Any, 2, 3), + public_function!("replica_store_farm_find_one", Some("opts_json"), Any, 2, 3), + public_function!( + "replica_store_farm_gcs_location_create", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_gcs_location_delete", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_gcs_location_find_many", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_gcs_location_find_one", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_gcs_location_update", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_member_claim_create", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_member_claim_delete", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_member_claim_find_many", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_member_claim_find_one", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_member_claim_update", + Some("opts_json"), + Any, + 2, + 3 + ), + public_function!( + "replica_store_farm_member_create", + Some("opts_json"), + Any, + 2, + 3 + ), public_function!( - "replica_db_farm_gcs_location_create", + "replica_store_farm_member_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_gcs_location_delete", + "replica_store_farm_member_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_gcs_location_find_many", + "replica_store_farm_member_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_gcs_location_find_one", + "replica_store_farm_member_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_gcs_location_update", + "replica_store_farm_tag_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_claim_create", + "replica_store_farm_tag_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_claim_delete", + "replica_store_farm_tag_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_claim_find_many", + "replica_store_farm_tag_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_claim_find_one", + "replica_store_farm_tag_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_claim_update", + "replica_store_gcs_location_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_create", + "replica_store_gcs_location_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_delete", + "replica_store_gcs_location_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_find_many", + "replica_store_gcs_location_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_farm_member_find_one", + "replica_store_gcs_location_update", Some("opts_json"), Any, 2, 3 ), + public_function!("replica_store_import_json", Some("dump_json"), Void, 2, 2), public_function!( - "replica_db_farm_member_update", + "replica_store_log_error_create", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_farm_tag_create", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_farm_tag_delete", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_farm_tag_find_many", + "replica_store_log_error_delete", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_farm_tag_find_one", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_farm_tag_update", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_gcs_location_create", + "replica_store_log_error_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_gcs_location_delete", + "replica_store_log_error_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_gcs_location_find_many", + "replica_store_log_error_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_gcs_location_find_one", + "replica_store_media_image_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_gcs_location_update", + "replica_store_media_image_delete", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_import_json", Some("dump_json"), Void, 2, 2), - public_function!("replica_db_log_error_create", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_log_error_delete", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_log_error_find_many", + "replica_store_media_image_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_log_error_find_one", + "replica_store_media_image_find_one", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_log_error_update", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_media_image_create", + "replica_store_media_image_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_media_image_delete", + "replica_store_nostr_event_head_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_media_image_find_many", + "replica_store_nostr_event_head_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_media_image_find_one", + "replica_store_nostr_event_head_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_media_image_update", + "replica_store_nostr_event_head_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_event_head_create", + "replica_store_nostr_event_head_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_event_head_delete", + "replica_store_nostr_profile_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_event_head_find_many", + "replica_store_nostr_profile_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_event_head_find_one", + "replica_store_nostr_profile_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_event_head_update", + "replica_store_nostr_profile_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_create", + "replica_store_nostr_profile_relay_set", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_delete", + "replica_store_nostr_profile_relay_unset", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_find_many", + "replica_store_nostr_profile_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_find_one", + "replica_store_nostr_relay_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_relay_set", + "replica_store_nostr_relay_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_relay_unset", + "replica_store_nostr_relay_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_profile_update", + "replica_store_nostr_relay_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_relay_create", + "replica_store_nostr_relay_update", Some("opts_json"), Any, 2, 3 ), + public_function!("replica_store_plot_create", Some("opts_json"), Any, 2, 3), + public_function!("replica_store_plot_delete", Some("opts_json"), Any, 2, 3), + public_function!("replica_store_plot_find_many", Some("opts_json"), Any, 2, 3), + public_function!("replica_store_plot_find_one", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_nostr_relay_delete", + "replica_store_plot_gcs_location_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_relay_find_many", + "replica_store_plot_gcs_location_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_relay_find_one", + "replica_store_plot_gcs_location_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_nostr_relay_update", + "replica_store_plot_gcs_location_find_one", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_plot_create", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_plot_delete", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_plot_find_many", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_plot_find_one", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_plot_gcs_location_create", + "replica_store_plot_gcs_location_update", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_plot_gcs_location_delete", + "replica_store_plot_tag_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_plot_gcs_location_find_many", + "replica_store_plot_tag_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_plot_gcs_location_find_one", + "replica_store_plot_tag_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_plot_gcs_location_update", + "replica_store_plot_tag_find_one", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_plot_tag_create", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_plot_tag_delete", Some("opts_json"), Any, 2, 3), public_function!( - "replica_db_plot_tag_find_many", + "replica_store_plot_tag_update", Some("opts_json"), Any, 2, 3 ), - public_function!("replica_db_plot_tag_find_one", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_plot_tag_update", Some("opts_json"), Any, 2, 3), - public_function!("replica_db_reset_database", None, Void, 0, 2), - public_function!("replica_db_run_migrations", None, Void, 0, 2), + public_function!("replica_store_reset_database", None, Void, 0, 2), + public_function!("replica_store_run_migrations", None, Void, 0, 2), public_function!( - "replica_db_trade_product_create", + "replica_store_trade_product_create", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_delete", + "replica_store_trade_product_delete", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_find_many", + "replica_store_trade_product_find_many", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_find_one", + "replica_store_trade_product_find_one", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_location_set", + "replica_store_trade_product_location_set", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_location_unset", + "replica_store_trade_product_location_unset", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_media_set", + "replica_store_trade_product_media_set", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_media_unset", + "replica_store_trade_product_media_unset", Some("opts_json"), Any, 2, 3 ), public_function!( - "replica_db_trade_product_update", + "replica_store_trade_product_update", Some("opts_json"), Any, 2, @@ -948,7 +1014,7 @@ mod tests { #[test] fn generated_declarations_include_public_wasm_entrypoints() { let specs = wasm_package_specs(); - let events = declaration_files(specs[0]).expect("events declarations"); + let events = declaration_files(specs[0]).expect("event declarations"); assert!(events[0].contents.contains("export function listing_tags")); assert!( events[1] @@ -956,16 +1022,16 @@ mod tests { .contains("export declare const listing_tags") ); - let replica_db = declaration_files(specs[1]).expect("replica db declarations"); + let replica_store = declaration_files(specs[1]).expect("replica store declarations"); assert!( - replica_db[0] + replica_store[0] .contents - .contains("export function replica_db_farm_create") + .contains("export function replica_store_farm_create") ); assert!( - replica_db[1] + replica_store[1] .contents - .contains("export declare const replica_db_farm_create") + .contains("export declare const replica_store_farm_create") ); let replica_sync = declaration_files(specs[2]).expect("replica sync declarations");