@labdigital/commercetools-mock 2.66.0 → 3.0.0-beta.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/README.md +31 -8
- package/dist/abstract-BKFcva6S.mjs +1044 -0
- package/dist/abstract-BKFcva6S.mjs.map +1 -0
- package/dist/config-BcNSzPZz.d.mts +1718 -0
- package/dist/index.d.mts +50 -1633
- package/dist/index.mjs +3769 -2653
- package/dist/index.mjs.map +1 -1
- package/dist/storage/sqlite.d.mts +59 -0
- package/dist/storage/sqlite.mjs +234 -0
- package/dist/storage/sqlite.mjs.map +1 -0
- package/package.json +26 -29
- package/src/ctMock.ts +125 -136
- package/src/helpers.ts +14 -6
- package/src/index.ts +5 -0
- package/src/lib/masking.ts +4 -5
- package/src/lib/product-review-statistics.test.ts +257 -294
- package/src/lib/review-statistics.ts +17 -4
- package/src/oauth/helpers.ts +7 -4
- package/src/oauth/server.test.ts +102 -62
- package/src/oauth/server.ts +215 -213
- package/src/oauth/store.ts +20 -6
- package/src/orderSearch.ts +3 -3
- package/src/product-projection-search.ts +38 -20
- package/src/product-search-availability.test.ts +31 -52
- package/src/product-search.ts +19 -10
- package/src/projectAPI.ts +6 -22
- package/src/repositories/abstract.ts +182 -48
- package/src/repositories/as-associate.test.ts +19 -19
- package/src/repositories/associate-role.ts +12 -23
- package/src/repositories/attribute-group.test.ts +23 -23
- package/src/repositories/attribute-group.ts +6 -4
- package/src/repositories/business-unit.test.ts +63 -57
- package/src/repositories/business-unit.ts +107 -55
- package/src/repositories/cart/actions.ts +96 -65
- package/src/repositories/cart/helpers.ts +15 -11
- package/src/repositories/cart/index.test.ts +136 -30
- package/src/repositories/cart/index.ts +76 -59
- package/src/repositories/cart-discount/actions.ts +12 -44
- package/src/repositories/cart-discount/index.ts +20 -8
- package/src/repositories/category/actions.ts +27 -27
- package/src/repositories/category/index.test.ts +13 -9
- package/src/repositories/category/index.ts +40 -23
- package/src/repositories/channel.test.ts +53 -51
- package/src/repositories/channel.ts +12 -22
- package/src/repositories/custom-object.ts +34 -25
- package/src/repositories/customer/actions.ts +47 -25
- package/src/repositories/customer/index.test.ts +11 -11
- package/src/repositories/customer/index.ts +65 -35
- package/src/repositories/customer-group.test.ts +44 -42
- package/src/repositories/customer-group.ts +12 -22
- package/src/repositories/discount-code/actions.ts +3 -19
- package/src/repositories/discount-code/index.ts +9 -4
- package/src/repositories/discount-group/index.ts +8 -3
- package/src/repositories/extension.test.ts +27 -27
- package/src/repositories/extension.ts +10 -5
- package/src/repositories/helpers.ts +126 -47
- package/src/repositories/inventory-entry/actions.ts +3 -24
- package/src/repositories/inventory-entry/index.ts +19 -11
- package/src/repositories/my-customer.ts +13 -12
- package/src/repositories/my-order.ts +5 -2
- package/src/repositories/order/actions.ts +84 -56
- package/src/repositories/order/index.test.ts +36 -31
- package/src/repositories/order/index.ts +83 -49
- package/src/repositories/order-edit.ts +8 -3
- package/src/repositories/payment/actions.ts +64 -44
- package/src/repositories/payment/helpers.ts +3 -3
- package/src/repositories/payment/index.ts +28 -12
- package/src/repositories/product/actions.ts +133 -98
- package/src/repositories/product/helpers.ts +29 -16
- package/src/repositories/product/index.ts +42 -25
- package/src/repositories/product-discount.ts +6 -4
- package/src/repositories/product-projection.ts +41 -21
- package/src/repositories/product-selection.ts +8 -15
- package/src/repositories/product-tailoring.ts +22 -3
- package/src/repositories/product-type.ts +45 -4
- package/src/repositories/project.ts +57 -13
- package/src/repositories/quote/actions.ts +5 -28
- package/src/repositories/quote/index.ts +29 -6
- package/src/repositories/quote-request/actions.ts +5 -28
- package/src/repositories/quote-request/index.test.ts +3 -3
- package/src/repositories/quote-request/index.ts +31 -11
- package/src/repositories/quote-staged/actions.ts +5 -28
- package/src/repositories/quote-staged/index.ts +22 -8
- package/src/repositories/recurrence-policy/index.ts +6 -4
- package/src/repositories/recurring-order/actions.ts +7 -32
- package/src/repositories/recurring-order/index.ts +8 -6
- package/src/repositories/review.test.ts +147 -142
- package/src/repositories/review.ts +31 -37
- package/src/repositories/shipping-method/actions.ts +11 -28
- package/src/repositories/shipping-method/index.ts +26 -15
- package/src/repositories/shopping-list/actions.ts +21 -31
- package/src/repositories/shopping-list/index.ts +44 -22
- package/src/repositories/standalone-price.ts +6 -4
- package/src/repositories/state.ts +15 -9
- package/src/repositories/store.ts +21 -32
- package/src/repositories/subscription.test.ts +22 -22
- package/src/repositories/subscription.ts +8 -3
- package/src/repositories/tax-category/index.ts +8 -3
- package/src/repositories/type/actions.ts +21 -3
- package/src/repositories/type/index.ts +5 -3
- package/src/repositories/zone.test.ts +112 -77
- package/src/repositories/zone.ts +5 -3
- package/src/schemas/generated/associate-role.ts +13 -0
- package/src/schemas/generated/attribute-group.ts +12 -0
- package/src/schemas/generated/business-unit.ts +38 -0
- package/src/schemas/generated/cart-discount.ts +33 -0
- package/src/schemas/generated/cart.ts +61 -0
- package/src/schemas/generated/category.ts +25 -0
- package/src/schemas/generated/channel.ts +21 -0
- package/src/schemas/generated/common.ts +1372 -0
- package/src/schemas/generated/custom-object.ts +11 -0
- package/src/schemas/generated/customer-group.ts +11 -0
- package/src/schemas/generated/customer.ts +47 -0
- package/src/schemas/generated/discount-code.ts +25 -0
- package/src/schemas/generated/discount-group.ts +13 -0
- package/src/schemas/generated/extension.ts +15 -0
- package/src/schemas/generated/index.ts +42 -0
- package/src/schemas/generated/inventory-entry.ts +20 -0
- package/src/schemas/generated/my-quote-request.ts +10 -0
- package/src/schemas/generated/order-edit.ts +18 -0
- package/src/schemas/generated/order-from-cart.ts +25 -0
- package/src/schemas/generated/payment.ts +30 -0
- package/src/schemas/generated/product-discount.ts +20 -0
- package/src/schemas/generated/product-selection.ts +18 -0
- package/src/schemas/generated/product-tailoring.ts +26 -0
- package/src/schemas/generated/product-type.ts +12 -0
- package/src/schemas/generated/product.ts +37 -0
- package/src/schemas/generated/quote-request.ts +19 -0
- package/src/schemas/generated/quote.ts +18 -0
- package/src/schemas/generated/recurrence-policy.ts +15 -0
- package/src/schemas/generated/recurring-order.ts +19 -0
- package/src/schemas/generated/review.ts +24 -0
- package/src/schemas/generated/shipping-method.ts +24 -0
- package/src/schemas/generated/shopping-list.ts +28 -0
- package/src/schemas/generated/staged-quote.ts +18 -0
- package/src/schemas/generated/standalone-price.ts +32 -0
- package/src/schemas/generated/state.ts +20 -0
- package/src/schemas/generated/store.ts +23 -0
- package/src/schemas/generated/subscription.ts +20 -0
- package/src/schemas/generated/tax-category.ts +12 -0
- package/src/schemas/generated/type.ts +17 -0
- package/src/schemas/generated/zone.ts +12 -0
- package/src/schemas/update-request.ts +3 -5
- package/src/server.ts +32 -4
- package/src/services/abstract.ts +207 -101
- package/src/services/as-associate-cart.test.ts +28 -36
- package/src/services/as-associate-cart.ts +15 -12
- package/src/services/as-associate-order.test.ts +33 -40
- package/src/services/as-associate-order.ts +15 -12
- package/src/services/as-associate-quote-request.ts +15 -12
- package/src/services/as-associate-shopping-list.test.ts +25 -35
- package/src/services/as-associate-shopping-list.ts +15 -12
- package/src/services/as-associate.test.ts +21 -15
- package/src/services/as-associate.ts +23 -22
- package/src/services/associate-roles.test.ts +16 -22
- package/src/services/associate-roles.ts +2 -2
- package/src/services/attribute-group.test.ts +40 -44
- package/src/services/attribute-group.ts +2 -2
- package/src/services/business-units.test.ts +227 -163
- package/src/services/business-units.ts +2 -2
- package/src/services/cart-discount.test.ts +253 -187
- package/src/services/cart-discount.ts +2 -2
- package/src/services/cart.test.ts +833 -832
- package/src/services/cart.ts +31 -12
- package/src/services/category.test.ts +208 -130
- package/src/services/category.ts +2 -2
- package/src/services/channel.test.ts +39 -44
- package/src/services/channel.ts +2 -2
- package/src/services/custom-object.test.ts +103 -79
- package/src/services/custom-object.ts +106 -38
- package/src/services/customer-group.test.ts +39 -44
- package/src/services/customer-group.ts +2 -2
- package/src/services/customer.test.ts +357 -292
- package/src/services/customer.ts +70 -23
- package/src/services/discount-code.test.ts +57 -68
- package/src/services/discount-code.ts +2 -2
- package/src/services/discount-group.test.ts +111 -134
- package/src/services/discount-group.ts +2 -2
- package/src/services/draft-validation.test.ts +255 -0
- package/src/services/extension.test.ts +39 -44
- package/src/services/extension.ts +2 -2
- package/src/services/inventory-entry.test.ts +106 -87
- package/src/services/inventory-entry.ts +2 -2
- package/src/services/my-business-unit.test.ts +82 -112
- package/src/services/my-business-unit.ts +25 -19
- package/src/services/my-cart.test.ts +46 -41
- package/src/services/my-cart.ts +32 -28
- package/src/services/my-customer.test.ts +153 -88
- package/src/services/my-customer.ts +130 -61
- package/src/services/my-order.ts +15 -12
- package/src/services/my-payment.test.ts +30 -24
- package/src/services/my-payment.ts +2 -2
- package/src/services/my-shopping-list.ts +2 -2
- package/src/services/order.test.ts +332 -276
- package/src/services/order.ts +45 -27
- package/src/services/payment.test.ts +31 -29
- package/src/services/payment.ts +2 -2
- package/src/services/product-discount.test.ts +39 -46
- package/src/services/product-discount.ts +2 -2
- package/src/services/product-projection.test.ts +176 -166
- package/src/services/product-projection.ts +31 -15
- package/src/services/product-selection.test.ts +17 -9
- package/src/services/product-selection.ts +2 -2
- package/src/services/product-type.test.ts +80 -21
- package/src/services/product-type.ts +2 -2
- package/src/services/product.test.ts +569 -534
- package/src/services/product.ts +14 -7
- package/src/services/project.test.ts +22 -12
- package/src/services/project.ts +28 -13
- package/src/services/quote-request.test.ts +36 -39
- package/src/services/quote-request.ts +2 -2
- package/src/services/quote-staged.ts +2 -2
- package/src/services/quote.ts +2 -2
- package/src/services/recurrence-policy.test.ts +114 -139
- package/src/services/recurrence-policy.ts +2 -2
- package/src/services/recurring-order.test.ts +149 -194
- package/src/services/recurring-order.ts +2 -2
- package/src/services/reviews.test.ts +127 -106
- package/src/services/reviews.ts +2 -2
- package/src/services/shipping-method.test.ts +96 -125
- package/src/services/shipping-method.ts +24 -12
- package/src/services/shopping-list.test.ts +183 -141
- package/src/services/shopping-list.ts +2 -2
- package/src/services/standalone-price.test.ts +60 -46
- package/src/services/standalone-price.ts +2 -2
- package/src/services/state.test.ts +20 -25
- package/src/services/state.ts +2 -2
- package/src/services/store.test.ts +26 -45
- package/src/services/store.ts +2 -2
- package/src/services/subscription.test.ts +39 -44
- package/src/services/subscription.ts +2 -2
- package/src/services/tax-category.test.ts +33 -36
- package/src/services/tax-category.ts +2 -2
- package/src/services/type.test.ts +45 -44
- package/src/services/type.ts +2 -2
- package/src/services/zone.test.ts +40 -44
- package/src/services/zone.ts +2 -2
- package/src/shipping.ts +41 -11
- package/src/storage/abstract.ts +248 -17
- package/src/storage/in-memory.ts +147 -290
- package/src/storage/sqlite.ts +429 -0
- package/src/storage/storage-map.ts +75 -0
- package/src/storage/storage.test-helpers.ts +97 -0
- package/src/storage/storage.test.ts +802 -0
- package/src/testing/associate-role.ts +28 -0
- package/src/testing/attribute-group.ts +27 -0
- package/src/testing/business-unit.ts +9 -8
- package/src/testing/cart-discount.ts +34 -0
- package/src/testing/cart.ts +20 -0
- package/src/testing/category.ts +25 -0
- package/src/testing/channel.ts +23 -0
- package/src/testing/custom-object.ts +27 -0
- package/src/testing/customer-group.ts +26 -0
- package/src/testing/customer.ts +36 -33
- package/src/testing/discount-code.ts +29 -0
- package/src/testing/discount-group.ts +27 -0
- package/src/testing/extension.ts +32 -0
- package/src/testing/index.ts +33 -0
- package/src/testing/inventory-entry.ts +26 -0
- package/src/testing/order.ts +27 -0
- package/src/testing/payment.ts +23 -0
- package/src/testing/product-discount.ts +33 -0
- package/src/testing/product-selection.ts +28 -0
- package/src/testing/product-type.ts +27 -0
- package/src/testing/product.ts +38 -0
- package/src/testing/quote-request.ts +29 -0
- package/src/testing/recurrence-policy.ts +33 -0
- package/src/testing/recurring-order.ts +32 -0
- package/src/testing/review.ts +24 -0
- package/src/testing/shipping-method.ts +31 -0
- package/src/testing/shopping-list.ts +25 -0
- package/src/testing/standalone-price.ts +31 -0
- package/src/testing/state.ts +21 -0
- package/src/testing/store.ts +26 -0
- package/src/testing/subscription.ts +38 -0
- package/src/testing/tax-category.ts +27 -0
- package/src/testing/type.ts +9 -6
- package/src/testing/zone.ts +22 -0
- package/src/validate.test.ts +122 -0
- package/src/validate.ts +78 -7
- package/src/.env +0 -0
|
@@ -0,0 +1,1372 @@
|
|
|
1
|
+
// This file is auto-generated by scripts/generate-schemas.ts
|
|
2
|
+
// Do not edit manually.
|
|
3
|
+
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
export const PermissionSchema = z.enum([
|
|
7
|
+
"AddChildUnits",
|
|
8
|
+
"UpdateAssociates",
|
|
9
|
+
"UpdateBusinessUnitDetails",
|
|
10
|
+
"UpdateParentUnit",
|
|
11
|
+
"ViewMyCarts",
|
|
12
|
+
"ViewOthersCarts",
|
|
13
|
+
"UpdateMyCarts",
|
|
14
|
+
"UpdateOthersCarts",
|
|
15
|
+
"CreateMyCarts",
|
|
16
|
+
"CreateOthersCarts",
|
|
17
|
+
"DeleteMyCarts",
|
|
18
|
+
"DeleteOthersCarts",
|
|
19
|
+
"ViewMyOrders",
|
|
20
|
+
"ViewOthersOrders",
|
|
21
|
+
"UpdateMyOrders",
|
|
22
|
+
"UpdateOthersOrders",
|
|
23
|
+
"CreateMyOrdersFromMyCarts",
|
|
24
|
+
"CreateMyOrdersFromMyQuotes",
|
|
25
|
+
"CreateOrdersFromOthersCarts",
|
|
26
|
+
"CreateOrdersFromOthersQuotes",
|
|
27
|
+
"ViewMyQuotes",
|
|
28
|
+
"ViewOthersQuotes",
|
|
29
|
+
"AcceptMyQuotes",
|
|
30
|
+
"AcceptOthersQuotes",
|
|
31
|
+
"DeclineMyQuotes",
|
|
32
|
+
"DeclineOthersQuotes",
|
|
33
|
+
"RenegotiateMyQuotes",
|
|
34
|
+
"RenegotiateOthersQuotes",
|
|
35
|
+
"ReassignMyQuotes",
|
|
36
|
+
"ReassignOthersQuotes",
|
|
37
|
+
"ViewMyQuoteRequests",
|
|
38
|
+
"ViewOthersQuoteRequests",
|
|
39
|
+
"UpdateMyQuoteRequests",
|
|
40
|
+
"UpdateOthersQuoteRequests",
|
|
41
|
+
"CreateMyQuoteRequestsFromMyCarts",
|
|
42
|
+
"CreateQuoteRequestsFromOthersCarts",
|
|
43
|
+
"CreateApprovalRules",
|
|
44
|
+
"UpdateApprovalRules",
|
|
45
|
+
"UpdateApprovalFlows",
|
|
46
|
+
"ViewMyShoppingLists",
|
|
47
|
+
"ViewOthersShoppingLists",
|
|
48
|
+
"UpdateMyShoppingLists",
|
|
49
|
+
"UpdateOthersShoppingLists",
|
|
50
|
+
"CreateMyShoppingLists",
|
|
51
|
+
"CreateOthersShoppingLists",
|
|
52
|
+
"DeleteMyShoppingLists",
|
|
53
|
+
"DeleteOthersShoppingLists",
|
|
54
|
+
]);
|
|
55
|
+
|
|
56
|
+
export const ReferenceTypeIdSchema = z.enum([
|
|
57
|
+
"approval-flow",
|
|
58
|
+
"approval-rule",
|
|
59
|
+
"associate-role",
|
|
60
|
+
"attribute-group",
|
|
61
|
+
"business-unit",
|
|
62
|
+
"cart",
|
|
63
|
+
"cart-discount",
|
|
64
|
+
"category",
|
|
65
|
+
"channel",
|
|
66
|
+
"customer",
|
|
67
|
+
"customer-email-token",
|
|
68
|
+
"customer-group",
|
|
69
|
+
"customer-password-token",
|
|
70
|
+
"direct-discount",
|
|
71
|
+
"discount-code",
|
|
72
|
+
"discount-group",
|
|
73
|
+
"extension",
|
|
74
|
+
"inventory-entry",
|
|
75
|
+
"key-value-document",
|
|
76
|
+
"order",
|
|
77
|
+
"order-edit",
|
|
78
|
+
"payment-method",
|
|
79
|
+
"payment",
|
|
80
|
+
"product",
|
|
81
|
+
"product-discount",
|
|
82
|
+
"product-price",
|
|
83
|
+
"product-selection",
|
|
84
|
+
"product-tailoring",
|
|
85
|
+
"product-type",
|
|
86
|
+
"quote",
|
|
87
|
+
"quote-request",
|
|
88
|
+
"recurrence-policy",
|
|
89
|
+
"recurring-order",
|
|
90
|
+
"review",
|
|
91
|
+
"shipping-method",
|
|
92
|
+
"shopping-list",
|
|
93
|
+
"staged-quote",
|
|
94
|
+
"standalone-price",
|
|
95
|
+
"state",
|
|
96
|
+
"store",
|
|
97
|
+
"subscription",
|
|
98
|
+
"tax-category",
|
|
99
|
+
"type",
|
|
100
|
+
"zone",
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
export const BusinessUnitStatusSchema = z.enum(["Active", "Inactive"]);
|
|
104
|
+
|
|
105
|
+
export const BusinessUnitStoreModeSchema = z.enum(["Explicit", "FromParent"]);
|
|
106
|
+
|
|
107
|
+
export const BusinessUnitTypeSchema = z.enum(["Company", "Division"]);
|
|
108
|
+
|
|
109
|
+
export const BusinessUnitAssociateModeSchema = z.enum([
|
|
110
|
+
"Explicit",
|
|
111
|
+
"ExplicitAndFromParent",
|
|
112
|
+
]);
|
|
113
|
+
|
|
114
|
+
export const AssociateRoleInheritanceModeSchema = z.enum([
|
|
115
|
+
"Enabled",
|
|
116
|
+
"Disabled",
|
|
117
|
+
]);
|
|
118
|
+
|
|
119
|
+
export const AssociateRoleDeprecatedSchema = z.enum(["Admin", "Buyer"]);
|
|
120
|
+
|
|
121
|
+
export const BusinessUnitApprovalRuleModeSchema = z.enum([
|
|
122
|
+
"Explicit",
|
|
123
|
+
"ExplicitAndFromParent",
|
|
124
|
+
]);
|
|
125
|
+
|
|
126
|
+
export const InventoryModeSchema = z.enum([
|
|
127
|
+
"None",
|
|
128
|
+
"TrackOnly",
|
|
129
|
+
"ReserveOnOrder",
|
|
130
|
+
]);
|
|
131
|
+
|
|
132
|
+
export const PriceSelectionModeSchema = z.enum(["Fixed", "Dynamic"]);
|
|
133
|
+
|
|
134
|
+
export const CustomLineItemPriceModeSchema = z.enum(["Standard", "External"]);
|
|
135
|
+
|
|
136
|
+
export const TaxModeSchema = z.enum([
|
|
137
|
+
"Platform",
|
|
138
|
+
"External",
|
|
139
|
+
"ExternalAmount",
|
|
140
|
+
"Disabled",
|
|
141
|
+
]);
|
|
142
|
+
|
|
143
|
+
export const RoundingModeSchema = z.enum(["HalfEven", "HalfUp", "HalfDown"]);
|
|
144
|
+
|
|
145
|
+
export const TaxCalculationModeSchema = z.enum([
|
|
146
|
+
"LineItemLevel",
|
|
147
|
+
"UnitPriceLevel",
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
export const ShippingModeSchema = z.enum(["Single", "Multiple"]);
|
|
151
|
+
|
|
152
|
+
export const ShippingRateTierTypeSchema = z.enum([
|
|
153
|
+
"CartValue",
|
|
154
|
+
"CartClassification",
|
|
155
|
+
"CartScore",
|
|
156
|
+
]);
|
|
157
|
+
|
|
158
|
+
export const CartOriginSchema = z.enum([
|
|
159
|
+
"Customer",
|
|
160
|
+
"Merchant",
|
|
161
|
+
"Quote",
|
|
162
|
+
"RecurringOrder",
|
|
163
|
+
]);
|
|
164
|
+
|
|
165
|
+
export const DiscountApplicationModeSchema = z.enum([
|
|
166
|
+
"ProportionateDistribution",
|
|
167
|
+
"EvenDistribution",
|
|
168
|
+
"IndividualApplication",
|
|
169
|
+
]);
|
|
170
|
+
|
|
171
|
+
export const MoneyTypeSchema = z.enum(["centPrecision", "highPrecision"]);
|
|
172
|
+
|
|
173
|
+
export const StackingModeSchema = z.enum(["Stacking", "StopAfterThisDiscount"]);
|
|
174
|
+
|
|
175
|
+
export const ChannelRoleEnumSchema = z.enum([
|
|
176
|
+
"InventorySupply",
|
|
177
|
+
"ProductDistribution",
|
|
178
|
+
"OrderExport",
|
|
179
|
+
"OrderImport",
|
|
180
|
+
"Primary",
|
|
181
|
+
]);
|
|
182
|
+
|
|
183
|
+
export const AuthenticationModeSchema = z.enum(["Password", "ExternalAuth"]);
|
|
184
|
+
|
|
185
|
+
export const ExtensionResourceTypeIdSchema = z.enum([
|
|
186
|
+
"cart",
|
|
187
|
+
"order",
|
|
188
|
+
"payment",
|
|
189
|
+
"payment-method",
|
|
190
|
+
"customer",
|
|
191
|
+
"customer-group",
|
|
192
|
+
"quote-request",
|
|
193
|
+
"staged-quote",
|
|
194
|
+
"quote",
|
|
195
|
+
"business-unit",
|
|
196
|
+
"shopping-list",
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
export const ExtensionActionSchema = z.enum(["Create", "Update"]);
|
|
200
|
+
|
|
201
|
+
export const PaymentStateSchema = z.enum([
|
|
202
|
+
"BalanceDue",
|
|
203
|
+
"Failed",
|
|
204
|
+
"Pending",
|
|
205
|
+
"CreditOwed",
|
|
206
|
+
"Paid",
|
|
207
|
+
]);
|
|
208
|
+
|
|
209
|
+
export const ShipmentStateSchema = z.enum([
|
|
210
|
+
"Shipped",
|
|
211
|
+
"Delivered",
|
|
212
|
+
"Ready",
|
|
213
|
+
"Pending",
|
|
214
|
+
"Delayed",
|
|
215
|
+
"Partial",
|
|
216
|
+
"Backorder",
|
|
217
|
+
"Canceled",
|
|
218
|
+
]);
|
|
219
|
+
|
|
220
|
+
export const OrderStateSchema = z.enum([
|
|
221
|
+
"Open",
|
|
222
|
+
"Confirmed",
|
|
223
|
+
"Complete",
|
|
224
|
+
"Cancelled",
|
|
225
|
+
]);
|
|
226
|
+
|
|
227
|
+
export const TransactionTypeSchema = z.enum([
|
|
228
|
+
"Authorization",
|
|
229
|
+
"CancelAuthorization",
|
|
230
|
+
"Charge",
|
|
231
|
+
"Refund",
|
|
232
|
+
"Chargeback",
|
|
233
|
+
]);
|
|
234
|
+
|
|
235
|
+
export const TransactionStateSchema = z.enum([
|
|
236
|
+
"Initial",
|
|
237
|
+
"Pending",
|
|
238
|
+
"Success",
|
|
239
|
+
"Failure",
|
|
240
|
+
]);
|
|
241
|
+
|
|
242
|
+
export const ProductPriceModeEnumSchema = z.enum(["Embedded", "Standalone"]);
|
|
243
|
+
|
|
244
|
+
export const ProductSelectionTypeEnumSchema = z.enum([
|
|
245
|
+
"individual",
|
|
246
|
+
"individualExclusion",
|
|
247
|
+
]);
|
|
248
|
+
|
|
249
|
+
export const ProductSelectionModeSchema = z.enum([
|
|
250
|
+
"Individual",
|
|
251
|
+
"IndividualExclusion",
|
|
252
|
+
]);
|
|
253
|
+
|
|
254
|
+
export const AttributeLevelEnumSchema = z.enum(["Product", "Variant"]);
|
|
255
|
+
|
|
256
|
+
export const AttributeConstraintEnumSchema = z.enum([
|
|
257
|
+
"None",
|
|
258
|
+
"Unique",
|
|
259
|
+
"CombinationUnique",
|
|
260
|
+
"SameForAll",
|
|
261
|
+
]);
|
|
262
|
+
|
|
263
|
+
export const TextInputHintSchema = z.enum(["SingleLine", "MultiLine"]);
|
|
264
|
+
|
|
265
|
+
export const IntervalUnitSchema = z.enum(["Days", "Weeks", "Months"]);
|
|
266
|
+
|
|
267
|
+
export const StateTypeEnumSchema = z.enum([
|
|
268
|
+
"OrderState",
|
|
269
|
+
"RecurringOrderState",
|
|
270
|
+
"LineItemState",
|
|
271
|
+
"ProductState",
|
|
272
|
+
"ReviewState",
|
|
273
|
+
"PaymentState",
|
|
274
|
+
"QuoteRequestState",
|
|
275
|
+
"StagedQuoteState",
|
|
276
|
+
"QuoteState",
|
|
277
|
+
]);
|
|
278
|
+
|
|
279
|
+
export const StateRoleEnumSchema = z.enum([
|
|
280
|
+
"ReviewIncludedInStatistics",
|
|
281
|
+
"Return",
|
|
282
|
+
]);
|
|
283
|
+
|
|
284
|
+
export const MessageSubscriptionResourceTypeIdSchema = z.enum([
|
|
285
|
+
"approval-flow",
|
|
286
|
+
"approval-rule",
|
|
287
|
+
"associate-role",
|
|
288
|
+
"business-unit",
|
|
289
|
+
"category",
|
|
290
|
+
"customer",
|
|
291
|
+
"customer-email-token",
|
|
292
|
+
"customer-group",
|
|
293
|
+
"customer-password-token",
|
|
294
|
+
"inventory-entry",
|
|
295
|
+
"order",
|
|
296
|
+
"payment",
|
|
297
|
+
"product",
|
|
298
|
+
"product-selection",
|
|
299
|
+
"product-tailoring",
|
|
300
|
+
"quote",
|
|
301
|
+
"quote-request",
|
|
302
|
+
"review",
|
|
303
|
+
"shopping-list",
|
|
304
|
+
"staged-quote",
|
|
305
|
+
"standalone-price",
|
|
306
|
+
"store",
|
|
307
|
+
]);
|
|
308
|
+
|
|
309
|
+
export const ChangeSubscriptionResourceTypeIdSchema = z.enum([
|
|
310
|
+
"approval-flow",
|
|
311
|
+
"approval-rule",
|
|
312
|
+
"associate-role",
|
|
313
|
+
"attribute-group",
|
|
314
|
+
"business-unit",
|
|
315
|
+
"cart",
|
|
316
|
+
"cart-discount",
|
|
317
|
+
"category",
|
|
318
|
+
"channel",
|
|
319
|
+
"customer",
|
|
320
|
+
"customer-email-token",
|
|
321
|
+
"customer-group",
|
|
322
|
+
"customer-password-token",
|
|
323
|
+
"discount-code",
|
|
324
|
+
"discount-group",
|
|
325
|
+
"extension",
|
|
326
|
+
"inventory-entry",
|
|
327
|
+
"key-value-document",
|
|
328
|
+
"order",
|
|
329
|
+
"order-edit",
|
|
330
|
+
"payment",
|
|
331
|
+
"product",
|
|
332
|
+
"product-discount",
|
|
333
|
+
"product-selection",
|
|
334
|
+
"product-tailoring",
|
|
335
|
+
"product-type",
|
|
336
|
+
"quote",
|
|
337
|
+
"quote-request",
|
|
338
|
+
"recurrence-policy",
|
|
339
|
+
"recurring-order",
|
|
340
|
+
"review",
|
|
341
|
+
"shipping-method",
|
|
342
|
+
"shopping-list",
|
|
343
|
+
"staged-quote",
|
|
344
|
+
"standalone-price",
|
|
345
|
+
"state",
|
|
346
|
+
"store",
|
|
347
|
+
"subscription",
|
|
348
|
+
"tax-category",
|
|
349
|
+
"type",
|
|
350
|
+
"zone",
|
|
351
|
+
]);
|
|
352
|
+
|
|
353
|
+
export const EventSubscriptionResourceTypeIdSchema = z.enum([
|
|
354
|
+
"checkout",
|
|
355
|
+
"import-api",
|
|
356
|
+
]);
|
|
357
|
+
|
|
358
|
+
export const EventTypeSchema = z.enum([
|
|
359
|
+
"CheckoutOrderCreationFailed",
|
|
360
|
+
"CheckoutPaymentAuthorizationCancelled",
|
|
361
|
+
"CheckoutPaymentAuthorizationFailed",
|
|
362
|
+
"CheckoutPaymentAuthorized",
|
|
363
|
+
"CheckoutPaymentCancelAuthorizationFailed",
|
|
364
|
+
"CheckoutPaymentCharged",
|
|
365
|
+
"CheckoutPaymentChargeFailed",
|
|
366
|
+
"CheckoutPaymentRefunded",
|
|
367
|
+
"CheckoutPaymentRefundFailed",
|
|
368
|
+
"ImportContainerCreated",
|
|
369
|
+
"ImportContainerDeleted",
|
|
370
|
+
"ImportOperationRejected",
|
|
371
|
+
"ImportUnresolved",
|
|
372
|
+
"ImportValidationFailed",
|
|
373
|
+
"ImportWaitForMasterVariant",
|
|
374
|
+
]);
|
|
375
|
+
|
|
376
|
+
export const ResourceTypeIdSchema = z.enum([
|
|
377
|
+
"address",
|
|
378
|
+
"asset",
|
|
379
|
+
"approval-flow",
|
|
380
|
+
"approval-rule",
|
|
381
|
+
"associate-role",
|
|
382
|
+
"business-unit",
|
|
383
|
+
"cart-discount",
|
|
384
|
+
"category",
|
|
385
|
+
"channel",
|
|
386
|
+
"customer",
|
|
387
|
+
"customer-group",
|
|
388
|
+
"custom-line-item",
|
|
389
|
+
"discount-code",
|
|
390
|
+
"inventory-entry",
|
|
391
|
+
"line-item",
|
|
392
|
+
"order",
|
|
393
|
+
"order-edit",
|
|
394
|
+
"order-delivery",
|
|
395
|
+
"order-parcel",
|
|
396
|
+
"order-return-item",
|
|
397
|
+
"payment",
|
|
398
|
+
"payment-interface-interaction",
|
|
399
|
+
"payment-method",
|
|
400
|
+
"payment-method-info",
|
|
401
|
+
"product-price",
|
|
402
|
+
"product-selection",
|
|
403
|
+
"product-tailoring",
|
|
404
|
+
"quote",
|
|
405
|
+
"review",
|
|
406
|
+
"recurring-order",
|
|
407
|
+
"shipping",
|
|
408
|
+
"shipping-method",
|
|
409
|
+
"shopping-list",
|
|
410
|
+
"shopping-list-text-line-item",
|
|
411
|
+
"standalone-price",
|
|
412
|
+
"store",
|
|
413
|
+
"transaction",
|
|
414
|
+
]);
|
|
415
|
+
|
|
416
|
+
export const TypeTextInputHintSchema = z.enum(["SingleLine", "MultiLine"]);
|
|
417
|
+
|
|
418
|
+
export const CountryCodeSchema = z.string();
|
|
419
|
+
|
|
420
|
+
export const CurrencyCodeSchema = z.string();
|
|
421
|
+
|
|
422
|
+
export const LocaleSchema = z.string();
|
|
423
|
+
|
|
424
|
+
export const TypeResourceIdentifierSchema = z
|
|
425
|
+
.object({
|
|
426
|
+
typeId: ReferenceTypeIdSchema,
|
|
427
|
+
id: z.string().optional(),
|
|
428
|
+
key: z.string().optional(),
|
|
429
|
+
})
|
|
430
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
431
|
+
message: "Either 'id' or 'key' must be provided",
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
export const FieldContainerSchema = z.record(z.string(), z.unknown());
|
|
435
|
+
|
|
436
|
+
export const CustomFieldsDraftSchema = z.object({
|
|
437
|
+
type: TypeResourceIdentifierSchema,
|
|
438
|
+
fields: FieldContainerSchema.optional(),
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
export const LocalizedStringSchema = z.record(z.string(), z.string());
|
|
442
|
+
|
|
443
|
+
export const AttributeReferenceSchema = z.object({
|
|
444
|
+
key: z.string(),
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
export const StoreResourceIdentifierSchema = z
|
|
448
|
+
.object({
|
|
449
|
+
typeId: ReferenceTypeIdSchema,
|
|
450
|
+
id: z.string().optional(),
|
|
451
|
+
key: z.string().optional(),
|
|
452
|
+
})
|
|
453
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
454
|
+
message: "Either 'id' or 'key' must be provided",
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
export const AssociateRoleResourceIdentifierSchema = z
|
|
458
|
+
.object({
|
|
459
|
+
typeId: ReferenceTypeIdSchema,
|
|
460
|
+
id: z.string().optional(),
|
|
461
|
+
key: z.string().optional(),
|
|
462
|
+
})
|
|
463
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
464
|
+
message: "Either 'id' or 'key' must be provided",
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
export const AssociateRoleAssignmentDraftSchema = z.object({
|
|
468
|
+
associateRole: AssociateRoleResourceIdentifierSchema,
|
|
469
|
+
inheritance: AssociateRoleInheritanceModeSchema.optional(),
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
export const CustomerResourceIdentifierSchema = z
|
|
473
|
+
.object({
|
|
474
|
+
typeId: ReferenceTypeIdSchema,
|
|
475
|
+
id: z.string().optional(),
|
|
476
|
+
key: z.string().optional(),
|
|
477
|
+
})
|
|
478
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
479
|
+
message: "Either 'id' or 'key' must be provided",
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
export const AssociateDraftSchema = z.object({
|
|
483
|
+
associateRoleAssignments: z.array(AssociateRoleAssignmentDraftSchema),
|
|
484
|
+
roles: z.array(AssociateRoleDeprecatedSchema).optional(),
|
|
485
|
+
customer: CustomerResourceIdentifierSchema,
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
export const BaseAddressSchema = z.object({
|
|
489
|
+
id: z.string().optional(),
|
|
490
|
+
key: z.string().optional(),
|
|
491
|
+
country: CountryCodeSchema,
|
|
492
|
+
title: z.string().optional(),
|
|
493
|
+
salutation: z.string().optional(),
|
|
494
|
+
firstName: z.string().optional(),
|
|
495
|
+
lastName: z.string().optional(),
|
|
496
|
+
streetName: z.string().optional(),
|
|
497
|
+
streetNumber: z.string().optional(),
|
|
498
|
+
additionalStreetInfo: z.string().optional(),
|
|
499
|
+
postalCode: z.string().optional(),
|
|
500
|
+
city: z.string().optional(),
|
|
501
|
+
region: z.string().optional(),
|
|
502
|
+
state: z.string().optional(),
|
|
503
|
+
company: z.string().optional(),
|
|
504
|
+
department: z.string().optional(),
|
|
505
|
+
building: z.string().optional(),
|
|
506
|
+
apartment: z.string().optional(),
|
|
507
|
+
pOBox: z.string().optional(),
|
|
508
|
+
phone: z.string().optional(),
|
|
509
|
+
mobile: z.string().optional(),
|
|
510
|
+
email: z.string().optional(),
|
|
511
|
+
fax: z.string().optional(),
|
|
512
|
+
additionalAddressInfo: z.string().optional(),
|
|
513
|
+
externalId: z.string().optional(),
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
export const CustomerGroupResourceIdentifierSchema = z
|
|
517
|
+
.object({
|
|
518
|
+
typeId: ReferenceTypeIdSchema,
|
|
519
|
+
id: z.string().optional(),
|
|
520
|
+
key: z.string().optional(),
|
|
521
|
+
})
|
|
522
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
523
|
+
message: "Either 'id' or 'key' must be provided",
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
export const CustomerGroupAssignmentDraftSchema = z.object({
|
|
527
|
+
customerGroup: CustomerGroupResourceIdentifierSchema,
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
export const CompanyDraftSchema = z.object({
|
|
531
|
+
key: z.string(),
|
|
532
|
+
status: BusinessUnitStatusSchema.optional(),
|
|
533
|
+
stores: z.array(StoreResourceIdentifierSchema).optional(),
|
|
534
|
+
storeMode: BusinessUnitStoreModeSchema.optional(),
|
|
535
|
+
unitType: BusinessUnitTypeSchema,
|
|
536
|
+
name: z.string(),
|
|
537
|
+
contactEmail: z.string().optional(),
|
|
538
|
+
associateMode: BusinessUnitAssociateModeSchema.optional(),
|
|
539
|
+
associates: z.array(AssociateDraftSchema).optional(),
|
|
540
|
+
approvalRuleMode: BusinessUnitApprovalRuleModeSchema.optional(),
|
|
541
|
+
addresses: z.array(BaseAddressSchema).optional(),
|
|
542
|
+
shippingAddresses: z.array(z.number().int()).optional(),
|
|
543
|
+
defaultShippingAddress: z.number().int().optional(),
|
|
544
|
+
billingAddresses: z.array(z.number().int()).optional(),
|
|
545
|
+
defaultBillingAddress: z.number().int().optional(),
|
|
546
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
547
|
+
customerGroupAssignments: z
|
|
548
|
+
.array(CustomerGroupAssignmentDraftSchema)
|
|
549
|
+
.optional(),
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
export const BusinessUnitResourceIdentifierSchema = z
|
|
553
|
+
.object({
|
|
554
|
+
typeId: ReferenceTypeIdSchema,
|
|
555
|
+
id: z.string().optional(),
|
|
556
|
+
key: z.string().optional(),
|
|
557
|
+
})
|
|
558
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
559
|
+
message: "Either 'id' or 'key' must be provided",
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
export const DivisionDraftSchema = z.object({
|
|
563
|
+
key: z.string(),
|
|
564
|
+
status: BusinessUnitStatusSchema.optional(),
|
|
565
|
+
stores: z.array(StoreResourceIdentifierSchema).optional(),
|
|
566
|
+
storeMode: BusinessUnitStoreModeSchema.optional(),
|
|
567
|
+
unitType: BusinessUnitTypeSchema,
|
|
568
|
+
name: z.string(),
|
|
569
|
+
contactEmail: z.string().optional(),
|
|
570
|
+
associateMode: BusinessUnitAssociateModeSchema.optional(),
|
|
571
|
+
associates: z.array(AssociateDraftSchema).optional(),
|
|
572
|
+
approvalRuleMode: BusinessUnitApprovalRuleModeSchema.optional(),
|
|
573
|
+
addresses: z.array(BaseAddressSchema).optional(),
|
|
574
|
+
shippingAddresses: z.array(z.number().int()).optional(),
|
|
575
|
+
defaultShippingAddress: z.number().int().optional(),
|
|
576
|
+
billingAddresses: z.array(z.number().int()).optional(),
|
|
577
|
+
defaultBillingAddress: z.number().int().optional(),
|
|
578
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
579
|
+
customerGroupAssignments: z
|
|
580
|
+
.array(CustomerGroupAssignmentDraftSchema)
|
|
581
|
+
.optional(),
|
|
582
|
+
parentUnit: BusinessUnitResourceIdentifierSchema,
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
export const ChannelResourceIdentifierSchema = z
|
|
586
|
+
.object({
|
|
587
|
+
typeId: ReferenceTypeIdSchema,
|
|
588
|
+
id: z.string().optional(),
|
|
589
|
+
key: z.string().optional(),
|
|
590
|
+
})
|
|
591
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
592
|
+
message: "Either 'id' or 'key' must be provided",
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
export const MoneySchema = z.object({
|
|
596
|
+
centAmount: z.number().int(),
|
|
597
|
+
currencyCode: CurrencyCodeSchema,
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
export const ExternalLineItemTotalPriceSchema = z.object({
|
|
601
|
+
price: MoneySchema,
|
|
602
|
+
totalPrice: MoneySchema,
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
export const SubRateSchema = z.object({
|
|
606
|
+
name: z.string(),
|
|
607
|
+
amount: z.number(),
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
export const ExternalTaxRateDraftSchema = z.object({
|
|
611
|
+
name: z.string(),
|
|
612
|
+
amount: z.number().optional(),
|
|
613
|
+
includedInPrice: z.boolean().optional(),
|
|
614
|
+
country: CountryCodeSchema,
|
|
615
|
+
state: z.string().optional(),
|
|
616
|
+
subRates: z.array(SubRateSchema).optional(),
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
export const MethodExternalTaxRateDraftSchema = z.object({
|
|
620
|
+
shippingMethodKey: z.string(),
|
|
621
|
+
taxRate: ExternalTaxRateDraftSchema.optional(),
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
export const ItemShippingTargetSchema = z.object({
|
|
625
|
+
addressKey: z.string(),
|
|
626
|
+
quantity: z.number().int(),
|
|
627
|
+
shippingMethodKey: z.string().optional(),
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
export const ItemShippingDetailsDraftSchema = z.object({
|
|
631
|
+
targets: z.array(ItemShippingTargetSchema),
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
export const RecurrencePolicyResourceIdentifierSchema = z
|
|
635
|
+
.object({
|
|
636
|
+
typeId: ReferenceTypeIdSchema,
|
|
637
|
+
id: z.string().optional(),
|
|
638
|
+
key: z.string().optional(),
|
|
639
|
+
})
|
|
640
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
641
|
+
message: "Either 'id' or 'key' must be provided",
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
export const LineItemRecurrenceInfoDraftSchema = z.object({
|
|
645
|
+
recurrencePolicy: RecurrencePolicyResourceIdentifierSchema,
|
|
646
|
+
priceSelectionMode: PriceSelectionModeSchema,
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
export const LineItemDraftSchema = z.object({
|
|
650
|
+
key: z.string().optional(),
|
|
651
|
+
productId: z.string().optional(),
|
|
652
|
+
variantId: z.number().int().optional(),
|
|
653
|
+
sku: z.string().optional(),
|
|
654
|
+
quantity: z.number().int().optional(),
|
|
655
|
+
addedAt: z.string().optional(),
|
|
656
|
+
distributionChannel: ChannelResourceIdentifierSchema.optional(),
|
|
657
|
+
supplyChannel: ChannelResourceIdentifierSchema.optional(),
|
|
658
|
+
externalPrice: MoneySchema.optional(),
|
|
659
|
+
externalTotalPrice: ExternalLineItemTotalPriceSchema.optional(),
|
|
660
|
+
externalTaxRate: ExternalTaxRateDraftSchema.optional(),
|
|
661
|
+
perMethodExternalTaxRate: z
|
|
662
|
+
.array(MethodExternalTaxRateDraftSchema)
|
|
663
|
+
.optional(),
|
|
664
|
+
inventoryMode: InventoryModeSchema.optional(),
|
|
665
|
+
shippingDetails: ItemShippingDetailsDraftSchema.optional(),
|
|
666
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
667
|
+
recurrenceInfo: LineItemRecurrenceInfoDraftSchema.optional(),
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
export const TaxCategoryResourceIdentifierSchema = z
|
|
671
|
+
.object({
|
|
672
|
+
typeId: ReferenceTypeIdSchema,
|
|
673
|
+
id: z.string().optional(),
|
|
674
|
+
key: z.string().optional(),
|
|
675
|
+
})
|
|
676
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
677
|
+
message: "Either 'id' or 'key' must be provided",
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
export const CustomLineItemRecurrenceInfoDraftSchema = z.object({
|
|
681
|
+
recurrencePolicy: RecurrencePolicyResourceIdentifierSchema,
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
export const CustomLineItemDraftSchema = z.object({
|
|
685
|
+
name: LocalizedStringSchema,
|
|
686
|
+
key: z.string().optional(),
|
|
687
|
+
quantity: z.number().int().optional(),
|
|
688
|
+
money: MoneySchema,
|
|
689
|
+
slug: z.string(),
|
|
690
|
+
taxCategory: TaxCategoryResourceIdentifierSchema.optional(),
|
|
691
|
+
externalTaxRate: ExternalTaxRateDraftSchema.optional(),
|
|
692
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
693
|
+
shippingDetails: ItemShippingDetailsDraftSchema.optional(),
|
|
694
|
+
priceMode: CustomLineItemPriceModeSchema.optional(),
|
|
695
|
+
recurrenceInfo: CustomLineItemRecurrenceInfoDraftSchema.optional(),
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
export const ShippingMethodResourceIdentifierSchema = z
|
|
699
|
+
.object({
|
|
700
|
+
typeId: ReferenceTypeIdSchema,
|
|
701
|
+
id: z.string().optional(),
|
|
702
|
+
key: z.string().optional(),
|
|
703
|
+
})
|
|
704
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
705
|
+
message: "Either 'id' or 'key' must be provided",
|
|
706
|
+
});
|
|
707
|
+
|
|
708
|
+
export const ClassificationShippingRateInputDraftSchema = z.object({
|
|
709
|
+
type: z.string(),
|
|
710
|
+
key: z.string(),
|
|
711
|
+
});
|
|
712
|
+
|
|
713
|
+
export const ScoreShippingRateInputDraftSchema = z.object({
|
|
714
|
+
type: z.string(),
|
|
715
|
+
score: z.number().int(),
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
export const ShippingRateInputDraftSchema = z.object({
|
|
719
|
+
type: z.string(),
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
export const CartClassificationTierSchema = z.object({
|
|
723
|
+
type: ShippingRateTierTypeSchema,
|
|
724
|
+
value: z.string(),
|
|
725
|
+
price: MoneySchema,
|
|
726
|
+
isMatching: z.boolean().optional(),
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
export const PriceFunctionSchema = z.object({
|
|
730
|
+
currencyCode: CurrencyCodeSchema,
|
|
731
|
+
function: z.string(),
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
export const CartScoreTierSchema = z.object({
|
|
735
|
+
type: ShippingRateTierTypeSchema,
|
|
736
|
+
score: z.number().int(),
|
|
737
|
+
price: MoneySchema.optional(),
|
|
738
|
+
priceFunction: PriceFunctionSchema.optional(),
|
|
739
|
+
isMatching: z.boolean().optional(),
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
export const CartValueTierSchema = z.object({
|
|
743
|
+
type: ShippingRateTierTypeSchema,
|
|
744
|
+
minimumCentAmount: z.number().int(),
|
|
745
|
+
price: MoneySchema,
|
|
746
|
+
isMatching: z.boolean().optional(),
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
export const ShippingRatePriceTierSchema = z.object({
|
|
750
|
+
type: ShippingRateTierTypeSchema,
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
export const ShippingRateDraftSchema = z.object({
|
|
754
|
+
price: MoneySchema,
|
|
755
|
+
freeAbove: MoneySchema.optional(),
|
|
756
|
+
tiers: z.array(ShippingRatePriceTierSchema).optional(),
|
|
757
|
+
});
|
|
758
|
+
|
|
759
|
+
export const DeliveryItemSchema = z.object({
|
|
760
|
+
id: z.string(),
|
|
761
|
+
quantity: z.number().int(),
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
export const ParcelMeasurementsSchema = z.object({
|
|
765
|
+
heightInMillimeter: z.number().int().optional(),
|
|
766
|
+
lengthInMillimeter: z.number().int().optional(),
|
|
767
|
+
widthInMillimeter: z.number().int().optional(),
|
|
768
|
+
weightInGram: z.number().int().optional(),
|
|
769
|
+
});
|
|
770
|
+
|
|
771
|
+
export const TrackingDataSchema = z.object({
|
|
772
|
+
trackingId: z.string().optional(),
|
|
773
|
+
carrier: z.string().optional(),
|
|
774
|
+
provider: z.string().optional(),
|
|
775
|
+
providerTransaction: z.string().optional(),
|
|
776
|
+
isReturn: z.boolean().optional(),
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
export const ParcelDraftSchema = z.object({
|
|
780
|
+
key: z.string().optional(),
|
|
781
|
+
measurements: ParcelMeasurementsSchema.optional(),
|
|
782
|
+
trackingData: TrackingDataSchema.optional(),
|
|
783
|
+
items: z.array(DeliveryItemSchema).optional(),
|
|
784
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
export const AddressDraftSchema = z.object({
|
|
788
|
+
id: z.string().optional(),
|
|
789
|
+
key: z.string().optional(),
|
|
790
|
+
country: CountryCodeSchema,
|
|
791
|
+
title: z.string().optional(),
|
|
792
|
+
salutation: z.string().optional(),
|
|
793
|
+
firstName: z.string().optional(),
|
|
794
|
+
lastName: z.string().optional(),
|
|
795
|
+
streetName: z.string().optional(),
|
|
796
|
+
streetNumber: z.string().optional(),
|
|
797
|
+
additionalStreetInfo: z.string().optional(),
|
|
798
|
+
postalCode: z.string().optional(),
|
|
799
|
+
city: z.string().optional(),
|
|
800
|
+
region: z.string().optional(),
|
|
801
|
+
state: z.string().optional(),
|
|
802
|
+
company: z.string().optional(),
|
|
803
|
+
department: z.string().optional(),
|
|
804
|
+
building: z.string().optional(),
|
|
805
|
+
apartment: z.string().optional(),
|
|
806
|
+
pOBox: z.string().optional(),
|
|
807
|
+
phone: z.string().optional(),
|
|
808
|
+
mobile: z.string().optional(),
|
|
809
|
+
email: z.string().optional(),
|
|
810
|
+
fax: z.string().optional(),
|
|
811
|
+
additionalAddressInfo: z.string().optional(),
|
|
812
|
+
externalId: z.string().optional(),
|
|
813
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
export const DeliveryDraftSchema = z.object({
|
|
817
|
+
key: z.string().optional(),
|
|
818
|
+
items: z.array(DeliveryItemSchema).optional(),
|
|
819
|
+
parcels: z.array(ParcelDraftSchema).optional(),
|
|
820
|
+
address: AddressDraftSchema.optional(),
|
|
821
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
export const CustomShippingDraftSchema = z.object({
|
|
825
|
+
key: z.string(),
|
|
826
|
+
shippingMethodName: z.string(),
|
|
827
|
+
shippingAddress: BaseAddressSchema.optional(),
|
|
828
|
+
shippingRate: ShippingRateDraftSchema,
|
|
829
|
+
shippingRateInput: ShippingRateInputDraftSchema.optional(),
|
|
830
|
+
taxCategory: TaxCategoryResourceIdentifierSchema.optional(),
|
|
831
|
+
externalTaxRate: ExternalTaxRateDraftSchema.optional(),
|
|
832
|
+
deliveries: z.array(DeliveryDraftSchema).optional(),
|
|
833
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
export const ShippingMethodReferenceSchema = z.object({
|
|
837
|
+
typeId: ReferenceTypeIdSchema,
|
|
838
|
+
id: z.string(),
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
export const ShippingDraftSchema = z.object({
|
|
842
|
+
key: z.string(),
|
|
843
|
+
shippingMethod: ShippingMethodReferenceSchema.optional(),
|
|
844
|
+
shippingAddress: BaseAddressSchema,
|
|
845
|
+
shippingRateInput: ShippingRateInputDraftSchema.optional(),
|
|
846
|
+
externalTaxRate: ExternalTaxRateDraftSchema.optional(),
|
|
847
|
+
deliveries: z.array(DeliveryDraftSchema).optional(),
|
|
848
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
export const CartDiscountValueAbsoluteDraftSchema = z.object({
|
|
852
|
+
type: z.string(),
|
|
853
|
+
money: z.array(MoneySchema),
|
|
854
|
+
applicationMode: DiscountApplicationModeSchema.optional(),
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
export const TypedMoneyDraftSchema = z.object({
|
|
858
|
+
centAmount: z.number().int(),
|
|
859
|
+
currencyCode: CurrencyCodeSchema,
|
|
860
|
+
type: MoneyTypeSchema,
|
|
861
|
+
fractionDigits: z.number().int().optional(),
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
export const CartDiscountValueFixedDraftSchema = z.object({
|
|
865
|
+
type: z.string(),
|
|
866
|
+
money: z.array(TypedMoneyDraftSchema),
|
|
867
|
+
applicationMode: DiscountApplicationModeSchema.optional(),
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
export const ProductResourceIdentifierSchema = z
|
|
871
|
+
.object({
|
|
872
|
+
typeId: ReferenceTypeIdSchema,
|
|
873
|
+
id: z.string().optional(),
|
|
874
|
+
key: z.string().optional(),
|
|
875
|
+
})
|
|
876
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
877
|
+
message: "Either 'id' or 'key' must be provided",
|
|
878
|
+
});
|
|
879
|
+
|
|
880
|
+
export const CartDiscountValueGiftLineItemDraftSchema = z.object({
|
|
881
|
+
type: z.string(),
|
|
882
|
+
product: ProductResourceIdentifierSchema,
|
|
883
|
+
variantId: z.number().int(),
|
|
884
|
+
supplyChannel: ChannelResourceIdentifierSchema.optional(),
|
|
885
|
+
distributionChannel: ChannelResourceIdentifierSchema.optional(),
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
export const CartDiscountValueRelativeDraftSchema = z.object({
|
|
889
|
+
type: z.string(),
|
|
890
|
+
permyriad: z.number().int(),
|
|
891
|
+
applicationMode: DiscountApplicationModeSchema.optional(),
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
export const CartDiscountValueDraftSchema = z.object({
|
|
895
|
+
type: z.string(),
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
export const CartDiscountTargetSchema = z.object({
|
|
899
|
+
type: z.string(),
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
export const DiscountGroupResourceIdentifierSchema = z
|
|
903
|
+
.object({
|
|
904
|
+
typeId: ReferenceTypeIdSchema,
|
|
905
|
+
id: z.string().optional(),
|
|
906
|
+
key: z.string().optional(),
|
|
907
|
+
})
|
|
908
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
909
|
+
message: "Either 'id' or 'key' must be provided",
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
export const AnyOrderDraftSchema = z.object({
|
|
913
|
+
type: z.string(),
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
export const ApplicableRecurrencePoliciesDraftSchema = z.object({
|
|
917
|
+
type: z.string(),
|
|
918
|
+
recurrencePolicies: z.array(RecurrencePolicyResourceIdentifierSchema),
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
export const NonRecurringOrdersOnlyDraftSchema = z.object({
|
|
922
|
+
type: z.string(),
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
export const RecurringOrdersOnlyDraftSchema = z.object({
|
|
926
|
+
type: z.string(),
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
export const RecurringOrderScopeDraftSchema = z.object({
|
|
930
|
+
type: z.string(),
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
export const CategoryResourceIdentifierSchema = z
|
|
934
|
+
.object({
|
|
935
|
+
typeId: ReferenceTypeIdSchema,
|
|
936
|
+
id: z.string().optional(),
|
|
937
|
+
key: z.string().optional(),
|
|
938
|
+
})
|
|
939
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
940
|
+
message: "Either 'id' or 'key' must be provided",
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
export const AssetDimensionsSchema = z.object({
|
|
944
|
+
w: z.number().int(),
|
|
945
|
+
h: z.number().int(),
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
export const AssetSourceSchema = z.object({
|
|
949
|
+
uri: z.string(),
|
|
950
|
+
key: z.string().optional(),
|
|
951
|
+
dimensions: AssetDimensionsSchema.optional(),
|
|
952
|
+
contentType: z.string().optional(),
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
export const AssetDraftSchema = z.object({
|
|
956
|
+
sources: z.array(AssetSourceSchema),
|
|
957
|
+
name: LocalizedStringSchema,
|
|
958
|
+
description: LocalizedStringSchema.optional(),
|
|
959
|
+
tags: z.array(z.string()).optional(),
|
|
960
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
961
|
+
key: z.string().optional(),
|
|
962
|
+
});
|
|
963
|
+
|
|
964
|
+
export const GeoJsonPointSchema = z.object({
|
|
965
|
+
type: z.string(),
|
|
966
|
+
coordinates: z.array(z.number()),
|
|
967
|
+
});
|
|
968
|
+
|
|
969
|
+
export const GeoJsonSchema = z.object({
|
|
970
|
+
type: z.string(),
|
|
971
|
+
coordinates: z.array(z.number()),
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
export const CartResourceIdentifierSchema = z
|
|
975
|
+
.object({
|
|
976
|
+
typeId: ReferenceTypeIdSchema,
|
|
977
|
+
id: z.string().optional(),
|
|
978
|
+
key: z.string().optional(),
|
|
979
|
+
})
|
|
980
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
981
|
+
message: "Either 'id' or 'key' must be provided",
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
export const CartDiscountResourceIdentifierSchema = z
|
|
985
|
+
.object({
|
|
986
|
+
typeId: ReferenceTypeIdSchema,
|
|
987
|
+
id: z.string().optional(),
|
|
988
|
+
key: z.string().optional(),
|
|
989
|
+
})
|
|
990
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
991
|
+
message: "Either 'id' or 'key' must be provided",
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
export const AWSLambdaDestinationSchema = z.object({
|
|
995
|
+
type: z.string(),
|
|
996
|
+
arn: z.string(),
|
|
997
|
+
accessKey: z.string(),
|
|
998
|
+
accessSecret: z.string(),
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
export const GoogleCloudFunctionDestinationSchema = z.object({
|
|
1002
|
+
type: z.string(),
|
|
1003
|
+
url: z.string(),
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
export const AuthorizationHeaderAuthenticationSchema = z.object({
|
|
1007
|
+
type: z.string(),
|
|
1008
|
+
headerValue: z.string(),
|
|
1009
|
+
});
|
|
1010
|
+
|
|
1011
|
+
export const AzureFunctionsAuthenticationSchema = z.object({
|
|
1012
|
+
type: z.string(),
|
|
1013
|
+
key: z.string(),
|
|
1014
|
+
});
|
|
1015
|
+
|
|
1016
|
+
export const HttpDestinationAuthenticationSchema = z.object({
|
|
1017
|
+
type: z.string(),
|
|
1018
|
+
});
|
|
1019
|
+
|
|
1020
|
+
export const HttpDestinationSchema = z.object({
|
|
1021
|
+
type: z.string(),
|
|
1022
|
+
url: z.string(),
|
|
1023
|
+
authentication: HttpDestinationAuthenticationSchema.optional(),
|
|
1024
|
+
});
|
|
1025
|
+
|
|
1026
|
+
export const ExtensionDestinationSchema = z.object({
|
|
1027
|
+
type: z.string(),
|
|
1028
|
+
});
|
|
1029
|
+
|
|
1030
|
+
export const ExtensionTriggerSchema = z.object({
|
|
1031
|
+
resourceTypeId: ExtensionResourceTypeIdSchema,
|
|
1032
|
+
actions: z.array(ExtensionActionSchema),
|
|
1033
|
+
condition: z.string().optional(),
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
export const OrderReferenceSchema = z.object({
|
|
1037
|
+
typeId: ReferenceTypeIdSchema,
|
|
1038
|
+
id: z.string(),
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
export const StagedOrderUpdateActionSchema = z.object({
|
|
1042
|
+
action: z.string(),
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
export const StateResourceIdentifierSchema = z
|
|
1046
|
+
.object({
|
|
1047
|
+
typeId: ReferenceTypeIdSchema,
|
|
1048
|
+
id: z.string().optional(),
|
|
1049
|
+
key: z.string().optional(),
|
|
1050
|
+
})
|
|
1051
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
1052
|
+
message: "Either 'id' or 'key' must be provided",
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
export const PaymentMethodTokenSchema = z.object({
|
|
1056
|
+
value: z.string(),
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
export const PaymentMethodInfoDraftSchema = z.object({
|
|
1060
|
+
paymentInterface: z.string().optional(),
|
|
1061
|
+
method: z.string().optional(),
|
|
1062
|
+
name: LocalizedStringSchema.optional(),
|
|
1063
|
+
token: PaymentMethodTokenSchema.optional(),
|
|
1064
|
+
interfaceAccount: z.string().optional(),
|
|
1065
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
export const PaymentStatusDraftSchema = z.object({
|
|
1069
|
+
interfaceCode: z.string().optional(),
|
|
1070
|
+
interfaceText: z.string().optional(),
|
|
1071
|
+
state: StateResourceIdentifierSchema.optional(),
|
|
1072
|
+
});
|
|
1073
|
+
|
|
1074
|
+
export const TransactionDraftSchema = z.object({
|
|
1075
|
+
timestamp: z.string().optional(),
|
|
1076
|
+
type: TransactionTypeSchema,
|
|
1077
|
+
amount: MoneySchema,
|
|
1078
|
+
interactionId: z.string().optional(),
|
|
1079
|
+
state: TransactionStateSchema.optional(),
|
|
1080
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
1081
|
+
interfaceId: z.string().optional(),
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
export const ProductTypeResourceIdentifierSchema = z
|
|
1085
|
+
.object({
|
|
1086
|
+
typeId: ReferenceTypeIdSchema,
|
|
1087
|
+
id: z.string().optional(),
|
|
1088
|
+
key: z.string().optional(),
|
|
1089
|
+
})
|
|
1090
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
1091
|
+
message: "Either 'id' or 'key' must be provided",
|
|
1092
|
+
});
|
|
1093
|
+
|
|
1094
|
+
export const CategoryOrderHintsSchema = z.record(z.string(), z.string());
|
|
1095
|
+
|
|
1096
|
+
export const ProductDiscountReferenceSchema = z.object({
|
|
1097
|
+
typeId: ReferenceTypeIdSchema,
|
|
1098
|
+
id: z.string(),
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
export const DiscountedPriceDraftSchema = z.object({
|
|
1102
|
+
value: MoneySchema,
|
|
1103
|
+
discount: ProductDiscountReferenceSchema,
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
export const PriceTierDraftSchema = z.object({
|
|
1107
|
+
minimumQuantity: z.number().int(),
|
|
1108
|
+
value: MoneySchema,
|
|
1109
|
+
});
|
|
1110
|
+
|
|
1111
|
+
export const PriceDraftSchema = z.object({
|
|
1112
|
+
key: z.string().optional(),
|
|
1113
|
+
value: MoneySchema,
|
|
1114
|
+
country: CountryCodeSchema.optional(),
|
|
1115
|
+
customerGroup: CustomerGroupResourceIdentifierSchema.optional(),
|
|
1116
|
+
channel: ChannelResourceIdentifierSchema.optional(),
|
|
1117
|
+
validFrom: z.string().optional(),
|
|
1118
|
+
validUntil: z.string().optional(),
|
|
1119
|
+
discounted: DiscountedPriceDraftSchema.optional(),
|
|
1120
|
+
tiers: z.array(PriceTierDraftSchema).optional(),
|
|
1121
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
1122
|
+
recurrencePolicy: RecurrencePolicyResourceIdentifierSchema.optional(),
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
export const AttributeSchema = z.object({
|
|
1126
|
+
name: z.string(),
|
|
1127
|
+
value: z.unknown(),
|
|
1128
|
+
});
|
|
1129
|
+
|
|
1130
|
+
export const ImageDimensionsSchema = z.object({
|
|
1131
|
+
w: z.number().int(),
|
|
1132
|
+
h: z.number().int(),
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
export const ImageSchema = z.object({
|
|
1136
|
+
url: z.string(),
|
|
1137
|
+
dimensions: ImageDimensionsSchema,
|
|
1138
|
+
label: z.string().optional(),
|
|
1139
|
+
});
|
|
1140
|
+
|
|
1141
|
+
export const ProductVariantDraftSchema = z.object({
|
|
1142
|
+
sku: z.string().optional(),
|
|
1143
|
+
key: z.string().optional(),
|
|
1144
|
+
prices: z.array(PriceDraftSchema).optional(),
|
|
1145
|
+
attributes: z.array(AttributeSchema).optional(),
|
|
1146
|
+
images: z.array(ImageSchema).optional(),
|
|
1147
|
+
assets: z.array(AssetDraftSchema).optional(),
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
export const SearchKeywordsSchema = z.record(z.string(), z.string());
|
|
1151
|
+
|
|
1152
|
+
export const ProductDiscountValueAbsoluteDraftSchema = z.object({
|
|
1153
|
+
type: z.string(),
|
|
1154
|
+
money: z.array(MoneySchema),
|
|
1155
|
+
});
|
|
1156
|
+
|
|
1157
|
+
export const ProductDiscountValueExternalDraftSchema = z.object({
|
|
1158
|
+
type: z.string(),
|
|
1159
|
+
});
|
|
1160
|
+
|
|
1161
|
+
export const ProductDiscountValueRelativeDraftSchema = z.object({
|
|
1162
|
+
type: z.string(),
|
|
1163
|
+
permyriad: z.number().int(),
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
export const ProductDiscountValueDraftSchema = z.object({
|
|
1167
|
+
type: z.string(),
|
|
1168
|
+
});
|
|
1169
|
+
|
|
1170
|
+
export const TypeReferenceSchema = z.object({
|
|
1171
|
+
typeId: ReferenceTypeIdSchema,
|
|
1172
|
+
id: z.string(),
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
export const CustomFieldsSchema = z.object({
|
|
1176
|
+
type: TypeReferenceSchema,
|
|
1177
|
+
fields: FieldContainerSchema,
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
export const AssetSchema = z.object({
|
|
1181
|
+
id: z.string(),
|
|
1182
|
+
sources: z.array(AssetSourceSchema),
|
|
1183
|
+
name: LocalizedStringSchema,
|
|
1184
|
+
description: LocalizedStringSchema.optional(),
|
|
1185
|
+
tags: z.array(z.string()).optional(),
|
|
1186
|
+
custom: CustomFieldsSchema.optional(),
|
|
1187
|
+
key: z.string().optional(),
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
export const ProductTailoringAttributeSchema = z.object({
|
|
1191
|
+
name: z.string(),
|
|
1192
|
+
value: z.unknown(),
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
export const ProductVariantTailoringDraftSchema = z.object({
|
|
1196
|
+
id: z.number().int().optional(),
|
|
1197
|
+
sku: z.string().optional(),
|
|
1198
|
+
images: z.array(ImageSchema).optional(),
|
|
1199
|
+
assets: z.array(AssetSchema).optional(),
|
|
1200
|
+
attributes: z.array(ProductTailoringAttributeSchema).optional(),
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
export const AttributeTypeSchema = z.object({
|
|
1204
|
+
name: z.string(),
|
|
1205
|
+
});
|
|
1206
|
+
|
|
1207
|
+
export const AttributeDefinitionDraftSchema = z.object({
|
|
1208
|
+
type: AttributeTypeSchema,
|
|
1209
|
+
name: z.string(),
|
|
1210
|
+
label: LocalizedStringSchema,
|
|
1211
|
+
isRequired: z.boolean(),
|
|
1212
|
+
level: AttributeLevelEnumSchema.optional(),
|
|
1213
|
+
attributeConstraint: AttributeConstraintEnumSchema.optional(),
|
|
1214
|
+
inputTip: LocalizedStringSchema.optional(),
|
|
1215
|
+
inputHint: TextInputHintSchema.optional(),
|
|
1216
|
+
isSearchable: z.boolean().optional(),
|
|
1217
|
+
});
|
|
1218
|
+
|
|
1219
|
+
export const StagedQuoteResourceIdentifierSchema = z
|
|
1220
|
+
.object({
|
|
1221
|
+
typeId: ReferenceTypeIdSchema,
|
|
1222
|
+
id: z.string().optional(),
|
|
1223
|
+
key: z.string().optional(),
|
|
1224
|
+
})
|
|
1225
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
1226
|
+
message: "Either 'id' or 'key' must be provided",
|
|
1227
|
+
});
|
|
1228
|
+
|
|
1229
|
+
export const StateReferenceSchema = z.object({
|
|
1230
|
+
typeId: ReferenceTypeIdSchema,
|
|
1231
|
+
id: z.string(),
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
export const DayOfMonthScheduleDraftSchema = z.object({
|
|
1235
|
+
type: z.string(),
|
|
1236
|
+
day: z.number().int(),
|
|
1237
|
+
});
|
|
1238
|
+
|
|
1239
|
+
export const StandardScheduleDraftSchema = z.object({
|
|
1240
|
+
type: z.string(),
|
|
1241
|
+
value: z.number().int(),
|
|
1242
|
+
intervalUnit: IntervalUnitSchema,
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
export const RecurrencePolicyScheduleDraftSchema = z.object({
|
|
1246
|
+
type: z.string(),
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
export const ZoneResourceIdentifierSchema = z
|
|
1250
|
+
.object({
|
|
1251
|
+
typeId: ReferenceTypeIdSchema,
|
|
1252
|
+
id: z.string().optional(),
|
|
1253
|
+
key: z.string().optional(),
|
|
1254
|
+
})
|
|
1255
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
1256
|
+
message: "Either 'id' or 'key' must be provided",
|
|
1257
|
+
});
|
|
1258
|
+
|
|
1259
|
+
export const ZoneRateDraftSchema = z.object({
|
|
1260
|
+
zone: ZoneResourceIdentifierSchema,
|
|
1261
|
+
shippingRates: z.array(ShippingRateDraftSchema),
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
export const ShoppingListLineItemDraftSchema = z.object({
|
|
1265
|
+
key: z.string().optional(),
|
|
1266
|
+
productId: z.string().optional(),
|
|
1267
|
+
variantId: z.number().int().optional(),
|
|
1268
|
+
sku: z.string().optional(),
|
|
1269
|
+
addedAt: z.string().optional(),
|
|
1270
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
1271
|
+
quantity: z.number().int().optional(),
|
|
1272
|
+
});
|
|
1273
|
+
|
|
1274
|
+
export const TextLineItemDraftSchema = z.object({
|
|
1275
|
+
key: z.string().optional(),
|
|
1276
|
+
addedAt: z.string().optional(),
|
|
1277
|
+
custom: CustomFieldsDraftSchema.optional(),
|
|
1278
|
+
description: LocalizedStringSchema.optional(),
|
|
1279
|
+
name: LocalizedStringSchema,
|
|
1280
|
+
quantity: z.number().int().optional(),
|
|
1281
|
+
});
|
|
1282
|
+
|
|
1283
|
+
export const StagedPriceDraftSchema = z.object({
|
|
1284
|
+
value: TypedMoneyDraftSchema,
|
|
1285
|
+
});
|
|
1286
|
+
|
|
1287
|
+
export const QuoteRequestResourceIdentifierSchema = z
|
|
1288
|
+
.object({
|
|
1289
|
+
typeId: ReferenceTypeIdSchema,
|
|
1290
|
+
id: z.string().optional(),
|
|
1291
|
+
key: z.string().optional(),
|
|
1292
|
+
})
|
|
1293
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
1294
|
+
message: "Either 'id' or 'key' must be provided",
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
export const StoreCountrySchema = z.object({
|
|
1298
|
+
code: CountryCodeSchema,
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
export const ProductSelectionResourceIdentifierSchema = z
|
|
1302
|
+
.object({
|
|
1303
|
+
typeId: ReferenceTypeIdSchema,
|
|
1304
|
+
id: z.string().optional(),
|
|
1305
|
+
key: z.string().optional(),
|
|
1306
|
+
})
|
|
1307
|
+
.refine((data) => data.id !== undefined || data.key !== undefined, {
|
|
1308
|
+
message: "Either 'id' or 'key' must be provided",
|
|
1309
|
+
});
|
|
1310
|
+
|
|
1311
|
+
export const ProductSelectionSettingDraftSchema = z.object({
|
|
1312
|
+
productSelection: ProductSelectionResourceIdentifierSchema,
|
|
1313
|
+
active: z.boolean().optional(),
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1316
|
+
export const DestinationSchema = z.object({
|
|
1317
|
+
type: z.string(),
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
export const MessageSubscriptionSchema = z.object({
|
|
1321
|
+
resourceTypeId: MessageSubscriptionResourceTypeIdSchema,
|
|
1322
|
+
types: z.array(z.string()).optional(),
|
|
1323
|
+
});
|
|
1324
|
+
|
|
1325
|
+
export const ChangeSubscriptionSchema = z.object({
|
|
1326
|
+
resourceTypeId: ChangeSubscriptionResourceTypeIdSchema,
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
export const EventSubscriptionSchema = z.object({
|
|
1330
|
+
resourceTypeId: EventSubscriptionResourceTypeIdSchema,
|
|
1331
|
+
types: z.array(EventTypeSchema).optional(),
|
|
1332
|
+
});
|
|
1333
|
+
|
|
1334
|
+
export const CloudEventsFormatSchema = z.object({
|
|
1335
|
+
type: z.string(),
|
|
1336
|
+
cloudEventsVersion: z.string(),
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
export const PlatformFormatSchema = z.object({
|
|
1340
|
+
type: z.string(),
|
|
1341
|
+
});
|
|
1342
|
+
|
|
1343
|
+
export const DeliveryFormatSchema = z.object({
|
|
1344
|
+
type: z.string(),
|
|
1345
|
+
});
|
|
1346
|
+
|
|
1347
|
+
export const TaxRateDraftSchema = z.object({
|
|
1348
|
+
name: z.string(),
|
|
1349
|
+
amount: z.number().optional(),
|
|
1350
|
+
includedInPrice: z.boolean(),
|
|
1351
|
+
country: CountryCodeSchema,
|
|
1352
|
+
state: z.string().optional(),
|
|
1353
|
+
subRates: z.array(SubRateSchema).optional(),
|
|
1354
|
+
key: z.string().optional(),
|
|
1355
|
+
});
|
|
1356
|
+
|
|
1357
|
+
export const FieldTypeSchema = z.object({
|
|
1358
|
+
name: z.string(),
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
export const FieldDefinitionSchema = z.object({
|
|
1362
|
+
type: FieldTypeSchema,
|
|
1363
|
+
name: z.string(),
|
|
1364
|
+
label: LocalizedStringSchema,
|
|
1365
|
+
required: z.boolean(),
|
|
1366
|
+
inputHint: TypeTextInputHintSchema.optional(),
|
|
1367
|
+
});
|
|
1368
|
+
|
|
1369
|
+
export const LocationSchema = z.object({
|
|
1370
|
+
country: CountryCodeSchema,
|
|
1371
|
+
state: z.string().optional(),
|
|
1372
|
+
});
|