@porulle/adapter-shopify 0.68.0 → 0.68.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/dist/graphql.js +5 -1
- package/dist/index.js +3 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -4
- package/src/graphql.ts +5 -1
- package/src/index.ts +3 -0
package/dist/graphql.js
CHANGED
|
@@ -51,6 +51,10 @@ async function readEnvelope(response) {
|
|
|
51
51
|
*/
|
|
52
52
|
export async function shopifyGraphql(target, query, variables, schema) {
|
|
53
53
|
const sleep = target.sleep ?? defaultSleep;
|
|
54
|
+
// Called unbound, never as `target.fetchImpl(...)`: workerd's global `fetch` refuses any `this`
|
|
55
|
+
// but the global scope ("Illegal invocation"), and Node's does not, so a method call passes on
|
|
56
|
+
// Node and fails every Admin API call on a Worker. test/workerd-fetch.e2e.test.ts holds it.
|
|
57
|
+
const { fetchImpl } = target;
|
|
54
58
|
const url = `${target.origin}/admin/api/${SHOPIFY_API_VERSION}/graphql.json`;
|
|
55
59
|
let waited = 0;
|
|
56
60
|
for (let attempt = 0;; attempt += 1) {
|
|
@@ -58,7 +62,7 @@ export async function shopifyGraphql(target, query, variables, schema) {
|
|
|
58
62
|
try {
|
|
59
63
|
// `manual`, never `error`: workerd implements only `follow` and `manual` and throws on `error`
|
|
60
64
|
// from the Request constructor. A 3xx is then simply not ok, which refuses the redirect.
|
|
61
|
-
response = await
|
|
65
|
+
response = await fetchImpl(url, {
|
|
62
66
|
method: "POST",
|
|
63
67
|
redirect: "manual",
|
|
64
68
|
headers: { accept: "application/json", "content-type": "application/json", "x-shopify-access-token": target.accessToken },
|
package/dist/index.js
CHANGED
|
@@ -221,6 +221,9 @@ export function shopifyConnector(options) {
|
|
|
221
221
|
lineItems: slice.lines.map((line) => ({
|
|
222
222
|
variantId: shopifyGid("ProductVariant", line.externalVariantId),
|
|
223
223
|
quantity: line.quantity,
|
|
224
|
+
// Defaults to false in orderCreate, which shows the order as "Shipping not required"
|
|
225
|
+
// although it carries the shopper's address. Every slice has one, so every line ships.
|
|
226
|
+
requiresShipping: true,
|
|
224
227
|
priceSet: money(line.unitPrice, slice.currency),
|
|
225
228
|
})),
|
|
226
229
|
transactions: [{ kind: "SALE", status: "SUCCESS", gateway: SOURCE_NAME, amountSet: money(slice.grandTotal, slice.currency) }],
|