Skip to main content

Crate stateset_embedded

Crate stateset_embedded 

Source
Expand description

§StateSet iCommerce

The SQLite of commerce operations. An embeddable commerce library that runs anywhere with zero external dependencies.

§Quick Start

use stateset_embedded::{Commerce, CreateCustomer, CreateOrder, CreateOrderItem, CreateInventoryItem};
use rust_decimal_macros::dec;

// Initialize with a database file (creates if not exists)
let commerce = Commerce::new("./store.db")?;

// Create a customer
let customer = commerce.customers().create(CreateCustomer {
    email: "alice@example.com".into(),
    first_name: "Alice".into(),
    last_name: "Smith".into(),
    ..Default::default()
})?;

// Create inventory
commerce.inventory().create_item(CreateInventoryItem {
    sku: "SKU-001".into(),
    name: "Widget".into(),
    initial_quantity: Some(dec!(100)),
    ..Default::default()
})?;

// Create an order
let order = commerce.orders().create(CreateOrder {
    customer_id: customer.id,
    items: vec![CreateOrderItem {
        sku: "SKU-001".into(),
        name: "Widget".into(),
        quantity: 2,
        unit_price: dec!(29.99),
        ..Default::default()
    }],
    ..Default::default()
})?;

// Adjust inventory
commerce.inventory().adjust("SKU-001", dec!(-2), "Order fulfillment")?;

§Features

  • Zero configuration - Just point to a file and go
  • Embedded SQLite - No external database server needed (default)
  • PostgreSQL support - Scale to production with postgres feature
  • Full commerce stack - Orders, inventory, customers, products, returns
  • Sync API - Simple blocking operations
  • Async API - True async for PostgreSQL with AsyncCommerce
  • Event-driven - Subscribe to commerce events for side effects

§Database Backends

§SQLite (default)

let commerce = Commerce::new("./store.db")?;
// or in-memory for testing
let commerce = Commerce::new(":memory:")?;

§PostgreSQL (requires postgres feature)

let commerce = Commerce::with_postgres("postgres://user:pass@localhost/db")?;
// or via builder
let commerce = Commerce::builder()
    .postgres("postgres://localhost/stateset")
    .max_connections(20)
    .build()?;

§Async PostgreSQL API

For true async operations with PostgreSQL, use AsyncCommerce:

use stateset_embedded::{AsyncCommerce, CreateOrder, CreateOrderItem};
use rust_decimal_macros::dec;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let commerce = AsyncCommerce::connect("postgres://localhost/stateset").await?;

    // All operations are truly async
    let order = commerce.orders().create(CreateOrder {
        customer_id: uuid::Uuid::new_v4(),
        items: vec![CreateOrderItem {
            sku: "SKU-001".into(),
            name: "Widget".into(),
            quantity: 2,
            unit_price: dec!(29.99),
            ..Default::default()
        }],
        ..Default::default()
    }).await?;

    let customers = commerce.customers().list(Default::default()).await?;
    let inventory = commerce.inventory().get_stock("SKU-001").await?;

    Ok(())
}

§Architecture

┌─────────────────────────────────────────┐
│           Your Application              │
│  ┌───────────────────────────────────┐  │
│  │     Commerce (this crate)         │  │
│  │  ┌─────────────────────────────┐  │  │
│  │  │  SQLite or PostgreSQL       │  │  │
│  │  └─────────────────────────────┘  │  │
│  └───────────────────────────────────┘  │
└─────────────────────────────────────────┘

Re-exports§

pub use events::EventBus;events
pub use events::EventConfig;events
pub use events::EventReceiver;events
pub use events::EventSubscription;events
pub use events::EventSystem;events
pub use events::FilteredSubscription;events
pub use events::InMemoryEventStore;events
pub use events::Webhook;events
pub use events::WebhookConfig;events
pub use events::WebhookDelivery;events
pub use events::WebhookManager;events
pub use events::WebhookRegistrationError;events
pub use events::filters;events
pub use maintenance::Maintenance;
pub use notifications::EmailBackend;
pub use notifications::EmailTemplate;
pub use notifications::LogEmailBackend;
pub use notifications::NotificationConfig;
pub use notifications::NotificationService;
pub use notifications::RecipientResolver;
pub use notifications::TransactionalEmail;
pub use notifications::WebhookEmailBackend;

Modules§

eventsevents
Event streaming infrastructure
maintenance
Backup, restore and structured export/import.
notifications
Transactional email notification service.
prelude
Curated stable subset of the public API — see prelude for what stateset-embedded intends to commit to at 1.0. Stable 1.0 surface for direct stateset-embedded consumers.

Structs§

