@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/adapter-shopify",
|
|
3
|
-
"version": "0.68.
|
|
3
|
+
"version": "0.68.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -16,16 +16,18 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"zod": "^4.1.11",
|
|
19
|
-
"@porulle/core": "0.68.
|
|
19
|
+
"@porulle/core": "0.68.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.5.2",
|
|
23
|
+
"esbuild": "0.25.12",
|
|
23
24
|
"eslint": "^9.39.1",
|
|
24
25
|
"graphql": "^16.11.0",
|
|
26
|
+
"miniflare": "4.20260722.1",
|
|
25
27
|
"typescript": "5.9.2",
|
|
26
28
|
"vitest": "^3.2.4",
|
|
27
|
-
"@porulle/
|
|
28
|
-
"@porulle/
|
|
29
|
+
"@porulle/eslint-config": "0.1.0",
|
|
30
|
+
"@porulle/typescript-config": "0.1.0"
|
|
29
31
|
},
|
|
30
32
|
"publishConfig": {
|
|
31
33
|
"access": "public"
|
package/src/graphql.ts
CHANGED
|
@@ -73,6 +73,10 @@ export async function shopifyGraphql<T>(
|
|
|
73
73
|
schema: z.ZodType<T>,
|
|
74
74
|
): Promise<Result<T, ChannelConnectorError>> {
|
|
75
75
|
const sleep = target.sleep ?? defaultSleep;
|
|
76
|
+
// Called unbound, never as `target.fetchImpl(...)`: workerd's global `fetch` refuses any `this`
|
|
77
|
+
// but the global scope ("Illegal invocation"), and Node's does not, so a method call passes on
|
|
78
|
+
// Node and fails every Admin API call on a Worker. test/workerd-fetch.e2e.test.ts holds it.
|
|
79
|
+
const { fetchImpl } = target;
|
|
76
80
|
const url = `${target.origin}/admin/api/${SHOPIFY_API_VERSION}/graphql.json`;
|
|
77
81
|
let waited = 0;
|
|
78
82
|
for (let attempt = 0; ; attempt += 1) {
|
|
@@ -80,7 +84,7 @@ export async function shopifyGraphql<T>(
|
|
|
80
84
|
try {
|
|
81
85
|
// `manual`, never `error`: workerd implements only `follow` and `manual` and throws on `error`
|
|
82
86
|
// from the Request constructor. A 3xx is then simply not ok, which refuses the redirect.
|
|
83
|
-
response = await
|
|
87
|
+
response = await fetchImpl(url, {
|
|
84
88
|
method: "POST",
|
|
85
89
|
redirect: "manual",
|
|
86
90
|
headers: { accept: "application/json", "content-type": "application/json", "x-shopify-access-token": target.accessToken },
|
package/src/index.ts
CHANGED
|
@@ -252,6 +252,9 @@ export function shopifyConnector(options: ShopifyConnectorOptions): ChannelConne
|
|
|
252
252
|
lineItems: slice.lines.map((line) => ({
|
|
253
253
|
variantId: shopifyGid("ProductVariant", line.externalVariantId),
|
|
254
254
|
quantity: line.quantity,
|
|
255
|
+
// Defaults to false in orderCreate, which shows the order as "Shipping not required"
|
|
256
|
+
// although it carries the shopper's address. Every slice has one, so every line ships.
|
|
257
|
+
requiresShipping: true,
|
|
255
258
|
priceSet: money(line.unitPrice, slice.currency),
|
|
256
259
|
})),
|
|
257
260
|
transactions: [{ kind: "SALE", status: "SUCCESS", gateway: SOURCE_NAME, amountSet: money(slice.grandTotal, slice.currency) }],
|