@develemit/commerce-contracts 0.4.0 → 0.7.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 +69 -0
- package/README.md +34 -2
- package/dist/index.cjs +45 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -21
- package/dist/index.d.ts +40 -21
- package/dist/index.js +42 -4
- package/dist/index.js.map +1 -1
- package/package.json +10 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
## 0.7.0 (2026-11-04)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- `adminProductInputSchema` accepts a draft with no `name`, `priceCents` or `category`; `status: 'active'` requires all three (one issue per field). New `adminProductCountsSchema`, `productIncompleteFieldSchema` and `publishRequiredFields`.
|
|
6
|
+
- `adminProductListQuerySchema` accepts `excludeArchived: 'true'` and `incomplete: 'true'`.
|
|
7
|
+
- `adminProductSchema` now types `name` as possibly `''`, and `priceCents` and `category` as nullable. Consumers reading these fields from admin responses must handle `null`.
|
|
8
|
+
|
|
9
|
+
### Docs
|
|
10
|
+
|
|
11
|
+
- The package now ships `CHANGELOG.md` and declares `description`, `repository` and `homepage`. The README lists every schema by area.
|
|
12
|
+
|
|
13
|
+
## 0.6.0 (2026-11-03)
|
|
14
|
+
|
|
15
|
+
No changes; released in lockstep with the other packages.
|
|
16
|
+
|
|
17
|
+
## 0.5.0 (2026-11-02)
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- Discount `currency` on input and patch schemas is trimmed and uppercased, so `usd` and `USD` are the same value.
|
|
22
|
+
|
|
23
|
+
## 0.4.0 (2026-10-30)
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
- `productImagePatchSchema` (`{ alt }`, trimmed, max 500) and `ProductImagePatch` for editing an image's alt text.
|
|
28
|
+
- Discount schemas in `discount.ts`: `discountSchema`, `discountInputSchema`, `discountPatchSchema`, `discountCodeSchema` (trimmed, uppercased, `[A-Z0-9_-]` up to 40), `discountPreviewRequestSchema`, `discountPreviewSchema` and `discountRejectionSchema`, with their types.
|
|
29
|
+
- `checkoutRequestSchema` accepts an optional `discountCode`.
|
|
30
|
+
- `orderSummarySchema` and `orderDetailSchema` gain `discountCents` (default 0) and `discountCode` (default `null`). Their output types now include both fields.
|
|
31
|
+
|
|
32
|
+
## 0.3.0 (2026-10-30)
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
- `adminProductListQuerySchema` accepts `stock: 'in' | 'sold'` (sold = stored quantity 0).
|
|
37
|
+
|
|
38
|
+
### Breaking changes
|
|
39
|
+
|
|
40
|
+
- `GET /admin/products` is paged: new `adminProductListQuerySchema` (`status`, `q`, `cursor`, `limit` 1-100 default 50) and `adminProductPageSchema` (`{ items, nextCursor }`), with `AdminProductListQuery` and `AdminProductPage` types.
|
|
41
|
+
- `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.
|
|
42
|
+
|
|
43
|
+
### Fixes
|
|
44
|
+
|
|
45
|
+
- Published tarballs no longer include declaration maps (`*.d.ts.map`), which pointed at `src/` files that were not shipped. JS sourcemaps now embed `sourcesContent`.
|
|
46
|
+
|
|
47
|
+
## 0.2.0 (2026-10-29)
|
|
48
|
+
|
|
49
|
+
First published release. 0.1.0 was tagged but never published to npm, so installing 0.2.0 gets everything in both entries below.
|
|
50
|
+
|
|
51
|
+
### Features
|
|
52
|
+
|
|
53
|
+
- Order status `refunded`, added to `orderStatusSchema`. Code that switches exhaustively over `OrderStatus` needs a new case.
|
|
54
|
+
- `fulfillment` on `orderSummarySchema` and `OrderDetail`: carrier, tracking number, tracking URL and shipped time, or `null` before shipping.
|
|
55
|
+
- Admin order schemas: `adminOrderListQuerySchema`, `adminOrderPageSchema`, `adminOrderDetailSchema` (with refunds and `refundedCents`), `shipOrderInputSchema` and `refundOrderInputSchema`.
|
|
56
|
+
- `orderRefundSchema` for a refund, with `status: 'pending' | 'succeeded'`. `adminOrderListQuerySchema` gains `hasPendingRefund`.
|
|
57
|
+
|
|
58
|
+
## 0.1.0 (2026-10-29)
|
|
59
|
+
|
|
60
|
+
First release. Zod schemas and inferred types shared by `@develemit/storefront` and `@develemit/commerce-server`. Builds to ESM and CJS.
|
|
61
|
+
|
|
62
|
+
### Features
|
|
63
|
+
|
|
64
|
+
- Money: integer cents plus an ISO-4217 currency.
|
|
65
|
+
- Catalog: product, product image, availability and category schemas.
|
|
66
|
+
- Cart and checkout: `CartLine`, `CheckoutRequest` and `CheckoutResponse`.
|
|
67
|
+
- 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).
|
|
68
|
+
- Shipping: shipping rate and option schemas.
|
|
69
|
+
- 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,
|
|
@@ -60,9 +61,11 @@ __export(index_exports, {
|
|
|
60
61
|
productCardSchema: () => productCardSchema,
|
|
61
62
|
productImagePatchSchema: () => productImagePatchSchema,
|
|
62
63
|
productImageSchema: () => productImageSchema,
|
|
64
|
+
productIncompleteFieldSchema: () => productIncompleteFieldSchema,
|
|
63
65
|
productListQuerySchema: () => productListQuerySchema,
|
|
64
66
|
productSchema: () => productSchema,
|
|
65
67
|
productStatusSchema: () => productStatusSchema,
|
|
68
|
+
publishRequiredFields: () => publishRequiredFields,
|
|
66
69
|
refundOrderInputSchema: () => refundOrderInputSchema,
|
|
67
70
|
shipOrderInputSchema: () => shipOrderInputSchema,
|
|
68
71
|
shippingRateSchema: () => shippingRateSchema,
|
|
@@ -148,6 +151,7 @@ var discountTypeSchema = import_zod4.z.enum(["percent", "fixed"]);
|
|
|
148
151
|
var discountCodeSchema = import_zod4.z.string().transform((value) => value.trim().toUpperCase()).pipe(
|
|
149
152
|
import_zod4.z.string().min(1).max(40).regex(/^[A-Z0-9_-]+$/)
|
|
150
153
|
);
|
|
154
|
+
var currencyInputSchema = import_zod4.z.string().transform((value) => value.trim().toUpperCase()).pipe(import_zod4.z.string().length(3));
|
|
151
155
|
var limitFields = {
|
|
152
156
|
minSubtotalCents: import_zod4.z.number().int().positive().nullable().optional(),
|
|
153
157
|
startsAt: import_zod4.z.string().min(1).nullable().optional(),
|
|
@@ -159,7 +163,7 @@ var discountValueFields = {
|
|
|
159
163
|
type: discountTypeSchema,
|
|
160
164
|
percentOff: import_zod4.z.number().int().min(1).max(100).nullable().optional(),
|
|
161
165
|
amountOffCents: import_zod4.z.number().int().positive().nullable().optional(),
|
|
162
|
-
currency:
|
|
166
|
+
currency: currencyInputSchema.nullable().optional()
|
|
163
167
|
};
|
|
164
168
|
var hasValue = (value) => value !== void 0 && value !== null;
|
|
165
169
|
function valueFieldsAgree(input) {
|
|
@@ -350,11 +354,31 @@ var productFields = import_zod8.z.object({
|
|
|
350
354
|
status: productStatusSchema,
|
|
351
355
|
featured: import_zod8.z.boolean()
|
|
352
356
|
});
|
|
357
|
+
var publishRequiredFields = [
|
|
358
|
+
"name",
|
|
359
|
+
"priceCents",
|
|
360
|
+
"category"
|
|
361
|
+
];
|
|
353
362
|
var adminProductInputSchema = productFields.extend({
|
|
363
|
+
name: import_zod8.z.string().trim().default(""),
|
|
354
364
|
description: import_zod8.z.string().default(""),
|
|
365
|
+
priceCents: productFields.shape.priceCents.optional(),
|
|
366
|
+
category: import_zod8.z.string().trim().optional(),
|
|
355
367
|
quantity: import_zod8.z.number().int().nonnegative().default(1),
|
|
356
368
|
status: productStatusSchema.default("draft"),
|
|
357
369
|
featured: import_zod8.z.boolean().default(false)
|
|
370
|
+
}).superRefine((product, ctx) => {
|
|
371
|
+
if (product.status !== "active") return;
|
|
372
|
+
for (const field of publishRequiredFields) {
|
|
373
|
+
const value = product[field];
|
|
374
|
+
if (value === void 0 || value === "") {
|
|
375
|
+
ctx.addIssue({
|
|
376
|
+
code: "custom",
|
|
377
|
+
path: [field],
|
|
378
|
+
message: `${field} is required to publish a product`
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
358
382
|
});
|
|
359
383
|
var adminProductPatchSchema = productFields.partial().extend({ sold: import_zod8.z.boolean().optional() });
|
|
360
384
|
var adminProductImageSchema = import_zod8.z.object({
|
|
@@ -366,13 +390,13 @@ var adminProductImageSchema = import_zod8.z.object({
|
|
|
366
390
|
var adminProductSchema = import_zod8.z.object({
|
|
367
391
|
id: import_zod8.z.string().min(1),
|
|
368
392
|
slug: import_zod8.z.string().min(1),
|
|
369
|
-
name: import_zod8.z.string()
|
|
393
|
+
name: import_zod8.z.string(),
|
|
370
394
|
description: import_zod8.z.string(),
|
|
371
395
|
materials: import_zod8.z.string().nullable(),
|
|
372
396
|
dimensions: import_zod8.z.string().nullable(),
|
|
373
|
-
priceCents: import_zod8.z.number().int().nonnegative(),
|
|
397
|
+
priceCents: import_zod8.z.number().int().nonnegative().nullable(),
|
|
374
398
|
currency: import_zod8.z.string().length(3),
|
|
375
|
-
category: import_zod8.z.string().min(1),
|
|
399
|
+
category: import_zod8.z.string().min(1).nullable(),
|
|
376
400
|
quantity: import_zod8.z.number().int().nonnegative(),
|
|
377
401
|
status: productStatusSchema,
|
|
378
402
|
featured: import_zod8.z.boolean(),
|
|
@@ -386,6 +410,8 @@ var productImagePatchSchema = import_zod8.z.object({
|
|
|
386
410
|
});
|
|
387
411
|
var adminProductListQuerySchema = import_zod8.z.object({
|
|
388
412
|
status: productStatusSchema.optional(),
|
|
413
|
+
excludeArchived: import_zod8.z.literal("true").optional(),
|
|
414
|
+
incomplete: import_zod8.z.literal("true").optional(),
|
|
389
415
|
stock: import_zod8.z.enum(["in", "sold"]).optional(),
|
|
390
416
|
q: import_zod8.z.string().trim().min(1).optional(),
|
|
391
417
|
cursor: import_zod8.z.string().min(1).optional(),
|
|
@@ -395,6 +421,18 @@ var adminProductPageSchema = import_zod8.z.object({
|
|
|
395
421
|
items: import_zod8.z.array(adminProductSchema),
|
|
396
422
|
nextCursor: import_zod8.z.string().nullable()
|
|
397
423
|
});
|
|
424
|
+
var adminProductCountsSchema = import_zod8.z.object({
|
|
425
|
+
all: import_zod8.z.number().int().nonnegative(),
|
|
426
|
+
live: import_zod8.z.number().int().nonnegative(),
|
|
427
|
+
draft: import_zod8.z.number().int().nonnegative(),
|
|
428
|
+
sold: import_zod8.z.number().int().nonnegative(),
|
|
429
|
+
archived: import_zod8.z.number().int().nonnegative(),
|
|
430
|
+
incompleteDrafts: import_zod8.z.number().int().nonnegative()
|
|
431
|
+
});
|
|
432
|
+
var productIncompleteFieldSchema = import_zod8.z.enum([
|
|
433
|
+
...publishRequiredFields,
|
|
434
|
+
"images"
|
|
435
|
+
]);
|
|
398
436
|
|
|
399
437
|
// src/admin-orders.ts
|
|
400
438
|
var import_zod9 = require("zod");
|
|
@@ -442,6 +480,7 @@ var refundOrderInputSchema = import_zod9.z.object({
|
|
|
442
480
|
adminOrderListItemSchema,
|
|
443
481
|
adminOrderListQuerySchema,
|
|
444
482
|
adminOrderPageSchema,
|
|
483
|
+
adminProductCountsSchema,
|
|
445
484
|
adminProductImageSchema,
|
|
446
485
|
adminProductInputSchema,
|
|
447
486
|
adminProductListQuerySchema,
|
|
@@ -476,9 +515,11 @@ var refundOrderInputSchema = import_zod9.z.object({
|
|
|
476
515
|
productCardSchema,
|
|
477
516
|
productImagePatchSchema,
|
|
478
517
|
productImageSchema,
|
|
518
|
+
productIncompleteFieldSchema,
|
|
479
519
|
productListQuerySchema,
|
|
480
520
|
productSchema,
|
|
481
521
|
productStatusSchema,
|
|
522
|
+
publishRequiredFields,
|
|
482
523
|
refundOrderInputSchema,
|
|
483
524
|
shipOrderInputSchema,
|
|
484
525
|
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 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: z.string().length(3).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,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,IAAM,yBAAyB,kBAAkB,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"],"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 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 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>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,CAAC;AAAA,EACpB,QAAQ;AAAA,EACR,OAAO,cAAE,OAAO,EAAE,SAAS;AAAA,EAC3B,YAAY,cAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EACzC,UAAU,cAAE,OAAO,EAAE,OAAO,CAAC;AAAA,EAC7B,WAAW,cAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EACxC,WAAW,cAAE,OAAO,EAAE,IAAI,CAAC;AAC7B,CAAC;AAEM,IAAM,uBAAuB,cAAE,OAAO;AAAA,EAC3C,OAAO,cAAE,MAAM,wBAAwB;AAAA,EACvC,YAAY,cAAE,OAAO,EAAE,SAAS;AAClC,CAAC;AAEM,IAAM,yBAAyB,kBAAkB,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"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -39,17 +39,17 @@ declare const productSchema: z.ZodObject<{
|
|
|
39
39
|
}, z.core.$strip>;
|
|
40
40
|
declare const productCardSchema: z.ZodObject<{
|
|
41
41
|
currency: z.ZodString;
|
|
42
|
-
slug: z.ZodString;
|
|
43
|
-
name: z.ZodString;
|
|
44
|
-
priceCents: z.ZodNumber;
|
|
45
|
-
quantity: z.ZodNumber;
|
|
46
42
|
availability: z.ZodEnum<{
|
|
47
43
|
available: "available";
|
|
48
44
|
sold: "sold";
|
|
49
45
|
reserved: "reserved";
|
|
50
46
|
}>;
|
|
51
47
|
id: z.ZodString;
|
|
48
|
+
slug: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
priceCents: z.ZodNumber;
|
|
52
51
|
category: z.ZodString;
|
|
52
|
+
quantity: z.ZodNumber;
|
|
53
53
|
featured: z.ZodBoolean;
|
|
54
54
|
images: z.ZodArray<z.ZodObject<{
|
|
55
55
|
url: z.ZodString;
|
|
@@ -70,17 +70,17 @@ declare const productListQuerySchema: z.ZodObject<{
|
|
|
70
70
|
declare const productCardPageSchema: z.ZodObject<{
|
|
71
71
|
items: z.ZodArray<z.ZodObject<{
|
|
72
72
|
currency: z.ZodString;
|
|
73
|
-
slug: z.ZodString;
|
|
74
|
-
name: z.ZodString;
|
|
75
|
-
priceCents: z.ZodNumber;
|
|
76
|
-
quantity: z.ZodNumber;
|
|
77
73
|
availability: z.ZodEnum<{
|
|
78
74
|
available: "available";
|
|
79
75
|
sold: "sold";
|
|
80
76
|
reserved: "reserved";
|
|
81
77
|
}>;
|
|
82
78
|
id: z.ZodString;
|
|
79
|
+
slug: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
priceCents: z.ZodNumber;
|
|
83
82
|
category: z.ZodString;
|
|
83
|
+
quantity: z.ZodNumber;
|
|
84
84
|
featured: z.ZodBoolean;
|
|
85
85
|
images: z.ZodArray<z.ZodObject<{
|
|
86
86
|
url: z.ZodString;
|
|
@@ -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";
|
|
@@ -347,6 +348,8 @@ declare const adminProductListQuerySchema: z.ZodObject<{
|
|
|
347
348
|
draft: "draft";
|
|
348
349
|
archived: "archived";
|
|
349
350
|
}>>;
|
|
351
|
+
excludeArchived: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
352
|
+
incomplete: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
350
353
|
stock: z.ZodOptional<z.ZodEnum<{
|
|
351
354
|
sold: "sold";
|
|
352
355
|
in: "in";
|
|
@@ -363,9 +366,9 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
363
366
|
description: z.ZodString;
|
|
364
367
|
materials: z.ZodNullable<z.ZodString>;
|
|
365
368
|
dimensions: z.ZodNullable<z.ZodString>;
|
|
366
|
-
priceCents: z.ZodNumber
|
|
369
|
+
priceCents: z.ZodNullable<z.ZodNumber>;
|
|
367
370
|
currency: z.ZodString;
|
|
368
|
-
category: z.ZodString
|
|
371
|
+
category: z.ZodNullable<z.ZodString>;
|
|
369
372
|
quantity: z.ZodNumber;
|
|
370
373
|
status: z.ZodEnum<{
|
|
371
374
|
active: "active";
|
|
@@ -382,6 +385,20 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
382
385
|
}, z.core.$strip>>;
|
|
383
386
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
384
387
|
}, z.core.$strip>;
|
|
388
|
+
declare const adminProductCountsSchema: z.ZodObject<{
|
|
389
|
+
all: z.ZodNumber;
|
|
390
|
+
live: z.ZodNumber;
|
|
391
|
+
draft: z.ZodNumber;
|
|
392
|
+
sold: z.ZodNumber;
|
|
393
|
+
archived: z.ZodNumber;
|
|
394
|
+
incompleteDrafts: z.ZodNumber;
|
|
395
|
+
}, z.core.$strip>;
|
|
396
|
+
declare const productIncompleteFieldSchema: z.ZodEnum<{
|
|
397
|
+
name: "name";
|
|
398
|
+
priceCents: "priceCents";
|
|
399
|
+
category: "category";
|
|
400
|
+
images: "images";
|
|
401
|
+
}>;
|
|
385
402
|
type ProductStatus = z.infer<typeof productStatusSchema>;
|
|
386
403
|
type AdminProductInput = z.input<typeof adminProductInputSchema>;
|
|
387
404
|
type AdminProductPatch = z.input<typeof adminProductPatchSchema>;
|
|
@@ -391,6 +408,8 @@ type ProductImagePatch = z.infer<typeof productImagePatchSchema>;
|
|
|
391
408
|
type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;
|
|
392
409
|
type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;
|
|
393
410
|
type AdminProductPage = z.infer<typeof adminProductPageSchema>;
|
|
411
|
+
type AdminProductCounts = z.infer<typeof adminProductCountsSchema>;
|
|
412
|
+
type ProductIncompleteField = z.infer<typeof productIncompleteFieldSchema>;
|
|
394
413
|
|
|
395
414
|
declare const adminOrderListQuerySchema: z.ZodObject<{
|
|
396
415
|
status: z.ZodOptional<z.ZodEnum<{
|
|
@@ -544,7 +563,7 @@ declare const discountSchema: z.ZodObject<{
|
|
|
544
563
|
}>;
|
|
545
564
|
percentOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
546
565
|
amountOffCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
547
|
-
currency: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
566
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
548
567
|
id: z.ZodString;
|
|
549
568
|
code: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
550
569
|
}, z.core.$strip>;
|
|
@@ -560,7 +579,7 @@ declare const discountInputSchema: z.ZodObject<{
|
|
|
560
579
|
}>;
|
|
561
580
|
percentOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
562
581
|
amountOffCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
563
|
-
currency: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
582
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
564
583
|
code: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
565
584
|
}, z.core.$strip>;
|
|
566
585
|
declare const discountPatchSchema: z.ZodObject<{
|
|
@@ -575,7 +594,7 @@ declare const discountPatchSchema: z.ZodObject<{
|
|
|
575
594
|
}>>;
|
|
576
595
|
percentOff: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
577
596
|
amountOffCents: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
578
|
-
currency: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString
|
|
597
|
+
currency: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
579
598
|
code: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
580
599
|
}, z.core.$strip>;
|
|
581
600
|
declare const discountStatusSchema: z.ZodEnum<{
|
|
@@ -611,7 +630,7 @@ declare const adminDiscountPageSchema: z.ZodObject<{
|
|
|
611
630
|
}>;
|
|
612
631
|
percentOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
613
632
|
amountOffCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
614
|
-
currency: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
633
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
615
634
|
id: z.ZodString;
|
|
616
635
|
code: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
617
636
|
}, z.core.$strip>>;
|
|
@@ -663,5 +682,5 @@ type DiscountPreview = z.infer<typeof discountPreviewSchema>;
|
|
|
663
682
|
type DiscountRejectionReason = z.infer<typeof discountRejectionReasonSchema>;
|
|
664
683
|
type DiscountRejection = z.infer<typeof discountRejectionSchema>;
|
|
665
684
|
|
|
666
|
-
export { adminDiscountListQuerySchema, adminDiscountPageSchema, adminOrderDetailSchema, adminOrderListItemSchema, adminOrderListQuerySchema, adminOrderPageSchema, adminProductImageSchema, adminProductInputSchema, adminProductListQuerySchema, adminProductPageSchema, adminProductPatchSchema, adminProductSchema, availabilitySchema, cartLineSchema, categorySchema, checkoutConflictSchema, checkoutRequestSchema, checkoutResponseSchema, discountCodeSchema, discountInputSchema, discountPatchSchema, discountPreviewRequestSchema, discountPreviewSchema, discountRejectionReasonSchema, discountRejectionSchema, discountSchema, discountStatusSchema, discountTypeSchema, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefundSchema, orderStatusSchema, orderSummarySchema, productCardPageSchema, productCardSchema, productImagePatchSchema, productImageSchema, productListQuerySchema, productSchema, productStatusSchema, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
|
|
667
|
-
export type { AdminDiscountListQuery, AdminDiscountPage, AdminOrderDetail, AdminOrderListItem, AdminOrderListQuery, AdminOrderPage, AdminProduct, 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, ProductListQuery, ProductStatus, RefundOrderInput, ShipOrderInput, ShippingRate, ShippingRateInput };
|
|
685
|
+
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, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefundSchema, orderStatusSchema, orderSummarySchema, productCardPageSchema, productCardSchema, productImagePatchSchema, productImageSchema, productIncompleteFieldSchema, productListQuerySchema, productSchema, productStatusSchema, publishRequiredFields, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
|
|
686
|
+
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
|
@@ -39,17 +39,17 @@ declare const productSchema: z.ZodObject<{
|
|
|
39
39
|
}, z.core.$strip>;
|
|
40
40
|
declare const productCardSchema: z.ZodObject<{
|
|
41
41
|
currency: z.ZodString;
|
|
42
|
-
slug: z.ZodString;
|
|
43
|
-
name: z.ZodString;
|
|
44
|
-
priceCents: z.ZodNumber;
|
|
45
|
-
quantity: z.ZodNumber;
|
|
46
42
|
availability: z.ZodEnum<{
|
|
47
43
|
available: "available";
|
|
48
44
|
sold: "sold";
|
|
49
45
|
reserved: "reserved";
|
|
50
46
|
}>;
|
|
51
47
|
id: z.ZodString;
|
|
48
|
+
slug: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
priceCents: z.ZodNumber;
|
|
52
51
|
category: z.ZodString;
|
|
52
|
+
quantity: z.ZodNumber;
|
|
53
53
|
featured: z.ZodBoolean;
|
|
54
54
|
images: z.ZodArray<z.ZodObject<{
|
|
55
55
|
url: z.ZodString;
|
|
@@ -70,17 +70,17 @@ declare const productListQuerySchema: z.ZodObject<{
|
|
|
70
70
|
declare const productCardPageSchema: z.ZodObject<{
|
|
71
71
|
items: z.ZodArray<z.ZodObject<{
|
|
72
72
|
currency: z.ZodString;
|
|
73
|
-
slug: z.ZodString;
|
|
74
|
-
name: z.ZodString;
|
|
75
|
-
priceCents: z.ZodNumber;
|
|
76
|
-
quantity: z.ZodNumber;
|
|
77
73
|
availability: z.ZodEnum<{
|
|
78
74
|
available: "available";
|
|
79
75
|
sold: "sold";
|
|
80
76
|
reserved: "reserved";
|
|
81
77
|
}>;
|
|
82
78
|
id: z.ZodString;
|
|
79
|
+
slug: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
priceCents: z.ZodNumber;
|
|
83
82
|
category: z.ZodString;
|
|
83
|
+
quantity: z.ZodNumber;
|
|
84
84
|
featured: z.ZodBoolean;
|
|
85
85
|
images: z.ZodArray<z.ZodObject<{
|
|
86
86
|
url: z.ZodString;
|
|
@@ -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";
|
|
@@ -347,6 +348,8 @@ declare const adminProductListQuerySchema: z.ZodObject<{
|
|
|
347
348
|
draft: "draft";
|
|
348
349
|
archived: "archived";
|
|
349
350
|
}>>;
|
|
351
|
+
excludeArchived: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
352
|
+
incomplete: z.ZodOptional<z.ZodLiteral<"true">>;
|
|
350
353
|
stock: z.ZodOptional<z.ZodEnum<{
|
|
351
354
|
sold: "sold";
|
|
352
355
|
in: "in";
|
|
@@ -363,9 +366,9 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
363
366
|
description: z.ZodString;
|
|
364
367
|
materials: z.ZodNullable<z.ZodString>;
|
|
365
368
|
dimensions: z.ZodNullable<z.ZodString>;
|
|
366
|
-
priceCents: z.ZodNumber
|
|
369
|
+
priceCents: z.ZodNullable<z.ZodNumber>;
|
|
367
370
|
currency: z.ZodString;
|
|
368
|
-
category: z.ZodString
|
|
371
|
+
category: z.ZodNullable<z.ZodString>;
|
|
369
372
|
quantity: z.ZodNumber;
|
|
370
373
|
status: z.ZodEnum<{
|
|
371
374
|
active: "active";
|
|
@@ -382,6 +385,20 @@ declare const adminProductPageSchema: z.ZodObject<{
|
|
|
382
385
|
}, z.core.$strip>>;
|
|
383
386
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
384
387
|
}, z.core.$strip>;
|
|
388
|
+
declare const adminProductCountsSchema: z.ZodObject<{
|
|
389
|
+
all: z.ZodNumber;
|
|
390
|
+
live: z.ZodNumber;
|
|
391
|
+
draft: z.ZodNumber;
|
|
392
|
+
sold: z.ZodNumber;
|
|
393
|
+
archived: z.ZodNumber;
|
|
394
|
+
incompleteDrafts: z.ZodNumber;
|
|
395
|
+
}, z.core.$strip>;
|
|
396
|
+
declare const productIncompleteFieldSchema: z.ZodEnum<{
|
|
397
|
+
name: "name";
|
|
398
|
+
priceCents: "priceCents";
|
|
399
|
+
category: "category";
|
|
400
|
+
images: "images";
|
|
401
|
+
}>;
|
|
385
402
|
type ProductStatus = z.infer<typeof productStatusSchema>;
|
|
386
403
|
type AdminProductInput = z.input<typeof adminProductInputSchema>;
|
|
387
404
|
type AdminProductPatch = z.input<typeof adminProductPatchSchema>;
|
|
@@ -391,6 +408,8 @@ type ProductImagePatch = z.infer<typeof productImagePatchSchema>;
|
|
|
391
408
|
type ImageOrderInput = z.infer<typeof imageOrderInputSchema>;
|
|
392
409
|
type AdminProductListQuery = z.input<typeof adminProductListQuerySchema>;
|
|
393
410
|
type AdminProductPage = z.infer<typeof adminProductPageSchema>;
|
|
411
|
+
type AdminProductCounts = z.infer<typeof adminProductCountsSchema>;
|
|
412
|
+
type ProductIncompleteField = z.infer<typeof productIncompleteFieldSchema>;
|
|
394
413
|
|
|
395
414
|
declare const adminOrderListQuerySchema: z.ZodObject<{
|
|
396
415
|
status: z.ZodOptional<z.ZodEnum<{
|
|
@@ -544,7 +563,7 @@ declare const discountSchema: z.ZodObject<{
|
|
|
544
563
|
}>;
|
|
545
564
|
percentOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
546
565
|
amountOffCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
547
|
-
currency: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
566
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
548
567
|
id: z.ZodString;
|
|
549
568
|
code: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
550
569
|
}, z.core.$strip>;
|
|
@@ -560,7 +579,7 @@ declare const discountInputSchema: z.ZodObject<{
|
|
|
560
579
|
}>;
|
|
561
580
|
percentOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
562
581
|
amountOffCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
563
|
-
currency: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
582
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
564
583
|
code: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
565
584
|
}, z.core.$strip>;
|
|
566
585
|
declare const discountPatchSchema: z.ZodObject<{
|
|
@@ -575,7 +594,7 @@ declare const discountPatchSchema: z.ZodObject<{
|
|
|
575
594
|
}>>;
|
|
576
595
|
percentOff: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
577
596
|
amountOffCents: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
578
|
-
currency: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString
|
|
597
|
+
currency: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>>;
|
|
579
598
|
code: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
580
599
|
}, z.core.$strip>;
|
|
581
600
|
declare const discountStatusSchema: z.ZodEnum<{
|
|
@@ -611,7 +630,7 @@ declare const adminDiscountPageSchema: z.ZodObject<{
|
|
|
611
630
|
}>;
|
|
612
631
|
percentOff: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
613
632
|
amountOffCents: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
614
|
-
currency: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
633
|
+
currency: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
615
634
|
id: z.ZodString;
|
|
616
635
|
code: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
617
636
|
}, z.core.$strip>>;
|
|
@@ -663,5 +682,5 @@ type DiscountPreview = z.infer<typeof discountPreviewSchema>;
|
|
|
663
682
|
type DiscountRejectionReason = z.infer<typeof discountRejectionReasonSchema>;
|
|
664
683
|
type DiscountRejection = z.infer<typeof discountRejectionSchema>;
|
|
665
684
|
|
|
666
|
-
export { adminDiscountListQuerySchema, adminDiscountPageSchema, adminOrderDetailSchema, adminOrderListItemSchema, adminOrderListQuerySchema, adminOrderPageSchema, adminProductImageSchema, adminProductInputSchema, adminProductListQuerySchema, adminProductPageSchema, adminProductPatchSchema, adminProductSchema, availabilitySchema, cartLineSchema, categorySchema, checkoutConflictSchema, checkoutRequestSchema, checkoutResponseSchema, discountCodeSchema, discountInputSchema, discountPatchSchema, discountPreviewRequestSchema, discountPreviewSchema, discountRejectionReasonSchema, discountRejectionSchema, discountSchema, discountStatusSchema, discountTypeSchema, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefundSchema, orderStatusSchema, orderSummarySchema, productCardPageSchema, productCardSchema, productImagePatchSchema, productImageSchema, productListQuerySchema, productSchema, productStatusSchema, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
|
|
667
|
-
export type { AdminDiscountListQuery, AdminDiscountPage, AdminOrderDetail, AdminOrderListItem, AdminOrderListQuery, AdminOrderPage, AdminProduct, 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, ProductListQuery, ProductStatus, RefundOrderInput, ShipOrderInput, ShippingRate, ShippingRateInput };
|
|
685
|
+
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, imageOrderInputSchema, moneySchema, orderAddressSchema, orderDetailSchema, orderFulfillmentSchema, orderRefundSchema, orderStatusSchema, orderSummarySchema, productCardPageSchema, productCardSchema, productImagePatchSchema, productImageSchema, productIncompleteFieldSchema, productListQuerySchema, productSchema, productStatusSchema, publishRequiredFields, refundOrderInputSchema, shipOrderInputSchema, shippingRateSchema, shippingRatesInputSchema };
|
|
686
|
+
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
|
@@ -76,6 +76,7 @@ var discountTypeSchema = z4.enum(["percent", "fixed"]);
|
|
|
76
76
|
var discountCodeSchema = z4.string().transform((value) => value.trim().toUpperCase()).pipe(
|
|
77
77
|
z4.string().min(1).max(40).regex(/^[A-Z0-9_-]+$/)
|
|
78
78
|
);
|
|
79
|
+
var currencyInputSchema = z4.string().transform((value) => value.trim().toUpperCase()).pipe(z4.string().length(3));
|
|
79
80
|
var limitFields = {
|
|
80
81
|
minSubtotalCents: z4.number().int().positive().nullable().optional(),
|
|
81
82
|
startsAt: z4.string().min(1).nullable().optional(),
|
|
@@ -87,7 +88,7 @@ var discountValueFields = {
|
|
|
87
88
|
type: discountTypeSchema,
|
|
88
89
|
percentOff: z4.number().int().min(1).max(100).nullable().optional(),
|
|
89
90
|
amountOffCents: z4.number().int().positive().nullable().optional(),
|
|
90
|
-
currency:
|
|
91
|
+
currency: currencyInputSchema.nullable().optional()
|
|
91
92
|
};
|
|
92
93
|
var hasValue = (value) => value !== void 0 && value !== null;
|
|
93
94
|
function valueFieldsAgree(input) {
|
|
@@ -278,11 +279,31 @@ var productFields = z8.object({
|
|
|
278
279
|
status: productStatusSchema,
|
|
279
280
|
featured: z8.boolean()
|
|
280
281
|
});
|
|
282
|
+
var publishRequiredFields = [
|
|
283
|
+
"name",
|
|
284
|
+
"priceCents",
|
|
285
|
+
"category"
|
|
286
|
+
];
|
|
281
287
|
var adminProductInputSchema = productFields.extend({
|
|
288
|
+
name: z8.string().trim().default(""),
|
|
282
289
|
description: z8.string().default(""),
|
|
290
|
+
priceCents: productFields.shape.priceCents.optional(),
|
|
291
|
+
category: z8.string().trim().optional(),
|
|
283
292
|
quantity: z8.number().int().nonnegative().default(1),
|
|
284
293
|
status: productStatusSchema.default("draft"),
|
|
285
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
|
+
}
|
|
286
307
|
});
|
|
287
308
|
var adminProductPatchSchema = productFields.partial().extend({ sold: z8.boolean().optional() });
|
|
288
309
|
var adminProductImageSchema = z8.object({
|
|
@@ -294,13 +315,13 @@ var adminProductImageSchema = z8.object({
|
|
|
294
315
|
var adminProductSchema = z8.object({
|
|
295
316
|
id: z8.string().min(1),
|
|
296
317
|
slug: z8.string().min(1),
|
|
297
|
-
name: z8.string()
|
|
318
|
+
name: z8.string(),
|
|
298
319
|
description: z8.string(),
|
|
299
320
|
materials: z8.string().nullable(),
|
|
300
321
|
dimensions: z8.string().nullable(),
|
|
301
|
-
priceCents: z8.number().int().nonnegative(),
|
|
322
|
+
priceCents: z8.number().int().nonnegative().nullable(),
|
|
302
323
|
currency: z8.string().length(3),
|
|
303
|
-
category: z8.string().min(1),
|
|
324
|
+
category: z8.string().min(1).nullable(),
|
|
304
325
|
quantity: z8.number().int().nonnegative(),
|
|
305
326
|
status: productStatusSchema,
|
|
306
327
|
featured: z8.boolean(),
|
|
@@ -314,6 +335,8 @@ var productImagePatchSchema = z8.object({
|
|
|
314
335
|
});
|
|
315
336
|
var adminProductListQuerySchema = z8.object({
|
|
316
337
|
status: productStatusSchema.optional(),
|
|
338
|
+
excludeArchived: z8.literal("true").optional(),
|
|
339
|
+
incomplete: z8.literal("true").optional(),
|
|
317
340
|
stock: z8.enum(["in", "sold"]).optional(),
|
|
318
341
|
q: z8.string().trim().min(1).optional(),
|
|
319
342
|
cursor: z8.string().min(1).optional(),
|
|
@@ -323,6 +346,18 @@ var adminProductPageSchema = z8.object({
|
|
|
323
346
|
items: z8.array(adminProductSchema),
|
|
324
347
|
nextCursor: z8.string().nullable()
|
|
325
348
|
});
|
|
349
|
+
var adminProductCountsSchema = z8.object({
|
|
350
|
+
all: z8.number().int().nonnegative(),
|
|
351
|
+
live: z8.number().int().nonnegative(),
|
|
352
|
+
draft: z8.number().int().nonnegative(),
|
|
353
|
+
sold: z8.number().int().nonnegative(),
|
|
354
|
+
archived: z8.number().int().nonnegative(),
|
|
355
|
+
incompleteDrafts: z8.number().int().nonnegative()
|
|
356
|
+
});
|
|
357
|
+
var productIncompleteFieldSchema = z8.enum([
|
|
358
|
+
...publishRequiredFields,
|
|
359
|
+
"images"
|
|
360
|
+
]);
|
|
326
361
|
|
|
327
362
|
// src/admin-orders.ts
|
|
328
363
|
import { z as z9 } from "zod";
|
|
@@ -369,6 +404,7 @@ export {
|
|
|
369
404
|
adminOrderListItemSchema,
|
|
370
405
|
adminOrderListQuerySchema,
|
|
371
406
|
adminOrderPageSchema,
|
|
407
|
+
adminProductCountsSchema,
|
|
372
408
|
adminProductImageSchema,
|
|
373
409
|
adminProductInputSchema,
|
|
374
410
|
adminProductListQuerySchema,
|
|
@@ -403,9 +439,11 @@ export {
|
|
|
403
439
|
productCardSchema,
|
|
404
440
|
productImagePatchSchema,
|
|
405
441
|
productImageSchema,
|
|
442
|
+
productIncompleteFieldSchema,
|
|
406
443
|
productListQuerySchema,
|
|
407
444
|
productSchema,
|
|
408
445
|
productStatusSchema,
|
|
446
|
+
publishRequiredFields,
|
|
409
447
|
refundOrderInputSchema,
|
|
410
448
|
shipOrderInputSchema,
|
|
411
449
|
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 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: z.string().length(3).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,GAA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3C,OAAOA,GAAE,MAAM,wBAAwB;AAAA,EACvC,YAAYA,GAAE,OAAO,EAAE,SAAS;AAClC,CAAC;AAEM,IAAM,yBAAyB,kBAAkB,OAAO;AAAA,EAC7D,SAASA,GAAE,MAAM,iBAAiB;AAAA,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"],"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 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>;\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AA,EACzC,UAAUA,GAAE,OAAO,EAAE,OAAO,CAAC;AAAA,EAC7B,WAAWA,GAAE,OAAO,EAAE,IAAI,EAAE,YAAY;AAAA,EACxC,WAAWA,GAAE,OAAO,EAAE,IAAI,CAAC;AAC7B,CAAC;AAEM,IAAM,uBAAuBA,GAAE,OAAO;AAAA,EAC3C,OAAOA,GAAE,MAAM,wBAAwB;AAAA,EACvC,YAAYA,GAAE,OAAO,EAAE,SAAS;AAClC,CAAC;AAEM,IAAM,yBAAyB,kBAAkB,OAAO;AAAA,EAC7D,SAASA,GAAE,MAAM,iBAAiB;AAAA,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develemit/commerce-contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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"
|