Skip to content

Commit 73d0431

Browse files
fix: biome formatting
1 parent 372433b commit 73d0431

6 files changed

Lines changed: 130 additions & 60 deletions

File tree

src/contracts/checkout.ts

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
import { oc } from "@orpc/contract";
22
import { z } from "zod";
33
import {
4-
CheckoutSchema,
5-
CheckoutStatusSchema,
6-
CheckoutTypeSchema,
7-
CheckoutListItemSchema,
4+
type CheckoutDetail,
85
CheckoutDetailSchema,
6+
type CheckoutListItem,
7+
CheckoutListItemSchema,
8+
CheckoutSchema,
99
type CheckoutStatus,
10+
CheckoutStatusSchema,
1011
type CheckoutType,
11-
type CheckoutListItem,
12-
type CheckoutDetail,
12+
CheckoutTypeSchema,
1313
} from "../schemas/checkout";
1414
import { CurrencySchema } from "../schemas/currency";
15-
import { PaginatedInputSchema, PaginationOutputSchema } from "../schemas/pagination";
15+
import {
16+
PaginatedInputSchema,
17+
PaginationOutputSchema,
18+
} from "../schemas/pagination";
1619

1720
// Re-export entity schemas for backwards compatibility
1821
export {
@@ -122,19 +125,29 @@ export const ListCheckoutsOutputSchema = z.object({
122125
export type ListCheckoutsOutput = z.infer<typeof ListCheckoutsOutputSchema>;
123126

124127
export const ListCheckoutsPaginatedInputSchema = PaginatedInputSchema.extend({
125-
status: CheckoutStatusSchema.optional().describe("Filter by status: UNCONFIRMED, CONFIRMED, PENDING_PAYMENT, PAYMENT_RECEIVED, or EXPIRED"),
126-
});
127-
export type ListCheckoutsPaginatedInput = z.infer<typeof ListCheckoutsPaginatedInputSchema>;
128-
129-
export const ListCheckoutsPaginatedOutputSchema = PaginationOutputSchema.extend({
130-
checkouts: z.array(CheckoutSchema),
128+
status: CheckoutStatusSchema.optional().describe(
129+
"Filter by status: UNCONFIRMED, CONFIRMED, PENDING_PAYMENT, PAYMENT_RECEIVED, or EXPIRED",
130+
),
131131
});
132-
export type ListCheckoutsPaginatedOutput = z.infer<typeof ListCheckoutsPaginatedOutputSchema>;
132+
export type ListCheckoutsPaginatedInput = z.infer<
133+
typeof ListCheckoutsPaginatedInputSchema
134+
>;
135+
136+
export const ListCheckoutsPaginatedOutputSchema = PaginationOutputSchema.extend(
137+
{
138+
checkouts: z.array(CheckoutSchema),
139+
},
140+
);
141+
export type ListCheckoutsPaginatedOutput = z.infer<
142+
typeof ListCheckoutsPaginatedOutputSchema
143+
>;
133144

134145
export const ListCheckoutsSummaryOutputSchema = PaginationOutputSchema.extend({
135146
checkouts: z.array(CheckoutListItemSchema),
136147
});
137-
export type ListCheckoutsSummaryOutput = z.infer<typeof ListCheckoutsSummaryOutputSchema>;
148+
export type ListCheckoutsSummaryOutput = z.infer<
149+
typeof ListCheckoutsSummaryOutputSchema
150+
>;
138151

139152
// Contracts
140153
export const createCheckoutContract = oc

src/contracts/customer.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
CustomerWithSubscriptionsSchema,
66
GetCustomerInputSchema as SdkGetCustomerInputSchema,
77
} from "../schemas/customer";
8-
import { PaginatedInputSchema, PaginationOutputSchema } from "../schemas/pagination";
8+
import {
9+
PaginatedInputSchema,
10+
PaginationOutputSchema,
11+
} from "../schemas/pagination";
912

1013
// Simple list (no pagination)
1114
export const ListCustomersOutputSchema = z.object({
@@ -15,19 +18,28 @@ export type ListCustomersOutput = z.infer<typeof ListCustomersOutputSchema>;
1518

1619
// Paginated list (no additional filters for customers)
1720
export const ListCustomersPaginatedInputSchema = PaginatedInputSchema;
18-
export type ListCustomersPaginatedInput = z.infer<typeof ListCustomersPaginatedInputSchema>;
19-
20-
export const ListCustomersPaginatedOutputSchema = PaginationOutputSchema.extend({
21-
customers: z.array(CustomerSchema),
22-
});
23-
export type ListCustomersPaginatedOutput = z.infer<typeof ListCustomersPaginatedOutputSchema>;
21+
export type ListCustomersPaginatedInput = z.infer<
22+
typeof ListCustomersPaginatedInputSchema
23+
>;
24+
25+
export const ListCustomersPaginatedOutputSchema = PaginationOutputSchema.extend(
26+
{
27+
customers: z.array(CustomerSchema),
28+
},
29+
);
30+
export type ListCustomersPaginatedOutput = z.infer<
31+
typeof ListCustomersPaginatedOutputSchema
32+
>;
2433

2534
// Flexible customer lookup - exactly one of id, email, or externalId
2635
// Base shape without refinement (for MCP tool schemas)
2736
export const CustomerLookupBaseSchema = z.object({
2837
id: z.string().optional().describe("The customer ID"),
2938
email: z.string().optional().describe("The customer email address"),
30-
externalId: z.string().optional().describe("The external ID from your system"),
39+
externalId: z
40+
.string()
41+
.optional()
42+
.describe("The external ID from your system"),
3143
});
3244

3345
// With refinement for runtime validation
@@ -47,15 +59,24 @@ export type DeleteCustomerInput = z.infer<typeof DeleteCustomerInputSchema>;
4759
export const CreateCustomerInputSchema = z.object({
4860
name: z.string().min(1).describe("Customer name"),
4961
email: z.string().email().describe("Customer email address"),
50-
externalId: z.string().optional().describe("External ID from your system for linking"),
62+
externalId: z
63+
.string()
64+
.optional()
65+
.describe("External ID from your system for linking"),
5166
});
5267

5368
export const UpdateCustomerInputSchema = z.object({
5469
id: z.string().describe("The customer ID to update"),
5570
name: z.string().optional().describe("New customer name"),
5671
email: z.string().email().optional().describe("New customer email address"),
57-
externalId: z.string().optional().describe("External ID from your system for linking"),
58-
userMetadata: z.record(z.string(), z.string()).optional().describe("Custom metadata key-value pairs"),
72+
externalId: z
73+
.string()
74+
.optional()
75+
.describe("External ID from your system for linking"),
76+
userMetadata: z
77+
.record(z.string(), z.string())
78+
.optional()
79+
.describe("Custom metadata key-value pairs"),
5980
});
6081

6182
export type CreateCustomerInput = z.infer<typeof CreateCustomerInputSchema>;

src/contracts/order.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { oc } from "@orpc/contract";
22
import { z } from "zod";
33
import {
4-
OrderWithRelationsSchema,
54
type OrderWithRelations,
5+
OrderWithRelationsSchema,
66
} from "../schemas/order";
7-
import { PaginatedInputSchema, PaginationOutputSchema } from "../schemas/pagination";
7+
import {
8+
PaginatedInputSchema,
9+
PaginationOutputSchema,
10+
} from "../schemas/pagination";
811

912
// Re-export entity schema for backwards compatibility
1013
export { OrderWithRelationsSchema };
@@ -18,14 +21,21 @@ export type ListOrdersOutput = z.infer<typeof ListOrdersOutputSchema>;
1821

1922
export const ListOrdersPaginatedInputSchema = PaginatedInputSchema.extend({
2023
customerId: z.string().optional().describe("Filter by customer ID"),
21-
status: z.string().optional().describe("Filter by status: PENDING, PAID, REFUNDED, or CANCELLED"),
24+
status: z
25+
.string()
26+
.optional()
27+
.describe("Filter by status: PENDING, PAID, REFUNDED, or CANCELLED"),
2228
});
23-
export type ListOrdersPaginatedInput = z.infer<typeof ListOrdersPaginatedInputSchema>;
29+
export type ListOrdersPaginatedInput = z.infer<
30+
typeof ListOrdersPaginatedInputSchema
31+
>;
2432

2533
export const ListOrdersPaginatedOutputSchema = PaginationOutputSchema.extend({
2634
orders: z.array(OrderWithRelationsSchema),
2735
});
28-
export type ListOrdersPaginatedOutput = z.infer<typeof ListOrdersPaginatedOutputSchema>;
36+
export type ListOrdersPaginatedOutput = z.infer<
37+
typeof ListOrdersPaginatedOutputSchema
38+
>;
2939

3040
export const GetOrderInputSchema = z.object({
3141
id: z.string().describe("The order ID"),

src/contracts/products.ts

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
11
import { oc } from "@orpc/contract";
22
import { z } from "zod";
33
import { CurrencySchema } from "../schemas/currency";
4-
import { PaginatedInputSchema, PaginationOutputSchema } from "../schemas/pagination";
54
import {
6-
PriceAmountTypeSchema,
7-
ProductPriceInputSchema,
8-
RecurringIntervalInputSchema,
9-
} from "../schemas/product-price-input";
5+
PaginatedInputSchema,
6+
PaginationOutputSchema,
7+
} from "../schemas/pagination";
108
import {
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 };
2524
export type { Product, ProductDetail, ProductPrice };
2625

2726
// List output schemas
@@ -33,7 +32,9 @@ export type ListProductsOutput = z.infer<typeof ListProductsOutputSchema>;
3332
export 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
3940
export const listProductsContract = oc
@@ -71,32 +72,46 @@ export type UpdateProductInput = z.infer<typeof UpdateProductInputSchema>;
7172
export 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

8492
export 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

101116
export const GetProductInputSchema = z.object({
102117
id: z.string().describe("The product ID"),

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ export {
141141
OrderItemSchema,
142142
OrderStatusSchema,
143143
} from "./schemas/order";
144-
export type { IdInput, PaginationInput, PaginatedInput, PaginationOutput } from "./schemas/pagination";
144+
export type {
145+
IdInput,
146+
PaginationInput,
147+
PaginatedInput,
148+
PaginationOutput,
149+
} from "./schemas/pagination";
145150
export {
146151
IdInputSchema,
147152
PaginationInputSchema,

src/schemas/pagination.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@ export type PaginationInput = z.infer<typeof PaginationInputSchema>;
2525
* Use .extend() to add entity-specific filters.
2626
*/
2727
export const PaginatedInputSchema = z.object({
28-
limit: z.number().optional().describe("Maximum number of items to return (1-100, default 50)"),
29-
cursor: z.string().optional().describe("Cursor for pagination (from previous response)"),
28+
limit: z
29+
.number()
30+
.optional()
31+
.describe("Maximum number of items to return (1-100, default 50)"),
32+
cursor: z
33+
.string()
34+
.optional()
35+
.describe("Cursor for pagination (from previous response)"),
3036
});
3137

3238
export type PaginatedInput = z.infer<typeof PaginatedInputSchema>;

0 commit comments

Comments
 (0)