A2APurchase
A persisted A2A purchase between agents
A2APurchaseFilter
Filter for listing A2A purchases
A2AQuote
A2A Quote - Price quote between agents
A2AQuoteFilter
Filter for listing quotes
AccountsPayable
Accounts Payable management interface.
AccountsReceivable
Accounts Receivable interface.
ActivityLogs
Activity log operations.
AddCartItem
Input for adding an item to cart
AddCarton
Input for adding a carton.
AddCartonItem
Input for adding item to carton.
AddLotCertificate
Input for adding a certificate to a lot
AddShipmentEvent
Input for adding a tracking event
AddWorkOrderMaterial
Input for adding material to a work order
Address
Address structure (shipping/billing)
AdjustInventory
Input for adjusting inventory
AdjustLocationInventory
Input for adjusting location inventory
AdjustLot
Input for adjusting lot quantity
AgentCard
Agent Card - Identity and capability advertisement for AI agents
AgentCardFilter
Filter for listing agent cards
AgentFeedback
Reputation feedback submitted by a client.
AgentFeedbackFilter
Filter for reading feedback.
AgentFeedbackResponse
Feedback response appended by an agent or third party.
AgentIdentity
Identity record for an on-chain ERC-8004 agent.
AgentIdentityFilter
Filter for listing agent identities.
AgentMetadataEntry
Metadata entry for on-chain identity metadata.
AgentRegistrationFile
Agent registration file (off-chain JSON referenced by agentURI).
AgentRegistrationRef
Registration reference entry in the registration file.
AgentServiceEndpoint
Service endpoint advertised by an agent registration file.
AgentValidationFilter
Filter for validation summaries.
AgentValidationRequest
Validation request submitted by an agent owner/operator.
AgentValidationResponse
Validation response from a validator.
AgentValidationStatus
Latest validation status for a request hash.
AllocateBackorder
Input for allocating inventory to a backorder.
Analytics
Analytics operations interface.
AnalyticsQuery
Common analytics query parameters
ApAgingSummary
AP aging summary.
AppliedPromotion
A promotion that was successfully applied
ApplyCartDiscount
Input for applying discount/coupon
ApplyCreditMemo
Input for applying a credit memo to an invoice
ApplyPaymentToInvoices
Input for applying a payment across invoices
ApplyPromotionsRequest
Request to apply promotions to a cart
ApplyPromotionsResult
Result of applying promotions
ArAgingFilter
Filter for AR aging queries
ArAgingSummary
AR aging summary across all customers
ArPaymentApplication
AR payment application (maps payments to invoices)
AutoPostingConfig
Auto-posting configuration
Backorder
A backorder record.
BackorderAllocation
Backorder allocation (reserved inventory for backorder).
BackorderFilter
Filter for listing backorders.
BackorderFulfillment
A backorder fulfillment record.
BackorderSummary
Overall backorder summary.
Backorders
Backorder Management interface.
BalanceSheet
Balance Sheet report
BalanceSheetLine
Balance Sheet line item
BatchResult
Result of a batch operation that allows partial success.
Bill
A bill/invoice from a supplier.
BillFilter
Filter for listing bills.
BillItem
A line item on a bill.
BillOfMaterials
Bill of Materials - defines what components make up a product
BillPayment
A payment made to a supplier.
BillPaymentFilter
Filter for listing payments.
BillingCycle
A billing cycle/period for a subscription
BillingCycleFilter
Filter for listing billing cycles
Bom
Bill of Materials operations.
BomComponent
A component in a Bill of Materials
BomFilter
Filter for listing BOMs
CanadianTaxInfo
Canadian province/territory tax information
CancelSubscription
Cancel subscription request
Cart
Cart/Checkout Session aggregate
CartAddress
Cart address (detailed for checkout)
CartFilter
Cart filter for querying
CartItem
Cart line item
Carton
A carton/package within a pack task.
CartonItem
Item in a carton.
Carts
Cart and Checkout operations
ChangeSerialStatus
Input for changing serial status with tracking
Channels
Channel operations (sales / fulfillment / end-to-end).
CheckoutResult
Checkout result after completing a cart
CloseMonthOptions
Options controlling a month-end close run.
CloseMonthReport
Report returned by the month-end close orchestration.
CloseMonthStepReport
Per-step detail of a month-end close run.
CollectionActivity
Collection activity record
CollectionActivityFilter
Filter for collection activity queries
Commerce
The main commerce interface.
CommerceBuilder
Builder for creating a Commerce instance with custom configuration.
CommerceHealth
Runtime health status for a Commerce engine instance.
Companies
B2B company operations.
CompleteInspection
Input for completing an inspection
CompletePick
Input for completing a pick.
CompletePutAway
Input for completing a put-away task.
CompleteShip
Input for completing shipping.
ConfirmDeliveryInput
Input for confirming delivery of a purchase
ConfirmDeliveryOutput
Output from confirm_delivery skill
ConsumeLot
Input for consuming from a lot
ConversionResult
Result of a currency conversion
ConvertCurrency
Request to convert money between currencies
CostAccounting
Cost Accounting management interface.
CostAdjustment
Cost adjustment record.
CostAdjustmentFilter
Filter for listing cost adjustments.
CostLayer
A cost layer for FIFO/LIFO costing.
CostLayerFilter
Filter for listing cost layers.
CostRollup
Standard cost roll-up for manufactured items.
CostTransaction
A cost transaction (records cost movements).
CostTransactionFilter
Filter for listing cost transactions.
CostVariance
Cost variance record.
CostVarianceFilter
Filter for listing cost variances.
CouponCode
A coupon code that activates a promotion
CouponFilter
Filter for listing coupon codes
CreateA2APurchase
Input for creating an A2A purchase
CreateA2AQuote
Input for creating an A2A quote
CreateAgentCard
Input for creating an agent card
CreateAgentFeedback
Input for creating new feedback.
CreateAgentFeedbackResponse
Input for appending a feedback response.
CreateAgentIdentity
Input for registering a new agent identity.
CreateAgentValidationRequest
Input for creating a validation request.
CreateAgentValidationResponse
Input for recording a validation response.
CreateAutoPostingConfig
Configuration for automatic postings between accounts
CreateBackorder
Input for creating a backorder.
CreateBill
Input for creating a bill.
CreateBillItem
Input for creating a bill item.
CreateBillPayment
Input for creating a payment.
CreateBillingCycle
Create a billing cycle for a subscription.
CreateBom
Input for creating a new BOM
CreateBomComponent
Input for creating a BOM component
CreateCart
Input for creating a new cart
CreateCollectionActivity
Input for logging a collection activity
CreateCostAdjustment
Input for creating a cost adjustment.
CreateCostLayer
Input for creating a cost layer.
CreateCouponCode
Create a coupon code
CreateCreditAccount
Input for creating a credit account.
CreateCreditMemo
Input for creating a credit memo
CreateCustomObject
Input for creating a custom object record.
CreateCustomObjectType
Input for creating a custom object type.
CreateCustomer
Input for creating a customer
CreateCustomerAddress
Input for creating a customer address
CreateCycleCount
Input for creating a cycle count
CreateCycleCountLine
Input line for creating a cycle count
CreateDefectCode
Input for creating a defect code
CreateFraudAssessment
Input for creating a fraud assessment
CreateGiftCard
Input for creating a gift card
CreateGlAccount
Input for creating a general ledger account
CreateGlPeriod
Input for creating a fiscal period
CreateInspection
Input for creating an inspection
CreateInspectionItem
Input for creating an inspection item
CreateInventoryItem
Input for creating inventory item
CreateInvoice
Input for creating an invoice
CreateInvoiceItem
Input for creating an invoice line item
CreateJournalEntry
Input for creating a journal entry with lines
CreateJournalEntryLine
Input for a journal entry line
CreateLocation
Input for creating a location
CreateLot
Input for creating a lot
CreateLoyaltyProgram
Input for creating a loyalty program
CreateNonConformance
Input for creating an NCR
CreateOrder
Input for creating a new order
CreateOrderItem
Input for creating an order item
CreatePackTask
Input for creating a pack task.
CreatePayment
Input for creating a new payment
CreatePaymentMethod
Input for creating a payment method
CreatePaymentRun
Input for creating a payment run.
CreatePickTask
Input for creating a pick task.
CreateProduct
Input for creating a product
CreateProductVariant
Input for creating a product variant
CreatePromotion
Create a new promotion
CreatePromotionCondition
Condition input used when creating a promotion
CreatePurchaseOrder
Input for creating a purchase order
CreatePurchaseOrderItem
Input for creating a PO line item
CreatePutAway
Input for creating a put-away task.
CreateQualityHold
Input for creating a quality hold
CreateReceipt
Input for creating a receipt.
CreateReceiptItem
Input for creating a receipt item.
CreateRefund
Input for creating a refund
CreateReturn
Input for creating a return
CreateReturnItem
Input for creating a return item
CreateReview
Input for creating a review
CreateSearchConfig
Input for creating a search configuration
CreateSegment
Input for creating a new segment
CreateSerialNumber
Input for creating a serial number
CreateSerialNumbersBulk
Input for creating multiple serial numbers in bulk
CreateShipTask
Input for creating a ship task.
CreateShipment
Input for creating a new shipment
CreateShipmentItem
Input for creating a shipment item
CreateShippingZone
Input for creating a shipping zone
CreateStoreCredit
Input for creating a new store credit
CreateSubscription
Create a new subscription
CreateSubscriptionItem
Item override when creating a subscription
CreateSubscriptionPlan
Create a new subscription plan
CreateSubscriptionPlanItem
Item definition for creating a subscription plan
CreateSupplier
Input for creating a supplier
CreateTaxExemption
Create a tax exemption for a customer
CreateTaxJurisdiction
Create a new tax jurisdiction
CreateTaxRate
Create a new tax rate
CreateWarehouse
Input for creating a warehouse
CreateWarranty
Input for creating a warranty
CreateWarrantyClaim
Input for creating a warranty claim
CreateWave
Input for creating a wave.
CreateWishlist
Input for creating a wishlist
CreateWorkOrder
Input for creating a work order
CreateWorkOrderTask
Input for creating a work order task
CreateWriteOff
Input for creating a write-off
CreateX402CreditAccount
Create a new x402 credit account
CreateX402PaymentIntent
Input for creating an x402 payment intent
CreateZone
Input for creating a zone
Credit
Credit Management interface.
CreditAccount
Customer credit account.
CreditAccountFilter
Filter for listing credit accounts.
CreditAgingBucket
Credit aging bucket.
CreditApplication
Credit application from a customer.
CreditApplicationFilter
Filter for listing credit applications.
CreditCheckResult
Credit check result.
CreditHold
Credit hold on an order.
CreditHoldFilter
Filter for listing credit holds.
CreditMemo
Credit memo
CreditMemoApplication
Credit memo application to invoice
CreditMemoFilter
Filter for credit memo queries
CreditTransaction
Credit transaction history.
CreditTransactionFilter
Filter for listing credit transactions.
CurrencyCode
ISO 4217 three-letter currency code.
CurrencyOps
Currency operations interface.
CustomFieldDefinition
Field definition inside a custom object type.
CustomObject
Custom object record (instance of a type definition).
CustomObjectFilter
Filter for querying custom object records.
CustomObjectType
Custom object type (schema / definition).
CustomObjectTypeFilter
Filter for listing custom object types.
CustomObjects
Custom object operations interface.
Customer
Customer entity
CustomerAddress
Customer address
CustomerArAging
AR aging by customer
CustomerArSummary
Customer AR summary
CustomerCreditSummary
Customer credit summary.
CustomerFilter
Customer filter for querying
CustomerId
Strongly-typed customer identifier.
CustomerMetrics
Customer segment metrics
CustomerStatement
Customer statement
Customers
Customer operations interface.
CycleCount
A cycle count header
CycleCountFilter
Filter for listing cycle counts
CycleCountLine
A single SKU line on a cycle count
DateRange
Date range for custom period queries
DefectCode
Defect code definition
DemandForecast
Demand forecast for a SKU
DiscountTier
A tiered discount level
DiscoverSellersInput
Input for discovering seller agents
DiscoverSellersOutput
Output from discover_sellers skill
EdiDocuments
EDI document operations.
Erc8004
ERC-8004 operations
EuVatInfo
EU VAT rates by country
ExchangeRate
An exchange rate between two currencies
ExchangeRateFilter
Filter for listing exchange rates
FeedbackSummary
Summary for feedback aggregation.
FixedAssets
Fixed asset register operations.
Fraud
Fraud detection operations for risk assessment and rules.
FulfillBackorder
Input for fulfilling a backorder.
Fulfillment
Fulfillment (pick/pack/ship) management interface.
FulfillmentId
Strongly-typed fulfillment identifier.
FulfillmentMetrics
Order fulfillment metrics
GeneralLedger
General Ledger interface.
GenerateStatementRequest
Request to generate a customer statement
GiftCards
Gift card operations for issuing, charging, and refunding.
GlAccount
A GL Account (Chart of Accounts entry)
GlAccountFilter
Filter for listing general ledger accounts
GlPeriod
GL Period (accounting period)
GlPeriodFilter
Filter for listing fiscal periods
HttpIdempotencyRecord
A durable idempotency entry: request fingerprint plus the stored response.
InboundShipments
Inbound shipment operations.
IncomeStatement
Income Statement report
IncomeStatementLine
Income Statement line item
InitiatePurchaseInput
Input for initiating a purchase from a quote
InitiatePurchaseOutput
Output from initiate_purchase skill
Inspection
Quality inspection for goods
InspectionFilter
Filter for listing inspections
InspectionItem
Line item in an inspection
IntegrationFieldMappings
Integration field-mapping operations.
IntegrationMappings
Integration mapping operations.
Inventory
Inventory operations interface.
InventoryBalance
Inventory balance at a location
InventoryFilter
Inventory filter for querying
InventoryHealth
Inventory health summary
InventoryItem
Inventory item (SKU master record)
InventoryMovement
Inventory movement summary
InventoryReservation
Inventory reservation
InventoryTransaction
Inventory transaction (audit trail)
InventoryValuation
Inventory valuation summary.
Invoice
An invoice
InvoiceFilter
Filter for listing invoices
InvoiceItem
A line item on an invoice
Invoices
Invoice operations for billing and accounts receivable
IssueCostLayers
Input for issuing from cost layers (FIFO/LIFO).
ItemCost
Cost record for an inventory item (standard cost master).
ItemCostFilter
Filter for listing item costs.
JournalEntry
Journal Entry header
JournalEntryFilter
Filter for listing journal entries
JournalEntryLine
Journal Entry line (detail)
JurisdictionSummary
Summary of a jurisdiction involved in calculation
LineItemDiscount
Discount applied to a specific line item
LineItemTax
Tax for a specific line item
Location
A location within a warehouse (zone/aisle/rack/bin)
LocationFilter
Filter for listing locations
LocationInventory
Inventory at a specific location
LocationInventoryFilter
Filter for location inventory
LocationMovement
Record of inventory movement between locations
LocationStock
Stock at a specific location
Lot
A lot/batch of inventory items
LotCertificate
Certificate/document associated with a lot
LotFilter
Filter for listing lots
LotLocation
Inventory of a lot at a specific location
LotTransaction
Transaction record for lot movements
Lots
Lot/Batch tracking management interface.
LowStockItem
Low stock alert
Loyalty
Loyalty program operations for points, accounts, and rewards.
MergeLots
Input for merging lots
Metrics
Thread-safe metrics handle for in-process telemetry.
MetricsConfig
Configuration for metrics initialization.
MetricsSnapshot
Snapshot of recorded metrics values.
Money
A monetary amount paired with its currency.
MoveInventory
Input for moving inventory between locations
MoveSerial
Input for moving a serial to a new location
MovementFilter
Filter for inventory movements
NonConformance
Non-Conformance Report for quality issues
NonConformanceFilter
Filter for listing NCRs
Order
Order aggregate root
OrderFilter
Order filter for querying
OrderId
Strongly-typed order identifier.
OrderItem
Order line item
OrderItemId
Strongly-typed order line item identifier.
OrderStatusBreakdown
Order status breakdown
Orders
Order operations interface.
PackTask
A pack task for packaging picked items.
PackTaskFilter
Filter for listing pack tasks.
PauseSubscription
Pause subscription request
PayBill
Input for paying a bill directly.
Payment
A payment transaction
PaymentAllocation
Allocation of a payment to specific bills.
PaymentAllocationInput
Payment allocation input.
PaymentApplicationLine
Payment allocation to a single invoice
PaymentFilter
Filter for listing payments
PaymentId
Strongly-typed payment identifier.
PaymentMethod
A stored payment method for a customer
PaymentObligations
Payment obligation operations.
PaymentRun
A scheduled payment batch.
PaymentRunFilter
Filter for payment runs.
Payments
Payment operations for transaction processing and refunds
PickTask
A pick task for retrieving items from warehouse locations.
PickTaskFilter
Filter for listing pick tasks.
PlaceCreditHold
Input for placing a credit hold.
Prepayments
Prepayment operations.
PriceLevels
Price level operations.
PriceSchedules
Price schedule operations.
PrintStations
Print station operations.
Product
Product entity
ProductAttribute
Product attribute
ProductFilter
Product filter for querying
ProductId
Strongly-typed product identifier.
ProductPerformance
Product performance metrics
ProductVariant
Product variant (SKU-level)
ProductionBatches
Production batch operations.
Products
Product operations interface.
Promotion
A promotion/discount offer
PromotionCondition
A condition that must be met for promotion to apply
PromotionFilter
Filter for listing promotions
PromotionLineItem
Line item for promotion calculation
PromotionUsage
Record of promotion usage
Promotions
Promotions and discounts management interface.
PurchaseOrder
A purchase order
PurchaseOrderFilter
Filter for listing purchase orders
PurchaseOrderItem
A line item on a purchase order
PurchaseOrders
Purchase Order operations for supplier procurement
Purgatory
Purgatory (order ingestion staging) operations.
PutAway
Put-away record for received items.
PutAwayFilter
Filter for listing put-aways.
Quality
Quality control management interface.
QualityHold
Quality hold to prevent inventory movement
QualityHoldFilter
Filter for listing quality holds
QuoteItem
Item to include in a quote request
QuotedItem
A quoted item with pricing
Receipt
A goods receipt document.
ReceiptFilter
Filter for listing receipts.
ReceiptItem
A line item on a receipt.
ReceiveItemLine
A line in a receive operation.
ReceiveItems
Input for receiving items.
ReceivePurchaseOrderItems
Input for receiving items on a purchase order
Receiving
Receiving and goods receipt management interface.
RecordCostVariance
Input for recording a cost variance.
RecordCreditTransaction
Input for recording a credit transaction.
RecordCycleCountLine
A recorded physical count for one line
RecordInspectionResult
Input for recording inspection results
RecordInvoicePayment
Input for recording a payment on an invoice
Refund
A refund for a payment
RejectedPromotion
A promotion that could not be applied
ReleaseCreditHold
Input for releasing a credit hold.
ReleaseQualityHold
Input for releasing a quality hold
RequestQuoteInput
Input for requesting a quote from a seller
RequestQuoteOutput
Output from request_quote skill
ReserveInventory
Input for reserving inventory
ReserveLot
Input for reserving from a lot
ReserveSerialNumber
Input for reserving a serial number
Return
Return entity
ReturnFilter
Return filter for querying
ReturnId
Strongly-typed return/RMA identifier.
ReturnItem
Return line item
ReturnMetrics
Return metrics
ReturnReasonCount
Return count by reason
Returns
Return operations interface.
RevenueByPeriod
Revenue breakdown by time bucket
RevenueForecast
Revenue forecast
RevenueRecognition
Revenue recognition (ASC 606) operations.
ReviewCreditApplication
Input for reviewing a credit application.
Reviews
Product review operations.
SalesSummary
Sales summary metrics
SearchConfigs
Search configuration operations.
Segments
Customer segment operations for grouping and targeting.
SellerInfo
Information about a seller agent
SeoMetadata
SEO metadata
SerialFilter
Filter for listing serial numbers
SerialHistory
History event for a serial number
SerialHistoryFilter
Filter for serial history
SerialLookupResult
Result of scanning/looking up a serial number
SerialNumber
A uniquely serialized unit of inventory
SerialReservation
Reservation of a specific serial number
SerialValidation
Serial number validation result
Serials
Serial number management interface.
SetCartPayment
Input for setting payment on cart
SetCartShipping
Input for setting shipping on cart
SetExchangeRate
Request to set an exchange rate
SetItemCost
Input for setting item cost.
ShipTask
A ship task for final shipping handoff.
ShipTaskFilter
Filter for listing ship tasks.
Shipment
A shipment tracks the physical delivery of items from an order
ShipmentEvent
A tracking event in a shipment’s history
ShipmentFilter
Filter for querying shipments
ShipmentId
Strongly-typed shipment identifier.
ShipmentItem
An item within a shipment
Shipments
Shipment operations for order fulfillment and delivery tracking
ShippingRate
Shipping rate/option
ShippingZones
Shipping zone and method operations.
SignX402PaymentIntent
Input for signing an x402 payment intent
SkillQuote
A persisted A2A quote between agents
SkillQuoteFilter
Filter for listing A2A quotes
SkipBillingCycle
Skip next billing cycle
SkuBackorderSummary
Backorder summary by SKU.
SkuCostSummary
Cost summary by SKU.
SplitLot
Input for splitting a lot
StatementLineItem
Customer statement line item
StockLevel
Stock level summary
StockSnapshots
Stock snapshot operations.
StoreCredits
Store credit operations for managing customer balances.
StoreCurrencySettings
Store-level currency configuration
SubmitCreditApplication
Input for submitting a credit application.
Subscription
A customer’s subscription
SubscriptionEvent
An event in a subscription’s history
SubscriptionFilter
Filter for listing subscriptions
SubscriptionItem
A line item in a subscription
SubscriptionPlan
A subscription plan template
SubscriptionPlanFilter
Filter for listing subscription plans
SubscriptionPlanItem
An item included in a subscription plan
Subscriptions
Subscription management interface.
Supplier
A supplier/vendor
SupplierApSummary
AP summary by supplier.
SupplierFilter
Filter for listing suppliers
SupplierSkus
Supplier SKU operations.
Tax
Tax calculation and management interface.
TaxAddress
Address for tax jurisdiction determination
TaxBreakdown
Tax breakdown by jurisdiction
TaxCalculationRequest
Input for tax calculation
TaxCalculationResult
Result of tax calculation
TaxDetail
Detailed tax information
TaxExemption
Customer tax exemption certificate
TaxJurisdiction
A tax jurisdiction (country, state, city, district)
TaxJurisdictionFilter
Filter for querying jurisdictions
TaxLineItem
A line item for tax calculation
TaxRate
A tax rate for a specific jurisdiction and category
TaxRateFilter
Filter for querying tax rates
TaxSettings
Store-level tax configuration
TopCustomer
Top customer by spend
TopProduct
Top selling product
TopReturnedProduct
Product with high return rate
TopologySnapshots
Topology snapshot operations.
TraceNode
A node in the traceability chain
TraceabilityResult
Result of a traceability query
TransferLot
Input for transferring lot between locations
TransferOrders
Transfer order operations.
TransferSerialOwnership
Input for transferring ownership of a serial number
TrialBalance
Trial Balance report
TrialBalanceLine
Trial Balance line
UnitsOfMeasure
Units-of-measure operations.
UpdateAgentCard
Input for updating an agent card
UpdateAgentIdentity
Input for updating an agent identity.
UpdateBackorder
Input for updating a backorder.
UpdateBill
Input for updating a bill.
UpdateBom
Input for updating a BOM
UpdateCart
Input for updating a cart
UpdateCartItem
Input for updating a cart item
UpdateCreditAccount
Input for updating a credit account.
UpdateCustomObject
Input for updating a custom object record.
UpdateCustomObjectType
Input for updating a custom object type.
UpdateCustomer
Input for updating a customer
UpdateGlAccount
Input for updating a general ledger account
UpdateInspection
Input for updating an inspection
UpdateInvoice
Input for updating an invoice
UpdateLocation
Input for updating a location
UpdateLot
Input for updating a lot
UpdateNonConformance
Input for updating an NCR
UpdateOrder
Input for updating an order
UpdatePayment
Input for updating a payment
UpdateProduct
Input for updating a product
UpdatePromotion
Update a promotion
UpdatePurchaseOrder
Input for updating a purchase order
UpdateReceipt
Input for updating a receipt.
UpdateReturn
Input for updating a return
UpdateSerialNumber
Input for updating a serial number
UpdateShipment
Input for updating a shipment
UpdateSubscription
Update a subscription
UpdateSubscriptionPlan
Update a subscription plan
UpdateSupplier
Input for updating a supplier
UpdateWarehouse
Input for updating a warehouse
UpdateWarranty
Input for updating a warranty
UpdateWarrantyClaim
Input for updating a warranty claim
UpdateWorkOrder
Input for updating a work order
UpdateWorkOrderTask
Input for updating a work order task
UpdateZone
Input for updating a zone
UsStateTaxInfo
US State tax information
ValidationSummary
Summary of validation responses for an agent.
VariantOption
Variant option (e.g., size: Large, color: Blue)
VendorCredits
Vendor credit operations.
VendorReturns
Vendor return operations.
Warehouse
A warehouse or distribution center
WarehouseAddress
Physical address for a warehouse
WarehouseFilter
Filter for listing warehouses
WarehouseOps
Warehouse and Location management interface.
Warranties
Warranty operations for product warranty management
Warranty
A warranty registration
WarrantyClaim
A warranty claim
WarrantyClaimFilter
Filter for listing warranty claims
WarrantyFilter
Filter for listing warranties
WarrantyLookupStatus
Warranty status for lookup
Wave
A wave groups multiple orders for efficient picking.
WaveFilter
Filter for listing waves.
Wishlists
Wishlist operations for managing customer wishlists.
WorkOrder
Work Order - a manufacturing job to build products
WorkOrderFilter
Filter for listing work orders
WorkOrderMaterial
Material tracking for a work order
WorkOrderTask
A task within a work order (a step in manufacturing)
WorkOrders
Work Order operations.
WriteOff
Write-off record
WriteOffFilter
Filter for write-off queries
X402
x402 payment protocol operations
X402CreditAccount
x402 Credit Account - tracks prepaid balances for metered usage
X402CreditAdjustment
Credit ledger adjustment (credit or debit)
X402CreditTransaction
x402 credit transaction (ledger entry)
X402CreditTransactionFilter
Filter for listing credit ledger transactions
X402PaymentBatch
x402 Payment Batch - A collection of payment intents for batch settlement
X402PaymentIntent
x402 Payment Intent - A signed off-chain payment request
X402PaymentIntentFilter
Filter for listing x402 payment intents
X402PaymentReceipt
x402 Payment Receipt - Proof that payment was made
X402PaymentRequired
x402 Payment Required Response
Zone
A zone within a warehouse (grouping of locations)

