11import { oc } from "@orpc/contract" ;
22import { z } from "zod" ;
33import { CurrencySchema } from "../schemas/currency" ;
4- import { PaginatedInputSchema , PaginationOutputSchema } from "../schemas/pagination" ;
54import {
6- PriceAmountTypeSchema ,
7- ProductPriceInputSchema ,
8- RecurringIntervalInputSchema ,
9- } from "../schemas/product-price-input" ;
5+ PaginatedInputSchema ,
6+ PaginationOutputSchema ,
7+ } from "../schemas/pagination" ;
108import {
11- ProductSchema ,
12- ProductDetailSchema ,
13- ProductPriceSchema ,
149 type Product ,
1510 type ProductDetail ,
11+ ProductDetailSchema ,
1612 type ProductPrice ,
13+ ProductPriceSchema ,
14+ ProductSchema ,
1715} from "../schemas/product" ;
16+ import {
17+ PriceAmountTypeSchema ,
18+ ProductPriceInputSchema ,
19+ RecurringIntervalInputSchema ,
20+ } from "../schemas/product-price-input" ;
1821
1922// Re-export entity schemas for backwards compatibility
20- export {
21- ProductSchema ,
22- ProductDetailSchema ,
23- ProductPriceSchema ,
24- } ;
23+ export { ProductSchema , ProductDetailSchema , ProductPriceSchema } ;
2524export type { Product , ProductDetail , ProductPrice } ;
2625
2726// List output schemas
@@ -33,7 +32,9 @@ export type ListProductsOutput = z.infer<typeof ListProductsOutputSchema>;
3332export const ListProductsDetailOutputSchema = PaginationOutputSchema . extend ( {
3433 products : z . array ( ProductDetailSchema ) ,
3534} ) ;
36- export type ListProductsDetailOutput = z . infer < typeof ListProductsDetailOutputSchema > ;
35+ export type ListProductsDetailOutput = z . infer <
36+ typeof ListProductsDetailOutputSchema
37+ > ;
3738
3839// Simple list without pagination
3940export const listProductsContract = oc
@@ -71,32 +72,46 @@ export type UpdateProductInput = z.infer<typeof UpdateProductInputSchema>;
7172export const CreateProductToolInputSchema = z . object ( {
7273 name : z . string ( ) . min ( 1 ) . describe ( "Product name" ) ,
7374 description : z . string ( ) . optional ( ) . describe ( "Product description" ) ,
74- priceAmount : z . number ( ) . optional ( ) . describe (
75- "Price amount (in cents for USD, whole sats for SAT). Required for fixed pricing."
75+ priceAmount : z
76+ . number ( )
77+ . optional ( )
78+ . describe (
79+ "Price amount (in cents for USD, whole sats for SAT). Required for fixed pricing." ,
80+ ) ,
81+ currency : CurrencySchema . optional ( ) . describe (
82+ "Currency: USD or SAT (default: USD)" ,
83+ ) ,
84+ amountType : PriceAmountTypeSchema . optional ( ) . describe (
85+ "Amount type: FIXED or CUSTOM (default: FIXED)" ,
7686 ) ,
77- currency : CurrencySchema . optional ( ) . describe ( "Currency: USD or SAT (default: USD)" ) ,
78- amountType : PriceAmountTypeSchema . optional ( ) . describe ( "Amount type: FIXED or CUSTOM (default: FIXED)" ) ,
7987 recurringInterval : RecurringIntervalInputSchema . optional ( ) . describe (
80- "Recurring interval: NEVER (one-time), MONTH, QUARTER, or YEAR (default: NEVER)"
88+ "Recurring interval: NEVER (one-time), MONTH, QUARTER, or YEAR (default: NEVER)" ,
8189 ) ,
8290} ) ;
8391
8492export const UpdateProductToolInputSchema = z . object ( {
8593 id : z . string ( ) . describe ( "The product ID to update" ) ,
8694 name : z . string ( ) . optional ( ) . describe ( "New product name" ) ,
8795 description : z . string ( ) . optional ( ) . describe ( "New product description" ) ,
88- priceAmount : z . number ( ) . optional ( ) . describe (
89- "New price amount (in cents for USD, whole sats for SAT)"
90- ) ,
96+ priceAmount : z
97+ . number ( )
98+ . optional ( )
99+ . describe ( "New price amount (in cents for USD, whole sats for SAT)" ) ,
91100 currency : CurrencySchema . optional ( ) . describe ( "Currency: USD or SAT" ) ,
92- amountType : PriceAmountTypeSchema . optional ( ) . describe ( "Amount type: FIXED or CUSTOM" ) ,
101+ amountType : PriceAmountTypeSchema . optional ( ) . describe (
102+ "Amount type: FIXED or CUSTOM" ,
103+ ) ,
93104 recurringInterval : RecurringIntervalInputSchema . optional ( ) . describe (
94- "Recurring interval: NEVER, MONTH, QUARTER, or YEAR"
105+ "Recurring interval: NEVER, MONTH, QUARTER, or YEAR" ,
95106 ) ,
96107} ) ;
97108
98- export type CreateProductToolInput = z . infer < typeof CreateProductToolInputSchema > ;
99- export type UpdateProductToolInput = z . infer < typeof UpdateProductToolInputSchema > ;
109+ export type CreateProductToolInput = z . infer <
110+ typeof CreateProductToolInputSchema
111+ > ;
112+ export type UpdateProductToolInput = z . infer <
113+ typeof UpdateProductToolInputSchema
114+ > ;
100115
101116export const GetProductInputSchema = z . object ( {
102117 id : z . string ( ) . describe ( "The product ID" ) ,
0 commit comments