sdk

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

commit ee040ce23067eeee888556086f4a65417622985b
parent 5101e03ab69fd669c70f2c427007511223f84341
Author: triesap <tyson@radroots.org>
Date:   Thu, 11 Jun 2026 06:13:23 -0700

test(sdk): capture current radroots generated baseline

Diffstat:
Mcrates/xtask/src/check.rs | 36++++++++++++++++++++++++++++++++++++
Atestdata/baseline/current-radroots-generated/core/types.ts | 25+++++++++++++++++++++++++
Atestdata/baseline/current-radroots-generated/events/constants.ts | 3+++
Atestdata/baseline/current-radroots-generated/events/kinds.ts | 87+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atestdata/baseline/current-radroots-generated/events/types.ts | 221+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atestdata/baseline/current-radroots-generated/identity/constants.ts | 3+++
Atestdata/baseline/current-radroots-generated/replica-db-schema/types.ts | 521+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atestdata/baseline/current-radroots-generated/trade/types.ts | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atestdata/baseline/current-radroots-generated/types/types.ts | 9+++++++++
9 files changed, 996 insertions(+), 0 deletions(-)

diff --git a/crates/xtask/src/check.rs b/crates/xtask/src/check.rs @@ -9,6 +9,7 @@ pub fn check() -> Result<(), String> { validate_package_matrix()?; let root = workspace_root()?; check_forbidden_packages(&root)?; + check_baseline(&root)?; for spec in package_specs() { let package_dir = root.join(spec.package_dir); let package_json_path = package_dir.join("package.json"); @@ -21,6 +22,41 @@ pub fn check() -> Result<(), String> { Ok(()) } +fn check_baseline(root: &Path) -> Result<(), String> { + let baseline = root.join("testdata/baseline/current-radroots-generated"); + if !baseline.is_dir() { + return Err(format!( + "missing generated baseline: {}", + baseline.display() + )); + } + let mut files = Vec::new(); + collect_files(&baseline, &mut files)?; + if files.is_empty() { + return Err(format!( + "generated baseline is empty: {}", + baseline.display() + )); + } + Ok(()) +} + +fn collect_files(dir: &Path, files: &mut Vec<std::path::PathBuf>) -> Result<(), String> { + let entries = + fs::read_dir(dir).map_err(|error| format!("failed to read {}: {error}", dir.display()))?; + for entry in entries { + let entry = + entry.map_err(|error| format!("failed to read {} entry: {error}", dir.display()))?; + let path = entry.path(); + if path.is_dir() { + collect_files(&path, files)?; + } else if path.is_file() { + files.push(path); + } + } + Ok(()) +} + fn check_forbidden_packages(root: &Path) -> Result<(), String> { for forbidden in FORBIDDEN_PACKAGE_NAMES { let package_leaf = forbidden.trim_start_matches("@radroots/").to_owned(); diff --git a/testdata/baseline/current-radroots-generated/core/types.ts b/testdata/baseline/current-radroots-generated/core/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/testdata/baseline/current-radroots-generated/events/constants.ts b/testdata/baseline/current-radroots-generated/events/constants.ts @@ -0,0 +1,3 @@ +import type { RadrootsListingProductTagKeys } from "./types.js"; + +export const RADROOTS_LISTING_PRODUCT_TAG_KEYS: RadrootsListingProductTagKeys = ["key", "title", "category", "summary", "process", "lot", "location", "profile", "year"]; diff --git a/testdata/baseline/current-radroots-generated/events/kinds.ts b/testdata/baseline/current-radroots-generated/events/kinds.ts @@ -0,0 +1,87 @@ +export const KIND_PROFILE = 0; +export const KIND_POST = 1; +export const KIND_FOLLOW = 3; +export const KIND_REACTION = 7; +export const KIND_SEAL = 13; +export const KIND_MESSAGE = 14; +export const KIND_MESSAGE_FILE = 15; +export const KIND_GIFT_WRAP = 1059; +export const KIND_COMMENT = 1111; +export const KIND_GEOCHAT = 20000; +export const KIND_LIST_MUTE = 10000; +export const KIND_LIST_PINNED_NOTES = 10001; +export const KIND_LIST_READ_WRITE_RELAYS = 10002; +export const KIND_LIST_BOOKMARKS = 10003; +export const KIND_LIST_COMMUNITIES = 10004; +export const KIND_LIST_PUBLIC_CHATS = 10005; +export const KIND_LIST_BLOCKED_RELAYS = 10006; +export const KIND_LIST_SEARCH_RELAYS = 10007; +export const KIND_LIST_SIMPLE_GROUPS = 10009; +export const KIND_LIST_RELAY_FEEDS = 10012; +export const KIND_LIST_INTERESTS = 10015; +export const KIND_LIST_MEDIA_FOLLOWS = 10020; +export const KIND_LIST_EMOJIS = 10030; +export const KIND_LIST_DM_RELAYS = 10050; +export const KIND_LIST_GOOD_WIKI_AUTHORS = 10101; +export const KIND_LIST_GOOD_WIKI_RELAYS = 10102; +export const KIND_LIST_SET_FOLLOW = 30000; +export const KIND_LIST_SET_GENERIC = 30001; +export const KIND_LIST_SET_RELAY = 30002; +export const KIND_LIST_SET_BOOKMARK = 30003; +export const KIND_LIST_SET_CURATION = 30004; +export const KIND_LIST_SET_VIDEO = 30005; +export const KIND_LIST_SET_PICTURE = 30006; +export const KIND_LIST_SET_KIND_MUTE = 30007; +export const KIND_LIST_SET_INTEREST = 30015; +export const KIND_LIST_SET_EMOJI = 30030; +export const KIND_LIST_SET_RELEASE_ARTIFACT = 30063; +export const KIND_LIST_SET_APP_CURATION = 30267; +export const KIND_LIST_SET_CALENDAR = 31924; +export const KIND_LIST_SET_STARTER_PACK = 39089; +export const KIND_LIST_SET_MEDIA_STARTER_PACK = 39092; +export const KIND_FARM = 30340; +export const KIND_PLOT = 30350; +export const KIND_COOP = 30360; +export const KIND_DOCUMENT = 30361; +export const KIND_RESOURCE_AREA = 30370; +export const KIND_RESOURCE_HARVEST_CAP = 30371; +export const KIND_ACCOUNT_CLAIM = 30380; +export const KIND_APP_DATA = 30078; +export const KIND_LISTING = 30402; +export const KIND_APPLICATION_HANDLER = 31990; +export const KIND_TRADE_LISTING_VALIDATE_REQ = 5321; +export const KIND_TRADE_LISTING_VALIDATE_RES = 6321; +export const KIND_WORKER_TRADE_TRANSITION_PROOF_REQ = 5322; +export const KIND_WORKER_TRADE_TRANSITION_PROOF_RES = 6322; +export const KIND_TRADE_ORDER_REQUEST = 3422; +export const KIND_TRADE_ORDER_RESPONSE = 3423; +export const KIND_TRADE_ORDER_DECISION = 3423; +export const KIND_TRADE_ORDER_REVISION = 3424; +export const KIND_TRADE_ORDER_REVISION_RESPONSE = 3425; +export const KIND_TRADE_QUESTION = 3426; +export const KIND_TRADE_ANSWER = 3427; +export const KIND_TRADE_DISCOUNT_REQUEST = 3428; +export const KIND_TRADE_DISCOUNT_OFFER = 3429; +export const KIND_TRADE_DISCOUNT_ACCEPT = 3430; +export const KIND_TRADE_FORBIDDEN_3431 = 3431; +export const KIND_TRADE_CANCEL = 3432; +export const KIND_TRADE_FULFILLMENT_UPDATE = 3433; +export const KIND_TRADE_RECEIPT = 3434; +export const KIND_TRADE_VALIDATION_RECEIPT = 3440; +export const KIND_TRADE_LISTING_ORDER_REQ = 3422; +export const KIND_TRADE_LISTING_ORDER_RES = 3423; +export const KIND_TRADE_LISTING_ORDER_REVISION_REQ = 3424; +export const KIND_TRADE_LISTING_ORDER_REVISION_RES = 3425; +export const KIND_TRADE_LISTING_QUESTION_REQ = 3426; +export const KIND_TRADE_LISTING_ANSWER_RES = 3427; +export const KIND_TRADE_LISTING_DISCOUNT_REQ = 3428; +export const KIND_TRADE_LISTING_DISCOUNT_OFFER_RES = 3429; +export const KIND_TRADE_LISTING_DISCOUNT_ACCEPT_REQ = 3430; +export const KIND_TRADE_LISTING_CANCEL_REQ = 3432; +export const KIND_TRADE_LISTING_FULFILLMENT_UPDATE_REQ = 3433; +export const KIND_TRADE_LISTING_RECEIPT_REQ = 3434; +export const KIND_JOB_REQUEST_MIN = 5000; +export const KIND_JOB_REQUEST_MAX = 5999; +export const KIND_JOB_RESULT_MIN = 6000; +export const KIND_JOB_RESULT_MAX = 6999; +export const KIND_JOB_FEEDBACK = 7000; diff --git a/testdata/baseline/current-radroots-generated/events/types.ts b/testdata/baseline/current-radroots-generated/events/types.ts @@ -0,0 +1,221 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type JobFeedbackStatus = "payment_required" | "processing" | "error" | "success" | "partial"; + +export type JobInputType = "url" | "event" | "job" | "text"; + +export type JobPaymentRequest = { amount_sat: number, bolt11?: string | null, }; + +export type RadrootsAccountClaim = { username: string, pubkey: string, nip05?: string | null, }; + +export type RadrootsActiveTradeEnvelope<T> = { version: number, domain: RadrootsTradeDomain, type: RadrootsActiveTradeMessageType, order_id: string, listing_addr: string, payload: T, }; + +export type RadrootsActiveTradeFulfillmentState = "accepted_not_fulfilled" | "preparing" | "ready_for_pickup" | "out_for_delivery" | "delivered" | "seller_cancelled"; + +export type RadrootsActiveTradeMessageType = "TradeOrderRequested" | "TradeOrderDecision" | "TradeOrderRevisionProposed" | "TradeOrderRevisionDecision" | "TradeOrderCancelled" | "TradeFulfillmentUpdated" | "TradeBuyerReceipt" | "TradePaymentRecorded" | "TradeSettlementDecision"; + +export type RadrootsAppData = { d_tag: string, content: string, }; + +export type RadrootsComment = { root: RadrootsNostrEventRef, parent: RadrootsNostrEventRef, content: string, }; + +export type RadrootsCoop = { d_tag: string, name: string, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location?: RadrootsCoopLocation | null, tags?: string[] | null, }; + +export type RadrootsCoopLocation = { primary?: string | null, city?: string | null, region?: string | null, country?: string | null, gcs: RadrootsGcsLocation, }; + +export type RadrootsCoopRef = { pubkey: string, d_tag: string, }; + +export type RadrootsDocument = { d_tag: string, doc_type: string, title: string, version: string, summary?: string | null, effective_at?: number | null, body_markdown?: string | null, subject: RadrootsDocumentSubject, tags?: string[] | null, }; + +export type RadrootsDocumentSubject = { pubkey: string, address?: string | null, }; + +export type RadrootsFarm = { d_tag: string, name: string, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location?: RadrootsFarmLocation | null, tags?: string[] | null, }; + +export type RadrootsFarmLocation = { primary?: string | null, city?: string | null, region?: string | null, country?: string | null, gcs?: RadrootsGcsLocation | null, }; + +export type RadrootsFarmRef = { pubkey: string, d_tag: string, }; + +export type RadrootsFollow = { list: Array<RadrootsFollowProfile>, }; + +export type RadrootsFollowProfile = { published_at: number, public_key: string, relay_url?: string | null, contact_name?: string | null, }; + +export type RadrootsGcsLocation = { lat: number, lng: number, geohash: string, point: RadrootsGeoJsonPoint, polygon: RadrootsGeoJsonPolygon, 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 RadrootsGeoChat = { geohash: string, content: string, nickname?: string | null, teleported: boolean, }; + +export type RadrootsGeoJsonPoint = { type: string, coordinates: [number, number], }; + +export type RadrootsGeoJsonPolygon = { type: string, coordinates: Array<Array<[number, number]>>, }; + +export type RadrootsGiftWrap = { recipient: RadrootsGiftWrapRecipient, content: string, expiration?: number | null, }; + +export type RadrootsGiftWrapRecipient = { public_key: string, relay_url?: string | null, }; + +export type RadrootsJobFeedback = { kind: number, status: JobFeedbackStatus, extra_info?: string | null, request_event: RadrootsNostrEventPtr, customer_pubkey?: string | null, payment?: JobPaymentRequest | null, content?: string | null, encrypted: boolean, }; + +export type RadrootsJobInput = { data: string, input_type: JobInputType, relay?: string | null, marker?: string | null, }; + +export type RadrootsJobParam = { key: string, value: string, }; + +export type RadrootsJobRequest = { kind: number, inputs: Array<RadrootsJobInput>, output?: string | null, params: Array<RadrootsJobParam>, bid_sat?: number | null, relays: Array<string>, providers: Array<string>, topics: Array<string>, encrypted: boolean, }; + +export type RadrootsJobResult = { kind: number, request_event: RadrootsNostrEventPtr, request_json?: string | null, inputs: Array<RadrootsJobInput>, customer_pubkey?: string | null, payment?: JobPaymentRequest | null, content?: string | null, encrypted: boolean, }; + +export type RadrootsList = { content: string, entries: Array<RadrootsListEntry>, }; + +export type RadrootsListEntry = { tag: string, values: Array<string>, }; + +export type RadrootsListSet = { d_tag: string, content: string, entries: Array<RadrootsListEntry>, title?: string | null, description?: string | null, image?: string | null, }; + +export type RadrootsListing = { d_tag: string, farm: RadrootsFarmRef, product: RadrootsListingProduct, primary_bin_id: string, bins: Array<RadrootsListingBin>, resource_area?: RadrootsResourceAreaRef | null, plot?: RadrootsPlotRef | null, discounts?: 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 RadrootsListingImage = { url: string, size?: RadrootsListingImageSize | null, }; + +export type RadrootsListingImageSize = { w: number, h: number, }; + +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 RadrootsListingProductTagKeys = readonly ["key", "title", "category", "summary", "process", "lot", "location", "profile", "year"]; + +export type RadrootsListingStatus = { "kind": "active" } | { "kind": "sold" } | { "kind": "other", "amount": { value: string, } }; + +export type RadrootsMessage = { recipients: Array<RadrootsMessageRecipient>, content: string, reply_to?: RadrootsNostrEventPtr | null, subject?: string | null, }; + +export type RadrootsMessageFile = { recipients: Array<RadrootsMessageRecipient>, file_url: string, reply_to?: RadrootsNostrEventPtr | null, subject?: string | null, file_type: string, encryption_algorithm: string, decryption_key: string, decryption_nonce: string, encrypted_hash: string, original_hash?: string | null, size?: number | null, dimensions?: RadrootsMessageFileDimensions | null, blurhash?: string | null, thumb?: string | null, fallbacks: Array<string>, }; + +export type RadrootsMessageFileDimensions = { w: number, h: number, }; + +export type RadrootsMessageRecipient = { public_key: string, relay_url?: string | null, }; + +export type RadrootsNostrEvent = { id: string, author: string, created_at: number, kind: number, tags: Array<Array<string>>, content: string, sig: string, }; + +export type RadrootsNostrEventPtr = { id: string, relays?: string | null, }; + +export type RadrootsNostrEventRef = { id: string, author: string, kind: number, d_tag?: string | null, relays?: string[] | null, }; + +export type RadrootsPlot = { d_tag: string, farm: RadrootsFarmRef, name: string, about?: string | null, location?: RadrootsPlotLocation | null, tags?: string[] | null, }; + +export type RadrootsPlotLocation = { primary?: string | null, city?: string | null, region?: string | null, country?: string | null, gcs: RadrootsGcsLocation, }; + +export type RadrootsPlotRef = { pubkey: string, d_tag: string, }; + +export type RadrootsPost = { content: string, }; + +export type RadrootsProfile = { name: string, display_name?: string | null, nip05?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, lud06?: string | null, lud16?: string | null, bot?: string | null, }; + +export type RadrootsProfileType = "individual" | "farm" | "coop" | "any" | "radrootsd"; + +export type RadrootsReaction = { root: RadrootsNostrEventRef, content: string, }; + +export type RadrootsRelayDocument = { name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: number[] | null, software?: string | null, version?: string | null, }; + +export type RadrootsResourceArea = { d_tag: string, name: string, about?: string | null, location: RadrootsResourceAreaLocation, tags?: string[] | null, }; + +export type RadrootsResourceAreaLocation = { primary?: string | null, city?: string | null, region?: string | null, country?: string | null, gcs: RadrootsGcsLocation, }; + +export type RadrootsResourceAreaRef = { pubkey: string, d_tag: string, }; + +export type RadrootsResourceHarvestCap = { d_tag: string, resource_area: RadrootsResourceAreaRef, product: RadrootsResourceHarvestProduct, start: bigint, end: bigint, cap_quantity: RadrootsCoreQuantity, display_amount?: RadrootsCoreDecimal | null, display_unit?: RadrootsCoreUnit | null, display_label?: string | null, tags?: string[] | null, }; + +export type RadrootsResourceHarvestProduct = { key: string, category?: string | null, }; + +export type RadrootsSeal = { content: string, }; + +export type RadrootsTradeAnswer = { question_id: string, }; + +export type RadrootsTradeBuyerReceipt = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, received: boolean, issue?: string | null, received_at: bigint, }; + +export type RadrootsTradeDiscountDecision = { "kind": "accept", "amount": { value: RadrootsCoreDiscountValue, } } | { "kind": "decline", "amount": { reason?: string | null, } }; + +export type RadrootsTradeDiscountOffer = { discount_id: string, value: RadrootsCoreDiscountValue, }; + +export type RadrootsTradeDiscountRequest = { discount_id: string, value: RadrootsCoreDiscountValue, }; + +export type RadrootsTradeDomain = "trade:listing"; + +export type RadrootsTradeEconomicActor = "buyer" | "seller"; + +export type RadrootsTradeEconomicEffect = "increase" | "decrease"; + +export type RadrootsTradeEconomicLineKind = "listing_discount" | "basket_adjustment" | "revision_adjustment"; + +export type RadrootsTradeEnvelope<T> = { version: number, domain: RadrootsTradeDomain, type: RadrootsTradeMessageType, order_id?: string | null, listing_addr: string, payload: T, }; + +export type RadrootsTradeFulfillmentStatus = { "kind": "preparing" } | { "kind": "shipped" } | { "kind": "ready_for_pickup" } | { "kind": "delivered" } | { "kind": "cancelled" }; + +export type RadrootsTradeFulfillmentUpdate = { status: RadrootsTradeFulfillmentStatus, }; + +export type RadrootsTradeFulfillmentUpdated = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, status: RadrootsActiveTradeFulfillmentState, }; + +export type RadrootsTradeInventoryCommitment = { bin_id: string, bin_count: number, }; + +export type RadrootsTradeListingCancel = { reason?: string | null, }; + +export type RadrootsTradeListingParseError = { "InvalidKind": number } | { "MissingTag": string } | { "InvalidTag": string } | { "InvalidNumber": string } | "InvalidUnit" | "InvalidCurrency" | { "InvalidJson": string } | { "InvalidDiscount": string }; + +export type RadrootsTradeListingValidateRequest = { listing_event?: RadrootsNostrEventPtr | null, }; + +export type RadrootsTradeListingValidateResult = { valid: boolean, errors: RadrootsTradeListingValidationError[], }; + +export type RadrootsTradeListingValidationError = { "kind": "invalid_kind", "amount": { kind: number, } } | { "kind": "missing_listing_id" } | { "kind": "listing_event_not_found", "amount": { listing_addr: string, } } | { "kind": "listing_event_fetch_failed", "amount": { listing_addr: string, } } | { "kind": "parse_error", "amount": { error: RadrootsTradeListingParseError, } } | { "kind": "invalid_seller" } | { "kind": "missing_farm_profile" } | { "kind": "missing_farm_record" } | { "kind": "missing_title" } | { "kind": "missing_description" } | { "kind": "missing_product_type" } | { "kind": "missing_bins" } | { "kind": "missing_primary_bin" } | { "kind": "invalid_bin" } | { "kind": "missing_price" } | { "kind": "invalid_price" } | { "kind": "missing_inventory" } | { "kind": "invalid_inventory" } | { "kind": "missing_availability" } | { "kind": "missing_location" } | { "kind": "missing_delivery_method" }; + +export type RadrootsTradeMessagePayload = { "kind": "listing_validate_request", "amount": RadrootsTradeListingValidateRequest } | { "kind": "listing_validate_result", "amount": RadrootsTradeListingValidateResult } | { "kind": "trade_order_requested", "amount": RadrootsTradeOrderRequested } | { "kind": "order_response", "amount": RadrootsTradeOrderResponse } | { "kind": "order_revision", "amount": RadrootsTradeOrderRevision } | { "kind": "order_revision_accept", "amount": RadrootsTradeOrderRevisionResponse } | { "kind": "order_revision_decline", "amount": RadrootsTradeOrderRevisionResponse } | { "kind": "question", "amount": RadrootsTradeQuestion } | { "kind": "answer", "amount": RadrootsTradeAnswer } | { "kind": "discount_request", "amount": RadrootsTradeDiscountRequest } | { "kind": "discount_offer", "amount": RadrootsTradeDiscountOffer } | { "kind": "discount_accept", "amount": RadrootsTradeDiscountDecision } | { "kind": "discount_decline", "amount": RadrootsTradeDiscountDecision } | { "kind": "cancel", "amount": RadrootsTradeListingCancel } | { "kind": "fulfillment_update", "amount": RadrootsTradeFulfillmentUpdate } | { "kind": "receipt", "amount": RadrootsTradeReceipt }; + +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 RadrootsTradeOrderCancelled = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, reason: string, }; + +export type RadrootsTradeOrderChange = { "kind": "bin_count", "amount": { item_index: number, bin_count: number, } } | { "kind": "item_add", "amount": { item: RadrootsTradeOrderItem, } } | { "kind": "item_remove", "amount": { item_index: number, } }; + +export type RadrootsTradeOrderDecision = { "decision": "accepted", inventory_commitments: Array<RadrootsTradeInventoryCommitment>, } | { "decision": "declined", reason: string, }; + +export type RadrootsTradeOrderDecisionEvent = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, decision: RadrootsTradeOrderDecision, }; + +export type RadrootsTradeOrderEconomicItem = { bin_id: string, bin_count: number, quantity_amount: RadrootsCoreDecimal, quantity_unit: RadrootsCoreUnit, unit_price_amount: RadrootsCoreDecimal, unit_price_currency: RadrootsCoreCurrency, line_subtotal: RadrootsCoreMoney, }; + +export type RadrootsTradeOrderEconomicLine = { id: string, kind: RadrootsTradeEconomicLineKind, actor: RadrootsTradeEconomicActor, effect: RadrootsTradeEconomicEffect, amount: RadrootsCoreMoney, reason: string, }; + +export type RadrootsTradeOrderEconomicTotals = { subtotal: RadrootsCoreMoney, discount_total: RadrootsCoreMoney, adjustment_total: RadrootsCoreMoney, total: RadrootsCoreMoney, }; + +export type RadrootsTradeOrderEconomics = { quote_id: string, quote_version: number, pricing_basis: RadrootsTradePricingBasis, currency: RadrootsCoreCurrency, items: Array<RadrootsTradeOrderEconomicItem>, discounts: Array<RadrootsTradeOrderEconomicLine>, adjustments: Array<RadrootsTradeOrderEconomicLine>, subtotal: RadrootsCoreMoney, discount_total: RadrootsCoreMoney, adjustment_total: RadrootsCoreMoney, total: RadrootsCoreMoney, }; + +export type RadrootsTradeOrderItem = { bin_id: string, bin_count: number, }; + +export type RadrootsTradeOrderRequested = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, items: Array<RadrootsTradeOrderItem>, economics: RadrootsTradeOrderEconomics, }; + +export type RadrootsTradeOrderResponse = { accepted: boolean, reason?: string | null, }; + +export type RadrootsTradeOrderRevision = { revision_id: string, changes: Array<RadrootsTradeOrderChange>, }; + +export type RadrootsTradeOrderRevisionDecision = { "decision": "accepted" } | { "decision": "declined", reason: string, }; + +export type RadrootsTradeOrderRevisionDecisionEvent = { revision_id: string, order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, root_event_id: string, prev_event_id: string, decision: RadrootsTradeOrderRevisionDecision, }; + +export type RadrootsTradeOrderRevisionProposed = { revision_id: string, order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, root_event_id: string, prev_event_id: string, items: Array<RadrootsTradeOrderItem>, economics: RadrootsTradeOrderEconomics, reason: string, }; + +export type RadrootsTradeOrderRevisionResponse = { accepted: boolean, reason?: string | null, }; + +export type RadrootsTradeOrderStatus = "draft" | "validated" | "requested" | "questioned" | "revised" | "accepted" | "declined" | "cancelled" | "fulfilled" | "completed"; + +export type RadrootsTradePaymentMethod = "cash" | "manual_transfer" | "other"; + +export type RadrootsTradePaymentRecorded = { order_id: string, listing_addr: string, buyer_pubkey: string, seller_pubkey: string, root_event_id: string, previous_event_id: string, agreement_event_id: string, quote_id: string, quote_version: number, economics_digest: string, amount: RadrootsCoreDecimal, currency: RadrootsCoreCurrency, method: RadrootsTradePaymentMethod, reference?: string | null, paid_at?: number | null, }; + +export type RadrootsTradePricingBasis = "listing_event"; + +export type RadrootsTradeQuestion = { question_id: string, }; + +export type RadrootsTradeReceipt = { acknowledged: boolean, at: bigint, }; + +export type RadrootsTradeSettlementDecision = "accepted" | "rejected"; + +export type RadrootsTradeSettlementDecisionEvent = { order_id: string, listing_addr: string, seller_pubkey: string, buyer_pubkey: string, root_event_id: string, previous_event_id: string, agreement_event_id: string, payment_event_id: string, quote_id: string, quote_version: number, economics_digest: string, amount: RadrootsCoreDecimal, currency: RadrootsCoreCurrency, decision: RadrootsTradeSettlementDecision, reason?: string | null, }; + +export type RadrootsTradeTransportLane = "service" | "public"; diff --git a/testdata/baseline/current-radroots-generated/identity/constants.ts b/testdata/baseline/current-radroots-generated/identity/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/testdata/baseline/current-radroots-generated/replica-db-schema/types.ts b/testdata/baseline/current-radroots-generated/replica-db-schema/types.ts @@ -0,0 +1,521 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type Farm = { id: string, created_at: string, updated_at: string, d_tag: string, pubkey: string, name: string, about: string | null, website: string | null, picture: string | null, banner: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; + +export type FarmGcsLocation = { id: string, created_at: string, updated_at: string, farm_id: string, gcs_location_id: string, role: string, }; + +export type FarmGcsLocationQueryBindValues = { id: string, } | { farm_id: string, } | { gcs_location_id: string, }; + +export type FarmMember = { id: string, created_at: string, updated_at: string, farm_id: string, member_pubkey: string, role: string, }; + +export type FarmMemberClaim = { id: string, created_at: string, updated_at: string, member_pubkey: string, farm_pubkey: string, }; + +export type FarmMemberClaimQueryBindValues = { id: string, } | { member_pubkey: string, } | { farm_pubkey: string, }; + +export type FarmMemberQueryBindValues = { id: string, } | { farm_id: string, } | { member_pubkey: string, }; + +export type FarmQueryBindValues = { id: string, } | { d_tag: string, } | { pubkey: string, }; + +export type FarmTag = { id: string, created_at: string, updated_at: string, farm_id: string, tag: string, }; + +export type FarmTagQueryBindValues = { id: string, } | { farm_id: string, } | { tag: string, }; + +export type GcsLocation = { id: string, created_at: string, updated_at: string, d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy: number | null, altitude: number | null, tag_0: string | null, label: string | null, area: number | null, elevation: number | null, soil: string | null, climate: string | null, gc_id: string | null, gc_name: string | null, gc_admin1_id: string | null, gc_admin1_name: string | null, gc_country_id: string | null, gc_country_name: string | null, }; + +export type GcsLocationFarmArgs = { id: string, }; + +export type GcsLocationFindManyRel = { "on_trade_product": GcsLocationTradeProductArgs } | { "off_trade_product": GcsLocationTradeProductArgs } | { "on_farm": GcsLocationFarmArgs } | { "off_farm": GcsLocationFarmArgs } | { "on_plot": GcsLocationPlotArgs } | { "off_plot": GcsLocationPlotArgs }; + +export type GcsLocationPlotArgs = { id: string, }; + +export type GcsLocationQueryBindValues = { id: string, } | { d_tag: string, } | { geohash: string, }; + +export type GcsLocationTradeProductArgs = { id: string, }; + +export type IFarmCreate = IFarmFields; + +export type IFarmCreateResolve = IResult<Farm>; + +export type IFarmDelete = IFarmFindOne; + +export type IFarmDeleteResolve = IResult<string>; + +export type IFarmFields = { d_tag: string, pubkey: string, name: string, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; + +export type IFarmFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, pubkey?: string, name?: string, about?: string, website?: string, picture?: string, banner?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; + +export type IFarmFieldsPartial = { d_tag?: string | null, pubkey?: string | null, name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; + +export type IFarmFindMany = { filter: IFarmFieldsFilter | null, }; + +export type IFarmFindManyResolve = IResultList<Farm>; + +export type IFarmFindOne = IFarmFindOneArgs; + +export type IFarmFindOneArgs = { on: FarmQueryBindValues, }; + +export type IFarmFindOneResolve = IResult<Farm>; + +export type IFarmGcsLocationCreate = IFarmGcsLocationFields; + +export type IFarmGcsLocationCreateResolve = IResult<FarmGcsLocation>; + +export type IFarmGcsLocationDelete = IFarmGcsLocationFindOne; + +export type IFarmGcsLocationDeleteResolve = IResult<string>; + +export type IFarmGcsLocationFields = { farm_id: string, gcs_location_id: string, role: string, }; + +export type IFarmGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, gcs_location_id?: string, role?: string, }; + +export type IFarmGcsLocationFieldsPartial = { farm_id?: string | null, gcs_location_id?: string | null, role?: string | null, }; + +export type IFarmGcsLocationFindMany = { filter: IFarmGcsLocationFieldsFilter | null, }; + +export type IFarmGcsLocationFindManyResolve = IResultList<FarmGcsLocation>; + +export type IFarmGcsLocationFindOne = IFarmGcsLocationFindOneArgs; + +export type IFarmGcsLocationFindOneArgs = { on: FarmGcsLocationQueryBindValues, }; + +export type IFarmGcsLocationFindOneResolve = IResult<FarmGcsLocation>; + +export type IFarmGcsLocationUpdate = { on: FarmGcsLocationQueryBindValues, fields: IFarmGcsLocationFieldsPartial, }; + +export type IFarmGcsLocationUpdateResolve = IResult<FarmGcsLocation>; + +export type IFarmMemberClaimCreate = IFarmMemberClaimFields; + +export type IFarmMemberClaimCreateResolve = IResult<FarmMemberClaim>; + +export type IFarmMemberClaimDelete = IFarmMemberClaimFindOne; + +export type IFarmMemberClaimDeleteResolve = IResult<string>; + +export type IFarmMemberClaimFields = { member_pubkey: string, farm_pubkey: string, }; + +export type IFarmMemberClaimFieldsFilter = { id?: string, created_at?: string, updated_at?: string, member_pubkey?: string, farm_pubkey?: string, }; + +export type IFarmMemberClaimFieldsPartial = { member_pubkey?: string | null, farm_pubkey?: string | null, }; + +export type IFarmMemberClaimFindMany = { filter: IFarmMemberClaimFieldsFilter | null, }; + +export type IFarmMemberClaimFindManyResolve = IResultList<FarmMemberClaim>; + +export type IFarmMemberClaimFindOne = IFarmMemberClaimFindOneArgs; + +export type IFarmMemberClaimFindOneArgs = { on: FarmMemberClaimQueryBindValues, }; + +export type IFarmMemberClaimFindOneResolve = IResult<FarmMemberClaim>; + +export type IFarmMemberClaimUpdate = { on: FarmMemberClaimQueryBindValues, fields: IFarmMemberClaimFieldsPartial, }; + +export type IFarmMemberClaimUpdateResolve = IResult<FarmMemberClaim>; + +export type IFarmMemberCreate = IFarmMemberFields; + +export type IFarmMemberCreateResolve = IResult<FarmMember>; + +export type IFarmMemberDelete = IFarmMemberFindOne; + +export type IFarmMemberDeleteResolve = IResult<string>; + +export type IFarmMemberFields = { farm_id: string, member_pubkey: string, role: string, }; + +export type IFarmMemberFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, member_pubkey?: string, role?: string, }; + +export type IFarmMemberFieldsPartial = { farm_id?: string | null, member_pubkey?: string | null, role?: string | null, }; + +export type IFarmMemberFindMany = { filter: IFarmMemberFieldsFilter | null, }; + +export type IFarmMemberFindManyResolve = IResultList<FarmMember>; + +export type IFarmMemberFindOne = IFarmMemberFindOneArgs; + +export type IFarmMemberFindOneArgs = { on: FarmMemberQueryBindValues, }; + +export type IFarmMemberFindOneResolve = IResult<FarmMember>; + +export type IFarmMemberUpdate = { on: FarmMemberQueryBindValues, fields: IFarmMemberFieldsPartial, }; + +export type IFarmMemberUpdateResolve = IResult<FarmMember>; + +export type IFarmTagCreate = IFarmTagFields; + +export type IFarmTagCreateResolve = IResult<FarmTag>; + +export type IFarmTagDelete = IFarmTagFindOne; + +export type IFarmTagDeleteResolve = IResult<string>; + +export type IFarmTagFields = { farm_id: string, tag: string, }; + +export type IFarmTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, farm_id?: string, tag?: string, }; + +export type IFarmTagFieldsPartial = { farm_id?: string | null, tag?: string | null, }; + +export type IFarmTagFindMany = { filter: IFarmTagFieldsFilter | null, }; + +export type IFarmTagFindManyResolve = IResultList<FarmTag>; + +export type IFarmTagFindOne = IFarmTagFindOneArgs; + +export type IFarmTagFindOneArgs = { on: FarmTagQueryBindValues, }; + +export type IFarmTagFindOneResolve = IResult<FarmTag>; + +export type IFarmTagUpdate = { on: FarmTagQueryBindValues, fields: IFarmTagFieldsPartial, }; + +export type IFarmTagUpdateResolve = IResult<FarmTag>; + +export type IFarmUpdate = { on: FarmQueryBindValues, fields: IFarmFieldsPartial, }; + +export type IFarmUpdateResolve = IResult<Farm>; + +export type IGcsLocationCreate = IGcsLocationFields; + +export type IGcsLocationCreateResolve = IResult<GcsLocation>; + +export type IGcsLocationDelete = IGcsLocationFindOne; + +export type IGcsLocationDeleteResolve = IResult<string>; + +export type IGcsLocationFields = { d_tag: string, lat: number, lng: number, geohash: string, point: string, polygon: string, accuracy?: number | null, altitude?: number | null, tag_0?: string | null, label?: string | null, area?: number | null, elevation?: number | null, soil?: string | null, climate?: string | null, gc_id?: string | null, gc_name?: string | null, gc_admin1_id?: string | null, gc_admin1_name?: string | null, gc_country_id?: string | null, gc_country_name?: string | null, }; + +export type IGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, lat?: number, lng?: number, geohash?: string, point?: string, polygon?: string, accuracy?: number, altitude?: number, tag_0?: string, label?: string, area?: number, elevation?: number, soil?: string, climate?: string, gc_id?: string, gc_name?: string, gc_admin1_id?: string, gc_admin1_name?: string, gc_country_id?: string, gc_country_name?: string, }; + +export type IGcsLocationFieldsPartial = { d_tag?: string | null, lat?: number | null, lng?: number | null, geohash?: string | null, point?: string | null, polygon?: string | null, accuracy?: number | null, altitude?: number | null, tag_0?: string | null, label?: string | null, area?: number | null, elevation?: number | null, soil?: string | null, climate?: string | null, gc_id?: string | null, gc_name?: string | null, gc_admin1_id?: string | null, gc_admin1_name?: string | null, gc_country_id?: string | null, gc_country_name?: string | null, }; + +export type IGcsLocationFindMany = { filter: IGcsLocationFieldsFilter | null, } | { rel: GcsLocationFindManyRel, }; + +export type IGcsLocationFindManyResolve = IResultList<GcsLocation>; + +export type IGcsLocationFindOne = IGcsLocationFindOneArgs | IGcsLocationFindOneRelArgs; + +export type IGcsLocationFindOneArgs = { on: GcsLocationQueryBindValues, }; + +export type IGcsLocationFindOneRelArgs = { rel: GcsLocationFindManyRel, }; + +export type IGcsLocationFindOneResolve = IResult<GcsLocation>; + +export type IGcsLocationUpdate = { on: GcsLocationQueryBindValues, fields: IGcsLocationFieldsPartial, }; + +export type IGcsLocationUpdateResolve = IResult<GcsLocation>; + +export type ILogErrorCreate = ILogErrorFields; + +export type ILogErrorCreateResolve = IResult<LogError>; + +export type ILogErrorDelete = ILogErrorFindOne; + +export type ILogErrorDeleteResolve = IResult<string>; + +export type ILogErrorFields = { error: string, message: string, stack_trace?: string | null, cause?: string | null, app_system: string, app_version: string, nostr_pubkey: string, data?: string | null, }; + +export type ILogErrorFieldsFilter = { id?: string, created_at?: string, updated_at?: string, error?: string, message?: string, stack_trace?: string, cause?: string, app_system?: string, app_version?: string, nostr_pubkey?: string, data?: string, }; + +export type ILogErrorFieldsPartial = { error?: string | null, message?: string | null, stack_trace?: string | null, cause?: string | null, app_system?: string | null, app_version?: string | null, nostr_pubkey?: string | null, data?: string | null, }; + +export type ILogErrorFindMany = { filter: ILogErrorFieldsFilter | null, }; + +export type ILogErrorFindManyResolve = IResultList<LogError>; + +export type ILogErrorFindOne = ILogErrorFindOneArgs; + +export type ILogErrorFindOneArgs = { on: LogErrorQueryBindValues, }; + +export type ILogErrorFindOneResolve = IResult<LogError>; + +export type ILogErrorUpdate = { on: LogErrorQueryBindValues, fields: ILogErrorFieldsPartial, }; + +export type ILogErrorUpdateResolve = IResult<LogError>; + +export type IMediaImageCreate = IMediaImageFields; + +export type IMediaImageCreateResolve = IResult<MediaImage>; + +export type IMediaImageDelete = IMediaImageFindOne; + +export type IMediaImageDeleteResolve = IResult<string>; + +export type IMediaImageFields = { file_path: string, mime_type: string, res_base: string, res_path: string, label?: string | null, description?: string | null, }; + +export type IMediaImageFieldsFilter = { id?: string, created_at?: string, updated_at?: string, file_path?: string, mime_type?: string, res_base?: string, res_path?: string, label?: string, description?: string, }; + +export type IMediaImageFieldsPartial = { file_path?: string | null, mime_type?: string | null, res_base?: string | null, res_path?: string | null, label?: string | null, description?: string | null, }; + +export type IMediaImageFindMany = { filter: IMediaImageFieldsFilter | null, } | { rel: MediaImageFindManyRel, }; + +export type IMediaImageFindManyResolve = IResultList<MediaImage>; + +export type IMediaImageFindOne = IMediaImageFindOneArgs | IMediaImageFindOneRelArgs; + +export type IMediaImageFindOneArgs = { on: MediaImageQueryBindValues, }; + +export type IMediaImageFindOneRelArgs = { rel: MediaImageFindManyRel, }; + +export type IMediaImageFindOneResolve = IResult<MediaImage>; + +export type IMediaImageUpdate = { on: MediaImageQueryBindValues, fields: IMediaImageFieldsPartial, }; + +export type IMediaImageUpdateResolve = IResult<MediaImage>; + +export type INostrEventStateCreate = INostrEventStateFields; + +export type INostrEventStateCreateResolve = IResult<NostrEventState>; + +export type INostrEventStateDelete = INostrEventStateFindOne; + +export type INostrEventStateDeleteResolve = IResult<string>; + +export type INostrEventStateFields = { key: string, kind: number, pubkey: string, d_tag: string, last_event_id: string, last_created_at: number, content_hash: string, }; + +export type INostrEventStateFieldsFilter = { id?: string, created_at?: string, updated_at?: string, key?: string, kind?: number, pubkey?: string, d_tag?: string, last_event_id?: string, last_created_at?: number, content_hash?: string, }; + +export type INostrEventStateFieldsPartial = { key?: string | null, kind?: number | null, pubkey?: string | null, d_tag?: string | null, last_event_id?: string | null, last_created_at?: number | null, content_hash?: string | null, }; + +export type INostrEventStateFindMany = { filter: INostrEventStateFieldsFilter | null, }; + +export type INostrEventStateFindManyResolve = IResultList<NostrEventState>; + +export type INostrEventStateFindOne = INostrEventStateFindOneArgs; + +export type INostrEventStateFindOneArgs = { on: NostrEventStateQueryBindValues, }; + +export type INostrEventStateFindOneResolve = IResult<NostrEventState>; + +export type INostrEventStateUpdate = { on: NostrEventStateQueryBindValues, fields: INostrEventStateFieldsPartial, }; + +export type INostrEventStateUpdateResolve = IResult<NostrEventState>; + +export type INostrProfileCreate = INostrProfileFields; + +export type INostrProfileCreateResolve = IResult<NostrProfile>; + +export type INostrProfileDelete = INostrProfileFindOne; + +export type INostrProfileDeleteResolve = IResult<string>; + +export type INostrProfileFields = { public_key: string, profile_type: string, name: string, display_name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, nip05?: string | null, lud06?: string | null, lud16?: string | null, }; + +export type INostrProfileFieldsFilter = { id?: string, created_at?: string, updated_at?: string, public_key?: string, profile_type?: string, name?: string, display_name?: string, about?: string, website?: string, picture?: string, banner?: string, nip05?: string, lud06?: string, lud16?: string, }; + +export type INostrProfileFieldsPartial = { public_key?: string | null, profile_type?: string | null, name?: string | null, display_name?: string | null, about?: string | null, website?: string | null, picture?: string | null, banner?: string | null, nip05?: string | null, lud06?: string | null, lud16?: string | null, }; + +export type INostrProfileFindMany = { filter: INostrProfileFieldsFilter | null, } | { rel: NostrProfileFindManyRel, }; + +export type INostrProfileFindManyResolve = IResultList<NostrProfile>; + +export type INostrProfileFindOne = INostrProfileFindOneArgs | INostrProfileFindOneRelArgs; + +export type INostrProfileFindOneArgs = { on: NostrProfileQueryBindValues, }; + +export type INostrProfileFindOneRelArgs = { rel: NostrProfileFindManyRel, }; + +export type INostrProfileFindOneResolve = IResult<NostrProfile>; + +export type INostrProfileRelayRelation = { nostr_profile: NostrProfileQueryBindValues, nostr_relay: NostrRelayQueryBindValues, }; + +export type INostrProfileRelayResolve = IResultPass; + +export type INostrProfileUpdate = { on: NostrProfileQueryBindValues, fields: INostrProfileFieldsPartial, }; + +export type INostrProfileUpdateResolve = IResult<NostrProfile>; + +export type INostrRelayCreate = INostrRelayFields; + +export type INostrRelayCreateResolve = IResult<NostrRelay>; + +export type INostrRelayDelete = INostrRelayFindOne; + +export type INostrRelayDeleteResolve = IResult<string>; + +export type INostrRelayFields = { url: string, relay_id?: string | null, name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: string | null, software?: string | null, version?: string | null, data?: string | null, }; + +export type INostrRelayFieldsFilter = { id?: string, created_at?: string, updated_at?: string, url?: string, relay_id?: string, name?: string, description?: string, pubkey?: string, contact?: string, supported_nips?: string, software?: string, version?: string, data?: string, }; + +export type INostrRelayFieldsPartial = { url?: string | null, relay_id?: string | null, name?: string | null, description?: string | null, pubkey?: string | null, contact?: string | null, supported_nips?: string | null, software?: string | null, version?: string | null, data?: string | null, }; + +export type INostrRelayFindMany = { filter: INostrRelayFieldsFilter | null, } | { rel: NostrRelayFindManyRel, }; + +export type INostrRelayFindManyResolve = IResultList<NostrRelay>; + +export type INostrRelayFindOne = INostrRelayFindOneArgs | INostrRelayFindOneRelArgs; + +export type INostrRelayFindOneArgs = { on: NostrRelayQueryBindValues, }; + +export type INostrRelayFindOneRelArgs = { rel: NostrRelayFindManyRel, }; + +export type INostrRelayFindOneResolve = IResult<NostrRelay>; + +export type INostrRelayUpdate = { on: NostrRelayQueryBindValues, fields: INostrRelayFieldsPartial, }; + +export type INostrRelayUpdateResolve = IResult<NostrRelay>; + +export type IPlotCreate = IPlotFields; + +export type IPlotCreateResolve = IResult<Plot>; + +export type IPlotDelete = IPlotFindOne; + +export type IPlotDeleteResolve = IResult<string>; + +export type IPlotFields = { d_tag: string, farm_id: string, name: string, about?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; + +export type IPlotFieldsFilter = { id?: string, created_at?: string, updated_at?: string, d_tag?: string, farm_id?: string, name?: string, about?: string, location_primary?: string, location_city?: string, location_region?: string, location_country?: string, }; + +export type IPlotFieldsPartial = { d_tag?: string | null, farm_id?: string | null, name?: string | null, about?: string | null, location_primary?: string | null, location_city?: string | null, location_region?: string | null, location_country?: string | null, }; + +export type IPlotFindMany = { filter: IPlotFieldsFilter | null, }; + +export type IPlotFindManyResolve = IResultList<Plot>; + +export type IPlotFindOne = IPlotFindOneArgs; + +export type IPlotFindOneArgs = { on: PlotQueryBindValues, }; + +export type IPlotFindOneResolve = IResult<Plot>; + +export type IPlotGcsLocationCreate = IPlotGcsLocationFields; + +export type IPlotGcsLocationCreateResolve = IResult<PlotGcsLocation>; + +export type IPlotGcsLocationDelete = IPlotGcsLocationFindOne; + +export type IPlotGcsLocationDeleteResolve = IResult<string>; + +export type IPlotGcsLocationFields = { plot_id: string, gcs_location_id: string, role: string, }; + +export type IPlotGcsLocationFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, gcs_location_id?: string, role?: string, }; + +export type IPlotGcsLocationFieldsPartial = { plot_id?: string | null, gcs_location_id?: string | null, role?: string | null, }; + +export type IPlotGcsLocationFindMany = { filter: IPlotGcsLocationFieldsFilter | null, }; + +export type IPlotGcsLocationFindManyResolve = IResultList<PlotGcsLocation>; + +export type IPlotGcsLocationFindOne = IPlotGcsLocationFindOneArgs; + +export type IPlotGcsLocationFindOneArgs = { on: PlotGcsLocationQueryBindValues, }; + +export type IPlotGcsLocationFindOneResolve = IResult<PlotGcsLocation>; + +export type IPlotGcsLocationUpdate = { on: PlotGcsLocationQueryBindValues, fields: IPlotGcsLocationFieldsPartial, }; + +export type IPlotGcsLocationUpdateResolve = IResult<PlotGcsLocation>; + +export type IPlotTagCreate = IPlotTagFields; + +export type IPlotTagCreateResolve = IResult<PlotTag>; + +export type IPlotTagDelete = IPlotTagFindOne; + +export type IPlotTagDeleteResolve = IResult<string>; + +export type IPlotTagFields = { plot_id: string, tag: string, }; + +export type IPlotTagFieldsFilter = { id?: string, created_at?: string, updated_at?: string, plot_id?: string, tag?: string, }; + +export type IPlotTagFieldsPartial = { plot_id?: string | null, tag?: string | null, }; + +export type IPlotTagFindMany = { filter: IPlotTagFieldsFilter | null, }; + +export type IPlotTagFindManyResolve = IResultList<PlotTag>; + +export type IPlotTagFindOne = IPlotTagFindOneArgs; + +export type IPlotTagFindOneArgs = { on: PlotTagQueryBindValues, }; + +export type IPlotTagFindOneResolve = IResult<PlotTag>; + +export type IPlotTagUpdate = { on: PlotTagQueryBindValues, fields: IPlotTagFieldsPartial, }; + +export type IPlotTagUpdateResolve = IResult<PlotTag>; + +export type IPlotUpdate = { on: PlotQueryBindValues, fields: IPlotFieldsPartial, }; + +export type IPlotUpdateResolve = IResult<Plot>; + +export type ITradeProductCreate = ITradeProductFields; + +export type ITradeProductCreateResolve = IResult<TradeProduct>; + +export type ITradeProductDelete = ITradeProductFindOne; + +export type ITradeProductDeleteResolve = IResult<string>; + +export type ITradeProductFields = { key: string, category: string, title: string, summary: string, process: string, lot: string, profile: string, year: bigint, qty_amt: number, qty_amt_exact: string, qty_unit: string, qty_label?: string | null, qty_avail?: number | null, price_amt: number, price_amt_exact: string, price_currency: string, price_qty_amt: number, price_qty_amt_exact: string, price_qty_unit: string, listing_addr?: string | null, primary_bin_id?: string | null, verified_primary_bin_id?: string | null, notes?: string | null, }; + +export type ITradeProductFieldsFilter = { id?: string, created_at?: string, updated_at?: string, key?: string, category?: string, title?: string, summary?: string, process?: string, lot?: string, profile?: string, year?: bigint, qty_amt?: number, qty_amt_exact?: string, qty_unit?: string, qty_label?: string, qty_avail?: bigint, price_amt?: number, price_amt_exact?: string, price_currency?: string, price_qty_amt?: number, price_qty_amt_exact?: string, price_qty_unit?: string, listing_addr?: string, primary_bin_id?: string, verified_primary_bin_id?: string, notes?: string, }; + +export type ITradeProductFieldsPartial = { key?: string | null, category?: string | null, title?: string | null, summary?: string | null, process?: string | null, lot?: string | null, profile?: string | null, year?: number | null, qty_amt?: number | null, qty_amt_exact?: string | null, qty_unit?: string | null, qty_label?: string | null, qty_avail?: number | null, price_amt?: number | null, price_amt_exact?: string | null, price_currency?: string | null, price_qty_amt?: number | null, price_qty_amt_exact?: string | null, price_qty_unit?: string | null, listing_addr?: string | null, primary_bin_id?: string | null, verified_primary_bin_id?: string | null, notes?: string | null, }; + +export type ITradeProductFindMany = { filter: ITradeProductFieldsFilter | null, }; + +export type ITradeProductFindManyResolve = IResultList<TradeProduct>; + +export type ITradeProductFindOne = ITradeProductFindOneArgs; + +export type ITradeProductFindOneArgs = { on: TradeProductQueryBindValues, }; + +export type ITradeProductFindOneResolve = IResult<TradeProduct>; + +export type ITradeProductLocationRelation = { trade_product: TradeProductQueryBindValues, gcs_location: GcsLocationQueryBindValues, }; + +export type ITradeProductLocationResolve = IResultPass; + +export type ITradeProductMediaRelation = { trade_product: TradeProductQueryBindValues, media_image: MediaImageQueryBindValues, }; + +export type ITradeProductMediaResolve = IResultPass; + +export type ITradeProductUpdate = { on: TradeProductQueryBindValues, fields: ITradeProductFieldsPartial, }; + +export type ITradeProductUpdateResolve = IResult<TradeProduct>; + +export type LogError = { id: string, created_at: string, updated_at: string, error: string, message: string, stack_trace: string | null, cause: string | null, app_system: string, app_version: string, nostr_pubkey: string, data: string | null, }; + +export type LogErrorQueryBindValues = { id: string, } | { nostr_pubkey: string, }; + +export type MediaImage = { id: string, created_at: string, updated_at: string, file_path: string, mime_type: string, res_base: string, res_path: string, label: string | null, description: string | null, }; + +export type MediaImageFindManyRel = { "on_trade_product": MediaImageTradeProductArgs } | { "off_trade_product": MediaImageTradeProductArgs }; + +export type MediaImageQueryBindValues = { id: string, } | { file_path: string, }; + +export type MediaImageTradeProductArgs = { id: string, }; + +export type NostrEventState = { id: string, created_at: string, updated_at: string, key: string, kind: number, pubkey: string, d_tag: string, last_event_id: string, last_created_at: number, content_hash: string, }; + +export type NostrEventStateQueryBindValues = { id: string, } | { key: string, }; + +export type NostrProfile = { id: string, created_at: string, updated_at: string, public_key: string, profile_type: string, name: string, display_name: string | null, about: string | null, website: string | null, picture: string | null, banner: string | null, nip05: string | null, lud06: string | null, lud16: string | null, }; + +export type NostrProfileFindManyRel = { "on_relay": NostrProfileRelayArgs } | { "off_relay": NostrProfileRelayArgs }; + +export type NostrProfileQueryBindValues = { id: string, } | { public_key: string, }; + +export type NostrProfileRelayArgs = { id: string, }; + +export type NostrRelay = { id: string, created_at: string, updated_at: string, url: string, relay_id: string | null, name: string | null, description: string | null, pubkey: string | null, contact: string | null, supported_nips: string | null, software: string | null, version: string | null, data: string | null, }; + +export type NostrRelayFindManyRel = { "on_profile": NostrRelayProfileArgs } | { "off_profile": NostrRelayProfileArgs }; + +export type NostrRelayProfileArgs = { public_key: string, }; + +export type NostrRelayQueryBindValues = { id: string, } | { url: string, }; + +export type Plot = { id: string, created_at: string, updated_at: string, d_tag: string, farm_id: string, name: string, about: string | null, location_primary: string | null, location_city: string | null, location_region: string | null, location_country: string | null, }; + +export type PlotGcsLocation = { id: string, created_at: string, updated_at: string, plot_id: string, gcs_location_id: string, role: string, }; + +export type PlotGcsLocationQueryBindValues = { id: string, } | { plot_id: string, } | { gcs_location_id: string, }; + +export type PlotQueryBindValues = { id: string, } | { d_tag: string, } | { farm_id: string, }; + +export type PlotTag = { id: string, created_at: string, updated_at: string, plot_id: string, tag: string, }; + +export type PlotTagQueryBindValues = { id: string, } | { plot_id: string, } | { tag: string, }; + +export type TradeProduct = { id: string, created_at: string, updated_at: string, key: string, category: string, title: string, summary: string, process: string, lot: string, profile: string, year: bigint, qty_amt: number, qty_amt_exact: string | null, qty_unit: string, qty_label: string | null, qty_avail: bigint | null, price_amt: number, price_amt_exact: string | null, price_currency: string, price_qty_amt: number, price_qty_amt_exact: string | null, price_qty_unit: string, listing_addr: string | null, primary_bin_id: string | null, verified_primary_bin_id: string | null, notes: string | null, }; + +export type TradeProductQueryBindValues = { id: string, }; diff --git a/testdata/baseline/current-radroots-generated/trade/types.ts b/testdata/baseline/current-radroots-generated/trade/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"; diff --git a/testdata/baseline/current-radroots-generated/types/types.ts b/testdata/baseline/current-radroots-generated/types/types.ts @@ -0,0 +1,9 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type IError<T> = { err: T, }; + +export type IResult<T> = { result: T, }; + +export type IResultList<T> = { results: Array<T>, }; + +export type IResultPass = { pass: boolean, };