lib

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

commit dffb7e0f1387d297ae6a41db0a807448308a9f20
parent 3d908d05c33bd949a1a173d644f14bd83973ae74
Author: triesap <tyson@radroots.org>
Date:   Thu, 11 Jun 2026 13:40:05 -0700

chore: align source layout

Diffstat:
Mcrates/core_bindings/src/lib.rs | 3+--
Acrates/core_bindings/src/typescript/types.ts | 25+++++++++++++++++++++++++
Mcrates/identity_bindings/src/lib.rs | 3+--
Acrates/identity_bindings/src/typescript/constants.ts | 3+++
Mcrates/trade_bindings/src/lib.rs | 3+--
Acrates/trade_bindings/src/typescript/types.ts | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 122 insertions(+), 6 deletions(-)

diff --git a/crates/core_bindings/src/lib.rs b/crates/core_bindings/src/lib.rs @@ -1,7 +1,6 @@ pub use radroots_core as upstream; -pub const TYPES_TS: &str = - include_str!("../../../testdata/baseline/current-radroots-generated/core/types.ts"); +pub const TYPES_TS: &str = include_str!("typescript/types.ts"); #[cfg(test)] mod tests { diff --git a/crates/core_bindings/src/typescript/types.ts b/crates/core_bindings/src/typescript/types.ts @@ -0,0 +1,25 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type RadrootsCoreCurrency = string; + +export type RadrootsCoreDecimal = string; + +export type RadrootsCoreDiscount = { scope: RadrootsCoreDiscountScope, threshold: RadrootsCoreDiscountThreshold, value: RadrootsCoreDiscountValue, }; + +export type RadrootsCoreDiscountScope = "bin" | "order_total"; + +export type RadrootsCoreDiscountThreshold = { "kind": "bin_count", "amount": { bin_id: string, min: number, } } | { "kind": "order_quantity", "amount": { min: RadrootsCoreQuantity, } }; + +export type RadrootsCoreDiscountValue = { "kind": "money_per_bin", "amount": RadrootsCoreMoney } | { "kind": "percent", "amount": RadrootsCorePercent }; + +export type RadrootsCoreMoney = { amount: string, currency: string, }; + +export type RadrootsCorePercent = { value: string, }; + +export type RadrootsCoreQuantity = { amount: string, unit: RadrootsCoreUnit, label: string | null, }; + +export type RadrootsCoreQuantityPrice = { amount: RadrootsCoreMoney, quantity: RadrootsCoreQuantity, }; + +export type RadrootsCoreUnit = "each" | "kg" | "g" | "oz" | "lb" | "l" | "ml"; + +export type RadrootsCoreUnitDimension = "count" | "mass" | "volume"; diff --git a/crates/identity_bindings/src/lib.rs b/crates/identity_bindings/src/lib.rs @@ -1,7 +1,6 @@ pub use radroots_identity as upstream; -pub const CONSTANTS_TS: &str = - include_str!("../../../testdata/baseline/current-radroots-generated/identity/constants.ts"); +pub const CONSTANTS_TS: &str = include_str!("typescript/constants.ts"); #[cfg(test)] mod tests { diff --git a/crates/identity_bindings/src/typescript/constants.ts b/crates/identity_bindings/src/typescript/constants.ts @@ -0,0 +1,3 @@ +export const RADROOTS_USERNAME_MIN_LEN = 3; +export const RADROOTS_USERNAME_MAX_LEN = 30; +export const RADROOTS_USERNAME_REGEX = "^(?!.*\.\.)(?!\.)(?!.*\.$)[a-z0-9._-]{3,30}$"; diff --git a/crates/trade_bindings/src/lib.rs b/crates/trade_bindings/src/lib.rs @@ -1,7 +1,6 @@ pub use radroots_trade as upstream; -pub const TYPES_TS: &str = - include_str!("../../../testdata/baseline/current-radroots-generated/trade/types.ts"); +pub const TYPES_TS: &str = include_str!("typescript/types.ts"); #[cfg(test)] mod tests { diff --git a/crates/trade_bindings/src/typescript/types.ts b/crates/trade_bindings/src/typescript/types.ts @@ -0,0 +1,91 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type RadrootsFarmRef = { pubkey: string, d_tag: string, }; + +export type RadrootsListing = { d_tag: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: Array<RadrootsListingBin>, resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: RadrootsCoreDiscount[] | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: RadrootsListingImage[] | null, }; + +export type RadrootsListingAvailability = { "kind": "window", "amount": { start?: number | null, end?: number | null, } } | { "kind": "status", "amount": { status: RadrootsListingStatus, } }; + +export type RadrootsListingBin = { bin_id: string, quantity: RadrootsCoreQuantity, price_per_canonical_unit: RadrootsCoreQuantityPrice, display_amount?: RadrootsCoreDecimal | null, display_unit?: RadrootsCoreUnit | null, display_label?: string | null, display_price?: RadrootsCoreMoney | null, display_price_unit?: RadrootsCoreUnit | null, }; + +export type RadrootsListingDeliveryMethod = { "kind": "pickup" } | { "kind": "local_delivery" } | { "kind": "shipping" } | { "kind": "other", "amount": { method: string, } }; + +export type RadrootsListingLocation = { primary: string, city?: string | null, region?: string | null, country?: string | null, lat?: number | null, lng?: number | null, geohash?: string | null, }; + +export type RadrootsListingProduct = { key: string, title: string, category: string, summary?: string | null, process?: string | null, lot?: string | null, location?: string | null, profile?: string | null, year?: string | null, }; + +export type RadrootsListingStatus = { "kind": "active" } | { "kind": "sold" } | { "kind": "other", "amount": { value: string, } }; + +export type RadrootsTradeFacetCount = { key: string, count: number, }; + +export type RadrootsTradeFulfillmentException = { code: string, severity: RadrootsTradeFulfillmentExceptionSeverity, status: RadrootsTradeFulfillmentExceptionStatus, source?: string | null, notes?: string | null, }; + +export type RadrootsTradeFulfillmentExceptionSeverity = "notice" | "warning" | "blocking"; + +export type RadrootsTradeFulfillmentExceptionStatus = "open" | "monitoring" | "resolved"; + +export type RadrootsTradeListing = { listing_id: string, listing_addr: string, seller_pubkey: string, title: string, description: string, product_type: string, primary_bin_id: string, bin_quantity: RadrootsCoreQuantity, unit: RadrootsCoreUnit, unit_price: RadrootsCoreMoney, inventory_available: RadrootsCoreDecimal, availability: RadrootsListingAvailability, location: RadrootsListingLocation, delivery_method: RadrootsListingDeliveryMethod, listing: RadrootsListing, }; + +export type RadrootsTradeListingBackofficeOverlay = { listing_addr: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: RadrootsTradeModerationFlag[], }; + +export type RadrootsTradeListingBackofficeQuery = { listing: RadrootsTradeListingQuery, requires_review?: boolean | null, has_open_moderation_flags?: boolean | null, }; + +export type RadrootsTradeListingBackofficeView = { listing: RadrootsTradeListingProjection, marketplace?: RadrootsTradeMarketplaceListingSummary | null, overlay?: RadrootsTradeListingBackofficeOverlay | null, requires_review: boolean, open_moderation_flag_count: number, }; + +export type RadrootsTradeListingBinProjection = { bin: RadrootsListingBin, one_bin_total: RadrootsTradeListingTotal, }; + +export type RadrootsTradeListingFacets = { seller_pubkeys: RadrootsTradeFacetCount[], farm_pubkeys: RadrootsTradeFacetCount[], farm_ids: RadrootsTradeFacetCount[], product_keys: RadrootsTradeFacetCount[], product_categories: RadrootsTradeFacetCount[], listing_statuses: RadrootsTradeFacetCount[], }; + +export type RadrootsTradeListingMarketStatus = "unknown" | "window" | "active" | "sold" | { "other": { value: string, } }; + +export type RadrootsTradeListingProjection = { listing_addr: string, seller_pubkey: string, listing_id: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: RadrootsTradeListingBinProjection[], resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: RadrootsCoreDiscount[] | null, inventory_available?: RadrootsCoreDecimal | null, availability?: RadrootsListingAvailability | null, delivery_method?: RadrootsListingDeliveryMethod | null, location?: RadrootsListingLocation | null, images?: RadrootsListingImage[] | null, order_count: number, open_order_count: number, terminal_order_count: number, }; + +export type RadrootsTradeListingQuery = { seller_pubkey?: string | null, farm_pubkey?: string | null, farm_id?: string | null, product_key?: string | null, product_category?: string | null, listing_status?: RadrootsTradeListingMarketStatus | null, }; + +export type RadrootsTradeListingSort = { field: RadrootsTradeListingSortField, direction: RadrootsTradeSortDirection, }; + +export type RadrootsTradeListingSortField = "listing_addr" | "product_title" | "product_category" | "seller_pubkey" | "inventory_available" | "open_order_count" | "total_order_count"; + +export type RadrootsTradeListingSubtotal = { price_amount: RadrootsCoreMoney, price_currency: RadrootsCoreCurrency, quantity_amount: RadrootsCoreDecimal, quantity_unit: RadrootsCoreUnit, }; + +export type RadrootsTradeListingTotal = { price_amount: RadrootsCoreMoney, price_currency: RadrootsCoreCurrency, quantity_amount: RadrootsCoreDecimal, quantity_unit: RadrootsCoreUnit, }; + +export type RadrootsTradeMarketplaceListingSummary = { listing_addr: string, seller_pubkey: string, farm_pubkey: string, farm_id: string, product_key: string, product_title: string, product_category: string, product_summary?: string | null, listing_status: RadrootsTradeListingMarketStatus, location_primary?: string | null, inventory_available?: RadrootsCoreDecimal | null, primary_bin_id: string, primary_bin_label?: string | null, primary_bin_total: RadrootsTradeListingTotal, order_count: number, open_order_count: number, terminal_order_count: number, }; + +export type RadrootsTradeMarketplaceOrderSummary = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, status: RadrootsTradeOrderStatus, last_message_type: RadrootsTradeMessageType, item_count: number, total_bin_count: number, has_requested_discounts: boolean, last_reason?: string | null, }; + +export type RadrootsTradeMessageType = "listing_validate_request" | "listing_validate_result" | "order_request" | "order_response" | "order_revision" | "order_revision_accept" | "order_revision_decline" | "question" | "answer" | "discount_request" | "discount_offer" | "discount_accept" | "discount_decline" | "cancel" | "fulfillment_update" | "receipt"; + +export type RadrootsTradeModerationFlag = { code: string, severity: RadrootsTradeModerationSeverity, status: RadrootsTradeModerationStatus, source?: string | null, reason?: string | null, }; + +export type RadrootsTradeModerationSeverity = "notice" | "warning" | "block"; + +export type RadrootsTradeModerationStatus = "open" | "snoozed" | "resolved"; + +export type RadrootsTradeOrderBackofficeOverlay = { order_id: string, review_queue?: RadrootsTradeReviewQueueEntry | null, moderation_flags: RadrootsTradeModerationFlag[], fulfillment_exceptions: RadrootsTradeFulfillmentException[], }; + +export type RadrootsTradeOrderBackofficeQuery = { order: RadrootsTradeOrderQuery, requires_review?: boolean | null, has_open_moderation_flags?: boolean | null, has_open_fulfillment_exceptions?: boolean | null, }; + +export type RadrootsTradeOrderBackofficeView = { order: RadrootsTradeOrderWorkflowProjection, marketplace: RadrootsTradeMarketplaceOrderSummary, overlay?: RadrootsTradeOrderBackofficeOverlay | null, requires_review: boolean, open_moderation_flag_count: number, open_fulfillment_exception_count: number, }; + +export type RadrootsTradeOrderFacets = { buyer_pubkeys: RadrootsTradeFacetCount[], seller_pubkeys: RadrootsTradeFacetCount[], listing_addrs: RadrootsTradeFacetCount[], statuses: RadrootsTradeFacetCount[], }; + +export type RadrootsTradeOrderQuery = { listing_addr?: string | null, buyer_pubkey?: string | null, seller_pubkey?: string | null, status?: RadrootsTradeOrderStatus | null, }; + +export type RadrootsTradeOrderSort = { field: RadrootsTradeOrderSortField, direction: RadrootsTradeSortDirection, }; + +export type RadrootsTradeOrderSortField = "order_id" | "listing_addr" | "buyer_pubkey" | "seller_pubkey" | "status" | "last_message_type" | "total_bin_count"; + +export type RadrootsTradeOrderStatus = "draft" | "validated" | "requested" | "questioned" | "revised" | "accepted" | "declined" | "cancelled" | "fulfilled" | "completed"; + +export type RadrootsTradeOrderWorkflowMessage = { event_id: string, actor_pubkey: string, counterparty_pubkey: string, listing_addr: string, order_id?: string | null, listing_event?: RadrootsNostrEventPtr | null, root_event_id?: string | null, prev_event_id?: string | null, payload: RadrootsTradeMessagePayload, }; + +export type RadrootsTradeOrderWorkflowProjection = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, items: RadrootsTradeOrderItem[], requested_discounts?: RadrootsTradeOrderEconomicLine[] | null, status: RadrootsTradeOrderStatus, listing_snapshot?: RadrootsNostrEventPtr | null, root_event_id: string, last_event_id: string, last_discount_request?: RadrootsCoreDiscountValue | null, last_discount_offer?: RadrootsCoreDiscountValue | null, accepted_discount?: RadrootsCoreDiscountValue | null, last_fulfillment_status?: RadrootsTradeFulfillmentStatus | null, receipt_acknowledged?: bool | null, receipt_at?: number | null, last_reason?: string | null, last_discount_decline_reason?: string | null, question_count: number, answer_count: number, revision_count: number, discount_request_count: number, discount_offer_count: number, discount_accept_count: number, discount_decline_count: number, cancellation_count: number, fulfillment_update_count: number, receipt_count: number, last_message_type: RadrootsTradeMessageType, last_actor_pubkey: string, }; + +export type RadrootsTradeReviewPriority = "low" | "normal" | "high" | "critical"; + +export type RadrootsTradeReviewQueueEntry = { queue: string, priority: RadrootsTradeReviewPriority, status: RadrootsTradeReviewStatus, assigned_operator?: string | null, reason?: string | null, }; + +export type RadrootsTradeReviewStatus = "queued" | "in_progress" | "blocked" | "resolved"; + +export type RadrootsTradeSortDirection = "asc" | "desc";