@develemit/commerce-contracts 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,429 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const moneySchema: z.ZodObject<{
4
+ amountCents: z.ZodNumber;
5
+ currency: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type Money = z.infer<typeof moneySchema>;
8
+
9
+ declare const productImageSchema: z.ZodObject<{
10
+ url: z.ZodString;
11
+ alt: z.ZodString;
12
+ }, z.core.$strip>;
13
+ declare const availabilitySchema: z.ZodEnum<{
14
+ available: "available";
15
+ sold: "sold";
16
+ reserved: "reserved";
17
+ }>;
18
+ declare const productSchema: z.ZodObject<{
19
+ id: z.ZodString;
20
+ slug: z.ZodString;
21
+ name: z.ZodString;
22
+ description: z.ZodString;
23
+ materials: z.ZodOptional<z.ZodString>;
24
+ dimensions: z.ZodOptional<z.ZodString>;
25
+ priceCents: z.ZodNumber;
26
+ currency: z.ZodString;
27
+ category: z.ZodString;
28
+ images: z.ZodArray<z.ZodObject<{
29
+ url: z.ZodString;
30
+ alt: z.ZodString;
31
+ }, z.core.$strip>>;
32
+ quantity: z.ZodNumber;
33
+ availability: z.ZodEnum<{
34
+ available: "available";
35
+ sold: "sold";
36
+ reserved: "reserved";
37
+ }>;
38
+ featured: z.ZodBoolean;
39
+ }, z.core.$strip>;
40
+ declare const categorySchema: z.ZodObject<{
41
+ slug: z.ZodString;
42
+ label: z.ZodString;
43
+ count: z.ZodNumber;
44
+ }, z.core.$strip>;
45
+ declare const productListQuerySchema: z.ZodObject<{
46
+ category: z.ZodOptional<z.ZodString>;
47
+ featured: z.ZodOptional<z.ZodBoolean>;
48
+ }, z.core.$strip>;
49
+ type ProductImage = z.infer<typeof productImageSchema>;
50
+ type ProductAvailability = z.infer<typeof availabilitySchema>;
51
+ type Product = z.infer<typeof productSchema>;
52
+ type Category = z.infer<typeof categorySchema>;
53
+ type ProductListQuery = z.infer<typeof productListQuerySchema>;
54
+
55
+ declare const cartLineSchema: z.ZodObject<{
56
+ productId: z.ZodString;
57
+ slug: z.ZodString;
58
+ name: z.ZodString;
59
+ priceCents: z.ZodNumber;
60
+ currency: z.ZodString;
61
+ imageUrl: z.ZodOptional<z.ZodString>;
62
+ quantity: z.ZodNumber;
63
+ maxQuantity: z.ZodNumber;
64
+ }, z.core.$strip>;
65
+ type CartLine = z.infer<typeof cartLineSchema>;
66
+
67
+ declare const checkoutRequestSchema: z.ZodObject<{
68
+ items: z.ZodArray<z.ZodObject<{
69
+ productId: z.ZodString;
70
+ quantity: z.ZodNumber;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>;
73
+ declare const checkoutResponseSchema: z.ZodObject<{
74
+ url: z.ZodString;
75
+ }, z.core.$strip>;
76
+ declare const checkoutConflictSchema: z.ZodObject<{
77
+ unavailableProductIds: z.ZodArray<z.ZodString>;
78
+ }, z.core.$strip>;
79
+ type CheckoutRequest = z.infer<typeof checkoutRequestSchema>;
80
+ type CheckoutResponse = z.infer<typeof checkoutResponseSchema>;
81
+ type CheckoutConflict = z.infer<typeof checkoutConflictSchema>;
82
+
83
+ declare const orderStatusSchema: z.ZodEnum<{
84
+ pending: "pending";
85
+ paid: "paid";
86
+ shipped: "shipped";
87
+ cancelled: "cancelled";
88
+ expired: "expired";
89
+ needs_attention: "needs_attention";
90
+ refunded: "refunded";
91
+ }>;
92
+ declare const orderFulfillmentSchema: z.ZodObject<{
93
+ carrier: z.ZodNullable<z.ZodString>;
94
+ trackingNumber: z.ZodNullable<z.ZodString>;
95
+ trackingUrl: z.ZodNullable<z.ZodString>;
96
+ shippedAt: z.ZodString;
97
+ }, z.core.$strip>;
98
+ declare const orderRefundSchema: z.ZodObject<{
99
+ id: z.ZodString;
100
+ amountCents: z.ZodNumber;
101
+ reason: z.ZodNullable<z.ZodString>;
102
+ restocked: z.ZodBoolean;
103
+ source: z.ZodEnum<{
104
+ admin: "admin";
105
+ gateway: "gateway";
106
+ }>;
107
+ status: z.ZodEnum<{
108
+ pending: "pending";
109
+ succeeded: "succeeded";
110
+ }>;
111
+ createdAt: z.ZodString;
112
+ }, z.core.$strip>;
113
+ declare const orderSummarySchema: z.ZodObject<{
114
+ id: z.ZodString;
115
+ status: z.ZodEnum<{
116
+ pending: "pending";
117
+ paid: "paid";
118
+ shipped: "shipped";
119
+ cancelled: "cancelled";
120
+ expired: "expired";
121
+ needs_attention: "needs_attention";
122
+ refunded: "refunded";
123
+ }>;
124
+ subtotalCents: z.ZodNumber;
125
+ shippingCents: z.ZodNumber;
126
+ shippingLabel: z.ZodNullable<z.ZodString>;
127
+ totalCents: z.ZodNumber;
128
+ currency: z.ZodString;
129
+ items: z.ZodArray<z.ZodObject<{
130
+ productId: z.ZodString;
131
+ name: z.ZodString;
132
+ priceCents: z.ZodNumber;
133
+ quantity: z.ZodNumber;
134
+ }, z.core.$strip>>;
135
+ fulfillment: z.ZodNullable<z.ZodObject<{
136
+ carrier: z.ZodNullable<z.ZodString>;
137
+ trackingNumber: z.ZodNullable<z.ZodString>;
138
+ trackingUrl: z.ZodNullable<z.ZodString>;
139
+ shippedAt: z.ZodString;
140
+ }, z.core.$strip>>;
141
+ createdAt: z.ZodString;
142
+ }, z.core.$strip>;
143
+ declare const orderAddressSchema: z.ZodObject<{
144
+ name: z.ZodOptional<z.ZodString>;
145
+ line1: z.ZodOptional<z.ZodString>;
146
+ line2: z.ZodOptional<z.ZodString>;
147
+ city: z.ZodOptional<z.ZodString>;
148
+ state: z.ZodOptional<z.ZodString>;
149
+ postalCode: z.ZodOptional<z.ZodString>;
150
+ country: z.ZodOptional<z.ZodString>;
151
+ }, z.core.$strip>;
152
+ declare const orderDetailSchema: z.ZodObject<{
153
+ email: z.ZodNullable<z.ZodString>;
154
+ shippingAddress: z.ZodNullable<z.ZodObject<{
155
+ name: z.ZodOptional<z.ZodString>;
156
+ line1: z.ZodOptional<z.ZodString>;
157
+ line2: z.ZodOptional<z.ZodString>;
158
+ city: z.ZodOptional<z.ZodString>;
159
+ state: z.ZodOptional<z.ZodString>;
160
+ postalCode: z.ZodOptional<z.ZodString>;
161
+ country: z.ZodOptional<z.ZodString>;
162
+ }, z.core.$strip>>;
163
+ id: z.ZodString;
164
+ status: z.ZodEnum<{
165
+ pending: "pending";
166
+ paid: "paid";
167
+ shipped: "shipped";
168
+ cancelled: "cancelled";
169
+ expired: "expired";
170
+ needs_attention: "needs_attention";
171
+ refunded: "refunded";
172
+ }>;
173
+ subtotalCents: z.ZodNumber;
174
+ shippingCents: z.ZodNumber;
175
+ shippingLabel: z.ZodNullable<z.ZodString>;
176
+ totalCents: z.ZodNumber;
177
+ currency: z.ZodString;
178
+ items: z.ZodArray<z.ZodObject<{
179
+ productId: z.ZodString;
180
+ name: z.ZodString;
181
+ priceCents: z.ZodNumber;
182
+ quantity: z.ZodNumber;
183
+ }, z.core.$strip>>;
184
+ fulfillment: z.ZodNullable<z.ZodObject<{
185
+ carrier: z.ZodNullable<z.ZodString>;
186
+ trackingNumber: z.ZodNullable<z.ZodString>;
187
+ trackingUrl: z.ZodNullable<z.ZodString>;
188
+ shippedAt: z.ZodString;
189
+ }, z.core.$strip>>;
190
+ createdAt: z.ZodString;
191
+ }, z.core.$strip>;
192
+ type OrderStatus = z.infer<typeof orderStatusSchema>;
193
+ type OrderFulfillment = z.infer<typeof orderFulfillmentSchema>;
194
+ type OrderRefund = z.infer<typeof orderRefundSchema>;
195
+ type OrderSummary = z.infer<typeof orderSummarySchema>;
196
+ type OrderAddress = z.infer<typeof orderAddressSchema>;
197
+ type OrderDetail = z.infer<typeof orderDetailSchema>;
198
+
199
+ declare const shippingRateSchema: z.ZodObject<{
200
+ label: z.ZodString;
201
+ amountCents: z.ZodNumber;
202
+ currency: z.ZodString;
203
+ minDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
204
+ maxDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
205
+ active: z.ZodDefault<z.ZodBoolean>;
206
+ sort: z.ZodDefault<z.ZodNumber>;
207
+ }, z.core.$strip>;
208
+ declare const shippingRatesInputSchema: z.ZodArray<z.ZodObject<{
209
+ label: z.ZodString;
210
+ amountCents: z.ZodNumber;
211
+ currency: z.ZodString;
212
+ minDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
213
+ maxDays: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
214
+ active: z.ZodDefault<z.ZodBoolean>;
215
+ sort: z.ZodDefault<z.ZodNumber>;
216
+ }, z.core.$strip>>;
217
+ type ShippingRate = z.infer<typeof shippingRateSchema>;
218
+ type ShippingRateInput = z.input<typeof shippingRateSchema>;
219
+
220
+ declare const productStatusSchema: z.ZodEnum<{
221
+ active: "active";
222
+ draft: "draft";
223
+ archived: "archived";
224
+ }>;
225
+ declare const adminProductInputSchema: z.ZodObject<{
226
+ name: z.ZodString;
227
+ materials: z.ZodOptional<z.ZodNullable<z.ZodString>>;
228
+ dimensions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
229
+ priceCents: z.ZodNumber;
230
+ currency: z.ZodOptional<z.ZodString>;
231
+ category: z.ZodString;
232
+ description: z.ZodDefault<z.ZodString>;
233
+ quantity: z.ZodDefault<z.ZodNumber>;
234
+ status: z.ZodDefault<z.ZodEnum<{
235
+ active: "active";
236
+ draft: "draft";
237
+ archived: "archived";
238
+ }>>;
239
+ featured: z.ZodDefault<z.ZodBoolean>;
240
+ }, z.core.$strip>;
241
+ declare const adminProductPatchSchema: z.ZodObject<{
242
+ name: z.ZodOptional<z.ZodString>;
243
+ description: z.ZodOptional<z.ZodString>;
244
+ materials: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
245
+ dimensions: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
246
+ priceCents: z.ZodOptional<z.ZodNumber>;
247
+ currency: z.ZodOptional<z.ZodOptional<z.ZodString>>;
248
+ category: z.ZodOptional<z.ZodString>;
249
+ quantity: z.ZodOptional<z.ZodNumber>;
250
+ status: z.ZodOptional<z.ZodEnum<{
251
+ active: "active";
252
+ draft: "draft";
253
+ archived: "archived";
254
+ }>>;
255
+ featured: z.ZodOptional<z.ZodBoolean>;
256
+ sold: z.ZodOptional<z.ZodBoolean>;
257
+ }, z.core.$strip>;
258
+ declare const adminProductImageSchema: z.ZodObject<{
259
+ id: z.ZodString;
260
+ url: z.ZodString;
261
+ alt: z.ZodString;
262
+ position: z.ZodNumber;
263
+ }, z.core.$strip>;
264
+ declare const adminProductSchema: z.ZodObject<{
265
+ id: z.ZodString;
266
+ slug: z.ZodString;
267
+ name: z.ZodString;
268
+ description: z.ZodString;
269
+ materials: z.ZodNullable<z.ZodString>;
270
+ dimensions: z.ZodNullable<z.ZodString>;
271
+ priceCents: z.ZodNumber;
272
+ currency: z.ZodString;
273
+ category: z.ZodString;
274
+ quantity: z.ZodNumber;
275
+ status: z.ZodEnum<{
276
+ active: "active";
277
+ draft: "draft";
278
+ archived: "archived";
279
+ }>;
280
+ featured: z.ZodBoolean;
281
+ images: z.ZodArray<z.ZodObject<{
282
+ id: z.ZodString;
283
+ url: z.ZodString;
284
+ alt: z.ZodString;
285
+ position: z.ZodNumber;
286
+ }, z.core.$strip>>;
287
+ }, z.core.$strip>;
288
+ declare const imageOrderInputSchema: z.ZodObject<{
289
+ imageIds: z.ZodArray<z.ZodString>;
290
+ }, z.core.$strip>;
291
+ type ProductStatus = z.infer<typeof productStatusSchema>;
292
+ type AdminProductInput = z.input<typeof adminProductInputSchema>;
293
+ type AdminProductPatch = z.input<typeof adminProductPatchSchema>;
294
+ type AdminProductImage = z.infer<typeof adminProductImageSchema>;
295
+ type AdminProduct = z.infer<typeof adminProductSchema>;
296
+ type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;
297
+
298
+ declare const adminOrderListQuerySchema: z.ZodObject<{
299
+ status: z.ZodOptional<z.ZodEnum<{
300
+ pending: "pending";
301
+ paid: "paid";
302
+ shipped: "shipped";
303
+ cancelled: "cancelled";
304
+ expired: "expired";
305
+ needs_attention: "needs_attention";
306
+ refunded: "refunded";
307
+ }>>;
308
+ q: z.ZodOptional<z.ZodString>;
309
+ hasPendingRefund: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
310
+ true: "true";
311
+ false: "false";
312
+ }>, z.ZodTransform<boolean, "true" | "false">>>;
313
+ cursor: z.ZodOptional<z.ZodString>;
314
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
315
+ }, z.core.$strip>;
316
+ declare const adminOrderListItemSchema: z.ZodObject<{
317
+ id: z.ZodString;
318
+ status: z.ZodEnum<{
319
+ pending: "pending";
320
+ paid: "paid";
321
+ shipped: "shipped";
322
+ cancelled: "cancelled";
323
+ expired: "expired";
324
+ needs_attention: "needs_attention";
325
+ refunded: "refunded";
326
+ }>;
327
+ email: z.ZodNullable<z.ZodString>;
328
+ totalCents: z.ZodNumber;
329
+ currency: z.ZodString;
330
+ itemCount: z.ZodNumber;
331
+ createdAt: z.ZodString;
332
+ }, z.core.$strip>;
333
+ declare const adminOrderPageSchema: z.ZodObject<{
334
+ items: z.ZodArray<z.ZodObject<{
335
+ id: z.ZodString;
336
+ status: z.ZodEnum<{
337
+ pending: "pending";
338
+ paid: "paid";
339
+ shipped: "shipped";
340
+ cancelled: "cancelled";
341
+ expired: "expired";
342
+ needs_attention: "needs_attention";
343
+ refunded: "refunded";
344
+ }>;
345
+ email: z.ZodNullable<z.ZodString>;
346
+ totalCents: z.ZodNumber;
347
+ currency: z.ZodString;
348
+ itemCount: z.ZodNumber;
349
+ createdAt: z.ZodString;
350
+ }, z.core.$strip>>;
351
+ nextCursor: z.ZodNullable<z.ZodString>;
352
+ }, z.core.$strip>;
353
+ declare const adminOrderDetailSchema: z.ZodObject<{
354
+ email: z.ZodNullable<z.ZodString>;
355
+ shippingAddress: z.ZodNullable<z.ZodObject<{
356
+ name: z.ZodOptional<z.ZodString>;
357
+ line1: z.ZodOptional<z.ZodString>;
358
+ line2: z.ZodOptional<z.ZodString>;
359
+ city: z.ZodOptional<z.ZodString>;
360
+ state: z.ZodOptional<z.ZodString>;
361
+ postalCode: z.ZodOptional<z.ZodString>;
362
+ country: z.ZodOptional<z.ZodString>;
363
+ }, z.core.$strip>>;
364
+ id: z.ZodString;
365
+ status: z.ZodEnum<{
366
+ pending: "pending";
367
+ paid: "paid";
368
+ shipped: "shipped";
369
+ cancelled: "cancelled";
370
+ expired: "expired";
371
+ needs_attention: "needs_attention";
372
+ refunded: "refunded";
373
+ }>;
374
+ subtotalCents: z.ZodNumber;
375
+ shippingCents: z.ZodNumber;
376
+ shippingLabel: z.ZodNullable<z.ZodString>;
377
+ totalCents: z.ZodNumber;
378
+ currency: z.ZodString;
379
+ items: z.ZodArray<z.ZodObject<{
380
+ productId: z.ZodString;
381
+ name: z.ZodString;
382
+ priceCents: z.ZodNumber;
383
+ quantity: z.ZodNumber;
384
+ }, z.core.$strip>>;
385
+ fulfillment: z.ZodNullable<z.ZodObject<{
386
+ carrier: z.ZodNullable<z.ZodString>;
387
+ trackingNumber: z.ZodNullable<z.ZodString>;
388
+ trackingUrl: z.ZodNullable<z.ZodString>;
389
+ shippedAt: z.ZodString;
390
+ }, z.core.$strip>>;
391
+ createdAt: z.ZodString;
392
+ refunds: z.ZodArray<z.ZodObject<{
393
+ id: z.ZodString;
394
+ amountCents: z.ZodNumber;
395
+ reason: z.ZodNullable<z.ZodString>;
396
+ restocked: z.ZodBoolean;
397
+ source: z.ZodEnum<{
398
+ admin: "admin";
399
+ gateway: "gateway";
400
+ }>;
401
+ status: z.ZodEnum<{
402
+ pending: "pending";
403
+ succeeded: "succeeded";
404
+ }>;
405
+ createdAt: z.ZodString;
406
+ }, z.core.$strip>>;
407
+ refundedCents: z.ZodNumber;
408
+ checkoutSessionId: z.ZodNullable<z.ZodString>;
409
+ updatedAt: z.ZodString;
410
+ }, z.core.$strip>;
411
+ declare const shipOrderInputSchema: z.ZodObject<{
412
+ carrier: z.ZodOptional<z.ZodString>;
413
+ trackingNumber: z.ZodOptional<z.ZodString>;
414
+ trackingUrl: z.ZodOptional<z.ZodString>;
415
+ }, z.core.$strip>;
416
+ declare const refundOrderInputSchema: z.ZodObject<{
417
+ amountCents: z.ZodOptional<z.ZodNumber>;
418
+ reason: z.ZodOptional<z.ZodString>;
419
+ restock: z.ZodDefault<z.ZodBoolean>;
420
+ }, z.core.$strip>;
421
+ type AdminOrderListQuery = z.infer<typeof adminOrderListQuerySchema>;
422
+ type AdminOrderListItem = z.infer<typeof adminOrderListItemSchema>;
423
+ type AdminOrderPage = z.infer<typeof adminOrderPageSchema>;
424
+ type AdminOrderDetail = z.infer<typeof adminOrderDetailSchema>;
425
+ type ShipOrderInput = z.infer<typeof shipOrderInputSchema>;
426
+ type RefundOrderInput = z.infer<typeof refundOrderInputSchema>;
427
+
428
+ export { adminOrderDetailSchema, adminOrderListItemSchema, adminOrderListQuerySchema, adminOrderPageSchema, adminProductImageSchema, adminProductInputSchema, adminProductPatchSchema, adminProductSchema, availabilitySchema, cartLineSchema, categorySchema, checkoutConflictSchema, checkoutRequestSchema, checkoutResponseSchema, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefundSchema, orderStatusSchema, orderSummarySchema, productImageSchema, productListQuerySchema, productSchema, productStatusSchema, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
429
+ export type { AdminOrderDetail, AdminOrderListItem, AdminOrderListQuery, AdminOrderPage, AdminProduct, AdminProductImage, AdminProductInput, AdminProductPatch, CartLine, Category, CheckoutConflict, CheckoutRequest, CheckoutResponse, ImageOrderInput, Money, OrderAddress, OrderDetail, OrderFulfillment, OrderRefund, OrderStatus, OrderSummary, Product, ProductAvailability, ProductImage, ProductListQuery, ProductStatus, RefundOrderInput, ShipOrderInput, ShippingRate, ShippingRateInput };
package/dist/index.js ADDED
@@ -0,0 +1,262 @@
1
+ // src/money.ts
2
+ import { z } from "zod";
3
+ var moneySchema = z.object({
4
+ amountCents: z.number().int(),
5
+ currency: z.string().length(3)
6
+ });
7
+
8
+ // src/product.ts
9
+ import { z as z2 } from "zod";
10
+ var productImageSchema = z2.object({
11
+ url: z2.string().min(1),
12
+ alt: z2.string()
13
+ });
14
+ var availabilitySchema = z2.enum(["available", "sold", "reserved"]);
15
+ var productSchema = z2.object({
16
+ id: z2.string().min(1),
17
+ slug: z2.string().min(1),
18
+ name: z2.string().min(1),
19
+ description: z2.string(),
20
+ materials: z2.string().optional(),
21
+ dimensions: z2.string().optional(),
22
+ priceCents: z2.number().int().nonnegative(),
23
+ currency: z2.string().length(3),
24
+ category: z2.string().min(1),
25
+ images: z2.array(productImageSchema),
26
+ quantity: z2.number().int().nonnegative(),
27
+ availability: availabilitySchema,
28
+ featured: z2.boolean()
29
+ });
30
+ var categorySchema = z2.object({
31
+ slug: z2.string().min(1),
32
+ label: z2.string().min(1),
33
+ count: z2.number().int().nonnegative()
34
+ });
35
+ var productListQuerySchema = z2.object({
36
+ category: z2.string().min(1).optional(),
37
+ featured: z2.boolean().optional()
38
+ });
39
+
40
+ // src/cart.ts
41
+ import { z as z3 } from "zod";
42
+ var cartLineSchema = z3.object({
43
+ productId: z3.string().min(1),
44
+ slug: z3.string().min(1),
45
+ name: z3.string().min(1),
46
+ priceCents: z3.number().int().nonnegative(),
47
+ currency: z3.string().length(3),
48
+ imageUrl: z3.string().optional(),
49
+ quantity: z3.number().int().positive(),
50
+ maxQuantity: z3.number().int().positive()
51
+ });
52
+
53
+ // src/checkout.ts
54
+ import { z as z4 } from "zod";
55
+ var checkoutRequestSchema = z4.object({
56
+ items: z4.array(
57
+ z4.object({
58
+ productId: z4.string().min(1),
59
+ quantity: z4.number().int().positive()
60
+ })
61
+ ).min(1)
62
+ });
63
+ var checkoutResponseSchema = z4.object({
64
+ url: z4.string().min(1)
65
+ });
66
+ var checkoutConflictSchema = z4.object({
67
+ unavailableProductIds: z4.array(z4.string().min(1)).min(1)
68
+ });
69
+
70
+ // src/order.ts
71
+ import { z as z5 } from "zod";
72
+ var orderStatusSchema = z5.enum([
73
+ "pending",
74
+ "paid",
75
+ "shipped",
76
+ "cancelled",
77
+ "expired",
78
+ "needs_attention",
79
+ "refunded"
80
+ ]);
81
+ var orderItemSchema = z5.object({
82
+ productId: z5.string().min(1),
83
+ name: z5.string().min(1),
84
+ priceCents: z5.number().int().nonnegative(),
85
+ quantity: z5.number().int().positive()
86
+ });
87
+ var orderFulfillmentSchema = z5.object({
88
+ carrier: z5.string().nullable(),
89
+ trackingNumber: z5.string().nullable(),
90
+ trackingUrl: z5.string().url().nullable(),
91
+ shippedAt: z5.string().min(1)
92
+ });
93
+ var orderRefundSchema = z5.object({
94
+ id: z5.string().min(1),
95
+ amountCents: z5.number().int().positive(),
96
+ reason: z5.string().nullable(),
97
+ restocked: z5.boolean(),
98
+ source: z5.enum(["admin", "gateway"]),
99
+ status: z5.enum(["pending", "succeeded"]),
100
+ createdAt: z5.string().min(1)
101
+ });
102
+ var orderTotalsShape = {
103
+ id: z5.string().min(1),
104
+ status: orderStatusSchema,
105
+ subtotalCents: z5.number().int().nonnegative(),
106
+ shippingCents: z5.number().int().nonnegative(),
107
+ shippingLabel: z5.string().nullable(),
108
+ totalCents: z5.number().int().nonnegative(),
109
+ currency: z5.string().length(3),
110
+ items: z5.array(orderItemSchema),
111
+ fulfillment: orderFulfillmentSchema.nullable(),
112
+ createdAt: z5.string().min(1)
113
+ };
114
+ var orderSummarySchema = z5.object(orderTotalsShape);
115
+ var orderAddressSchema = z5.object({
116
+ name: z5.string().optional(),
117
+ line1: z5.string().optional(),
118
+ line2: z5.string().optional(),
119
+ city: z5.string().optional(),
120
+ state: z5.string().optional(),
121
+ postalCode: z5.string().optional(),
122
+ country: z5.string().optional()
123
+ });
124
+ var orderDetailSchema = z5.object({
125
+ ...orderTotalsShape,
126
+ email: z5.string().nullable(),
127
+ shippingAddress: orderAddressSchema.nullable()
128
+ });
129
+
130
+ // src/shipping.ts
131
+ import { z as z6 } from "zod";
132
+ var shippingRateSchema = z6.object({
133
+ label: z6.string().min(1),
134
+ amountCents: z6.number().int().nonnegative(),
135
+ currency: z6.string().length(3),
136
+ minDays: z6.number().int().nonnegative().nullable().optional(),
137
+ maxDays: z6.number().int().nonnegative().nullable().optional(),
138
+ active: z6.boolean().default(true),
139
+ sort: z6.number().int().default(0)
140
+ });
141
+ var shippingRatesInputSchema = z6.array(shippingRateSchema).refine((rates) => new Set(rates.map((r) => r.label)).size === rates.length, {
142
+ message: "Shipping rate labels must be unique"
143
+ });
144
+
145
+ // src/admin.ts
146
+ import { z as z7 } from "zod";
147
+ var productStatusSchema = z7.enum(["draft", "active", "archived"]);
148
+ var productFields = z7.object({
149
+ name: z7.string().trim().min(1),
150
+ description: z7.string(),
151
+ materials: z7.string().nullable().optional(),
152
+ dimensions: z7.string().nullable().optional(),
153
+ priceCents: z7.number().int().nonnegative(),
154
+ currency: z7.string().length(3).optional(),
155
+ category: z7.string().trim().min(1),
156
+ quantity: z7.number().int().nonnegative(),
157
+ status: productStatusSchema,
158
+ featured: z7.boolean()
159
+ });
160
+ var adminProductInputSchema = productFields.extend({
161
+ description: z7.string().default(""),
162
+ quantity: z7.number().int().nonnegative().default(1),
163
+ status: productStatusSchema.default("draft"),
164
+ featured: z7.boolean().default(false)
165
+ });
166
+ var adminProductPatchSchema = productFields.partial().extend({ sold: z7.boolean().optional() });
167
+ var adminProductImageSchema = z7.object({
168
+ id: z7.string().min(1),
169
+ url: z7.string().min(1),
170
+ alt: z7.string(),
171
+ position: z7.number().int().nonnegative()
172
+ });
173
+ var adminProductSchema = z7.object({
174
+ id: z7.string().min(1),
175
+ slug: z7.string().min(1),
176
+ name: z7.string().min(1),
177
+ description: z7.string(),
178
+ materials: z7.string().nullable(),
179
+ dimensions: z7.string().nullable(),
180
+ priceCents: z7.number().int().nonnegative(),
181
+ currency: z7.string().length(3),
182
+ category: z7.string().min(1),
183
+ quantity: z7.number().int().nonnegative(),
184
+ status: productStatusSchema,
185
+ featured: z7.boolean(),
186
+ images: z7.array(adminProductImageSchema)
187
+ });
188
+ var imageOrderInputSchema = z7.object({
189
+ imageIds: z7.array(z7.string().min(1))
190
+ });
191
+
192
+ // src/admin-orders.ts
193
+ import { z as z8 } from "zod";
194
+ var adminOrderListQuerySchema = z8.object({
195
+ status: orderStatusSchema.optional(),
196
+ q: z8.string().trim().min(1).optional(),
197
+ hasPendingRefund: z8.enum(["true", "false"]).transform((v) => v === "true").optional(),
198
+ cursor: z8.string().min(1).optional(),
199
+ limit: z8.coerce.number().int().min(1).max(100).default(25)
200
+ });
201
+ var adminOrderListItemSchema = z8.object({
202
+ id: z8.string().min(1),
203
+ status: orderStatusSchema,
204
+ email: z8.string().nullable(),
205
+ totalCents: z8.number().int().nonnegative(),
206
+ currency: z8.string().length(3),
207
+ itemCount: z8.number().int().nonnegative(),
208
+ createdAt: z8.string().min(1)
209
+ });
210
+ var adminOrderPageSchema = z8.object({
211
+ items: z8.array(adminOrderListItemSchema),
212
+ nextCursor: z8.string().nullable()
213
+ });
214
+ var adminOrderDetailSchema = orderDetailSchema.extend({
215
+ refunds: z8.array(orderRefundSchema),
216
+ refundedCents: z8.number().int().nonnegative(),
217
+ checkoutSessionId: z8.string().nullable(),
218
+ updatedAt: z8.string().min(1)
219
+ });
220
+ var shipOrderInputSchema = z8.object({
221
+ carrier: z8.string().optional(),
222
+ trackingNumber: z8.string().optional(),
223
+ trackingUrl: z8.string().url().optional()
224
+ });
225
+ var refundOrderInputSchema = z8.object({
226
+ amountCents: z8.number().int().positive().optional(),
227
+ reason: z8.string().max(500).optional(),
228
+ restock: z8.boolean().default(false)
229
+ });
230
+ export {
231
+ adminOrderDetailSchema,
232
+ adminOrderListItemSchema,
233
+ adminOrderListQuerySchema,
234
+ adminOrderPageSchema,
235
+ adminProductImageSchema,
236
+ adminProductInputSchema,
237
+ adminProductPatchSchema,
238
+ adminProductSchema,
239
+ availabilitySchema,
240
+ cartLineSchema,
241
+ categorySchema,
242
+ checkoutConflictSchema,
243
+ checkoutRequestSchema,
244
+ checkoutResponseSchema,
245
+ imageOrderInputSchema,
246
+ moneySchema,
247
+ orderAddressSchema,
248
+ orderDetailSchema,
249
+ orderFulfillmentSchema,
250
+ orderRefundSchema,
251
+ orderStatusSchema,
252
+ orderSummarySchema,
253
+ productImageSchema,
254
+ productListQuerySchema,
255
+ productSchema,
256
+ productStatusSchema,
257
+ refundOrderInputSchema,
258
+ shipOrderInputSchema,
259
+ shippingRateSchema,
260
+ shippingRatesInputSchema
261
+ };
262
+ //# sourceMappingURL=index.js.map