@useairfoil/producer-shopify 0.2.0 → 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/README.md +85 -248
- package/dist/index.d.mts +6993 -0
- package/dist/index.mjs +3 -0
- package/dist/main.d.mts +1 -0
- package/dist/main.mjs +700 -0
- package/dist/main.mjs.map +1 -0
- package/dist/manifest.d.mts +32 -0
- package/dist/manifest.mjs +51 -0
- package/dist/manifest.mjs.map +1 -0
- package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.mjs} +4 -4
- package/dist/src-YBU_KSf5.mjs +2472 -0
- package/dist/src-YBU_KSf5.mjs.map +1 -0
- package/package.json +27 -27
- package/src/{auth.ts → api/auth.ts} +15 -35
- package/src/api/client.ts +429 -0
- package/src/api/graphql.ts +221 -0
- package/src/api/http.ts +25 -0
- package/src/connector.ts +266 -163
- package/src/create-table.ts +10 -0
- package/src/demo/customers.ts +412 -0
- package/src/demo/index.ts +31 -0
- package/src/demo/setup.ts +63 -0
- package/src/demo/shared.ts +114 -0
- package/src/index.ts +35 -21
- package/src/main.ts +14 -8
- package/src/manifest.ts +4 -55
- package/src/resources/carts/row.ts +82 -0
- package/src/resources/carts/webhook.ts +98 -0
- package/src/resources/customers/graphql.ts +175 -0
- package/src/resources/customers/row.ts +140 -0
- package/src/resources/customers/webhook.ts +30 -0
- package/src/resources/orders/graphql.ts +419 -0
- package/src/resources/orders/row.ts +306 -0
- package/src/resources/orders/webhook.ts +248 -0
- package/src/resources/products/graphql.ts +142 -0
- package/src/resources/products/row.ts +122 -0
- package/src/resources/products/webhook.ts +130 -0
- package/src/resources/refunds/graphql.ts +196 -0
- package/src/resources/refunds/row.ts +137 -0
- package/src/resources/refunds/webhook.ts +123 -0
- package/src/resources/shared.ts +300 -0
- package/src/sandbox.ts +3 -3
- package/src/start.ts +4 -6
- package/src/tables.ts +15 -0
- package/dist/index.d.ts +0 -965
- package/dist/index.js +0 -4
- package/dist/main.d.ts +0 -1
- package/dist/main.js +0 -49
- package/dist/main.js.map +0 -1
- package/dist/manifest-BFfx2LkS.js +0 -91
- package/dist/manifest-BFfx2LkS.js.map +0 -1
- package/dist/manifest-CPOEExQU.d.ts +0 -34
- package/dist/manifest.d.ts +0 -2
- package/dist/manifest.js +0 -3
- package/dist/src-DqmiLrYS.js +0 -984
- package/dist/src-DqmiLrYS.js.map +0 -1
- package/src/api.ts +0 -636
- package/src/schemas.ts +0 -319
- package/src/throttle.ts +0 -89
- package/src/transient-retry.ts +0 -74
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AddressFields,
|
|
5
|
+
DiscountAllocationFields,
|
|
6
|
+
GraphQLAddressSchema,
|
|
7
|
+
GraphQLAttributeSchema,
|
|
8
|
+
GraphQLDiscountAllocationSchema,
|
|
9
|
+
GraphQLMoneyBagSchema,
|
|
10
|
+
GraphQLTaxLineSchema,
|
|
11
|
+
MoneyBagFields,
|
|
12
|
+
type Nodes,
|
|
13
|
+
PageInfoFields,
|
|
14
|
+
TaxLineFields,
|
|
15
|
+
connection,
|
|
16
|
+
emptyText,
|
|
17
|
+
fromGraphQL,
|
|
18
|
+
idRef,
|
|
19
|
+
normalizeAmount,
|
|
20
|
+
pageQuery,
|
|
21
|
+
} from "../shared";
|
|
22
|
+
import {
|
|
23
|
+
DiscountAllocationMethodSchema,
|
|
24
|
+
type DiscountApplication,
|
|
25
|
+
type DiscountApplicationType,
|
|
26
|
+
DiscountTargetSelectionSchema,
|
|
27
|
+
DiscountTargetTypeSchema,
|
|
28
|
+
type Order,
|
|
29
|
+
OrderCancelReasonSchema,
|
|
30
|
+
OrderFinancialStatusSchema,
|
|
31
|
+
} from "./row";
|
|
32
|
+
|
|
33
|
+
const LineItemFields = `
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
title
|
|
37
|
+
variantTitle
|
|
38
|
+
sku
|
|
39
|
+
vendor
|
|
40
|
+
product { id }
|
|
41
|
+
variant { id }
|
|
42
|
+
quantity
|
|
43
|
+
currentQuantity
|
|
44
|
+
taxable
|
|
45
|
+
requiresShipping
|
|
46
|
+
isGiftCard
|
|
47
|
+
originalUnitPriceSet { ${MoneyBagFields} }
|
|
48
|
+
totalDiscountSet { ${MoneyBagFields} }
|
|
49
|
+
taxLines { ${TaxLineFields} }
|
|
50
|
+
discountAllocations { ${DiscountAllocationFields} }
|
|
51
|
+
customAttributes { key value }
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const ShippingLineFields = `
|
|
55
|
+
id
|
|
56
|
+
title
|
|
57
|
+
code
|
|
58
|
+
source
|
|
59
|
+
carrierIdentifier
|
|
60
|
+
phone
|
|
61
|
+
isRemoved
|
|
62
|
+
originalPriceSet { ${MoneyBagFields} }
|
|
63
|
+
discountedPriceSet { ${MoneyBagFields} }
|
|
64
|
+
currentDiscountedPriceSet { ${MoneyBagFields} }
|
|
65
|
+
taxLines { ${TaxLineFields} }
|
|
66
|
+
discountAllocations { ${DiscountAllocationFields} }
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
const DiscountApplicationFields = `
|
|
70
|
+
__typename
|
|
71
|
+
index
|
|
72
|
+
allocationMethod
|
|
73
|
+
targetSelection
|
|
74
|
+
targetType
|
|
75
|
+
value {
|
|
76
|
+
__typename
|
|
77
|
+
... on MoneyV2 { amount }
|
|
78
|
+
... on PricingPercentageValue { percentage }
|
|
79
|
+
}
|
|
80
|
+
... on DiscountCodeApplication { code }
|
|
81
|
+
... on ManualDiscountApplication { title description }
|
|
82
|
+
... on AutomaticDiscountApplication { title }
|
|
83
|
+
... on ScriptDiscountApplication { title }
|
|
84
|
+
`;
|
|
85
|
+
|
|
86
|
+
export const OrderFields = `
|
|
87
|
+
id
|
|
88
|
+
legacyResourceId
|
|
89
|
+
name
|
|
90
|
+
email
|
|
91
|
+
phone
|
|
92
|
+
customer { id }
|
|
93
|
+
customerLocale
|
|
94
|
+
customerAcceptsMarketing
|
|
95
|
+
billingAddress { ${AddressFields} }
|
|
96
|
+
shippingAddress { ${AddressFields} }
|
|
97
|
+
note
|
|
98
|
+
customAttributes { key value }
|
|
99
|
+
tags
|
|
100
|
+
confirmationNumber
|
|
101
|
+
poNumber
|
|
102
|
+
sourceName
|
|
103
|
+
sourceIdentifier
|
|
104
|
+
app { id }
|
|
105
|
+
paymentGatewayNames
|
|
106
|
+
test
|
|
107
|
+
taxesIncluded
|
|
108
|
+
taxExempt
|
|
109
|
+
dutiesIncluded
|
|
110
|
+
estimatedTaxes
|
|
111
|
+
totalWeight
|
|
112
|
+
displayFinancialStatus
|
|
113
|
+
cancelReason
|
|
114
|
+
cancelledAt
|
|
115
|
+
closedAt
|
|
116
|
+
processedAt
|
|
117
|
+
createdAt
|
|
118
|
+
updatedAt
|
|
119
|
+
currencyCode
|
|
120
|
+
presentmentCurrencyCode
|
|
121
|
+
discountCodes
|
|
122
|
+
discountApplications(first: 25) { nodes { ${DiscountApplicationFields} } ${PageInfoFields} }
|
|
123
|
+
subtotalPriceSet { ${MoneyBagFields} }
|
|
124
|
+
currentSubtotalPriceSet { ${MoneyBagFields} }
|
|
125
|
+
totalDiscountsSet { ${MoneyBagFields} }
|
|
126
|
+
currentTotalDiscountsSet { ${MoneyBagFields} }
|
|
127
|
+
totalShippingPriceSet { ${MoneyBagFields} }
|
|
128
|
+
currentShippingPriceSet { ${MoneyBagFields} }
|
|
129
|
+
totalTaxSet { ${MoneyBagFields} }
|
|
130
|
+
currentTotalTaxSet { ${MoneyBagFields} }
|
|
131
|
+
originalTotalDutiesSet { ${MoneyBagFields} }
|
|
132
|
+
currentTotalDutiesSet { ${MoneyBagFields} }
|
|
133
|
+
totalPriceSet { ${MoneyBagFields} }
|
|
134
|
+
currentTotalPriceSet { ${MoneyBagFields} }
|
|
135
|
+
taxLines { ${TaxLineFields} }
|
|
136
|
+
shippingLines(first: 25, includeRemovals: true) { nodes { ${ShippingLineFields} } ${PageInfoFields} }
|
|
137
|
+
lineItems(first: 50) { nodes { ${LineItemFields} } ${PageInfoFields} }
|
|
138
|
+
`;
|
|
139
|
+
|
|
140
|
+
const orderConnectionQuery = (name: string, selection: string) => `#graphql
|
|
141
|
+
query ${name}($id: ID!, $first: Int!, $after: String) {
|
|
142
|
+
node: order(id: $id) {
|
|
143
|
+
connection: ${selection}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
export const OrderLineItemsQuery = orderConnectionQuery(
|
|
149
|
+
"AirfoilOrderLineItems",
|
|
150
|
+
`lineItems(first: $first, after: $after) { nodes { ${LineItemFields} } ${PageInfoFields} }`,
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
export const OrderShippingLinesQuery = orderConnectionQuery(
|
|
154
|
+
"AirfoilOrderShippingLines",
|
|
155
|
+
`shippingLines(first: $first, after: $after, includeRemovals: true) { nodes { ${ShippingLineFields} } ${PageInfoFields} }`,
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
export const OrderDiscountApplicationsQuery = orderConnectionQuery(
|
|
159
|
+
"AirfoilOrderDiscountApplications",
|
|
160
|
+
`discountApplications(first: $first, after: $after) { nodes { ${DiscountApplicationFields} } ${PageInfoFields} }`,
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
export const GraphQLLineItemsSchema = connection(
|
|
164
|
+
Schema.Struct({
|
|
165
|
+
id: Schema.String,
|
|
166
|
+
name: Schema.String,
|
|
167
|
+
title: Schema.String,
|
|
168
|
+
variantTitle: Schema.NullOr(Schema.String),
|
|
169
|
+
sku: Schema.NullOr(Schema.String),
|
|
170
|
+
vendor: Schema.NullOr(Schema.String),
|
|
171
|
+
product: idRef,
|
|
172
|
+
variant: idRef,
|
|
173
|
+
quantity: Schema.Int,
|
|
174
|
+
currentQuantity: Schema.Int,
|
|
175
|
+
taxable: Schema.Boolean,
|
|
176
|
+
requiresShipping: Schema.Boolean,
|
|
177
|
+
isGiftCard: Schema.Boolean,
|
|
178
|
+
originalUnitPriceSet: GraphQLMoneyBagSchema,
|
|
179
|
+
totalDiscountSet: GraphQLMoneyBagSchema,
|
|
180
|
+
taxLines: Schema.Array(GraphQLTaxLineSchema),
|
|
181
|
+
discountAllocations: Schema.Array(GraphQLDiscountAllocationSchema),
|
|
182
|
+
customAttributes: Schema.Array(GraphQLAttributeSchema),
|
|
183
|
+
}),
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
export const GraphQLShippingLinesSchema = connection(
|
|
187
|
+
Schema.Struct({
|
|
188
|
+
id: Schema.NullOr(Schema.String),
|
|
189
|
+
title: Schema.String,
|
|
190
|
+
code: Schema.NullOr(Schema.String),
|
|
191
|
+
source: Schema.NullOr(Schema.String),
|
|
192
|
+
carrierIdentifier: Schema.NullOr(Schema.String),
|
|
193
|
+
phone: Schema.NullOr(Schema.String),
|
|
194
|
+
isRemoved: Schema.Boolean,
|
|
195
|
+
originalPriceSet: GraphQLMoneyBagSchema,
|
|
196
|
+
discountedPriceSet: GraphQLMoneyBagSchema,
|
|
197
|
+
currentDiscountedPriceSet: GraphQLMoneyBagSchema,
|
|
198
|
+
taxLines: Schema.Array(GraphQLTaxLineSchema),
|
|
199
|
+
discountAllocations: Schema.Array(GraphQLDiscountAllocationSchema),
|
|
200
|
+
}),
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
const discountApplicationBase = {
|
|
204
|
+
index: Schema.Int,
|
|
205
|
+
allocationMethod: DiscountAllocationMethodSchema,
|
|
206
|
+
targetSelection: DiscountTargetSelectionSchema,
|
|
207
|
+
targetType: DiscountTargetTypeSchema,
|
|
208
|
+
value: Schema.Union([
|
|
209
|
+
Schema.Struct({ __typename: Schema.Literal("MoneyV2"), amount: Schema.String }),
|
|
210
|
+
Schema.Struct({
|
|
211
|
+
__typename: Schema.Literal("PricingPercentageValue"),
|
|
212
|
+
percentage: Schema.Number,
|
|
213
|
+
}),
|
|
214
|
+
]),
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export const GraphQLDiscountApplicationsSchema = connection(
|
|
218
|
+
Schema.Union([
|
|
219
|
+
Schema.Struct({
|
|
220
|
+
__typename: Schema.Literal("DiscountCodeApplication"),
|
|
221
|
+
code: Schema.String,
|
|
222
|
+
...discountApplicationBase,
|
|
223
|
+
}),
|
|
224
|
+
Schema.Struct({
|
|
225
|
+
__typename: Schema.Literal("ManualDiscountApplication"),
|
|
226
|
+
title: Schema.String,
|
|
227
|
+
description: Schema.NullOr(Schema.String),
|
|
228
|
+
...discountApplicationBase,
|
|
229
|
+
}),
|
|
230
|
+
Schema.Struct({
|
|
231
|
+
__typename: Schema.Literals(["AutomaticDiscountApplication", "ScriptDiscountApplication"]),
|
|
232
|
+
title: Schema.String,
|
|
233
|
+
...discountApplicationBase,
|
|
234
|
+
}),
|
|
235
|
+
]),
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
export const GraphQLOrderNodeSchema = Schema.Struct({
|
|
239
|
+
id: Schema.String,
|
|
240
|
+
legacyResourceId: Schema.String,
|
|
241
|
+
name: Schema.String,
|
|
242
|
+
email: Schema.NullOr(Schema.String),
|
|
243
|
+
phone: Schema.NullOr(Schema.String),
|
|
244
|
+
customer: idRef,
|
|
245
|
+
customerLocale: Schema.NullOr(Schema.String),
|
|
246
|
+
customerAcceptsMarketing: Schema.Boolean,
|
|
247
|
+
billingAddress: Schema.NullOr(GraphQLAddressSchema),
|
|
248
|
+
shippingAddress: Schema.NullOr(GraphQLAddressSchema),
|
|
249
|
+
note: Schema.NullOr(Schema.String),
|
|
250
|
+
customAttributes: Schema.Array(GraphQLAttributeSchema),
|
|
251
|
+
tags: Schema.Array(Schema.String),
|
|
252
|
+
confirmationNumber: Schema.NullOr(Schema.String),
|
|
253
|
+
poNumber: Schema.NullOr(Schema.String),
|
|
254
|
+
sourceName: Schema.NullOr(Schema.String),
|
|
255
|
+
sourceIdentifier: Schema.NullOr(Schema.String),
|
|
256
|
+
app: idRef,
|
|
257
|
+
paymentGatewayNames: Schema.Array(Schema.String),
|
|
258
|
+
test: Schema.Boolean,
|
|
259
|
+
taxesIncluded: Schema.Boolean,
|
|
260
|
+
taxExempt: Schema.Boolean,
|
|
261
|
+
dutiesIncluded: Schema.Boolean,
|
|
262
|
+
estimatedTaxes: Schema.Boolean,
|
|
263
|
+
totalWeight: Schema.NullOr(Schema.NumberFromString),
|
|
264
|
+
displayFinancialStatus: Schema.NullOr(OrderFinancialStatusSchema),
|
|
265
|
+
cancelReason: Schema.NullOr(OrderCancelReasonSchema),
|
|
266
|
+
cancelledAt: Schema.NullOr(Schema.DateFromString),
|
|
267
|
+
closedAt: Schema.NullOr(Schema.DateFromString),
|
|
268
|
+
processedAt: Schema.DateFromString,
|
|
269
|
+
createdAt: Schema.DateFromString,
|
|
270
|
+
updatedAt: Schema.DateFromString,
|
|
271
|
+
currencyCode: Schema.String,
|
|
272
|
+
presentmentCurrencyCode: Schema.String,
|
|
273
|
+
discountCodes: Schema.Array(Schema.String),
|
|
274
|
+
discountApplications: GraphQLDiscountApplicationsSchema,
|
|
275
|
+
subtotalPriceSet: Schema.NullOr(GraphQLMoneyBagSchema),
|
|
276
|
+
currentSubtotalPriceSet: GraphQLMoneyBagSchema,
|
|
277
|
+
totalDiscountsSet: Schema.NullOr(GraphQLMoneyBagSchema),
|
|
278
|
+
currentTotalDiscountsSet: GraphQLMoneyBagSchema,
|
|
279
|
+
totalShippingPriceSet: GraphQLMoneyBagSchema,
|
|
280
|
+
currentShippingPriceSet: GraphQLMoneyBagSchema,
|
|
281
|
+
totalTaxSet: Schema.NullOr(GraphQLMoneyBagSchema),
|
|
282
|
+
currentTotalTaxSet: GraphQLMoneyBagSchema,
|
|
283
|
+
originalTotalDutiesSet: Schema.NullOr(GraphQLMoneyBagSchema),
|
|
284
|
+
currentTotalDutiesSet: Schema.NullOr(GraphQLMoneyBagSchema),
|
|
285
|
+
totalPriceSet: GraphQLMoneyBagSchema,
|
|
286
|
+
currentTotalPriceSet: GraphQLMoneyBagSchema,
|
|
287
|
+
taxLines: Schema.Array(GraphQLTaxLineSchema),
|
|
288
|
+
shippingLines: GraphQLShippingLinesSchema,
|
|
289
|
+
lineItems: GraphQLLineItemsSchema,
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
export type GraphQLOrderNode = Schema.Schema.Type<typeof GraphQLOrderNodeSchema>;
|
|
293
|
+
|
|
294
|
+
const discountApplicationType = {
|
|
295
|
+
DiscountCodeApplication: "DISCOUNT_CODE",
|
|
296
|
+
ManualDiscountApplication: "MANUAL",
|
|
297
|
+
AutomaticDiscountApplication: "AUTOMATIC",
|
|
298
|
+
ScriptDiscountApplication: "SCRIPT",
|
|
299
|
+
} as const satisfies Record<string, DiscountApplicationType>;
|
|
300
|
+
|
|
301
|
+
export const fromOrderNode = (
|
|
302
|
+
node: GraphQLOrderNode,
|
|
303
|
+
nested: {
|
|
304
|
+
readonly discountApplications: Nodes<typeof GraphQLDiscountApplicationsSchema>;
|
|
305
|
+
readonly shippingLines: Nodes<typeof GraphQLShippingLinesSchema>;
|
|
306
|
+
readonly lineItems: Nodes<typeof GraphQLLineItemsSchema>;
|
|
307
|
+
},
|
|
308
|
+
): Order => ({
|
|
309
|
+
id: node.id,
|
|
310
|
+
legacyResourceId: node.legacyResourceId,
|
|
311
|
+
name: node.name,
|
|
312
|
+
email: emptyText(node.email),
|
|
313
|
+
phone: emptyText(node.phone),
|
|
314
|
+
customerId: node.customer?.id ?? "",
|
|
315
|
+
customerLocale: emptyText(node.customerLocale),
|
|
316
|
+
customerAcceptsMarketing: node.customerAcceptsMarketing,
|
|
317
|
+
billingAddress: node.billingAddress ? fromGraphQL.address(node.billingAddress) : null,
|
|
318
|
+
shippingAddress: node.shippingAddress ? fromGraphQL.address(node.shippingAddress) : null,
|
|
319
|
+
note: emptyText(node.note),
|
|
320
|
+
customAttributes: node.customAttributes,
|
|
321
|
+
tags: node.tags,
|
|
322
|
+
confirmationNumber: emptyText(node.confirmationNumber),
|
|
323
|
+
poNumber: emptyText(node.poNumber),
|
|
324
|
+
sourceName: emptyText(node.sourceName),
|
|
325
|
+
sourceIdentifier: emptyText(node.sourceIdentifier),
|
|
326
|
+
appId: node.app?.id ?? "",
|
|
327
|
+
paymentGatewayNames: node.paymentGatewayNames,
|
|
328
|
+
test: node.test,
|
|
329
|
+
taxesIncluded: node.taxesIncluded,
|
|
330
|
+
taxExempt: node.taxExempt,
|
|
331
|
+
dutiesIncluded: node.dutiesIncluded,
|
|
332
|
+
estimatedTaxes: node.estimatedTaxes,
|
|
333
|
+
totalWeight: node.totalWeight,
|
|
334
|
+
displayFinancialStatus: node.displayFinancialStatus,
|
|
335
|
+
cancelReason: node.cancelReason,
|
|
336
|
+
cancelledAt: node.cancelledAt,
|
|
337
|
+
closedAt: node.closedAt,
|
|
338
|
+
processedAt: node.processedAt,
|
|
339
|
+
createdAt: node.createdAt,
|
|
340
|
+
updatedAt: node.updatedAt,
|
|
341
|
+
currencyCode: node.currencyCode,
|
|
342
|
+
presentmentCurrencyCode: node.presentmentCurrencyCode,
|
|
343
|
+
discountCodes: node.discountCodes,
|
|
344
|
+
discountApplications: nested.discountApplications.map(
|
|
345
|
+
(application): DiscountApplication => ({
|
|
346
|
+
index: application.index,
|
|
347
|
+
type: discountApplicationType[application.__typename],
|
|
348
|
+
code: application.__typename === "DiscountCodeApplication" ? application.code : null,
|
|
349
|
+
title: application.__typename === "DiscountCodeApplication" ? null : application.title,
|
|
350
|
+
description:
|
|
351
|
+
application.__typename === "ManualDiscountApplication" ? application.description : null,
|
|
352
|
+
allocationMethod: application.allocationMethod,
|
|
353
|
+
targetSelection: application.targetSelection,
|
|
354
|
+
targetType: application.targetType,
|
|
355
|
+
valueType: application.value.__typename === "MoneyV2" ? "FIXED_AMOUNT" : "PERCENTAGE",
|
|
356
|
+
value:
|
|
357
|
+
application.value.__typename === "MoneyV2"
|
|
358
|
+
? normalizeAmount(application.value.amount)
|
|
359
|
+
: normalizeAmount(String(application.value.percentage)),
|
|
360
|
+
}),
|
|
361
|
+
),
|
|
362
|
+
subtotalPriceSet: node.subtotalPriceSet ? fromGraphQL.money(node.subtotalPriceSet) : null,
|
|
363
|
+
currentSubtotalPriceSet: fromGraphQL.money(node.currentSubtotalPriceSet),
|
|
364
|
+
totalDiscountsSet: node.totalDiscountsSet ? fromGraphQL.money(node.totalDiscountsSet) : null,
|
|
365
|
+
currentTotalDiscountsSet: fromGraphQL.money(node.currentTotalDiscountsSet),
|
|
366
|
+
totalShippingPriceSet: fromGraphQL.money(node.totalShippingPriceSet),
|
|
367
|
+
currentShippingPriceSet: fromGraphQL.money(node.currentShippingPriceSet),
|
|
368
|
+
totalTaxSet: node.totalTaxSet ? fromGraphQL.money(node.totalTaxSet) : null,
|
|
369
|
+
currentTotalTaxSet: fromGraphQL.money(node.currentTotalTaxSet),
|
|
370
|
+
originalTotalDutiesSet: node.originalTotalDutiesSet
|
|
371
|
+
? fromGraphQL.money(node.originalTotalDutiesSet)
|
|
372
|
+
: null,
|
|
373
|
+
currentTotalDutiesSet: node.currentTotalDutiesSet
|
|
374
|
+
? fromGraphQL.money(node.currentTotalDutiesSet)
|
|
375
|
+
: null,
|
|
376
|
+
totalPriceSet: fromGraphQL.money(node.totalPriceSet),
|
|
377
|
+
currentTotalPriceSet: fromGraphQL.money(node.currentTotalPriceSet),
|
|
378
|
+
taxLines: node.taxLines.map(fromGraphQL.taxLine),
|
|
379
|
+
shippingLines: nested.shippingLines.map((line) => ({
|
|
380
|
+
id: line.id,
|
|
381
|
+
title: line.title,
|
|
382
|
+
code: line.code,
|
|
383
|
+
source: line.source,
|
|
384
|
+
carrierIdentifier: line.carrierIdentifier,
|
|
385
|
+
phone: line.phone,
|
|
386
|
+
isRemoved: line.isRemoved,
|
|
387
|
+
originalPriceSet: fromGraphQL.money(line.originalPriceSet),
|
|
388
|
+
discountedPriceSet: fromGraphQL.money(line.discountedPriceSet),
|
|
389
|
+
currentDiscountedPriceSet: fromGraphQL.money(line.currentDiscountedPriceSet),
|
|
390
|
+
taxLines: line.taxLines.map(fromGraphQL.taxLine),
|
|
391
|
+
discountAllocations: line.discountAllocations.map(fromGraphQL.discountAllocation),
|
|
392
|
+
})),
|
|
393
|
+
lineItems: nested.lineItems.map((item) => ({
|
|
394
|
+
id: item.id,
|
|
395
|
+
name: item.name,
|
|
396
|
+
title: item.title,
|
|
397
|
+
variantTitle: item.variantTitle,
|
|
398
|
+
sku: item.sku,
|
|
399
|
+
vendor: item.vendor,
|
|
400
|
+
productId: item.product?.id ?? null,
|
|
401
|
+
variantId: item.variant?.id ?? null,
|
|
402
|
+
quantity: item.quantity,
|
|
403
|
+
currentQuantity: item.currentQuantity,
|
|
404
|
+
taxable: item.taxable,
|
|
405
|
+
requiresShipping: item.requiresShipping,
|
|
406
|
+
isGiftCard: item.isGiftCard,
|
|
407
|
+
originalUnitPriceSet: fromGraphQL.money(item.originalUnitPriceSet),
|
|
408
|
+
totalDiscountSet: fromGraphQL.money(item.totalDiscountSet),
|
|
409
|
+
taxLines: item.taxLines.map(fromGraphQL.taxLine),
|
|
410
|
+
discountAllocations: item.discountAllocations.map(fromGraphQL.discountAllocation),
|
|
411
|
+
customAttributes: item.customAttributes,
|
|
412
|
+
})),
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
export const OrdersQuery = pageQuery("AirfoilOrders", "orders", OrderFields);
|
|
416
|
+
|
|
417
|
+
export const GraphQLOrdersDataSchema = Schema.Struct({
|
|
418
|
+
orders: connection(GraphQLOrderNodeSchema),
|
|
419
|
+
});
|