Enums§

A2ASkill
A2A commerce skills that an agent can advertise
AccountStatus
Account status
AccountSubType
Account sub-types for more granular classification
AccountType
GL Account type (follows standard accounting)
AddressType
Address type enumeration
AgentWalletProofType
Type of proof used to set or update agent wallet ownership.
AgingBucket
AR aging bucket classification
AllocationStatus
Allocation status.
BackorderPriority
Backorder priority.
BackorderStatus
Backorder status.
BalanceSide
Balance side (debit or credit)
BillStatus
Status of a bill.
BillingCycleStatus
Status of a billing cycle
BillingInterval
Billing interval for subscriptions
BomStatus
BOM lifecycle status
CardBrand
Card brand for credit/debit cards
CartPaymentStatus
Cart payment status
CartStatus
Cart status enumeration
CertificateType
Type of certificate
ClaimResolution
Claim resolution type
ClaimStatus
Warranty claim status
CloseMonthStepStatus
Outcome of one step in a month-end close run.
CollectionActivityType
Collection activity type
CollectionStatus
Collection status for an invoice
CommerceBackend
Active database backend used by a Commerce instance.
CommerceError
Main error type for commerce operations.
CommerceEvent
Commerce domain event
ConditionOperator
Condition operator for rules
ConditionType
Type of condition
CostAdjustmentStatus
Cost adjustment status.
CostAdjustmentType
Cost adjustment type.
CostLayerSource
Source of a cost layer.
CostMethod
Inventory costing method.
CostTransactionType
Cost transaction type.
CouponStatus
Status of an individual coupon code
CreditAccountStatus
Credit account status.
CreditApplicationStatus
Credit application status.
CreditHoldStatus
Credit hold status.
CreditHoldType
Credit hold type.
CreditMemoReason
Credit memo reason
CreditMemoStatus
Credit memo status
CreditTransactionType
Credit transaction type.
Currency
ISO 4217 Currency codes
CustomFieldType
Custom object field type.
CustomerStatus
Customer status enumeration
CycleCountStatus
Status of a cycle count
Disposition
Disposition decision for non-conforming material
DunningLetterType
Dunning letter template type
ExemptionType
Customer exemption type
FulfillmentSourceType
Source type for fulfillment.
FulfillmentStatus
Fulfillment status enumeration.
FulfillmentType
Fulfillment type
HoldType
Type of quality hold
InspectionResult
Result of inspecting an item
InspectionStatus
Status of an inspection
InspectionType
Type of inspection
InvoiceStatus
Invoice status
InvoiceType
Invoice type
ItemAvailability
Item availability status
ItemCondition
Item condition on return
JournalEntrySource
Journal entry source
JournalEntryStatus
Journal entry status
JournalEntryType
Journal entry type
JurisdictionLevel
Level of tax jurisdiction
LocationType
Type of location within a warehouse
LotStatus
Status of a lot
LotTransactionType
Type of lot transaction
MovementType
Type of inventory movement
NcrStatus
Status of an NCR
NonConformanceSource
Source of the non-conformance
OrderStatus
Order status enumeration.
PackStatus
Status of a pack task.
PackageType
Package type for cartons.
PaymentMethodAP
AP payment method.
PaymentMethodType
Payment method type
PaymentRunStatus
Payment run status.
PaymentStatus
Payment status enumeration.
PaymentStatusAP
AP payment status.
PaymentTerms
Payment terms for purchase orders
PaymentTransactionStatus
Payment transaction status in the processing lifecycle
PeriodStatus
GL Period status
PickStatus
Status of a pick task.
PlanStatus
Status of a subscription plan
ProductStatus
Product status enumeration
ProductTaxCategory
Product tax category
ProductType
Product type enumeration
PromotionStatus
Status of a promotion
PromotionTarget
What the promotion applies to
PromotionTrigger
How the promotion is triggered
PromotionType
Type of promotion
PurchaseOrderStatus
Purchase order status
PurchaseStatus
Purchase status
PutAwayStatus
Status of a put-away task.
QuoteStatus
Quote status
ReceiptItemStatus
Status of a receipt line item.
ReceiptStatus
Status of a receipt.
ReceiptType
Type of receipt.
RefundStatus
Refund status
RejectionReason
Reason a promotion or coupon was rejected during evaluation
ReservationStatus
Reservation status enumeration
ReturnReason
Return reason enumeration
ReturnStatus
Return status enumeration
RiskRating
Risk rating.
RoundingMode
Rounding mode for currency conversions
SegmentType
Segment type
SerialEventType
Type of serial number event
SerialStatus
Status of a serial number
Severity
Severity level
ShipStatus
Status of a ship task.
ShipmentStatus
Status of a shipment through its lifecycle
ShippingCarrier
Shipping carrier for deliveries
ShippingMethod
Shipping method/speed
StackingBehavior
Stacking behavior with other promotions
StatementTransactionType
Statement transaction type
StoreCreditReason
Reason for issuing store credit
SubscriptionEventType
Type of subscription event
SubscriptionStatus
Status of a subscription
TaskStatus
Task status
TaxCalculationMethod
Tax calculation method
TaxCompoundMethod
How to apply multiple tax rates
TaxType
Types of taxes supported
TimeGranularity
Granularity for time-series data
TimePeriod
Time period for analytics queries
TraceNodeType
Type of node in traceability chain
TransactionType
Transaction type enumeration
Trend
Trend direction
TrustLevel
Trust level for agent cards
VarianceType
Variance type.
WarehouseType
Type of warehouse
WarrantyStatus
Warranty status
WarrantyType
Warranty type/tier
WaveStatus
Status of a wave.
WaveType
Type of wave for order grouping
WorkOrderPriority
Work order priority
WorkOrderStatus
Work order status
WriteOffReason
Write-off reason code
X402Asset
Supported payment assets for x402
X402BatchStatus
Status of a payment batch
X402CreditDirection
Direction of x402 credit ledger entries
X402CryptoError
X402IntentStatus
Status of an x402 payment intent
X402Network
Supported blockchain networks for x402 payments

