@develemit/commerce-contracts 0.6.0 → 0.8.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.
- package/CHANGELOG.md +76 -0
- package/README.md +34 -2
- package/dist/index.cjs +56 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -11
- package/dist/index.d.ts +35 -11
- package/dist/index.js +51 -3
- package/dist/index.js.map +1 -1
- package/package.json +10 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
## 0.8.0 (2026-11-12)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- `adminProductSchema` gains `everPublished` (boolean, defaults to `false`): true once a product has been active, which makes it archive-only.
|
|
6
|
+
- `formatOrderRef(id)` returns the short, quotable order reference (`#` + the first 8 hex characters, uppercased); `orderRefSearchTerm(input)` strips a leading `#` from a search term. The full id stays in URLs and the database.
|
|
7
|
+
|
|
8
|
+
## 0.7.0 (2026-11-04)
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
- `adminProductInputSchema` accepts a draft with no `name`, `priceCents` or `category`; `status: 'active'` requires all three (one issue per field). New `adminProductCountsSchema`, `productIncompleteFieldSchema` and `publishRequiredFields`.
|
|
13
|
+
- `adminProductListQuerySchema` accepts `excludeArchived: 'true'` and `incomplete: 'true'`.
|
|
14
|
+
- `adminProductSchema` now types `name` as possibly `''`, and `priceCents` and `category` as nullable. Consumers reading these fields from admin responses must handle `null`.
|
|
15
|
+
|
|
16
|
+
### Docs
|
|
17
|
+
|
|
18
|
+
- The package now ships `CHANGELOG.md` and declares `description`, `repository` and `homepage`. The README lists every schema by area.
|
|
19
|
+
|
|
20
|
+
## 0.6.0 (2026-11-03)
|
|
21
|
+
|
|
22
|
+
No changes; released in lockstep with the other packages.
|
|
23
|
+
|
|
24
|
+
## 0.5.0 (2026-11-02)
|
|
25
|
+
|
|
26
|
+
### Fixes
|
|
27
|
+
|
|
28
|
+
- Discount `currency` on input and patch schemas is trimmed and uppercased, so `usd` and `USD` are the same value.
|
|
29
|
+
|
|
30
|
+
## 0.4.0 (2026-10-30)
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
- `productImagePatchSchema` (`{ alt }`, trimmed, max 500) and `ProductImagePatch` for editing an image's alt text.
|
|
35
|
+
- Discount schemas in `discount.ts`: `discountSchema`, `discountInputSchema`, `discountPatchSchema`, `discountCodeSchema` (trimmed, uppercased, `[A-Z0-9_-]` up to 40), `discountPreviewRequestSchema`, `discountPreviewSchema` and `discountRejectionSchema`, with their types.
|
|
36
|
+
- `checkoutRequestSchema` accepts an optional `discountCode`.
|
|
37
|
+
- `orderSummarySchema` and `orderDetailSchema` gain `discountCents` (default 0) and `discountCode` (default `null`). Their output types now include both fields.
|
|
38
|
+
|
|
39
|
+
## 0.3.0 (2026-10-30)
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
- `adminProductListQuerySchema` accepts `stock: 'in' | 'sold'` (sold = stored quantity 0).
|
|
44
|
+
|
|
45
|
+
### Breaking changes
|
|
46
|
+
|
|
47
|
+
- `GET /admin/products` is paged: new `adminProductListQuerySchema` (`status`, `q`, `cursor`, `limit` 1-100 default 50) and `adminProductPageSchema` (`{ items, nextCursor }`), with `AdminProductListQuery` and `AdminProductPage` types.
|
|
48
|
+
- `GET /catalog/products` now returns `{ items, nextCursor }` with card-shaped items. New schemas: `productCardSchema` (no description, materials or dimensions; at most one image) and `productCardPageSchema`. `productListQuerySchema` gains `limit` (1-100, default 48) and `cursor`; `ProductListQuery` is now the schema's input type.
|
|
49
|
+
|
|
50
|
+
### Fixes
|
|
51
|
+
|
|
52
|
+
- Published tarballs no longer include declaration maps (`*.d.ts.map`), which pointed at `src/` files that were not shipped. JS sourcemaps now embed `sourcesContent`.
|
|
53
|
+
|
|
54
|
+
## 0.2.0 (2026-10-29)
|
|
55
|
+
|
|
56
|
+
First published release. 0.1.0 was tagged but never published to npm, so installing 0.2.0 gets everything in both entries below.
|
|
57
|
+
|
|
58
|
+
### Features
|
|
59
|
+
|
|
60
|
+
- Order status `refunded`, added to `orderStatusSchema`. Code that switches exhaustively over `OrderStatus` needs a new case.
|
|
61
|
+
- `fulfillment` on `orderSummarySchema` and `OrderDetail`: carrier, tracking number, tracking URL and shipped time, or `null` before shipping.
|
|
62
|
+
- Admin order schemas: `adminOrderListQuerySchema`, `adminOrderPageSchema`, `adminOrderDetailSchema` (with refunds and `refundedCents`), `shipOrderInputSchema` and `refundOrderInputSchema`.
|
|
63
|
+
- `orderRefundSchema` for a refund, with `status: 'pending' | 'succeeded'`. `adminOrderListQuerySchema` gains `hasPendingRefund`.
|
|
64
|
+
|
|
65
|
+
## 0.1.0 (2026-10-29)
|
|
66
|
+
|
|
67
|
+
First release. Zod schemas and inferred types shared by `@develemit/storefront` and `@develemit/commerce-server`. Builds to ESM and CJS.
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
- Money: integer cents plus an ISO-4217 currency.
|
|
72
|
+
- Catalog: product, product image, availability and category schemas.
|
|
73
|
+
- Cart and checkout: `CartLine`, `CheckoutRequest` and `CheckoutResponse`.
|
|
74
|
+
- Orders: `orderSummarySchema` and `OrderDetail`, both carrying the chosen shipping method and address. The order status includes `needs_attention`, used when a payment lands on an order that can no longer be fulfilled (late or async completions).
|
|
75
|
+
- Shipping: shipping rate and option schemas.
|
|
76
|
+
- Admin: product input and patch schemas (`draft` / `active` / `archived` status), admin product and image schemas, and the image-order input.
|
package/README.md
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
# @develemit/commerce-contracts
|
|
2
2
|
|
|
3
|
-
Zod schemas and inferred types shared by `@develemit/storefront
|
|
4
|
-
`@develemit/commerce-server`. It is the only
|
|
3
|
+
Zod schemas and inferred types shared by `@develemit/storefront`,
|
|
4
|
+
`@develemit/commerce-server` and `@develemit/commerce-admin`. It is the only
|
|
5
|
+
thing client and server agree on. What changed in each version is in
|
|
6
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add @develemit/commerce-contracts
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Most schemas `fooSchema` have a matching type `Foo` (`z.infer`); use
|
|
13
|
+
`z.infer<typeof fooSchema>` for the few that don't. Money is always
|
|
14
|
+
integer cents plus an ISO-4217 `currency` (`moneySchema`).
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {
|
|
18
|
+
orderSummarySchema,
|
|
19
|
+
type OrderSummary,
|
|
20
|
+
} from '@develemit/commerce-contracts';
|
|
21
|
+
|
|
22
|
+
const order: OrderSummary = orderSummarySchema.parse(await res.json());
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Schemas
|
|
26
|
+
|
|
27
|
+
| Area | Schemas |
|
|
28
|
+
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| Catalog | `productSchema`, `productCardSchema`, `productCardPageSchema`, `productImageSchema`, `availabilitySchema`, `categorySchema`, `productListQuerySchema` |
|
|
30
|
+
| Cart | `cartLineSchema` |
|
|
31
|
+
| Checkout | `checkoutRequestSchema`, `checkoutResponseSchema`, `checkoutConflictSchema`, `discountPreviewRequestSchema`, `discountPreviewSchema`, `discountRejectionSchema`, `discountRejectionReasonSchema` |
|
|
32
|
+
| Orders | `orderSummarySchema` (public, by session; never includes the shipping address), `orderDetailSchema` (what order hooks receive), `orderStatusSchema`, `orderAddressSchema`, `orderFulfillmentSchema`, `orderRefundSchema` |
|
|
33
|
+
| Shipping | `shippingRateSchema`, `shippingRatesInputSchema` |
|
|
34
|
+
| Admin | Products: `adminProductSchema`, `adminProductInputSchema`, `adminProductPatchSchema`, `adminProductImageSchema`, `productImagePatchSchema`, `imageOrderInputSchema`, `productStatusSchema`, `adminProductListQuerySchema`, `adminProductPageSchema`, `adminProductCountsSchema`, `productIncompleteFieldSchema` |
|
|
35
|
+
| | Orders: `adminOrderDetailSchema`, `adminOrderListItemSchema`, `adminOrderListQuerySchema`, `adminOrderPageSchema`, `shipOrderInputSchema`, `refundOrderInputSchema` |
|
|
36
|
+
| | Discounts: `discountSchema`, `discountInputSchema`, `discountPatchSchema`, `discountTypeSchema`, `discountCodeSchema`, `discountStatusSchema`, `adminDiscountListQuerySchema`, `adminDiscountPageSchema` |
|
|
5
37
|
|
|
6
38
|
## Versioning rule
|
|
7
39
|
|
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
adminOrderListItemSchema: () => adminOrderListItemSchema,
|
|
27
27
|
adminOrderListQuerySchema: () => adminOrderListQuerySchema,
|
|
28
28
|
adminOrderPageSchema: () => adminOrderPageSchema,
|
|
29
|
+
adminProductCountsSchema: () => adminProductCountsSchema,
|
|
29
30
|
adminProductImageSchema: () => adminProductImageSchema,
|
|
30
31
|
adminProductInputSchema: () => adminProductInputSchema,
|
|
31
32
|
adminProductListQuerySchema: () => adminProductListQuerySchema,
|
|
@@ -48,11 +49,13 @@ __export(index_exports, {
|
|
|
48
49
|
discountSchema: () => discountSchema,
|
|
49
50
|
discountStatusSchema: () => discountStatusSchema,
|
|
50
51
|
discountTypeSchema: () => discountTypeSchema,
|
|
52
|
+
formatOrderRef: () => formatOrderRef,
|
|
51
53
|
imageOrderInputSchema: () => imageOrderInputSchema,
|
|
52
54
|
moneySchema: () => moneySchema,
|
|
53
55
|
orderAddressSchema: () => orderAddressSchema,
|
|
54
56
|
orderDetailSchema: () => orderDetailSchema,
|
|
55
57
|
orderFulfillmentSchema: () => orderFulfillmentSchema,
|
|
58
|
+
orderRefSearchTerm: () => orderRefSearchTerm,
|
|
56
59
|
orderRefundSchema: () => orderRefundSchema,
|
|
57
60
|
orderStatusSchema: () => orderStatusSchema,
|
|
58
61
|
orderSummarySchema: () => orderSummarySchema,
|
|
@@ -60,9 +63,11 @@ __export(index_exports, {
|
|
|
60
63
|
productCardSchema: () => productCardSchema,
|
|
61
64
|
productImagePatchSchema: () => productImagePatchSchema,
|
|
62
65
|
productImageSchema: () => productImageSchema,
|
|
66
|
+
productIncompleteFieldSchema: () => productIncompleteFieldSchema,
|
|
63
67
|
productListQuerySchema: () => productListQuerySchema,
|
|
64
68
|
productSchema: () => productSchema,
|
|
65
69
|
productStatusSchema: () => productStatusSchema,
|
|
70
|
+
publishRequiredFields: () => publishRequiredFields,
|
|
66
71
|
refundOrderInputSchema: () => refundOrderInputSchema,
|
|
67
72
|
shipOrderInputSchema: () => shipOrderInputSchema,
|
|
68
73
|
shippingRateSchema: () => shippingRateSchema,
|
|
@@ -351,11 +356,31 @@ var productFields = import_zod8.z.object({
|
|
|
351
356
|
status: productStatusSchema,
|
|
352
357
|
featured: import_zod8.z.boolean()
|
|
353
358
|
});
|
|
359
|
+
var publishRequiredFields = [
|
|
360
|
+
"name",
|
|
361
|
+
"priceCents",
|
|
362
|
+
"category"
|
|
363
|
+
];
|
|
354
364
|
var adminProductInputSchema = productFields.extend({
|
|
365
|
+
name: import_zod8.z.string().trim().default(""),
|
|
355
366
|
description: import_zod8.z.string().default(""),
|
|
367
|
+
priceCents: productFields.shape.priceCents.optional(),
|
|
368
|
+
category: import_zod8.z.string().trim().optional(),
|
|
356
369
|
quantity: import_zod8.z.number().int().nonnegative().default(1),
|
|
357
370
|
status: productStatusSchema.default("draft"),
|
|
358
371
|
featured: import_zod8.z.boolean().default(false)
|
|
372
|
+
}).superRefine((product, ctx) => {
|
|
373
|
+
if (product.status !== "active") return;
|
|
374
|
+
for (const field of publishRequiredFields) {
|
|
375
|
+
const value = product[field];
|
|
376
|
+
if (value === void 0 || value === "") {
|
|
377
|
+
ctx.addIssue({
|
|
378
|
+
code: "custom",
|
|
379
|
+
path: [field],
|
|
380
|
+
message: `${field} is required to publish a product`
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
359
384
|
});
|
|
360
385
|
var adminProductPatchSchema = productFields.partial().extend({ sold: import_zod8.z.boolean().optional() });
|
|
361
386
|
var adminProductImageSchema = import_zod8.z.object({
|
|
@@ -367,16 +392,17 @@ var adminProductImageSchema = import_zod8.z.object({
|
|
|
367
392
|
var adminProductSchema = import_zod8.z.object({
|
|
368
393
|
id: import_zod8.z.string().min(1),
|
|
369
394
|
slug: import_zod8.z.string().min(1),
|
|
370
|
-
name: import_zod8.z.string()
|
|
395
|
+
name: import_zod8.z.string(),
|
|
371
396
|
description: import_zod8.z.string(),
|
|
372
397
|
materials: import_zod8.z.string().nullable(),
|
|
373
398
|
dimensions: import_zod8.z.string().nullable(),
|
|
374
|
-
priceCents: import_zod8.z.number().int().nonnegative(),
|
|
399
|
+
priceCents: import_zod8.z.number().int().nonnegative().nullable(),
|
|
375
400
|
currency: import_zod8.z.string().length(3),
|
|
376
|
-
category: import_zod8.z.string().min(1),
|
|
401
|
+
category: import_zod8.z.string().min(1).nullable(),
|
|
377
402
|
quantity: import_zod8.z.number().int().nonnegative(),
|
|
378
403
|
status: productStatusSchema,
|
|
379
404
|
featured: import_zod8.z.boolean(),
|
|
405
|
+
everPublished: import_zod8.z.boolean().default(false),
|
|
380
406
|
images: import_zod8.z.array(adminProductImageSchema)
|
|
381
407
|
});
|
|
382
408
|
var imageOrderInputSchema = import_zod8.z.object({
|
|
@@ -387,6 +413,8 @@ var productImagePatchSchema = import_zod8.z.object({
|
|
|
387
413
|
});
|
|
388
414
|
var adminProductListQuerySchema = import_zod8.z.object({
|
|
389
415
|
status: productStatusSchema.optional(),
|
|
416
|
+
excludeArchived: import_zod8.z.literal("true").optional(),
|
|
417
|
+
incomplete: import_zod8.z.literal("true").optional(),
|
|
390
418
|
stock: import_zod8.z.enum(["in", "sold"]).optional(),
|
|
391
419
|
q: import_zod8.z.string().trim().min(1).optional(),
|
|
392
420
|
cursor: import_zod8.z.string().min(1).optional(),
|
|
@@ -396,6 +424,18 @@ var adminProductPageSchema = import_zod8.z.object({
|
|
|
396
424
|
items: import_zod8.z.array(adminProductSchema),
|
|
397
425
|
nextCursor: import_zod8.z.string().nullable()
|
|
398
426
|
});
|
|
427
|
+
var adminProductCountsSchema = import_zod8.z.object({
|
|
428
|
+
all: import_zod8.z.number().int().nonnegative(),
|
|
429
|
+
live: import_zod8.z.number().int().nonnegative(),
|
|
430
|
+
draft: import_zod8.z.number().int().nonnegative(),
|
|
431
|
+
sold: import_zod8.z.number().int().nonnegative(),
|
|
432
|
+
archived: import_zod8.z.number().int().nonnegative(),
|
|
433
|
+
incompleteDrafts: import_zod8.z.number().int().nonnegative()
|
|
434
|
+
});
|
|
435
|
+
var productIncompleteFieldSchema = import_zod8.z.enum([
|
|
436
|
+
...publishRequiredFields,
|
|
437
|
+
"images"
|
|
438
|
+
]);
|
|
399
439
|
|
|
400
440
|
// src/admin-orders.ts
|
|
401
441
|
var import_zod9 = require("zod");
|
|
@@ -435,6 +475,14 @@ var refundOrderInputSchema = import_zod9.z.object({
|
|
|
435
475
|
reason: import_zod9.z.string().max(500).optional(),
|
|
436
476
|
restock: import_zod9.z.boolean().default(false)
|
|
437
477
|
});
|
|
478
|
+
|
|
479
|
+
// src/order-ref.ts
|
|
480
|
+
function formatOrderRef(id) {
|
|
481
|
+
return `#${id.replace(/-/g, "").slice(0, 8).toUpperCase()}`;
|
|
482
|
+
}
|
|
483
|
+
function orderRefSearchTerm(input) {
|
|
484
|
+
return input.trim().replace(/^#/, "");
|
|
485
|
+
}
|
|
438
486
|
// Annotate the CommonJS export names for ESM import in node:
|
|
439
487
|
0 && (module.exports = {
|
|
440
488
|
adminDiscountListQuerySchema,
|
|
@@ -443,6 +491,7 @@ var refundOrderInputSchema = import_zod9.z.object({
|
|
|
443
491
|
adminOrderListItemSchema,
|
|
444
492
|
adminOrderListQuerySchema,
|
|
445
493
|
adminOrderPageSchema,
|
|
494
|
+
adminProductCountsSchema,
|
|
446
495
|
adminProductImageSchema,
|
|
447
496
|
adminProductInputSchema,
|
|
448
497
|
adminProductListQuerySchema,
|
|
@@ -465,11 +514,13 @@ var refundOrderInputSchema = import_zod9.z.object({
|
|
|
465
514
|
discountSchema,
|
|
466
515
|
discountStatusSchema,
|
|
467
516
|
discountTypeSchema,
|
|
517
|
+
formatOrderRef,
|
|
468
518
|
imageOrderInputSchema,
|
|
469
519
|
moneySchema,
|
|
470
520
|
orderAddressSchema,
|
|
471
521
|
orderDetailSchema,
|
|
472
522
|
orderFulfillmentSchema,
|
|
523
|
+
orderRefSearchTerm,
|
|
473
524
|
orderRefundSchema,
|
|
474
525
|
orderStatusSchema,
|
|
475
526
|
orderSummarySchema,
|
|
@@ -477,9 +528,11 @@ var refundOrderInputSchema = import_zod9.z.object({
|
|
|
477
528
|
productCardSchema,
|
|
478
529
|
productImagePatchSchema,
|
|
479
530
|
productImageSchema,
|
|
531
|
+
productIncompleteFieldSchema,
|
|
480
532
|
productListQuerySchema,
|
|
481
533
|
productSchema,
|
|
482
534
|
productStatusSchema,
|
|
535
|
+
publishRequiredFields,
|
|
483
536
|
refundOrderInputSchema,
|
|
484
537
|
shipOrderInputSchema,
|
|
485
538
|
shippingRateSchema,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/money.ts","../src/product.ts","../src/cart.ts","../src/checkout.ts","../src/discount.ts","../src/order.ts","../src/shipping.ts","../src/admin.ts","../src/admin-orders.ts"],"sourcesContent":["export * from './money';\nexport * from './product';\nexport * from './cart';\nexport * from './checkout';\nexport * from './order';\nexport * from './shipping';\nexport * from './admin';\nexport * from './admin-orders';\nexport * from './discount';\n","import { z } from 'zod';\n\nexport const moneySchema = z.object({\n amountCents: z.number().int(),\n currency: z.string().length(3),\n});\n\nexport type Money = z.infer<typeof moneySchema>;\n","import { z } from 'zod';\n\nexport const productImageSchema = z.object({\n url: z.string().min(1),\n alt: z.string(),\n});\n\nexport const availabilitySchema = z.enum(['available', 'sold', 'reserved']);\n\nexport const productSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n description: z.string(),\n materials: z.string().optional(),\n dimensions: z.string().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n category: z.string().min(1),\n images: z.array(productImageSchema),\n quantity: z.number().int().nonnegative(),\n availability: availabilitySchema,\n featured: z.boolean(),\n});\n\nexport const productCardSchema = productSchema\n .pick({\n id: true,\n slug: true,\n name: true,\n priceCents: true,\n currency: true,\n category: true,\n quantity: true,\n availability: true,\n featured: true,\n })\n .extend({ images: z.array(productImageSchema).max(1) });\n\nexport const categorySchema = z.object({\n slug: z.string().min(1),\n label: z.string().min(1),\n count: z.number().int().nonnegative(),\n});\n\nexport const productListQuerySchema = z.object({\n category: z.string().min(1).optional(),\n featured: z.boolean().optional(),\n limit: z.coerce.number().int().min(1).max(100).default(48),\n cursor: z.string().min(1).optional(),\n});\n\nexport const productCardPageSchema = z.object({\n items: z.array(productCardSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport type ProductImage = z.infer<typeof productImageSchema>;\nexport type ProductAvailability = z.infer<typeof availabilitySchema>;\nexport type Product = z.infer<typeof productSchema>;\nexport type ProductCard = z.infer<typeof productCardSchema>;\nexport type ProductCardPage = z.infer<typeof productCardPageSchema>;\nexport type Category = z.infer<typeof categorySchema>;\nexport type ProductListQuery = z.input<typeof productListQuerySchema>;\n","import { z } from 'zod';\n\nexport const cartLineSchema = z.object({\n productId: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n imageUrl: z.string().optional(),\n quantity: z.number().int().positive(),\n maxQuantity: z.number().int().positive(),\n});\n\nexport type CartLine = z.infer<typeof cartLineSchema>;\n","import { z } from 'zod';\nimport { discountCodeSchema } from './discount';\n\nexport const checkoutRequestSchema = z.object({\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n discountCode: discountCodeSchema.optional(),\n});\n\nexport const checkoutResponseSchema = z.object({\n url: z.string().min(1),\n});\n\nexport const checkoutConflictSchema = z.object({\n unavailableProductIds: z.array(z.string().min(1)).min(1),\n});\n\nexport type CheckoutRequest = z.infer<typeof checkoutRequestSchema>;\nexport type CheckoutResponse = z.infer<typeof checkoutResponseSchema>;\nexport type CheckoutConflict = z.infer<typeof checkoutConflictSchema>;\n","import { z } from 'zod';\n\nexport const discountTypeSchema = z.enum(['percent', 'fixed']);\n\nexport const discountCodeSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(\n z\n .string()\n .min(1)\n .max(40)\n .regex(/^[A-Z0-9_-]+$/),\n );\n\nconst currencyInputSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(z.string().length(3));\n\nconst limitFields = {\n minSubtotalCents: z.number().int().positive().nullable().optional(),\n startsAt: z.string().min(1).nullable().optional(),\n endsAt: z.string().min(1).nullable().optional(),\n maxRedemptions: z.number().int().positive().nullable().optional(),\n active: z.boolean(),\n};\n\nconst discountValueFields = {\n type: discountTypeSchema,\n percentOff: z.number().int().min(1).max(100).nullable().optional(),\n amountOffCents: z.number().int().positive().nullable().optional(),\n currency: currencyInputSchema.nullable().optional(),\n};\n\ntype ValueFields = {\n type?: z.infer<typeof discountTypeSchema>;\n percentOff?: number | null;\n amountOffCents?: number | null;\n currency?: string | null;\n};\n\nconst hasValue = (value: unknown) => value !== undefined && value !== null;\n\nfunction valueFieldsAgree(input: ValueFields): boolean {\n const { type, percentOff, amountOffCents, currency } = input;\n if (type === 'percent') {\n return (\n hasValue(percentOff) && !hasValue(amountOffCents) && !hasValue(currency)\n );\n }\n if (type === 'fixed') {\n return (\n !hasValue(percentOff) && hasValue(amountOffCents) && hasValue(currency)\n );\n }\n return !(hasValue(percentOff) && hasValue(amountOffCents));\n}\n\nconst valueFieldsMessage = {\n message:\n 'percent needs percentOff only; fixed needs amountOffCents and currency only',\n path: ['type'],\n};\n\nexport const discountSchema = z.object({\n id: z.string().min(1),\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n redeemedCount: z.number().int().nonnegative(),\n reservedCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const discountInputSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n active: limitFields.active.default(true),\n })\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountPatchSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n })\n .partial()\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountStatusSchema = z.enum([\n 'active',\n 'inactive',\n 'scheduled',\n 'expired',\n]);\n\nexport const adminDiscountListQuerySchema = z.object({\n status: discountStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminDiscountPageSchema = z.object({\n items: z.array(discountSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const discountPreviewRequestSchema = z.object({\n code: discountCodeSchema,\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n});\n\nexport const discountPreviewSchema = z.object({\n code: z.string().min(1),\n discountCents: z.number().int().nonnegative(),\n subtotalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n});\n\nexport const discountRejectionReasonSchema = z.enum([\n 'not_found',\n 'inactive',\n 'not_started',\n 'expired',\n 'min_subtotal',\n 'exhausted',\n 'currency',\n]);\n\nexport const discountRejectionSchema = z.object({\n error: z.literal('DISCOUNT_INVALID'),\n reason: discountRejectionReasonSchema,\n});\n\nexport type DiscountType = z.infer<typeof discountTypeSchema>;\nexport type Discount = z.infer<typeof discountSchema>;\nexport type DiscountStatus = z.infer<typeof discountStatusSchema>;\nexport type AdminDiscountListQuery = z.infer<\n typeof adminDiscountListQuerySchema\n>;\nexport type AdminDiscountPage = z.infer<typeof adminDiscountPageSchema>;\nexport type DiscountInput = z.input<typeof discountInputSchema>;\nexport type DiscountPatch = z.input<typeof discountPatchSchema>;\nexport type DiscountPreviewRequest = z.input<\n typeof discountPreviewRequestSchema\n>;\nexport type DiscountPreview = z.infer<typeof discountPreviewSchema>;\nexport type DiscountRejectionReason = z.infer<\n typeof discountRejectionReasonSchema\n>;\nexport type DiscountRejection = z.infer<typeof discountRejectionSchema>;\n","import { z } from 'zod';\n\nexport const orderStatusSchema = z.enum([\n 'pending',\n 'paid',\n 'shipped',\n 'cancelled',\n 'expired',\n 'needs_attention',\n 'refunded',\n]);\n\nconst orderItemSchema = z.object({\n productId: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n quantity: z.number().int().positive(),\n});\n\nexport const orderFulfillmentSchema = z.object({\n carrier: z.string().nullable(),\n trackingNumber: z.string().nullable(),\n trackingUrl: z.string().url().nullable(),\n shippedAt: z.string().min(1),\n});\n\nexport const orderRefundSchema = z.object({\n id: z.string().min(1),\n amountCents: z.number().int().positive(),\n reason: z.string().nullable(),\n restocked: z.boolean(),\n source: z.enum(['admin', 'gateway']),\n status: z.enum(['pending', 'succeeded']),\n createdAt: z.string().min(1),\n});\n\nconst orderTotalsShape = {\n id: z.string().min(1),\n status: orderStatusSchema,\n subtotalCents: z.number().int().nonnegative(),\n discountCents: z.number().int().nonnegative().default(0),\n discountCode: z.string().nullable().default(null),\n shippingCents: z.number().int().nonnegative(),\n shippingLabel: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n items: z.array(orderItemSchema),\n fulfillment: orderFulfillmentSchema.nullable(),\n createdAt: z.string().min(1),\n};\n\nexport const orderSummarySchema = z.object(orderTotalsShape);\n\nexport const orderAddressSchema = z.object({\n name: z.string().optional(),\n line1: z.string().optional(),\n line2: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n postalCode: z.string().optional(),\n country: z.string().optional(),\n});\n\nexport const orderDetailSchema = z.object({\n ...orderTotalsShape,\n email: z.string().nullable(),\n shippingAddress: orderAddressSchema.nullable(),\n});\n\nexport type OrderStatus = z.infer<typeof orderStatusSchema>;\nexport type OrderFulfillment = z.infer<typeof orderFulfillmentSchema>;\nexport type OrderRefund = z.infer<typeof orderRefundSchema>;\nexport type OrderSummary = z.infer<typeof orderSummarySchema>;\nexport type OrderAddress = z.infer<typeof orderAddressSchema>;\nexport type OrderDetail = z.infer<typeof orderDetailSchema>;\n","import { z } from 'zod';\n\nexport const shippingRateSchema = z.object({\n label: z.string().min(1),\n amountCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n minDays: z.number().int().nonnegative().nullable().optional(),\n maxDays: z.number().int().nonnegative().nullable().optional(),\n active: z.boolean().default(true),\n sort: z.number().int().default(0),\n});\n\nexport const shippingRatesInputSchema = z\n .array(shippingRateSchema)\n .refine((rates) => new Set(rates.map((r) => r.label)).size === rates.length, {\n message: 'Shipping rate labels must be unique',\n });\n\nexport type ShippingRate = z.infer<typeof shippingRateSchema>;\nexport type ShippingRateInput = z.input<typeof shippingRateSchema>;\n","import { z } from 'zod';\n\nexport const productStatusSchema = z.enum(['draft', 'active', 'archived']);\n\nconst productFields = z.object({\n name: z.string().trim().min(1),\n description: z.string(),\n materials: z.string().nullable().optional(),\n dimensions: z.string().nullable().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3).optional(),\n category: z.string().trim().min(1),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n});\n\nexport const adminProductInputSchema = productFields.extend({\n description: z.string().default(''),\n quantity: z.number().int().nonnegative().default(1),\n status: productStatusSchema.default('draft'),\n featured: z.boolean().default(false),\n});\n\nexport const adminProductPatchSchema = productFields\n .partial()\n .extend({ sold: z.boolean().optional() });\n\nexport const adminProductImageSchema = z.object({\n id: z.string().min(1),\n url: z.string().min(1),\n alt: z.string(),\n position: z.number().int().nonnegative(),\n});\n\nexport const adminProductSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n description: z.string(),\n materials: z.string().nullable(),\n dimensions: z.string().nullable(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n category: z.string().min(1),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n images: z.array(adminProductImageSchema),\n});\n\nexport const imageOrderInputSchema = z.object({\n imageIds: z.array(z.string().min(1)),\n});\n\nexport const productImagePatchSchema = z.object({\n alt: z.string().trim().max(500),\n});\n\nexport const adminProductListQuerySchema = z.object({\n status: productStatusSchema.optional(),\n stock: z.enum(['in', 'sold']).optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n});\n\nexport const adminProductPageSchema = z.object({\n items: z.array(adminProductSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport type ProductStatus = z.infer<typeof productStatusSchema>;\nexport type AdminProductInput = z.input<typeof adminProductInputSchema>;\nexport type AdminProductPatch = z.input<typeof adminProductPatchSchema>;\nexport type AdminProductImage = z.infer<typeof adminProductImageSchema>;\nexport type AdminProduct = z.infer<typeof adminProductSchema>;\nexport type ProductImagePatch = z.infer<typeof productImagePatchSchema>;\nexport type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;\nexport type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;\nexport type AdminProductPage = z.infer<typeof adminProductPageSchema>;\n","import { z } from 'zod';\nimport {\n orderDetailSchema,\n orderRefundSchema,\n orderStatusSchema,\n} from './order';\n\nexport const adminOrderListQuerySchema = z.object({\n status: orderStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n hasPendingRefund: z\n .enum(['true', 'false'])\n .transform((v) => v === 'true')\n .optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminOrderListItemSchema = z.object({\n id: z.string().min(1),\n status: orderStatusSchema,\n email: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n itemCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const adminOrderPageSchema = z.object({\n items: z.array(adminOrderListItemSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const adminOrderDetailSchema = orderDetailSchema.extend({\n refunds: z.array(orderRefundSchema),\n refundedCents: z.number().int().nonnegative(),\n checkoutSessionId: z.string().nullable(),\n updatedAt: z.string().min(1),\n});\n\nexport const shipOrderInputSchema = z.object({\n carrier: z.string().optional(),\n trackingNumber: z.string().optional(),\n trackingUrl: z.string().url().optional(),\n});\n\nexport const refundOrderInputSchema = z.object({\n amountCents: z.number().int().positive().optional(),\n reason: z.string().max(500).optional(),\n restock: z.boolean().default(false),\n});\n\nexport type AdminOrderListQuery = z.infer<typeof adminOrderListQuerySchema>;\nexport type AdminOrderListItem = z.infer<typeof adminOrderListItemSchema>;\nexport type AdminOrderPage = z.infer<typeof adminOrderPageSchema>;\nexport type AdminOrderDetail = z.infer<typeof adminOrderDetailSchema>;\nexport type ShipOrderInput = z.infer<typeof shipOrderInputSchema>;\nexport type RefundOrderInput = z.infer<typeof refundOrderInputSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,cAAc,aAAE,OAAO;AAAA,EAClC,aAAa,aAAE,OAAO,EAAE,IAAI;AAAA,EAC5B,UAAU,aAAE,OAAO,EAAE,OAAO,CAAC;AAC/B,CAAC;;;ACLD,IAAAA,cAAkB;AAEX,IAAM,qBAAqB,cAAE,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B,OAAO;AAAA,EAC7D,SAAS,cAAE,MAAM,iBAAiB;AAAA,EAClC,eAAe,cAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EAC5C,mBAAmB,cAAE,OAAO,EAAE,SAAS;AAAA,EACvC,WAAW,cAAE,OAAO,EAAE,IAAI,CAAC;AAC7B,CAAC;AAEM,IAAM,uBAAuB,cAAE,OAAO;AAAA,EAC3C,SAAS,cAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,gBAAgB,cAAE,OAAO,EAAE,SAAS;AAAA,EACpC,aAAa,cAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACzC,CAAC;AAEM,IAAM,yBAAyB,cAAE,OAAO;AAAA,EAC7C,aAAa,cAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,QAAQ,cAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EACrC,SAAS,cAAE,QAAQ,EAAE,QAAQ,KAAK;AACpC,CAAC;","names":["import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/money.ts","../src/product.ts","../src/cart.ts","../src/checkout.ts","../src/discount.ts","../src/order.ts","../src/shipping.ts","../src/admin.ts","../src/admin-orders.ts","../src/order-ref.ts"],"sourcesContent":["export * from './money';\nexport * from './product';\nexport * from './cart';\nexport * from './checkout';\nexport * from './order';\nexport * from './shipping';\nexport * from './admin';\nexport * from './admin-orders';\nexport * from './discount';\nexport * from './order-ref';\n","import { z } from 'zod';\n\nexport const moneySchema = z.object({\n amountCents: z.number().int(),\n currency: z.string().length(3),\n});\n\nexport type Money = z.infer<typeof moneySchema>;\n","import { z } from 'zod';\n\nexport const productImageSchema = z.object({\n url: z.string().min(1),\n alt: z.string(),\n});\n\nexport const availabilitySchema = z.enum(['available', 'sold', 'reserved']);\n\nexport const productSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n description: z.string(),\n materials: z.string().optional(),\n dimensions: z.string().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n category: z.string().min(1),\n images: z.array(productImageSchema),\n quantity: z.number().int().nonnegative(),\n availability: availabilitySchema,\n featured: z.boolean(),\n});\n\nexport const productCardSchema = productSchema\n .pick({\n id: true,\n slug: true,\n name: true,\n priceCents: true,\n currency: true,\n category: true,\n quantity: true,\n availability: true,\n featured: true,\n })\n .extend({ images: z.array(productImageSchema).max(1) });\n\nexport const categorySchema = z.object({\n slug: z.string().min(1),\n label: z.string().min(1),\n count: z.number().int().nonnegative(),\n});\n\nexport const productListQuerySchema = z.object({\n category: z.string().min(1).optional(),\n featured: z.boolean().optional(),\n limit: z.coerce.number().int().min(1).max(100).default(48),\n cursor: z.string().min(1).optional(),\n});\n\nexport const productCardPageSchema = z.object({\n items: z.array(productCardSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport type ProductImage = z.infer<typeof productImageSchema>;\nexport type ProductAvailability = z.infer<typeof availabilitySchema>;\nexport type Product = z.infer<typeof productSchema>;\nexport type ProductCard = z.infer<typeof productCardSchema>;\nexport type ProductCardPage = z.infer<typeof productCardPageSchema>;\nexport type Category = z.infer<typeof categorySchema>;\nexport type ProductListQuery = z.input<typeof productListQuerySchema>;\n","import { z } from 'zod';\n\nexport const cartLineSchema = z.object({\n productId: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n imageUrl: z.string().optional(),\n quantity: z.number().int().positive(),\n maxQuantity: z.number().int().positive(),\n});\n\nexport type CartLine = z.infer<typeof cartLineSchema>;\n","import { z } from 'zod';\nimport { discountCodeSchema } from './discount';\n\nexport const checkoutRequestSchema = z.object({\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n discountCode: discountCodeSchema.optional(),\n});\n\nexport const checkoutResponseSchema = z.object({\n url: z.string().min(1),\n});\n\nexport const checkoutConflictSchema = z.object({\n unavailableProductIds: z.array(z.string().min(1)).min(1),\n});\n\nexport type CheckoutRequest = z.infer<typeof checkoutRequestSchema>;\nexport type CheckoutResponse = z.infer<typeof checkoutResponseSchema>;\nexport type CheckoutConflict = z.infer<typeof checkoutConflictSchema>;\n","import { z } from 'zod';\n\nexport const discountTypeSchema = z.enum(['percent', 'fixed']);\n\nexport const discountCodeSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(\n z\n .string()\n .min(1)\n .max(40)\n .regex(/^[A-Z0-9_-]+$/),\n );\n\nconst currencyInputSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(z.string().length(3));\n\nconst limitFields = {\n minSubtotalCents: z.number().int().positive().nullable().optional(),\n startsAt: z.string().min(1).nullable().optional(),\n endsAt: z.string().min(1).nullable().optional(),\n maxRedemptions: z.number().int().positive().nullable().optional(),\n active: z.boolean(),\n};\n\nconst discountValueFields = {\n type: discountTypeSchema,\n percentOff: z.number().int().min(1).max(100).nullable().optional(),\n amountOffCents: z.number().int().positive().nullable().optional(),\n currency: currencyInputSchema.nullable().optional(),\n};\n\ntype ValueFields = {\n type?: z.infer<typeof discountTypeSchema>;\n percentOff?: number | null;\n amountOffCents?: number | null;\n currency?: string | null;\n};\n\nconst hasValue = (value: unknown) => value !== undefined && value !== null;\n\nfunction valueFieldsAgree(input: ValueFields): boolean {\n const { type, percentOff, amountOffCents, currency } = input;\n if (type === 'percent') {\n return (\n hasValue(percentOff) && !hasValue(amountOffCents) && !hasValue(currency)\n );\n }\n if (type === 'fixed') {\n return (\n !hasValue(percentOff) && hasValue(amountOffCents) && hasValue(currency)\n );\n }\n return !(hasValue(percentOff) && hasValue(amountOffCents));\n}\n\nconst valueFieldsMessage = {\n message:\n 'percent needs percentOff only; fixed needs amountOffCents and currency only',\n path: ['type'],\n};\n\nexport const discountSchema = z.object({\n id: z.string().min(1),\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n redeemedCount: z.number().int().nonnegative(),\n reservedCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const discountInputSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n active: limitFields.active.default(true),\n })\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountPatchSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n })\n .partial()\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountStatusSchema = z.enum([\n 'active',\n 'inactive',\n 'scheduled',\n 'expired',\n]);\n\nexport const adminDiscountListQuerySchema = z.object({\n status: discountStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminDiscountPageSchema = z.object({\n items: z.array(discountSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const discountPreviewRequestSchema = z.object({\n code: discountCodeSchema,\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n});\n\nexport const discountPreviewSchema = z.object({\n code: z.string().min(1),\n discountCents: z.number().int().nonnegative(),\n subtotalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n});\n\nexport const discountRejectionReasonSchema = z.enum([\n 'not_found',\n 'inactive',\n 'not_started',\n 'expired',\n 'min_subtotal',\n 'exhausted',\n 'currency',\n]);\n\nexport const discountRejectionSchema = z.object({\n error: z.literal('DISCOUNT_INVALID'),\n reason: discountRejectionReasonSchema,\n});\n\nexport type DiscountType = z.infer<typeof discountTypeSchema>;\nexport type Discount = z.infer<typeof discountSchema>;\nexport type DiscountStatus = z.infer<typeof discountStatusSchema>;\nexport type AdminDiscountListQuery = z.infer<\n typeof adminDiscountListQuerySchema\n>;\nexport type AdminDiscountPage = z.infer<typeof adminDiscountPageSchema>;\nexport type DiscountInput = z.input<typeof discountInputSchema>;\nexport type DiscountPatch = z.input<typeof discountPatchSchema>;\nexport type DiscountPreviewRequest = z.input<\n typeof discountPreviewRequestSchema\n>;\nexport type DiscountPreview = z.infer<typeof discountPreviewSchema>;\nexport type DiscountRejectionReason = z.infer<\n typeof discountRejectionReasonSchema\n>;\nexport type DiscountRejection = z.infer<typeof discountRejectionSchema>;\n","import { z } from 'zod';\n\nexport const orderStatusSchema = z.enum([\n 'pending',\n 'paid',\n 'shipped',\n 'cancelled',\n 'expired',\n 'needs_attention',\n 'refunded',\n]);\n\nconst orderItemSchema = z.object({\n productId: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n quantity: z.number().int().positive(),\n});\n\nexport const orderFulfillmentSchema = z.object({\n carrier: z.string().nullable(),\n trackingNumber: z.string().nullable(),\n trackingUrl: z.string().url().nullable(),\n shippedAt: z.string().min(1),\n});\n\nexport const orderRefundSchema = z.object({\n id: z.string().min(1),\n amountCents: z.number().int().positive(),\n reason: z.string().nullable(),\n restocked: z.boolean(),\n source: z.enum(['admin', 'gateway']),\n status: z.enum(['pending', 'succeeded']),\n createdAt: z.string().min(1),\n});\n\nconst orderTotalsShape = {\n id: z.string().min(1),\n status: orderStatusSchema,\n subtotalCents: z.number().int().nonnegative(),\n discountCents: z.number().int().nonnegative().default(0),\n discountCode: z.string().nullable().default(null),\n shippingCents: z.number().int().nonnegative(),\n shippingLabel: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n items: z.array(orderItemSchema),\n fulfillment: orderFulfillmentSchema.nullable(),\n createdAt: z.string().min(1),\n};\n\nexport const orderSummarySchema = z.object(orderTotalsShape);\n\nexport const orderAddressSchema = z.object({\n name: z.string().optional(),\n line1: z.string().optional(),\n line2: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n postalCode: z.string().optional(),\n country: z.string().optional(),\n});\n\nexport const orderDetailSchema = z.object({\n ...orderTotalsShape,\n email: z.string().nullable(),\n shippingAddress: orderAddressSchema.nullable(),\n});\n\nexport type OrderStatus = z.infer<typeof orderStatusSchema>;\nexport type OrderFulfillment = z.infer<typeof orderFulfillmentSchema>;\nexport type OrderRefund = z.infer<typeof orderRefundSchema>;\nexport type OrderSummary = z.infer<typeof orderSummarySchema>;\nexport type OrderAddress = z.infer<typeof orderAddressSchema>;\nexport type OrderDetail = z.infer<typeof orderDetailSchema>;\n","import { z } from 'zod';\n\nexport const shippingRateSchema = z.object({\n label: z.string().min(1),\n amountCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n minDays: z.number().int().nonnegative().nullable().optional(),\n maxDays: z.number().int().nonnegative().nullable().optional(),\n active: z.boolean().default(true),\n sort: z.number().int().default(0),\n});\n\nexport const shippingRatesInputSchema = z\n .array(shippingRateSchema)\n .refine((rates) => new Set(rates.map((r) => r.label)).size === rates.length, {\n message: 'Shipping rate labels must be unique',\n });\n\nexport type ShippingRate = z.infer<typeof shippingRateSchema>;\nexport type ShippingRateInput = z.input<typeof shippingRateSchema>;\n","import { z } from 'zod';\n\nexport const productStatusSchema = z.enum(['draft', 'active', 'archived']);\n\nconst productFields = z.object({\n name: z.string().trim().min(1),\n description: z.string(),\n materials: z.string().nullable().optional(),\n dimensions: z.string().nullable().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3).optional(),\n category: z.string().trim().min(1),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n});\n\nexport const publishRequiredFields = [\n 'name',\n 'priceCents',\n 'category',\n] as const;\n\nexport const adminProductInputSchema = productFields\n .extend({\n name: z.string().trim().default(''),\n description: z.string().default(''),\n priceCents: productFields.shape.priceCents.optional(),\n category: z.string().trim().optional(),\n quantity: z.number().int().nonnegative().default(1),\n status: productStatusSchema.default('draft'),\n featured: z.boolean().default(false),\n })\n .superRefine((product, ctx) => {\n if (product.status !== 'active') return;\n for (const field of publishRequiredFields) {\n const value = product[field];\n if (value === undefined || value === '') {\n ctx.addIssue({\n code: 'custom',\n path: [field],\n message: `${field} is required to publish a product`,\n });\n }\n }\n });\n\nexport const adminProductPatchSchema = productFields\n .partial()\n .extend({ sold: z.boolean().optional() });\n\nexport const adminProductImageSchema = z.object({\n id: z.string().min(1),\n url: z.string().min(1),\n alt: z.string(),\n position: z.number().int().nonnegative(),\n});\n\nexport const adminProductSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string(),\n description: z.string(),\n materials: z.string().nullable(),\n dimensions: z.string().nullable(),\n priceCents: z.number().int().nonnegative().nullable(),\n currency: z.string().length(3),\n category: z.string().min(1).nullable(),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n everPublished: z.boolean().default(false),\n images: z.array(adminProductImageSchema),\n});\n\nexport const imageOrderInputSchema = z.object({\n imageIds: z.array(z.string().min(1)),\n});\n\nexport const productImagePatchSchema = z.object({\n alt: z.string().trim().max(500),\n});\n\nexport const adminProductListQuerySchema = z.object({\n status: productStatusSchema.optional(),\n excludeArchived: z.literal('true').optional(),\n incomplete: z.literal('true').optional(),\n stock: z.enum(['in', 'sold']).optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n});\n\nexport const adminProductPageSchema = z.object({\n items: z.array(adminProductSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const adminProductCountsSchema = z.object({\n all: z.number().int().nonnegative(),\n live: z.number().int().nonnegative(),\n draft: z.number().int().nonnegative(),\n sold: z.number().int().nonnegative(),\n archived: z.number().int().nonnegative(),\n incompleteDrafts: z.number().int().nonnegative(),\n});\n\nexport const productIncompleteFieldSchema = z.enum([\n ...publishRequiredFields,\n 'images',\n]);\n\nexport type ProductStatus = z.infer<typeof productStatusSchema>;\nexport type AdminProductInput = z.input<typeof adminProductInputSchema>;\nexport type AdminProductPatch = z.input<typeof adminProductPatchSchema>;\nexport type AdminProductImage = z.infer<typeof adminProductImageSchema>;\nexport type AdminProduct = z.infer<typeof adminProductSchema>;\nexport type ProductImagePatch = z.infer<typeof productImagePatchSchema>;\nexport type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;\nexport type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;\nexport type AdminProductPage = z.infer<typeof adminProductPageSchema>;\nexport type AdminProductCounts = z.infer<typeof adminProductCountsSchema>;\nexport type ProductIncompleteField = z.infer<\n typeof productIncompleteFieldSchema\n>;\n","import { z } from 'zod';\nimport {\n orderDetailSchema,\n orderRefundSchema,\n orderStatusSchema,\n} from './order';\n\nexport const adminOrderListQuerySchema = z.object({\n status: orderStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n hasPendingRefund: z\n .enum(['true', 'false'])\n .transform((v) => v === 'true')\n .optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminOrderListItemSchema = z.object({\n id: z.string().min(1),\n status: orderStatusSchema,\n email: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n itemCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const adminOrderPageSchema = z.object({\n items: z.array(adminOrderListItemSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const adminOrderDetailSchema = orderDetailSchema.extend({\n refunds: z.array(orderRefundSchema),\n refundedCents: z.number().int().nonnegative(),\n checkoutSessionId: z.string().nullable(),\n updatedAt: z.string().min(1),\n});\n\nexport const shipOrderInputSchema = z.object({\n carrier: z.string().optional(),\n trackingNumber: z.string().optional(),\n trackingUrl: z.string().url().optional(),\n});\n\nexport const refundOrderInputSchema = z.object({\n amountCents: z.number().int().positive().optional(),\n reason: z.string().max(500).optional(),\n restock: z.boolean().default(false),\n});\n\nexport type AdminOrderListQuery = z.infer<typeof adminOrderListQuerySchema>;\nexport type AdminOrderListItem = z.infer<typeof adminOrderListItemSchema>;\nexport type AdminOrderPage = z.infer<typeof adminOrderPageSchema>;\nexport type AdminOrderDetail = z.infer<typeof adminOrderDetailSchema>;\nexport type ShipOrderInput = z.infer<typeof shipOrderInputSchema>;\nexport type RefundOrderInput = z.infer<typeof refundOrderInputSchema>;\n","export function formatOrderRef(id: string): string {\n return `#${id.replace(/-/g, '').slice(0, 8).toUpperCase()}`;\n}\n\nexport function orderRefSearchTerm(input: string): string {\n return input.trim().replace(/^#/, '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,cAAc,aAAE,OAAO;AAAA,EAClC,aAAa,aAAE,OAAO,EAAE,IAAI;AAAA,EAC5B,UAAU,aAAE,OAAO,EAAE,OAAO,CAAC;AAC/B,CAAC;;;ACLD,IAAAA,cAAkB;AAEX,IAAM,qBAAqB,cAAE,OAAO;AAAA,EACzC,KAAK,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACrB,KAAK,cAAE,OAAO;AAChB,CAAC;AAEM,IAAM,qBAAqB,cAAE,KAAK,CAAC,aAAa,QAAQ,UAAU,CAAC;AAEnE,IAAM,gBAAgB,cAAE,OAAO;AAAA,EACpC,IAAI,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,MAAM,cAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,aAAa,cAAE,OAAO;AAAA,EACtB,WAAW,cAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,YAAY,cAAE,OAAO,EAAE,SAAS;AAAA,EAChC,Y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AE,QAAQ,EAAE,QAAQ,KAAK;AACpC,CAAC;;;AClDM,SAAS,eAAe,IAAoB;AACjD,SAAO,IAAI,GAAG,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,CAAC,EAAE,YAAY,CAAC;AAC3D;AAEO,SAAS,mBAAmB,OAAuB;AACxD,SAAO,MAAM,KAAK,EAAE,QAAQ,MAAM,EAAE;AACtC;","names":["import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod","import_zod"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -272,14 +272,15 @@ declare const productStatusSchema: z.ZodEnum<{
|
|
|
272
272
|
draft: "draft";
|
|
273
273
|
archived: "archived";
|
|
274
274
|
}>;
|
|
275
|
+
declare const publishRequiredFields: readonly ["name", "priceCents", "category"];
|
|
275
276
|
declare const adminProductInputSchema: z.ZodObject<{
|
|
276
|
-
name: z.ZodString;
|
|
277
277
|
materials: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
278
278
|
dimensions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
279
|
-
priceCents: z.ZodNumber;
|
|
280
279
|
currency: z.ZodOptional<z.ZodString>;
|
|
281
|
-
|
|
280
|
+
name: z.ZodDefault<z.ZodString>;
|
|
282
281
|
description: z.ZodDefault<z.ZodString>;
|
|
282
|
+
priceCents: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
category: z.ZodOptional<z.ZodString>;
|
|
283
284
|
quantity: z.ZodDefault<z.ZodNumber>;
|
|
284
285
|
status: z.ZodDefault<z.ZodEnum<{
|
|
285
286
|
active: "active";
|
|
@@ -318,9 +319,9 @@ declare const adminProductSchema: z.ZodObject<{
|
|
|
318
319
|
description: z.ZodString;
|
|
319
320
|
materials: z.ZodNullable<z.ZodString>;
|
|
320
321
|
dimensions: z.ZodNullable<z.ZodString>;
|
|
321
|
-
priceCents: z.ZodNumber
|
|
322
|
+
priceCents: z.ZodNullable<z.ZodNumber>;
|
|
322
323
|
currency: z.ZodString;
|
|
323
|
-
category: z.ZodString
|
|
324
|
+
category: z.ZodNullable<z.ZodString>;
|
|
324
325
|
quantity: z.ZodNumber;
|
|
325
326
|
status: z.ZodEnum<{
|
|
326
327
|
active: "active";
|
|
@@ -328,6 +329,7 @@ declare const adminProductSchema: z.ZodObject<{
|
|
|
328
329
|
archived: "archived";
|
|
329
330
|
}>;
|
|
330
331
|
featured: z.ZodBoolean;
|
|
332
|
+
everPublished: z.ZodDefault<z.ZodBoolean>;
|
|
331
333
|
images: z.ZodArray<z.ZodObject<{
|
|
332
334
|
id: z.ZodString;
|
|
333
335
|
url: z.ZodString;
|
|
@@ -347,6 +349,8 @@ declare const adminProductListQuerySchema: z.ZodObject<{
|
|
|
347
349
|
draft: "draft";
|
|
348
350
|
archived: "archived";
|
|
349
351
|
}>>;
|
|
352
|
+
excludeArchived: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
353
|
+
incomplete: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
350
354
|
stock: z.ZodOptional<z.ZodEnum<{
|
|
351
355
|
sold: "sold";
|
|
352
356
|
in: "in";
|
|
@@ -363,9 +367,9 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
363
367
|
description: z.ZodString;
|
|
364
368
|
materials: z.ZodNullable<z.ZodString>;
|
|
365
369
|
dimensions: z.ZodNullable<z.ZodString>;
|
|
366
|
-
priceCents: z.ZodNumber
|
|
370
|
+
priceCents: z.ZodNullable<z.ZodNumber>;
|
|
367
371
|
currency: z.ZodString;
|
|
368
|
-
category: z.ZodString
|
|
372
|
+
category: z.ZodNullable<z.ZodString>;
|
|
369
373
|
quantity: z.ZodNumber;
|
|
370
374
|
status: z.ZodEnum<{
|
|
371
375
|
active: "active";
|
|
@@ -373,6 +377,7 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
373
377
|
archived: "archived";
|
|
374
378
|
}>;
|
|
375
379
|
featured: z.ZodBoolean;
|
|
380
|
+
everPublished: z.ZodDefault<z.ZodBoolean>;
|
|
376
381
|
images: z.ZodArray<z.ZodObject<{
|
|
377
382
|
id: z.ZodString;
|
|
378
383
|
url: z.ZodString;
|
|
@@ -382,6 +387,20 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
382
387
|
}, z.core.$strip>>;
|
|
383
388
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
384
389
|
}, z.core.$strip>;
|
|
390
|
+
declare const adminProductCountsSchema: z.ZodObject<{
|
|
391
|
+
all: z.ZodNumber;
|
|
392
|
+
live: z.ZodNumber;
|
|
393
|
+
draft: z.ZodNumber;
|
|
394
|
+
sold: z.ZodNumber;
|
|
395
|
+
archived: z.ZodNumber;
|
|
396
|
+
incompleteDrafts: z.ZodNumber;
|
|
397
|
+
}, z.core.$strip>;
|
|
398
|
+
declare const productIncompleteFieldSchema: z.ZodEnum<{
|
|
399
|
+
name: "name";
|
|
400
|
+
priceCents: "priceCents";
|
|
401
|
+
category: "category";
|
|
402
|
+
images: "images";
|
|
403
|
+
}>;
|
|
385
404
|
type ProductStatus = z.infer<typeof productStatusSchema>;
|
|
386
405
|
type AdminProductInput = z.input<typeof adminProductInputSchema>;
|
|
387
406
|
type AdminProductPatch = z.input<typeof adminProductPatchSchema>;
|
|
@@ -391,6 +410,8 @@ type ProductImagePatch = z.infer<typeof productImagePatchSchema>;
|
|
|
391
410
|
type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;
|
|
392
411
|
type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;
|
|
393
412
|
type AdminProductPage = z.infer<typeof adminProductPageSchema>;
|
|
413
|
+
type AdminProductCounts = z.infer<typeof adminProductCountsSchema>;
|
|
414
|
+
type ProductIncompleteField = z.infer<typeof productIncompleteFieldSchema>;
|
|
394
415
|
|
|
395
416
|
declare const adminOrderListQuerySchema: z.ZodObject<{
|
|
396
417
|
status: z.ZodOptional<z.ZodEnum<{
|
|
@@ -579,15 +600,15 @@ declare const discountPatchSchema: z.ZodObject<{
|
|
|
579
600
|
code: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
580
601
|
}, z.core.$strip>;
|
|
581
602
|
declare const discountStatusSchema: z.ZodEnum<{
|
|
582
|
-
expired: "expired";
|
|
583
603
|
active: "active";
|
|
604
|
+
expired: "expired";
|
|
584
605
|
inactive: "inactive";
|
|
585
606
|
scheduled: "scheduled";
|
|
586
607
|
}>;
|
|
587
608
|
declare const adminDiscountListQuerySchema: z.ZodObject<{
|
|
588
609
|
status: z.ZodOptional<z.ZodEnum<{
|
|
589
|
-
expired: "expired";
|
|
590
610
|
active: "active";
|
|
611
|
+
expired: "expired";
|
|
591
612
|
inactive: "inactive";
|
|
592
613
|
scheduled: "scheduled";
|
|
593
614
|
}>>;
|
|
@@ -663,5 +684,8 @@ type DiscountPreview = z.infer<typeof discountPreviewSchema>;
|
|
|
663
684
|
type DiscountRejectionReason = z.infer<typeof discountRejectionReasonSchema>;
|
|
664
685
|
type DiscountRejection = z.infer<typeof discountRejectionSchema>;
|
|
665
686
|
|
|
666
|
-
|
|
667
|
-
|
|
687
|
+
declare function formatOrderRef(id: string): string;
|
|
688
|
+
declare function orderRefSearchTerm(input: string): string;
|
|
689
|
+
|
|
690
|
+
export { adminDiscountListQuerySchema, adminDiscountPageSchema, adminOrderDetailSchema, adminOrderListItemSchema, adminOrderListQuerySchema, adminOrderPageSchema, adminProductCountsSchema, adminProductImageSchema, adminProductInputSchema, adminProductListQuerySchema, adminProductPageSchema, adminProductPatchSchema, adminProductSchema, availabilitySchema, cartLineSchema, categorySchema, checkoutConflictSchema, checkoutRequestSchema, checkoutResponseSchema, discountCodeSchema, discountInputSchema, discountPatchSchema, discountPreviewRequestSchema, discountPreviewSchema, discountRejectionReasonSchema, discountRejectionSchema, discountSchema, discountStatusSchema, discountTypeSchema, formatOrderRef, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefSearchTerm, orderRefundSchema, orderStatusSchema, orderSummarySchema, productCardPageSchema, productCardSchema, productImagePatchSchema, productImageSchema, productIncompleteFieldSchema, productListQuerySchema, productSchema, productStatusSchema, publishRequiredFields, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
|
|
691
|
+
export type { AdminDiscountListQuery, AdminDiscountPage, AdminOrderDetail, AdminOrderListItem, AdminOrderListQuery, AdminOrderPage, AdminProduct, AdminProductCounts, AdminProductImage, AdminProductInput, AdminProductListQuery, AdminProductPage, AdminProductPatch, CartLine, Category, CheckoutConflict, CheckoutRequest, CheckoutResponse, Discount, DiscountInput, DiscountPatch, DiscountPreview, DiscountPreviewRequest, DiscountRejection, DiscountRejectionReason, DiscountStatus, DiscountType, ImageOrderInput, Money, OrderAddress, OrderDetail, OrderFulfillment, OrderRefund, OrderStatus, OrderSummary, Product, ProductAvailability, ProductCard, ProductCardPage, ProductImage, ProductImagePatch, ProductIncompleteField, ProductListQuery, ProductStatus, RefundOrderInput, ShipOrderInput, ShippingRate, ShippingRateInput };
|
package/dist/index.d.ts
CHANGED
|
@@ -272,14 +272,15 @@ declare const productStatusSchema: z.ZodEnum<{
|
|
|
272
272
|
draft: "draft";
|
|
273
273
|
archived: "archived";
|
|
274
274
|
}>;
|
|
275
|
+
declare const publishRequiredFields: readonly ["name", "priceCents", "category"];
|
|
275
276
|
declare const adminProductInputSchema: z.ZodObject<{
|
|
276
|
-
name: z.ZodString;
|
|
277
277
|
materials: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
278
278
|
dimensions: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
279
|
-
priceCents: z.ZodNumber;
|
|
280
279
|
currency: z.ZodOptional<z.ZodString>;
|
|
281
|
-
|
|
280
|
+
name: z.ZodDefault<z.ZodString>;
|
|
282
281
|
description: z.ZodDefault<z.ZodString>;
|
|
282
|
+
priceCents: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
category: z.ZodOptional<z.ZodString>;
|
|
283
284
|
quantity: z.ZodDefault<z.ZodNumber>;
|
|
284
285
|
status: z.ZodDefault<z.ZodEnum<{
|
|
285
286
|
active: "active";
|
|
@@ -318,9 +319,9 @@ declare const adminProductSchema: z.ZodObject<{
|
|
|
318
319
|
description: z.ZodString;
|
|
319
320
|
materials: z.ZodNullable<z.ZodString>;
|
|
320
321
|
dimensions: z.ZodNullable<z.ZodString>;
|
|
321
|
-
priceCents: z.ZodNumber
|
|
322
|
+
priceCents: z.ZodNullable<z.ZodNumber>;
|
|
322
323
|
currency: z.ZodString;
|
|
323
|
-
category: z.ZodString
|
|
324
|
+
category: z.ZodNullable<z.ZodString>;
|
|
324
325
|
quantity: z.ZodNumber;
|
|
325
326
|
status: z.ZodEnum<{
|
|
326
327
|
active: "active";
|
|
@@ -328,6 +329,7 @@ declare const adminProductSchema: z.ZodObject<{
|
|
|
328
329
|
archived: "archived";
|
|
329
330
|
}>;
|
|
330
331
|
featured: z.ZodBoolean;
|
|
332
|
+
everPublished: z.ZodDefault<z.ZodBoolean>;
|
|
331
333
|
images: z.ZodArray<z.ZodObject<{
|
|
332
334
|
id: z.ZodString;
|
|
333
335
|
url: z.ZodString;
|
|
@@ -347,6 +349,8 @@ declare const adminProductListQuerySchema: z.ZodObject<{
|
|
|
347
349
|
draft: "draft";
|
|
348
350
|
archived: "archived";
|
|
349
351
|
}>>;
|
|
352
|
+
excludeArchived: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
353
|
+
incomplete: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
350
354
|
stock: z.ZodOptional<z.ZodEnum<{
|
|
351
355
|
sold: "sold";
|
|
352
356
|
in: "in";
|
|
@@ -363,9 +367,9 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
363
367
|
description: z.ZodString;
|
|
364
368
|
materials: z.ZodNullable<z.ZodString>;
|
|
365
369
|
dimensions: z.ZodNullable<z.ZodString>;
|
|
366
|
-
priceCents: z.ZodNumber
|
|
370
|
+
priceCents: z.ZodNullable<z.ZodNumber>;
|
|
367
371
|
currency: z.ZodString;
|
|
368
|
-
category: z.ZodString
|
|
372
|
+
category: z.ZodNullable<z.ZodString>;
|
|
369
373
|
quantity: z.ZodNumber;
|
|
370
374
|
status: z.ZodEnum<{
|
|
371
375
|
active: "active";
|
|
@@ -373,6 +377,7 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
373
377
|
archived: "archived";
|
|
374
378
|
}>;
|
|
375
379
|
featured: z.ZodBoolean;
|
|
380
|
+
everPublished: z.ZodDefault<z.ZodBoolean>;
|
|
376
381
|
images: z.ZodArray<z.ZodObject<{
|
|
377
382
|
id: z.ZodString;
|
|
378
383
|
url: z.ZodString;
|
|
@@ -382,6 +387,20 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
382
387
|
}, z.core.$strip>>;
|
|
383
388
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
384
389
|
}, z.core.$strip>;
|
|
390
|
+
declare const adminProductCountsSchema: z.ZodObject<{
|
|
391
|
+
all: z.ZodNumber;
|
|
392
|
+
live: z.ZodNumber;
|
|
393
|
+
draft: z.ZodNumber;
|
|
394
|
+
sold: z.ZodNumber;
|
|
395
|
+
archived: z.ZodNumber;
|
|
396
|
+
incompleteDrafts: z.ZodNumber;
|
|
397
|
+
}, z.core.$strip>;
|
|
398
|
+
declare const productIncompleteFieldSchema: z.ZodEnum<{
|
|
399
|
+
name: "name";
|
|
400
|
+
priceCents: "priceCents";
|
|
401
|
+
category: "category";
|
|
402
|
+
images: "images";
|
|
403
|
+
}>;
|
|
385
404
|
type ProductStatus = z.infer<typeof productStatusSchema>;
|
|
386
405
|
type AdminProductInput = z.input<typeof adminProductInputSchema>;
|
|
387
406
|
type AdminProductPatch = z.input<typeof adminProductPatchSchema>;
|
|
@@ -391,6 +410,8 @@ type ProductImagePatch = z.infer<typeof productImagePatchSchema>;
|
|
|
391
410
|
type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;
|
|
392
411
|
type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;
|
|
393
412
|
type AdminProductPage = z.infer<typeof adminProductPageSchema>;
|
|
413
|
+
type AdminProductCounts = z.infer<typeof adminProductCountsSchema>;
|
|
414
|
+
type ProductIncompleteField = z.infer<typeof productIncompleteFieldSchema>;
|
|
394
415
|
|
|
395
416
|
declare const adminOrderListQuerySchema: z.ZodObject<{
|
|
396
417
|
status: z.ZodOptional<z.ZodEnum<{
|
|
@@ -579,15 +600,15 @@ declare const discountPatchSchema: z.ZodObject<{
|
|
|
579
600
|
code: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
580
601
|
}, z.core.$strip>;
|
|
581
602
|
declare const discountStatusSchema: z.ZodEnum<{
|
|
582
|
-
expired: "expired";
|
|
583
603
|
active: "active";
|
|
604
|
+
expired: "expired";
|
|
584
605
|
inactive: "inactive";
|
|
585
606
|
scheduled: "scheduled";
|
|
586
607
|
}>;
|
|
587
608
|
declare const adminDiscountListQuerySchema: z.ZodObject<{
|
|
588
609
|
status: z.ZodOptional<z.ZodEnum<{
|
|
589
|
-
expired: "expired";
|
|
590
610
|
active: "active";
|
|
611
|
+
expired: "expired";
|
|
591
612
|
inactive: "inactive";
|
|
592
613
|
scheduled: "scheduled";
|
|
593
614
|
}>>;
|
|
@@ -663,5 +684,8 @@ type DiscountPreview = z.infer<typeof discountPreviewSchema>;
|
|
|
663
684
|
type DiscountRejectionReason = z.infer<typeof discountRejectionReasonSchema>;
|
|
664
685
|
type DiscountRejection = z.infer<typeof discountRejectionSchema>;
|
|
665
686
|
|
|
666
|
-
|
|
667
|
-
|
|
687
|
+
declare function formatOrderRef(id: string): string;
|
|
688
|
+
declare function orderRefSearchTerm(input: string): string;
|
|
689
|
+
|
|
690
|
+
export { adminDiscountListQuerySchema, adminDiscountPageSchema, adminOrderDetailSchema, adminOrderListItemSchema, adminOrderListQuerySchema, adminOrderPageSchema, adminProductCountsSchema, adminProductImageSchema, adminProductInputSchema, adminProductListQuerySchema, adminProductPageSchema, adminProductPatchSchema, adminProductSchema, availabilitySchema, cartLineSchema, categorySchema, checkoutConflictSchema, checkoutRequestSchema, checkoutResponseSchema, discountCodeSchema, discountInputSchema, discountPatchSchema, discountPreviewRequestSchema, discountPreviewSchema, discountRejectionReasonSchema, discountRejectionSchema, discountSchema, discountStatusSchema, discountTypeSchema, formatOrderRef, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefSearchTerm, orderRefundSchema, orderStatusSchema, orderSummarySchema, productCardPageSchema, productCardSchema, productImagePatchSchema, productImageSchema, productIncompleteFieldSchema, productListQuerySchema, productSchema, productStatusSchema, publishRequiredFields, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
|
|
691
|
+
export type { AdminDiscountListQuery, AdminDiscountPage, AdminOrderDetail, AdminOrderListItem, AdminOrderListQuery, AdminOrderPage, AdminProduct, AdminProductCounts, AdminProductImage, AdminProductInput, AdminProductListQuery, AdminProductPage, AdminProductPatch, CartLine, Category, CheckoutConflict, CheckoutRequest, CheckoutResponse, Discount, DiscountInput, DiscountPatch, DiscountPreview, DiscountPreviewRequest, DiscountRejection, DiscountRejectionReason, DiscountStatus, DiscountType, ImageOrderInput, Money, OrderAddress, OrderDetail, OrderFulfillment, OrderRefund, OrderStatus, OrderSummary, Product, ProductAvailability, ProductCard, ProductCardPage, ProductImage, ProductImagePatch, ProductIncompleteField, ProductListQuery, ProductStatus, RefundOrderInput, ShipOrderInput, ShippingRate, ShippingRateInput };
|
package/dist/index.js
CHANGED
|
@@ -279,11 +279,31 @@ var productFields = z8.object({
|
|
|
279
279
|
status: productStatusSchema,
|
|
280
280
|
featured: z8.boolean()
|
|
281
281
|
});
|
|
282
|
+
var publishRequiredFields = [
|
|
283
|
+
"name",
|
|
284
|
+
"priceCents",
|
|
285
|
+
"category"
|
|
286
|
+
];
|
|
282
287
|
var adminProductInputSchema = productFields.extend({
|
|
288
|
+
name: z8.string().trim().default(""),
|
|
283
289
|
description: z8.string().default(""),
|
|
290
|
+
priceCents: productFields.shape.priceCents.optional(),
|
|
291
|
+
category: z8.string().trim().optional(),
|
|
284
292
|
quantity: z8.number().int().nonnegative().default(1),
|
|
285
293
|
status: productStatusSchema.default("draft"),
|
|
286
294
|
featured: z8.boolean().default(false)
|
|
295
|
+
}).superRefine((product, ctx) => {
|
|
296
|
+
if (product.status !== "active") return;
|
|
297
|
+
for (const field of publishRequiredFields) {
|
|
298
|
+
const value = product[field];
|
|
299
|
+
if (value === void 0 || value === "") {
|
|
300
|
+
ctx.addIssue({
|
|
301
|
+
code: "custom",
|
|
302
|
+
path: [field],
|
|
303
|
+
message: `${field} is required to publish a product`
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
}
|
|
287
307
|
});
|
|
288
308
|
var adminProductPatchSchema = productFields.partial().extend({ sold: z8.boolean().optional() });
|
|
289
309
|
var adminProductImageSchema = z8.object({
|
|
@@ -295,16 +315,17 @@ var adminProductImageSchema = z8.object({
|
|
|
295
315
|
var adminProductSchema = z8.object({
|
|
296
316
|
id: z8.string().min(1),
|
|
297
317
|
slug: z8.string().min(1),
|
|
298
|
-
name: z8.string()
|
|
318
|
+
name: z8.string(),
|
|
299
319
|
description: z8.string(),
|
|
300
320
|
materials: z8.string().nullable(),
|
|
301
321
|
dimensions: z8.string().nullable(),
|
|
302
|
-
priceCents: z8.number().int().nonnegative(),
|
|
322
|
+
priceCents: z8.number().int().nonnegative().nullable(),
|
|
303
323
|
currency: z8.string().length(3),
|
|
304
|
-
category: z8.string().min(1),
|
|
324
|
+
category: z8.string().min(1).nullable(),
|
|
305
325
|
quantity: z8.number().int().nonnegative(),
|
|
306
326
|
status: productStatusSchema,
|
|
307
327
|
featured: z8.boolean(),
|
|
328
|
+
everPublished: z8.boolean().default(false),
|
|
308
329
|
images: z8.array(adminProductImageSchema)
|
|
309
330
|
});
|
|
310
331
|
var imageOrderInputSchema = z8.object({
|
|
@@ -315,6 +336,8 @@ var productImagePatchSchema = z8.object({
|
|
|
315
336
|
});
|
|
316
337
|
var adminProductListQuerySchema = z8.object({
|
|
317
338
|
status: productStatusSchema.optional(),
|
|
339
|
+
excludeArchived: z8.literal("true").optional(),
|
|
340
|
+
incomplete: z8.literal("true").optional(),
|
|
318
341
|
stock: z8.enum(["in", "sold"]).optional(),
|
|
319
342
|
q: z8.string().trim().min(1).optional(),
|
|
320
343
|
cursor: z8.string().min(1).optional(),
|
|
@@ -324,6 +347,18 @@ var adminProductPageSchema = z8.object({
|
|
|
324
347
|
items: z8.array(adminProductSchema),
|
|
325
348
|
nextCursor: z8.string().nullable()
|
|
326
349
|
});
|
|
350
|
+
var adminProductCountsSchema = z8.object({
|
|
351
|
+
all: z8.number().int().nonnegative(),
|
|
352
|
+
live: z8.number().int().nonnegative(),
|
|
353
|
+
draft: z8.number().int().nonnegative(),
|
|
354
|
+
sold: z8.number().int().nonnegative(),
|
|
355
|
+
archived: z8.number().int().nonnegative(),
|
|
356
|
+
incompleteDrafts: z8.number().int().nonnegative()
|
|
357
|
+
});
|
|
358
|
+
var productIncompleteFieldSchema = z8.enum([
|
|
359
|
+
...publishRequiredFields,
|
|
360
|
+
"images"
|
|
361
|
+
]);
|
|
327
362
|
|
|
328
363
|
// src/admin-orders.ts
|
|
329
364
|
import { z as z9 } from "zod";
|
|
@@ -363,6 +398,14 @@ var refundOrderInputSchema = z9.object({
|
|
|
363
398
|
reason: z9.string().max(500).optional(),
|
|
364
399
|
restock: z9.boolean().default(false)
|
|
365
400
|
});
|
|
401
|
+
|
|
402
|
+
// src/order-ref.ts
|
|
403
|
+
function formatOrderRef(id) {
|
|
404
|
+
return `#${id.replace(/-/g, "").slice(0, 8).toUpperCase()}`;
|
|
405
|
+
}
|
|
406
|
+
function orderRefSearchTerm(input) {
|
|
407
|
+
return input.trim().replace(/^#/, "");
|
|
408
|
+
}
|
|
366
409
|
export {
|
|
367
410
|
adminDiscountListQuerySchema,
|
|
368
411
|
adminDiscountPageSchema,
|
|
@@ -370,6 +413,7 @@ export {
|
|
|
370
413
|
adminOrderListItemSchema,
|
|
371
414
|
adminOrderListQuerySchema,
|
|
372
415
|
adminOrderPageSchema,
|
|
416
|
+
adminProductCountsSchema,
|
|
373
417
|
adminProductImageSchema,
|
|
374
418
|
adminProductInputSchema,
|
|
375
419
|
adminProductListQuerySchema,
|
|
@@ -392,11 +436,13 @@ export {
|
|
|
392
436
|
discountSchema,
|
|
393
437
|
discountStatusSchema,
|
|
394
438
|
discountTypeSchema,
|
|
439
|
+
formatOrderRef,
|
|
395
440
|
imageOrderInputSchema,
|
|
396
441
|
moneySchema,
|
|
397
442
|
orderAddressSchema,
|
|
398
443
|
orderDetailSchema,
|
|
399
444
|
orderFulfillmentSchema,
|
|
445
|
+
orderRefSearchTerm,
|
|
400
446
|
orderRefundSchema,
|
|
401
447
|
orderStatusSchema,
|
|
402
448
|
orderSummarySchema,
|
|
@@ -404,9 +450,11 @@ export {
|
|
|
404
450
|
productCardSchema,
|
|
405
451
|
productImagePatchSchema,
|
|
406
452
|
productImageSchema,
|
|
453
|
+
productIncompleteFieldSchema,
|
|
407
454
|
productListQuerySchema,
|
|
408
455
|
productSchema,
|
|
409
456
|
productStatusSchema,
|
|
457
|
+
publishRequiredFields,
|
|
410
458
|
refundOrderInputSchema,
|
|
411
459
|
shipOrderInputSchema,
|
|
412
460
|
shippingRateSchema,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/money.ts","../src/product.ts","../src/cart.ts","../src/checkout.ts","../src/discount.ts","../src/order.ts","../src/shipping.ts","../src/admin.ts","../src/admin-orders.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const moneySchema = z.object({\n amountCents: z.number().int(),\n currency: z.string().length(3),\n});\n\nexport type Money = z.infer<typeof moneySchema>;\n","import { z } from 'zod';\n\nexport const productImageSchema = z.object({\n url: z.string().min(1),\n alt: z.string(),\n});\n\nexport const availabilitySchema = z.enum(['available', 'sold', 'reserved']);\n\nexport const productSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n description: z.string(),\n materials: z.string().optional(),\n dimensions: z.string().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n category: z.string().min(1),\n images: z.array(productImageSchema),\n quantity: z.number().int().nonnegative(),\n availability: availabilitySchema,\n featured: z.boolean(),\n});\n\nexport const productCardSchema = productSchema\n .pick({\n id: true,\n slug: true,\n name: true,\n priceCents: true,\n currency: true,\n category: true,\n quantity: true,\n availability: true,\n featured: true,\n })\n .extend({ images: z.array(productImageSchema).max(1) });\n\nexport const categorySchema = z.object({\n slug: z.string().min(1),\n label: z.string().min(1),\n count: z.number().int().nonnegative(),\n});\n\nexport const productListQuerySchema = z.object({\n category: z.string().min(1).optional(),\n featured: z.boolean().optional(),\n limit: z.coerce.number().int().min(1).max(100).default(48),\n cursor: z.string().min(1).optional(),\n});\n\nexport const productCardPageSchema = z.object({\n items: z.array(productCardSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport type ProductImage = z.infer<typeof productImageSchema>;\nexport type ProductAvailability = z.infer<typeof availabilitySchema>;\nexport type Product = z.infer<typeof productSchema>;\nexport type ProductCard = z.infer<typeof productCardSchema>;\nexport type ProductCardPage = z.infer<typeof productCardPageSchema>;\nexport type Category = z.infer<typeof categorySchema>;\nexport type ProductListQuery = z.input<typeof productListQuerySchema>;\n","import { z } from 'zod';\n\nexport const cartLineSchema = z.object({\n productId: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n imageUrl: z.string().optional(),\n quantity: z.number().int().positive(),\n maxQuantity: z.number().int().positive(),\n});\n\nexport type CartLine = z.infer<typeof cartLineSchema>;\n","import { z } from 'zod';\nimport { discountCodeSchema } from './discount';\n\nexport const checkoutRequestSchema = z.object({\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n discountCode: discountCodeSchema.optional(),\n});\n\nexport const checkoutResponseSchema = z.object({\n url: z.string().min(1),\n});\n\nexport const checkoutConflictSchema = z.object({\n unavailableProductIds: z.array(z.string().min(1)).min(1),\n});\n\nexport type CheckoutRequest = z.infer<typeof checkoutRequestSchema>;\nexport type CheckoutResponse = z.infer<typeof checkoutResponseSchema>;\nexport type CheckoutConflict = z.infer<typeof checkoutConflictSchema>;\n","import { z } from 'zod';\n\nexport const discountTypeSchema = z.enum(['percent', 'fixed']);\n\nexport const discountCodeSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(\n z\n .string()\n .min(1)\n .max(40)\n .regex(/^[A-Z0-9_-]+$/),\n );\n\nconst currencyInputSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(z.string().length(3));\n\nconst limitFields = {\n minSubtotalCents: z.number().int().positive().nullable().optional(),\n startsAt: z.string().min(1).nullable().optional(),\n endsAt: z.string().min(1).nullable().optional(),\n maxRedemptions: z.number().int().positive().nullable().optional(),\n active: z.boolean(),\n};\n\nconst discountValueFields = {\n type: discountTypeSchema,\n percentOff: z.number().int().min(1).max(100).nullable().optional(),\n amountOffCents: z.number().int().positive().nullable().optional(),\n currency: currencyInputSchema.nullable().optional(),\n};\n\ntype ValueFields = {\n type?: z.infer<typeof discountTypeSchema>;\n percentOff?: number | null;\n amountOffCents?: number | null;\n currency?: string | null;\n};\n\nconst hasValue = (value: unknown) => value !== undefined && value !== null;\n\nfunction valueFieldsAgree(input: ValueFields): boolean {\n const { type, percentOff, amountOffCents, currency } = input;\n if (type === 'percent') {\n return (\n hasValue(percentOff) && !hasValue(amountOffCents) && !hasValue(currency)\n );\n }\n if (type === 'fixed') {\n return (\n !hasValue(percentOff) && hasValue(amountOffCents) && hasValue(currency)\n );\n }\n return !(hasValue(percentOff) && hasValue(amountOffCents));\n}\n\nconst valueFieldsMessage = {\n message:\n 'percent needs percentOff only; fixed needs amountOffCents and currency only',\n path: ['type'],\n};\n\nexport const discountSchema = z.object({\n id: z.string().min(1),\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n redeemedCount: z.number().int().nonnegative(),\n reservedCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const discountInputSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n active: limitFields.active.default(true),\n })\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountPatchSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n })\n .partial()\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountStatusSchema = z.enum([\n 'active',\n 'inactive',\n 'scheduled',\n 'expired',\n]);\n\nexport const adminDiscountListQuerySchema = z.object({\n status: discountStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminDiscountPageSchema = z.object({\n items: z.array(discountSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const discountPreviewRequestSchema = z.object({\n code: discountCodeSchema,\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n});\n\nexport const discountPreviewSchema = z.object({\n code: z.string().min(1),\n discountCents: z.number().int().nonnegative(),\n subtotalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n});\n\nexport const discountRejectionReasonSchema = z.enum([\n 'not_found',\n 'inactive',\n 'not_started',\n 'expired',\n 'min_subtotal',\n 'exhausted',\n 'currency',\n]);\n\nexport const discountRejectionSchema = z.object({\n error: z.literal('DISCOUNT_INVALID'),\n reason: discountRejectionReasonSchema,\n});\n\nexport type DiscountType = z.infer<typeof discountTypeSchema>;\nexport type Discount = z.infer<typeof discountSchema>;\nexport type DiscountStatus = z.infer<typeof discountStatusSchema>;\nexport type AdminDiscountListQuery = z.infer<\n typeof adminDiscountListQuerySchema\n>;\nexport type AdminDiscountPage = z.infer<typeof adminDiscountPageSchema>;\nexport type DiscountInput = z.input<typeof discountInputSchema>;\nexport type DiscountPatch = z.input<typeof discountPatchSchema>;\nexport type DiscountPreviewRequest = z.input<\n typeof discountPreviewRequestSchema\n>;\nexport type DiscountPreview = z.infer<typeof discountPreviewSchema>;\nexport type DiscountRejectionReason = z.infer<\n typeof discountRejectionReasonSchema\n>;\nexport type DiscountRejection = z.infer<typeof discountRejectionSchema>;\n","import { z } from 'zod';\n\nexport const orderStatusSchema = z.enum([\n 'pending',\n 'paid',\n 'shipped',\n 'cancelled',\n 'expired',\n 'needs_attention',\n 'refunded',\n]);\n\nconst orderItemSchema = z.object({\n productId: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n quantity: z.number().int().positive(),\n});\n\nexport const orderFulfillmentSchema = z.object({\n carrier: z.string().nullable(),\n trackingNumber: z.string().nullable(),\n trackingUrl: z.string().url().nullable(),\n shippedAt: z.string().min(1),\n});\n\nexport const orderRefundSchema = z.object({\n id: z.string().min(1),\n amountCents: z.number().int().positive(),\n reason: z.string().nullable(),\n restocked: z.boolean(),\n source: z.enum(['admin', 'gateway']),\n status: z.enum(['pending', 'succeeded']),\n createdAt: z.string().min(1),\n});\n\nconst orderTotalsShape = {\n id: z.string().min(1),\n status: orderStatusSchema,\n subtotalCents: z.number().int().nonnegative(),\n discountCents: z.number().int().nonnegative().default(0),\n discountCode: z.string().nullable().default(null),\n shippingCents: z.number().int().nonnegative(),\n shippingLabel: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n items: z.array(orderItemSchema),\n fulfillment: orderFulfillmentSchema.nullable(),\n createdAt: z.string().min(1),\n};\n\nexport const orderSummarySchema = z.object(orderTotalsShape);\n\nexport const orderAddressSchema = z.object({\n name: z.string().optional(),\n line1: z.string().optional(),\n line2: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n postalCode: z.string().optional(),\n country: z.string().optional(),\n});\n\nexport const orderDetailSchema = z.object({\n ...orderTotalsShape,\n email: z.string().nullable(),\n shippingAddress: orderAddressSchema.nullable(),\n});\n\nexport type OrderStatus = z.infer<typeof orderStatusSchema>;\nexport type OrderFulfillment = z.infer<typeof orderFulfillmentSchema>;\nexport type OrderRefund = z.infer<typeof orderRefundSchema>;\nexport type OrderSummary = z.infer<typeof orderSummarySchema>;\nexport type OrderAddress = z.infer<typeof orderAddressSchema>;\nexport type OrderDetail = z.infer<typeof orderDetailSchema>;\n","import { z } from 'zod';\n\nexport const shippingRateSchema = z.object({\n label: z.string().min(1),\n amountCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n minDays: z.number().int().nonnegative().nullable().optional(),\n maxDays: z.number().int().nonnegative().nullable().optional(),\n active: z.boolean().default(true),\n sort: z.number().int().default(0),\n});\n\nexport const shippingRatesInputSchema = z\n .array(shippingRateSchema)\n .refine((rates) => new Set(rates.map((r) => r.label)).size === rates.length, {\n message: 'Shipping rate labels must be unique',\n });\n\nexport type ShippingRate = z.infer<typeof shippingRateSchema>;\nexport type ShippingRateInput = z.input<typeof shippingRateSchema>;\n","import { z } from 'zod';\n\nexport const productStatusSchema = z.enum(['draft', 'active', 'archived']);\n\nconst productFields = z.object({\n name: z.string().trim().min(1),\n description: z.string(),\n materials: z.string().nullable().optional(),\n dimensions: z.string().nullable().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3).optional(),\n category: z.string().trim().min(1),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n});\n\nexport const adminProductInputSchema = productFields.extend({\n description: z.string().default(''),\n quantity: z.number().int().nonnegative().default(1),\n status: productStatusSchema.default('draft'),\n featured: z.boolean().default(false),\n});\n\nexport const adminProductPatchSchema = productFields\n .partial()\n .extend({ sold: z.boolean().optional() });\n\nexport const adminProductImageSchema = z.object({\n id: z.string().min(1),\n url: z.string().min(1),\n alt: z.string(),\n position: z.number().int().nonnegative(),\n});\n\nexport const adminProductSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n description: z.string(),\n materials: z.string().nullable(),\n dimensions: z.string().nullable(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n category: z.string().min(1),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n images: z.array(adminProductImageSchema),\n});\n\nexport const imageOrderInputSchema = z.object({\n imageIds: z.array(z.string().min(1)),\n});\n\nexport const productImagePatchSchema = z.object({\n alt: z.string().trim().max(500),\n});\n\nexport const adminProductListQuerySchema = z.object({\n status: productStatusSchema.optional(),\n stock: z.enum(['in', 'sold']).optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n});\n\nexport const adminProductPageSchema = z.object({\n items: z.array(adminProductSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport type ProductStatus = z.infer<typeof productStatusSchema>;\nexport type AdminProductInput = z.input<typeof adminProductInputSchema>;\nexport type AdminProductPatch = z.input<typeof adminProductPatchSchema>;\nexport type AdminProductImage = z.infer<typeof adminProductImageSchema>;\nexport type AdminProduct = z.infer<typeof adminProductSchema>;\nexport type ProductImagePatch = z.infer<typeof productImagePatchSchema>;\nexport type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;\nexport type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;\nexport type AdminProductPage = z.infer<typeof adminProductPageSchema>;\n","import { z } from 'zod';\nimport {\n orderDetailSchema,\n orderRefundSchema,\n orderStatusSchema,\n} from './order';\n\nexport const adminOrderListQuerySchema = z.object({\n status: orderStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n hasPendingRefund: z\n .enum(['true', 'false'])\n .transform((v) => v === 'true')\n .optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminOrderListItemSchema = z.object({\n id: z.string().min(1),\n status: orderStatusSchema,\n email: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n itemCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const adminOrderPageSchema = z.object({\n items: z.array(adminOrderListItemSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const adminOrderDetailSchema = orderDetailSchema.extend({\n refunds: z.array(orderRefundSchema),\n refundedCents: z.number().int().nonnegative(),\n checkoutSessionId: z.string().nullable(),\n updatedAt: z.string().min(1),\n});\n\nexport const shipOrderInputSchema = z.object({\n carrier: z.string().optional(),\n trackingNumber: z.string().optional(),\n trackingUrl: z.string().url().optional(),\n});\n\nexport const refundOrderInputSchema = z.object({\n amountCents: z.number().int().positive().optional(),\n reason: z.string().max(500).optional(),\n restock: z.boolean().default(false),\n});\n\nexport type AdminOrderListQuery = z.infer<typeof adminOrderListQuerySchema>;\nexport type AdminOrderListItem = z.infer<typeof adminOrderListItemSchema>;\nexport type AdminOrderPage = z.infer<typeof adminOrderPageSchema>;\nexport type AdminOrderDetail = z.infer<typeof adminOrderDetailSchema>;\nexport type ShipOrderInput = z.infer<typeof shipOrderInputSchema>;\nexport type RefundOrderInput = z.infer<typeof refundOrderInputSchema>;\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,cAAc,EAAE,OAAO;AAAA,EAClC,aAAa,EAAE,OAAO,EAAE,IAAI;AAAA,EAC5B,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC;AAC/B,CAAC;;;ACLD,SAAS,KAAAA,UAAS;AAEX,IAAM,qBAAqBA,GAAE,OAAO;AAAA,EACzC,KAAKA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACrB,KAAKA,GAAE,OAAO;AAChB,CAAC;AAEM,IAAM,qBAAqBA,GAAE,KAAK,CAAC,aAAa,QAAQ,UAAU,CAAC;AAEnE,IAAM,gBAAgBA,GAAE,OAAO;AAAA,EACpC,IAAIA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACpB,MAAMA,GAAE,OAAO,EAAE,IAAI,CAAC;AAAA,E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,EAClC,eAAeA,GAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EAC5C,mBAAmBA,GAAE,OAAO,EAAE,SAAS;AAAA,EACvC,WAAWA,GAAE,OAAO,EAAE,IAAI,CAAC;AAC7B,CAAC;AAEM,IAAM,uBAAuBA,GAAE,OAAO;AAAA,EAC3C,SAASA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,gBAAgBA,GAAE,OAAO,EAAE,SAAS;AAAA,EACpC,aAAaA,GAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AACzC,CAAC;AAEM,IAAM,yBAAyBA,GAAE,OAAO;AAAA,EAC7C,aAAaA,GAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,EAClD,QAAQA,GAAE,OAAO,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EACrC,SAASA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AACpC,CAAC;","names":["z","z","z","z","z","z","z","z","z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/money.ts","../src/product.ts","../src/cart.ts","../src/checkout.ts","../src/discount.ts","../src/order.ts","../src/shipping.ts","../src/admin.ts","../src/admin-orders.ts","../src/order-ref.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const moneySchema = z.object({\n amountCents: z.number().int(),\n currency: z.string().length(3),\n});\n\nexport type Money = z.infer<typeof moneySchema>;\n","import { z } from 'zod';\n\nexport const productImageSchema = z.object({\n url: z.string().min(1),\n alt: z.string(),\n});\n\nexport const availabilitySchema = z.enum(['available', 'sold', 'reserved']);\n\nexport const productSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n description: z.string(),\n materials: z.string().optional(),\n dimensions: z.string().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n category: z.string().min(1),\n images: z.array(productImageSchema),\n quantity: z.number().int().nonnegative(),\n availability: availabilitySchema,\n featured: z.boolean(),\n});\n\nexport const productCardSchema = productSchema\n .pick({\n id: true,\n slug: true,\n name: true,\n priceCents: true,\n currency: true,\n category: true,\n quantity: true,\n availability: true,\n featured: true,\n })\n .extend({ images: z.array(productImageSchema).max(1) });\n\nexport const categorySchema = z.object({\n slug: z.string().min(1),\n label: z.string().min(1),\n count: z.number().int().nonnegative(),\n});\n\nexport const productListQuerySchema = z.object({\n category: z.string().min(1).optional(),\n featured: z.boolean().optional(),\n limit: z.coerce.number().int().min(1).max(100).default(48),\n cursor: z.string().min(1).optional(),\n});\n\nexport const productCardPageSchema = z.object({\n items: z.array(productCardSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport type ProductImage = z.infer<typeof productImageSchema>;\nexport type ProductAvailability = z.infer<typeof availabilitySchema>;\nexport type Product = z.infer<typeof productSchema>;\nexport type ProductCard = z.infer<typeof productCardSchema>;\nexport type ProductCardPage = z.infer<typeof productCardPageSchema>;\nexport type Category = z.infer<typeof categorySchema>;\nexport type ProductListQuery = z.input<typeof productListQuerySchema>;\n","import { z } from 'zod';\n\nexport const cartLineSchema = z.object({\n productId: z.string().min(1),\n slug: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n imageUrl: z.string().optional(),\n quantity: z.number().int().positive(),\n maxQuantity: z.number().int().positive(),\n});\n\nexport type CartLine = z.infer<typeof cartLineSchema>;\n","import { z } from 'zod';\nimport { discountCodeSchema } from './discount';\n\nexport const checkoutRequestSchema = z.object({\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n discountCode: discountCodeSchema.optional(),\n});\n\nexport const checkoutResponseSchema = z.object({\n url: z.string().min(1),\n});\n\nexport const checkoutConflictSchema = z.object({\n unavailableProductIds: z.array(z.string().min(1)).min(1),\n});\n\nexport type CheckoutRequest = z.infer<typeof checkoutRequestSchema>;\nexport type CheckoutResponse = z.infer<typeof checkoutResponseSchema>;\nexport type CheckoutConflict = z.infer<typeof checkoutConflictSchema>;\n","import { z } from 'zod';\n\nexport const discountTypeSchema = z.enum(['percent', 'fixed']);\n\nexport const discountCodeSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(\n z\n .string()\n .min(1)\n .max(40)\n .regex(/^[A-Z0-9_-]+$/),\n );\n\nconst currencyInputSchema = z\n .string()\n .transform((value) => value.trim().toUpperCase())\n .pipe(z.string().length(3));\n\nconst limitFields = {\n minSubtotalCents: z.number().int().positive().nullable().optional(),\n startsAt: z.string().min(1).nullable().optional(),\n endsAt: z.string().min(1).nullable().optional(),\n maxRedemptions: z.number().int().positive().nullable().optional(),\n active: z.boolean(),\n};\n\nconst discountValueFields = {\n type: discountTypeSchema,\n percentOff: z.number().int().min(1).max(100).nullable().optional(),\n amountOffCents: z.number().int().positive().nullable().optional(),\n currency: currencyInputSchema.nullable().optional(),\n};\n\ntype ValueFields = {\n type?: z.infer<typeof discountTypeSchema>;\n percentOff?: number | null;\n amountOffCents?: number | null;\n currency?: string | null;\n};\n\nconst hasValue = (value: unknown) => value !== undefined && value !== null;\n\nfunction valueFieldsAgree(input: ValueFields): boolean {\n const { type, percentOff, amountOffCents, currency } = input;\n if (type === 'percent') {\n return (\n hasValue(percentOff) && !hasValue(amountOffCents) && !hasValue(currency)\n );\n }\n if (type === 'fixed') {\n return (\n !hasValue(percentOff) && hasValue(amountOffCents) && hasValue(currency)\n );\n }\n return !(hasValue(percentOff) && hasValue(amountOffCents));\n}\n\nconst valueFieldsMessage = {\n message:\n 'percent needs percentOff only; fixed needs amountOffCents and currency only',\n path: ['type'],\n};\n\nexport const discountSchema = z.object({\n id: z.string().min(1),\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n redeemedCount: z.number().int().nonnegative(),\n reservedCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const discountInputSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n active: limitFields.active.default(true),\n })\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountPatchSchema = z\n .object({\n code: discountCodeSchema,\n ...discountValueFields,\n ...limitFields,\n })\n .partial()\n .refine(valueFieldsAgree, valueFieldsMessage);\n\nexport const discountStatusSchema = z.enum([\n 'active',\n 'inactive',\n 'scheduled',\n 'expired',\n]);\n\nexport const adminDiscountListQuerySchema = z.object({\n status: discountStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminDiscountPageSchema = z.object({\n items: z.array(discountSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const discountPreviewRequestSchema = z.object({\n code: discountCodeSchema,\n items: z\n .array(\n z.object({\n productId: z.string().min(1),\n quantity: z.number().int().positive(),\n }),\n )\n .min(1),\n});\n\nexport const discountPreviewSchema = z.object({\n code: z.string().min(1),\n discountCents: z.number().int().nonnegative(),\n subtotalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n});\n\nexport const discountRejectionReasonSchema = z.enum([\n 'not_found',\n 'inactive',\n 'not_started',\n 'expired',\n 'min_subtotal',\n 'exhausted',\n 'currency',\n]);\n\nexport const discountRejectionSchema = z.object({\n error: z.literal('DISCOUNT_INVALID'),\n reason: discountRejectionReasonSchema,\n});\n\nexport type DiscountType = z.infer<typeof discountTypeSchema>;\nexport type Discount = z.infer<typeof discountSchema>;\nexport type DiscountStatus = z.infer<typeof discountStatusSchema>;\nexport type AdminDiscountListQuery = z.infer<\n typeof adminDiscountListQuerySchema\n>;\nexport type AdminDiscountPage = z.infer<typeof adminDiscountPageSchema>;\nexport type DiscountInput = z.input<typeof discountInputSchema>;\nexport type DiscountPatch = z.input<typeof discountPatchSchema>;\nexport type DiscountPreviewRequest = z.input<\n typeof discountPreviewRequestSchema\n>;\nexport type DiscountPreview = z.infer<typeof discountPreviewSchema>;\nexport type DiscountRejectionReason = z.infer<\n typeof discountRejectionReasonSchema\n>;\nexport type DiscountRejection = z.infer<typeof discountRejectionSchema>;\n","import { z } from 'zod';\n\nexport const orderStatusSchema = z.enum([\n 'pending',\n 'paid',\n 'shipped',\n 'cancelled',\n 'expired',\n 'needs_attention',\n 'refunded',\n]);\n\nconst orderItemSchema = z.object({\n productId: z.string().min(1),\n name: z.string().min(1),\n priceCents: z.number().int().nonnegative(),\n quantity: z.number().int().positive(),\n});\n\nexport const orderFulfillmentSchema = z.object({\n carrier: z.string().nullable(),\n trackingNumber: z.string().nullable(),\n trackingUrl: z.string().url().nullable(),\n shippedAt: z.string().min(1),\n});\n\nexport const orderRefundSchema = z.object({\n id: z.string().min(1),\n amountCents: z.number().int().positive(),\n reason: z.string().nullable(),\n restocked: z.boolean(),\n source: z.enum(['admin', 'gateway']),\n status: z.enum(['pending', 'succeeded']),\n createdAt: z.string().min(1),\n});\n\nconst orderTotalsShape = {\n id: z.string().min(1),\n status: orderStatusSchema,\n subtotalCents: z.number().int().nonnegative(),\n discountCents: z.number().int().nonnegative().default(0),\n discountCode: z.string().nullable().default(null),\n shippingCents: z.number().int().nonnegative(),\n shippingLabel: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n items: z.array(orderItemSchema),\n fulfillment: orderFulfillmentSchema.nullable(),\n createdAt: z.string().min(1),\n};\n\nexport const orderSummarySchema = z.object(orderTotalsShape);\n\nexport const orderAddressSchema = z.object({\n name: z.string().optional(),\n line1: z.string().optional(),\n line2: z.string().optional(),\n city: z.string().optional(),\n state: z.string().optional(),\n postalCode: z.string().optional(),\n country: z.string().optional(),\n});\n\nexport const orderDetailSchema = z.object({\n ...orderTotalsShape,\n email: z.string().nullable(),\n shippingAddress: orderAddressSchema.nullable(),\n});\n\nexport type OrderStatus = z.infer<typeof orderStatusSchema>;\nexport type OrderFulfillment = z.infer<typeof orderFulfillmentSchema>;\nexport type OrderRefund = z.infer<typeof orderRefundSchema>;\nexport type OrderSummary = z.infer<typeof orderSummarySchema>;\nexport type OrderAddress = z.infer<typeof orderAddressSchema>;\nexport type OrderDetail = z.infer<typeof orderDetailSchema>;\n","import { z } from 'zod';\n\nexport const shippingRateSchema = z.object({\n label: z.string().min(1),\n amountCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n minDays: z.number().int().nonnegative().nullable().optional(),\n maxDays: z.number().int().nonnegative().nullable().optional(),\n active: z.boolean().default(true),\n sort: z.number().int().default(0),\n});\n\nexport const shippingRatesInputSchema = z\n .array(shippingRateSchema)\n .refine((rates) => new Set(rates.map((r) => r.label)).size === rates.length, {\n message: 'Shipping rate labels must be unique',\n });\n\nexport type ShippingRate = z.infer<typeof shippingRateSchema>;\nexport type ShippingRateInput = z.input<typeof shippingRateSchema>;\n","import { z } from 'zod';\n\nexport const productStatusSchema = z.enum(['draft', 'active', 'archived']);\n\nconst productFields = z.object({\n name: z.string().trim().min(1),\n description: z.string(),\n materials: z.string().nullable().optional(),\n dimensions: z.string().nullable().optional(),\n priceCents: z.number().int().nonnegative(),\n currency: z.string().length(3).optional(),\n category: z.string().trim().min(1),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n});\n\nexport const publishRequiredFields = [\n 'name',\n 'priceCents',\n 'category',\n] as const;\n\nexport const adminProductInputSchema = productFields\n .extend({\n name: z.string().trim().default(''),\n description: z.string().default(''),\n priceCents: productFields.shape.priceCents.optional(),\n category: z.string().trim().optional(),\n quantity: z.number().int().nonnegative().default(1),\n status: productStatusSchema.default('draft'),\n featured: z.boolean().default(false),\n })\n .superRefine((product, ctx) => {\n if (product.status !== 'active') return;\n for (const field of publishRequiredFields) {\n const value = product[field];\n if (value === undefined || value === '') {\n ctx.addIssue({\n code: 'custom',\n path: [field],\n message: `${field} is required to publish a product`,\n });\n }\n }\n });\n\nexport const adminProductPatchSchema = productFields\n .partial()\n .extend({ sold: z.boolean().optional() });\n\nexport const adminProductImageSchema = z.object({\n id: z.string().min(1),\n url: z.string().min(1),\n alt: z.string(),\n position: z.number().int().nonnegative(),\n});\n\nexport const adminProductSchema = z.object({\n id: z.string().min(1),\n slug: z.string().min(1),\n name: z.string(),\n description: z.string(),\n materials: z.string().nullable(),\n dimensions: z.string().nullable(),\n priceCents: z.number().int().nonnegative().nullable(),\n currency: z.string().length(3),\n category: z.string().min(1).nullable(),\n quantity: z.number().int().nonnegative(),\n status: productStatusSchema,\n featured: z.boolean(),\n everPublished: z.boolean().default(false),\n images: z.array(adminProductImageSchema),\n});\n\nexport const imageOrderInputSchema = z.object({\n imageIds: z.array(z.string().min(1)),\n});\n\nexport const productImagePatchSchema = z.object({\n alt: z.string().trim().max(500),\n});\n\nexport const adminProductListQuerySchema = z.object({\n status: productStatusSchema.optional(),\n excludeArchived: z.literal('true').optional(),\n incomplete: z.literal('true').optional(),\n stock: z.enum(['in', 'sold']).optional(),\n q: z.string().trim().min(1).optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n});\n\nexport const adminProductPageSchema = z.object({\n items: z.array(adminProductSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const adminProductCountsSchema = z.object({\n all: z.number().int().nonnegative(),\n live: z.number().int().nonnegative(),\n draft: z.number().int().nonnegative(),\n sold: z.number().int().nonnegative(),\n archived: z.number().int().nonnegative(),\n incompleteDrafts: z.number().int().nonnegative(),\n});\n\nexport const productIncompleteFieldSchema = z.enum([\n ...publishRequiredFields,\n 'images',\n]);\n\nexport type ProductStatus = z.infer<typeof productStatusSchema>;\nexport type AdminProductInput = z.input<typeof adminProductInputSchema>;\nexport type AdminProductPatch = z.input<typeof adminProductPatchSchema>;\nexport type AdminProductImage = z.infer<typeof adminProductImageSchema>;\nexport type AdminProduct = z.infer<typeof adminProductSchema>;\nexport type ProductImagePatch = z.infer<typeof productImagePatchSchema>;\nexport type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;\nexport type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;\nexport type AdminProductPage = z.infer<typeof adminProductPageSchema>;\nexport type AdminProductCounts = z.infer<typeof adminProductCountsSchema>;\nexport type ProductIncompleteField = z.infer<\n typeof productIncompleteFieldSchema\n>;\n","import { z } from 'zod';\nimport {\n orderDetailSchema,\n orderRefundSchema,\n orderStatusSchema,\n} from './order';\n\nexport const adminOrderListQuerySchema = z.object({\n status: orderStatusSchema.optional(),\n q: z.string().trim().min(1).optional(),\n hasPendingRefund: z\n .enum(['true', 'false'])\n .transform((v) => v === 'true')\n .optional(),\n cursor: z.string().min(1).optional(),\n limit: z.coerce.number().int().min(1).max(100).default(25),\n});\n\nexport const adminOrderListItemSchema = z.object({\n id: z.string().min(1),\n status: orderStatusSchema,\n email: z.string().nullable(),\n totalCents: z.number().int().nonnegative(),\n currency: z.string().length(3),\n itemCount: z.number().int().nonnegative(),\n createdAt: z.string().min(1),\n});\n\nexport const adminOrderPageSchema = z.object({\n items: z.array(adminOrderListItemSchema),\n nextCursor: z.string().nullable(),\n});\n\nexport const adminOrderDetailSchema = orderDetailSchema.extend({\n refunds: z.array(orderRefundSchema),\n refundedCents: z.number().int().nonnegative(),\n checkoutSessionId: z.string().nullable(),\n updatedAt: z.string().min(1),\n});\n\nexport const shipOrderInputSchema = z.object({\n carrier: z.string().optional(),\n trackingNumber: z.string().optional(),\n trackingUrl: z.string().url().optional(),\n});\n\nexport const refundOrderInputSchema = z.object({\n amountCents: z.number().int().positive().optional(),\n reason: z.string().max(500).optional(),\n restock: z.boolean().default(false),\n});\n\nexport type AdminOrderListQuery = z.infer<typeof adminOrderListQuerySchema>;\nexport type AdminOrderListItem = z.infer<typeof adminOrderListItemSchema>;\nexport type AdminOrderPage = z.infer<typeof adminOrderPageSchema>;\nexport type AdminOrderDetail = z.infer<typeof adminOrderDetailSchema>;\nexport type ShipOrderInput = z.infer<typeof shipOrderInputSchema>;\nexport type RefundOrderInput = z.infer<typeof refundOrderInputSchema>;\n","export function formatOrderRef(id: string): string {\n return `#${id.replace(/-/g, '').slice(0, 8).toUpperCase()}`;\n}\n\nexport function orderRefSearchTerm(input: string): string {\n return input.trim().replace(/^#/, '');\n}\n"],"mappings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|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develemit/commerce-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Zod schemas and types shared by the @develemit storefront, server and admin.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/develemit/develemit-commerce.git",
|
|
8
|
+
"directory": "packages/commerce-contracts"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/develemit/develemit-commerce/blob/main/docs/getting-started.md",
|
|
4
11
|
"license": "MIT",
|
|
5
12
|
"type": "module",
|
|
6
13
|
"engines": {
|
|
@@ -17,7 +24,8 @@
|
|
|
17
24
|
"main": "./dist/index.cjs",
|
|
18
25
|
"types": "./dist/index.d.ts",
|
|
19
26
|
"files": [
|
|
20
|
-
"dist"
|
|
27
|
+
"dist",
|
|
28
|
+
"CHANGELOG.md"
|
|
21
29
|
],
|
|
22
30
|
"publishConfig": {
|
|
23
31
|
"access": "public"
|