@useairfoil/producer-shopify 0.2.1 → 0.2.2
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/LICENSE.txt +201 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/main.mjs +7 -5
- package/dist/main.mjs.map +1 -1
- package/dist/{src-Bgvuhcfk.mjs → src-YBU_KSf5.mjs} +272 -273
- package/dist/src-YBU_KSf5.mjs.map +1 -0
- package/package.json +17 -17
- package/src/create-table.ts +6 -1
- package/src/main.ts +8 -2
- package/src/resources/carts/row.ts +59 -35
- package/src/resources/customers/row.ts +67 -39
- package/src/resources/orders/row.ts +242 -116
- package/src/resources/products/row.ts +72 -42
- package/src/resources/refunds/row.ts +84 -44
- package/src/resources/shared.ts +77 -70
- package/src/start.ts +2 -2
- package/dist/src-Bgvuhcfk.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Iceberg } from "@useairfoil/connector-kit";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
|
|
4
|
-
import { address, attributes, discountAllocations,
|
|
4
|
+
import { address, attributes, discountAllocations, moneyBag, taxLines } from "../shared";
|
|
5
5
|
|
|
6
6
|
export const OrderCancelReasonSchema = Schema.Literals([
|
|
7
7
|
"CUSTOMER",
|
|
@@ -40,133 +40,259 @@ export const DiscountTargetTypeSchema = Schema.Literals(["LINE_ITEM", "SHIPPING_
|
|
|
40
40
|
export const DiscountValueTypeSchema = Schema.Literals(["PERCENTAGE", "FIXED_AMOUNT"]);
|
|
41
41
|
|
|
42
42
|
export const DiscountApplicationSchema = Schema.Struct({
|
|
43
|
-
index: Schema.Int.pipe(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
index: Schema.Int.pipe(
|
|
44
|
+
Schema.annotateKey({ description: "Position used by discount allocations." }),
|
|
45
|
+
),
|
|
46
|
+
type: DiscountApplicationTypeSchema.pipe(
|
|
47
|
+
Schema.annotateKey({ description: "How the discount was applied." }),
|
|
48
|
+
),
|
|
49
|
+
code: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Discount code." })),
|
|
50
|
+
title: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Discount title." })),
|
|
51
|
+
description: Schema.NullOr(Schema.String).pipe(
|
|
52
|
+
Schema.annotateKey({ description: "Manual discount description." }),
|
|
53
|
+
),
|
|
54
|
+
allocationMethod: DiscountAllocationMethodSchema.pipe(
|
|
55
|
+
Schema.annotateKey({ description: "How the value is split." }),
|
|
56
|
+
),
|
|
57
|
+
targetSelection: DiscountTargetSelectionSchema.pipe(
|
|
58
|
+
Schema.annotateKey({ description: "Which lines are targeted." }),
|
|
59
|
+
),
|
|
60
|
+
targetType: DiscountTargetTypeSchema.pipe(
|
|
61
|
+
Schema.annotateKey({ description: "Kind of lines targeted." }),
|
|
62
|
+
),
|
|
63
|
+
valueType: DiscountValueTypeSchema.pipe(
|
|
64
|
+
Schema.annotateKey({ description: "Whether the value is a percent." }),
|
|
65
|
+
),
|
|
66
|
+
value: Schema.String.pipe(
|
|
67
|
+
Schema.annotateKey({ description: "Percent or amount in the customer currency." }),
|
|
68
|
+
),
|
|
53
69
|
});
|
|
54
70
|
|
|
55
71
|
export const ShippingLineSchema = Schema.Struct({
|
|
56
|
-
id: Schema.NullOr(Schema.String).pipe(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
id: Schema.NullOr(Schema.String).pipe(
|
|
73
|
+
Schema.annotateKey({ description: "Unique shipping line identifier." }),
|
|
74
|
+
),
|
|
75
|
+
title: Schema.String.pipe(Schema.annotateKey({ description: "Shipping method title." })),
|
|
76
|
+
code: Schema.NullOr(Schema.String).pipe(
|
|
77
|
+
Schema.annotateKey({ description: "Shipping rate code." }),
|
|
78
|
+
),
|
|
79
|
+
source: Schema.NullOr(Schema.String).pipe(
|
|
80
|
+
Schema.annotateKey({ description: "Source of the shipping rate." }),
|
|
81
|
+
),
|
|
82
|
+
carrierIdentifier: Schema.NullOr(Schema.String).pipe(
|
|
83
|
+
Schema.annotateKey({ description: "Carrier service identifier." }),
|
|
84
|
+
),
|
|
85
|
+
phone: Schema.NullOr(Schema.String).pipe(
|
|
86
|
+
Schema.annotateKey({ description: "Phone number for the shipping line." }),
|
|
87
|
+
),
|
|
88
|
+
isRemoved: Schema.Boolean.pipe(
|
|
89
|
+
Schema.annotateKey({ description: "Whether the line was removed by an edit." }),
|
|
90
|
+
),
|
|
91
|
+
originalPriceSet: moneyBag.pipe(Schema.annotateKey({ description: "Price before discounts." })),
|
|
92
|
+
discountedPriceSet: moneyBag.pipe(Schema.annotateKey({ description: "Price after discounts." })),
|
|
93
|
+
currentDiscountedPriceSet: moneyBag.pipe(
|
|
94
|
+
Schema.annotateKey({ description: "Price after discounts, edits, and refunds." }),
|
|
95
|
+
),
|
|
96
|
+
taxLines: taxLines.pipe(Schema.annotateKey({ description: "Taxes on the shipping line." })),
|
|
97
|
+
discountAllocations: discountAllocations.pipe(
|
|
98
|
+
Schema.annotateKey({ description: "Discounts on the line." }),
|
|
99
|
+
),
|
|
70
100
|
});
|
|
71
101
|
|
|
72
102
|
export const OrderLineItemSchema = Schema.Struct({
|
|
73
|
-
id: Schema.String.pipe(
|
|
74
|
-
name: Schema.String.pipe(
|
|
75
|
-
title: Schema.String.pipe(
|
|
76
|
-
variantTitle: Schema.NullOr(Schema.String).pipe(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
id: Schema.String.pipe(Schema.annotateKey({ description: "Unique line item identifier." })),
|
|
104
|
+
name: Schema.String.pipe(Schema.annotateKey({ description: "Product and variant name." })),
|
|
105
|
+
title: Schema.String.pipe(Schema.annotateKey({ description: "Product title." })),
|
|
106
|
+
variantTitle: Schema.NullOr(Schema.String).pipe(
|
|
107
|
+
Schema.annotateKey({ description: "Variant title." }),
|
|
108
|
+
),
|
|
109
|
+
sku: Schema.NullOr(Schema.String).pipe(
|
|
110
|
+
Schema.annotateKey({ description: "Stock keeping unit." }),
|
|
111
|
+
),
|
|
112
|
+
vendor: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Product vendor." })),
|
|
113
|
+
productId: Schema.NullOr(Schema.String).pipe(
|
|
114
|
+
Schema.annotateKey({ description: "Product identifier." }),
|
|
115
|
+
),
|
|
116
|
+
variantId: Schema.NullOr(Schema.String).pipe(
|
|
117
|
+
Schema.annotateKey({ description: "Product variant identifier." }),
|
|
118
|
+
),
|
|
119
|
+
quantity: Schema.Int.pipe(
|
|
120
|
+
Schema.annotateKey({ description: "Quantity when the order was placed." }),
|
|
121
|
+
),
|
|
122
|
+
currentQuantity: Schema.Int.pipe(
|
|
123
|
+
Schema.annotateKey({ description: "Quantity after removals and refunds." }),
|
|
124
|
+
),
|
|
125
|
+
taxable: Schema.Boolean.pipe(
|
|
126
|
+
Schema.annotateKey({ description: "Whether the line item is taxable." }),
|
|
127
|
+
),
|
|
128
|
+
requiresShipping: Schema.Boolean.pipe(
|
|
129
|
+
Schema.annotateKey({ description: "Whether the line item needs shipping." }),
|
|
130
|
+
),
|
|
131
|
+
isGiftCard: Schema.Boolean.pipe(
|
|
132
|
+
Schema.annotateKey({ description: "Whether the line item is a gift card." }),
|
|
133
|
+
),
|
|
134
|
+
originalUnitPriceSet: moneyBag.pipe(
|
|
135
|
+
Schema.annotateKey({ description: "Unit price before discounts." }),
|
|
136
|
+
),
|
|
137
|
+
totalDiscountSet: moneyBag.pipe(
|
|
138
|
+
Schema.annotateKey({ description: "Total discount on the line." }),
|
|
139
|
+
),
|
|
140
|
+
taxLines: taxLines.pipe(Schema.annotateKey({ description: "Taxes on the line." })),
|
|
141
|
+
discountAllocations: discountAllocations.pipe(
|
|
142
|
+
Schema.annotateKey({ description: "Discounts on the line." }),
|
|
143
|
+
),
|
|
144
|
+
customAttributes: attributes.pipe(Schema.annotateKey({ description: "Custom line properties." })),
|
|
91
145
|
});
|
|
92
146
|
|
|
93
147
|
export const OrderSchema = Schema.Struct({
|
|
94
|
-
id: Schema.String.pipe(
|
|
95
|
-
legacyResourceId: Schema.String.pipe(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
148
|
+
id: Schema.String.pipe(Schema.annotateKey({ description: "Unique order identifier." })),
|
|
149
|
+
legacyResourceId: Schema.String.pipe(
|
|
150
|
+
Schema.annotateKey({ description: "Numeric order identifier stored as text." }),
|
|
151
|
+
),
|
|
152
|
+
name: Schema.String.pipe(
|
|
153
|
+
Schema.annotateKey({ description: "Order name shown to the merchant." }),
|
|
154
|
+
),
|
|
155
|
+
email: Schema.NullOr(Schema.String).pipe(
|
|
156
|
+
Schema.annotateKey({ description: "Email used for the order." }),
|
|
157
|
+
),
|
|
158
|
+
phone: Schema.NullOr(Schema.String).pipe(
|
|
159
|
+
Schema.annotateKey({ description: "Phone used for the order." }),
|
|
160
|
+
),
|
|
161
|
+
customerId: Schema.NullOr(Schema.String).pipe(
|
|
162
|
+
Schema.annotateKey({ description: "Customer identifier." }),
|
|
163
|
+
),
|
|
164
|
+
customerLocale: Schema.NullOr(Schema.String).pipe(
|
|
165
|
+
Schema.annotateKey({ description: "Customer language." }),
|
|
166
|
+
),
|
|
167
|
+
customerAcceptsMarketing: Schema.Boolean.pipe(
|
|
168
|
+
Schema.annotateKey({ description: "Whether the buyer accepts marketing." }),
|
|
169
|
+
),
|
|
170
|
+
billingAddress: Schema.NullOr(address).pipe(
|
|
171
|
+
Schema.annotateKey({ description: "Billing address." }),
|
|
172
|
+
),
|
|
173
|
+
shippingAddress: Schema.NullOr(address).pipe(
|
|
174
|
+
Schema.annotateKey({ description: "Shipping address." }),
|
|
175
|
+
),
|
|
176
|
+
note: Schema.NullOr(Schema.String).pipe(Schema.annotateKey({ description: "Order note." })),
|
|
177
|
+
customAttributes: attributes.pipe(
|
|
178
|
+
Schema.annotateKey({ description: "Custom order attributes." }),
|
|
179
|
+
),
|
|
180
|
+
tags: Schema.Array(Schema.String).pipe(
|
|
181
|
+
Schema.annotateKey({ description: "Tags added to the order." }),
|
|
182
|
+
),
|
|
183
|
+
confirmationNumber: Schema.NullOr(Schema.String).pipe(
|
|
184
|
+
Schema.annotateKey({ description: "Confirmation number." }),
|
|
185
|
+
),
|
|
186
|
+
poNumber: Schema.NullOr(Schema.String).pipe(
|
|
187
|
+
Schema.annotateKey({ description: "Purchase order number." }),
|
|
188
|
+
),
|
|
189
|
+
sourceName: Schema.NullOr(Schema.String).pipe(
|
|
190
|
+
Schema.annotateKey({ description: "Channel that created the order." }),
|
|
191
|
+
),
|
|
192
|
+
sourceIdentifier: Schema.NullOr(Schema.String).pipe(
|
|
193
|
+
Schema.annotateKey({ description: "Identifier from the source." }),
|
|
194
|
+
),
|
|
195
|
+
appId: Schema.NullOr(Schema.String).pipe(
|
|
196
|
+
Schema.annotateKey({ description: "App that created the order." }),
|
|
197
|
+
),
|
|
198
|
+
paymentGatewayNames: Schema.Array(Schema.String).pipe(
|
|
199
|
+
Schema.annotateKey({ description: "Payment gateways used." }),
|
|
200
|
+
),
|
|
201
|
+
test: Schema.Boolean.pipe(
|
|
202
|
+
Schema.annotateKey({ description: "Whether the order is a test order." }),
|
|
203
|
+
),
|
|
204
|
+
taxesIncluded: Schema.Boolean.pipe(
|
|
205
|
+
Schema.annotateKey({ description: "Whether prices include taxes." }),
|
|
206
|
+
),
|
|
207
|
+
taxExempt: Schema.Boolean.pipe(
|
|
208
|
+
Schema.annotateKey({ description: "Whether the order is exempt from tax." }),
|
|
209
|
+
),
|
|
210
|
+
dutiesIncluded: Schema.Boolean.pipe(
|
|
211
|
+
Schema.annotateKey({ description: "Whether prices include duties." }),
|
|
212
|
+
),
|
|
213
|
+
estimatedTaxes: Schema.Boolean.pipe(
|
|
214
|
+
Schema.annotateKey({ description: "Whether taxes are estimates." }),
|
|
215
|
+
),
|
|
216
|
+
totalWeight: Schema.NullOr(Schema.Int).pipe(
|
|
217
|
+
Schema.annotateKey({ description: "Total weight in grams." }),
|
|
218
|
+
),
|
|
123
219
|
displayFinancialStatus: Schema.NullOr(OrderFinancialStatusSchema).pipe(
|
|
124
|
-
|
|
220
|
+
Schema.annotateKey({ description: "Payment status of the order." }),
|
|
125
221
|
),
|
|
126
222
|
cancelReason: Schema.NullOr(OrderCancelReasonSchema).pipe(
|
|
127
|
-
|
|
128
|
-
),
|
|
129
|
-
cancelledAt: Schema.NullOr(Schema.Date).pipe(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
),
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
),
|
|
169
|
-
|
|
223
|
+
Schema.annotateKey({ description: "Reason the order was cancelled." }),
|
|
224
|
+
),
|
|
225
|
+
cancelledAt: Schema.NullOr(Schema.Date).pipe(
|
|
226
|
+
Schema.annotateKey({ description: "Time when the order was cancelled." }),
|
|
227
|
+
),
|
|
228
|
+
closedAt: Schema.NullOr(Schema.Date).pipe(
|
|
229
|
+
Schema.annotateKey({ description: "Time when the order was closed." }),
|
|
230
|
+
),
|
|
231
|
+
processedAt: Schema.Date.pipe(
|
|
232
|
+
Schema.annotateKey({ description: "Time when the order was processed." }),
|
|
233
|
+
),
|
|
234
|
+
createdAt: Schema.Date.pipe(
|
|
235
|
+
Schema.annotateKey({ description: "Time when the order was created." }),
|
|
236
|
+
),
|
|
237
|
+
updatedAt: Schema.Date.pipe(
|
|
238
|
+
Schema.annotateKey({ description: "Time when the order was last changed." }),
|
|
239
|
+
),
|
|
240
|
+
currencyCode: Schema.String.pipe(Schema.annotateKey({ description: "Shop currency code." })),
|
|
241
|
+
presentmentCurrencyCode: Schema.String.pipe(
|
|
242
|
+
Schema.annotateKey({ description: "Customer currency code." }),
|
|
243
|
+
),
|
|
244
|
+
discountCodes: Schema.Array(Schema.String).pipe(
|
|
245
|
+
Schema.annotateKey({ description: "Discount codes used." }),
|
|
246
|
+
),
|
|
247
|
+
discountApplications: Schema.Array(DiscountApplicationSchema).pipe(
|
|
248
|
+
Schema.annotateKey({ description: "Discounts applied to the order." }),
|
|
249
|
+
),
|
|
250
|
+
subtotalPriceSet: Schema.NullOr(moneyBag).pipe(
|
|
251
|
+
Schema.annotateKey({ description: "Subtotal when the order was placed." }),
|
|
252
|
+
),
|
|
253
|
+
currentSubtotalPriceSet: moneyBag.pipe(
|
|
254
|
+
Schema.annotateKey({ description: "Subtotal after edits and refunds." }),
|
|
255
|
+
),
|
|
256
|
+
totalDiscountsSet: Schema.NullOr(moneyBag).pipe(
|
|
257
|
+
Schema.annotateKey({ description: "Discounts when the order was placed." }),
|
|
258
|
+
),
|
|
259
|
+
currentTotalDiscountsSet: moneyBag.pipe(
|
|
260
|
+
Schema.annotateKey({ description: "Discounts after edits and refunds." }),
|
|
261
|
+
),
|
|
262
|
+
totalShippingPriceSet: moneyBag.pipe(
|
|
263
|
+
Schema.annotateKey({ description: "Shipping when the order was placed." }),
|
|
264
|
+
),
|
|
265
|
+
currentShippingPriceSet: moneyBag.pipe(
|
|
266
|
+
Schema.annotateKey({ description: "Shipping after edits and refunds." }),
|
|
267
|
+
),
|
|
268
|
+
totalTaxSet: Schema.NullOr(moneyBag).pipe(
|
|
269
|
+
Schema.annotateKey({ description: "Tax when the order was placed." }),
|
|
270
|
+
),
|
|
271
|
+
currentTotalTaxSet: moneyBag.pipe(
|
|
272
|
+
Schema.annotateKey({ description: "Tax after edits and refunds." }),
|
|
273
|
+
),
|
|
274
|
+
originalTotalDutiesSet: Schema.NullOr(moneyBag).pipe(
|
|
275
|
+
Schema.annotateKey({ description: "Duties when the order was placed." }),
|
|
276
|
+
),
|
|
277
|
+
currentTotalDutiesSet: Schema.NullOr(moneyBag).pipe(
|
|
278
|
+
Schema.annotateKey({ description: "Duties after edits and refunds." }),
|
|
279
|
+
),
|
|
280
|
+
totalPriceSet: moneyBag.pipe(
|
|
281
|
+
Schema.annotateKey({ description: "Total when the order was placed." }),
|
|
282
|
+
),
|
|
283
|
+
currentTotalPriceSet: moneyBag.pipe(
|
|
284
|
+
Schema.annotateKey({ description: "Total after edits and refunds." }),
|
|
285
|
+
),
|
|
286
|
+
taxLines: taxLines.pipe(Schema.annotateKey({ description: "Taxes when the order was placed." })),
|
|
287
|
+
shippingLines: Schema.Array(ShippingLineSchema).pipe(
|
|
288
|
+
Schema.annotateKey({ description: "Shipping lines, including removed ones." }),
|
|
289
|
+
),
|
|
290
|
+
lineItems: Schema.Array(OrderLineItemSchema).pipe(
|
|
291
|
+
Schema.annotateKey({ description: "Line items in the order." }),
|
|
292
|
+
),
|
|
293
|
+
_deleted: Schema.optional(Schema.Boolean).pipe(
|
|
294
|
+
Schema.annotateKey({ description: "Whether the order was deleted." }),
|
|
295
|
+
),
|
|
170
296
|
})
|
|
171
297
|
.annotate({
|
|
172
298
|
description: "Orders in a Shopify store.",
|
|
@@ -1,76 +1,106 @@
|
|
|
1
1
|
import { Iceberg } from "@useairfoil/connector-kit";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
3
|
|
|
4
|
-
import { field } from "../shared";
|
|
5
|
-
|
|
6
4
|
export const ProductStatusSchema = Schema.Literals(["ACTIVE", "ARCHIVED", "DRAFT", "UNLISTED"]);
|
|
7
5
|
|
|
8
6
|
export const ProductVariantInventoryPolicySchema = Schema.Literals(["CONTINUE", "DENY"]);
|
|
9
7
|
|
|
10
8
|
const ProductImageSchema = Schema.Struct({
|
|
11
|
-
url: Schema.String.pipe(
|
|
12
|
-
altText: Schema.NullOr(Schema.String).pipe(
|
|
9
|
+
url: Schema.String.pipe(Schema.annotateKey({ description: "URL of the image." })),
|
|
10
|
+
altText: Schema.NullOr(Schema.String).pipe(
|
|
11
|
+
Schema.annotateKey({ description: "Alternative text for the image." }),
|
|
12
|
+
),
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export const ProductFeaturedMediaSchema = Schema.Struct({
|
|
16
|
-
image: Schema.NullOr(ProductImageSchema).pipe(
|
|
16
|
+
image: Schema.NullOr(ProductImageSchema).pipe(
|
|
17
|
+
Schema.annotateKey({ description: "Image for the featured media." }),
|
|
18
|
+
),
|
|
17
19
|
});
|
|
18
20
|
|
|
19
21
|
export const ProductOptionSchema = Schema.Struct({
|
|
20
|
-
id: Schema.String.pipe(
|
|
21
|
-
name: Schema.String.pipe(
|
|
22
|
-
position: Schema.Int.pipe(
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
id: Schema.String.pipe(Schema.annotateKey({ description: "Unique product option identifier." })),
|
|
23
|
+
name: Schema.String.pipe(Schema.annotateKey({ description: "Name of the product option." })),
|
|
24
|
+
position: Schema.Int.pipe(
|
|
25
|
+
Schema.annotateKey({ description: "Position of the option on the product." }),
|
|
26
|
+
),
|
|
27
|
+
values: Schema.Array(Schema.String).pipe(
|
|
28
|
+
Schema.annotateKey({ description: "Values available for the option." }),
|
|
25
29
|
),
|
|
26
30
|
});
|
|
27
31
|
|
|
28
32
|
export const ProductVariantSchema = Schema.Struct({
|
|
29
|
-
id: Schema.String.pipe(
|
|
30
|
-
legacyResourceId: Schema.String.pipe(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
id: Schema.String.pipe(Schema.annotateKey({ description: "Unique product variant identifier." })),
|
|
34
|
+
legacyResourceId: Schema.String.pipe(
|
|
35
|
+
Schema.annotateKey({ description: "Numeric variant identifier stored as text." }),
|
|
36
|
+
),
|
|
37
|
+
title: Schema.String.pipe(Schema.annotateKey({ description: "Display title of the variant." })),
|
|
38
|
+
sku: Schema.NullOr(Schema.String).pipe(
|
|
39
|
+
Schema.annotateKey({ description: "Stock keeping unit for the variant." }),
|
|
40
|
+
),
|
|
41
|
+
barcode: Schema.NullOr(Schema.String).pipe(
|
|
42
|
+
Schema.annotateKey({ description: "Barcode for the variant." }),
|
|
43
|
+
),
|
|
44
|
+
price: Schema.String.pipe(Schema.annotateKey({ description: "Price of the variant." })),
|
|
35
45
|
compareAtPrice: Schema.NullOr(Schema.String).pipe(
|
|
36
|
-
|
|
46
|
+
Schema.annotateKey({ description: "Original price used for comparison." }),
|
|
37
47
|
),
|
|
38
48
|
inventoryPolicy: ProductVariantInventoryPolicySchema.pipe(
|
|
39
|
-
|
|
49
|
+
Schema.annotateKey({ description: "Behavior when the variant is out of stock." }),
|
|
50
|
+
),
|
|
51
|
+
taxable: Schema.Boolean.pipe(
|
|
52
|
+
Schema.annotateKey({ description: "Whether the variant is taxable." }),
|
|
53
|
+
),
|
|
54
|
+
createdAt: Schema.Date.pipe(
|
|
55
|
+
Schema.annotateKey({ description: "Time when the variant was created." }),
|
|
56
|
+
),
|
|
57
|
+
updatedAt: Schema.Date.pipe(
|
|
58
|
+
Schema.annotateKey({ description: "Time when the variant was last changed." }),
|
|
40
59
|
),
|
|
41
|
-
taxable: Schema.Boolean.pipe(field(410, "Whether the variant is taxable.")),
|
|
42
|
-
createdAt: Schema.Date.pipe(field(411, "Time when the variant was created.")),
|
|
43
|
-
updatedAt: Schema.Date.pipe(field(412, "Time when the variant was last changed.")),
|
|
44
60
|
});
|
|
45
61
|
|
|
46
62
|
export const ProductSchema = Schema.Struct({
|
|
47
|
-
id: Schema.String.pipe(
|
|
48
|
-
legacyResourceId: Schema.String.pipe(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
id: Schema.String.pipe(Schema.annotateKey({ description: "Unique product identifier." })),
|
|
64
|
+
legacyResourceId: Schema.String.pipe(
|
|
65
|
+
Schema.annotateKey({ description: "Numeric product identifier stored as text." }),
|
|
66
|
+
),
|
|
67
|
+
title: Schema.String.pipe(Schema.annotateKey({ description: "Title of the product." })),
|
|
68
|
+
handle: Schema.String.pipe(Schema.annotateKey({ description: "URL handle for the product." })),
|
|
69
|
+
descriptionHtml: Schema.String.pipe(
|
|
70
|
+
Schema.annotateKey({ description: "Product description as HTML." }),
|
|
71
|
+
),
|
|
72
|
+
productType: Schema.String.pipe(
|
|
73
|
+
Schema.annotateKey({ description: "Merchant-defined product type." }),
|
|
74
|
+
),
|
|
75
|
+
vendor: Schema.String.pipe(Schema.annotateKey({ description: "Vendor of the product." })),
|
|
76
|
+
status: ProductStatusSchema.pipe(Schema.annotateKey({ description: "Current product status." })),
|
|
77
|
+
tags: Schema.Array(Schema.String).pipe(
|
|
78
|
+
Schema.annotateKey({ description: "Tags added to the product." }),
|
|
79
|
+
),
|
|
80
|
+
createdAt: Schema.Date.pipe(
|
|
81
|
+
Schema.annotateKey({ description: "Time when the product was created." }),
|
|
82
|
+
),
|
|
83
|
+
updatedAt: Schema.Date.pipe(
|
|
84
|
+
Schema.annotateKey({ description: "Time when the product was last changed." }),
|
|
85
|
+
),
|
|
86
|
+
publishedAt: Schema.NullOr(Schema.Date).pipe(
|
|
87
|
+
Schema.annotateKey({ description: "Time when the product was published." }),
|
|
88
|
+
),
|
|
61
89
|
templateSuffix: Schema.NullOr(Schema.String).pipe(
|
|
62
|
-
|
|
90
|
+
Schema.annotateKey({ description: "Theme template suffix used by the product." }),
|
|
63
91
|
),
|
|
64
92
|
featuredMedia: Schema.NullOr(ProductFeaturedMediaSchema).pipe(
|
|
65
|
-
|
|
93
|
+
Schema.annotateKey({ description: "Featured media for the product." }),
|
|
94
|
+
),
|
|
95
|
+
options: Schema.Array(ProductOptionSchema).pipe(
|
|
96
|
+
Schema.annotateKey({ description: "Options for the product." }),
|
|
66
97
|
),
|
|
67
|
-
|
|
68
|
-
|
|
98
|
+
variants: Schema.Array(ProductVariantSchema).pipe(
|
|
99
|
+
Schema.annotateKey({ description: "Variants of the product." }),
|
|
69
100
|
),
|
|
70
|
-
|
|
71
|
-
|
|
101
|
+
_deleted: Schema.optional(Schema.Boolean).pipe(
|
|
102
|
+
Schema.annotateKey({ description: "Whether the product was deleted." }),
|
|
72
103
|
),
|
|
73
|
-
_deleted: Schema.optional(Schema.Boolean).pipe(field(17, "Whether the product was deleted.")),
|
|
74
104
|
})
|
|
75
105
|
.annotate({
|
|
76
106
|
description: "Products in a Shopify store.",
|