Constants§

ERC8004_REGISTRATION_V1
ERC-8004 registration file type URL (v1)
X402_DEFAULT_VALIDITY_SECONDS
Default payment validity window (1 hour in seconds)
X402_DOMAIN_SEPARATOR
Domain separator for x402 payment signing (per EIP-712 style)
X402_MAX_VALIDITY_SECONDS
Maximum payment validity window (24 hours in seconds)
X402_VERSION
x402 protocol version

Traits§

Database
Unified database trait that both SQLite and PostgreSQL implement. This allows stateset-embedded to work with either backend.
HttpIdempotencyRepository
Repository over the http_idempotency_keys table.

Functions§

from_smallest_unit
Calculate decimal amount from smallest unit
generate_ap_payment_number
Generate a payment number.
generate_backorder_number
Generate a backorder number.
generate_bill_number
Generate a bill number.
generate_claim_number
Generate a unique claim number
generate_cost_adjustment_number
Generate a cost adjustment number.
generate_coupon_code
Generate a unique coupon code (human-friendly)
generate_credit_application_number
Generate a credit application number.
generate_credit_memo_number
Generate a credit memo reference number
generate_invoice_number
Generate a unique invoice number
generate_journal_entry_number
Generate a journal entry number using a timestamp
generate_payment_number
Generate a unique payment number
generate_payment_run_number
Generate a payment run number.
generate_plan_code
Generate a unique plan code
generate_po_number
Generate a unique purchase order number
generate_promotion_code
Generate a unique promotion code
generate_refund_number
Generate a unique refund number
generate_subscription_number
Generate a unique subscription number
generate_warranty_number
Generate a unique warranty number
generate_write_off_number
Generate a write-off reference number
generate_x402_intent_id
Generate a unique x402 intent ID
get_canadian_tax_info
Get Canadian tax information for a province
get_eu_vat_info
Get EU VAT information for a country
get_us_state_tax_info
Pre-configured US state tax data
is_eu_member
Check if a country is in the EU
to_smallest_unit
Calculate amount in smallest unit from decimal
validate_currency_code
Validate a currency code (ISO 4217 format).
validate_custom_object_type_input
Validate a type definition input.
validate_email
Validate an email address format.
validate_phone
Validate a phone number format (basic validation).
validate_postal_code
Validate a postal/ZIP code format (basic validation).
validate_price
Validate a price/amount value.
validate_quantity
Validate a quantity value.
validate_sku
Validate a SKU format.

Type Aliases§

CreateNcr
Alias for CreateNonConformance for API convenience
CreateReceiptLine
Alias for CreateReceiptItem for API convenience
CreateSerial
Alias for CreateSerialNumber for API convenience
CreateWarehouseLocation
Alias for CreateLocation for API convenience
Result
Result type alias for commerce operations.