@decocms/apps-shopify 8.1.0-next.1 → 8.1.0-next.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/client.d.ts +36 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +82 -0
- package/dist/client.js.map +1 -0
- package/dist/graphqlOperationName.d.ts +36 -0
- package/dist/graphqlOperationName.d.ts.map +1 -0
- package/dist/graphqlOperationName.js +59 -0
- package/dist/graphqlOperationName.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/package.json +13 -9
- package/src/client.ts +1 -1
- package/src/index.ts +1 -1
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export interface ShopifyClientConfig {
|
|
2
|
+
/** The store's subdomain: "acme" for acme.myshopify.com. */
|
|
3
|
+
storeName: string;
|
|
4
|
+
/** Storefront API access token. */
|
|
5
|
+
storefrontAccessToken: string;
|
|
6
|
+
/** Admin API access token; `admin` is only available when it's set. */
|
|
7
|
+
adminAccessToken?: string;
|
|
8
|
+
/** The Shopify API version, e.g. "2026-07". The site owns it, so there is no default to go stale. */
|
|
9
|
+
apiVersion: string;
|
|
10
|
+
}
|
|
11
|
+
interface ShopifyRequestOptions {
|
|
12
|
+
/** Extra request headers, e.g. `Shopify-Storefront-Buyer-IP`. */
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
/** One GraphQL endpoint: send a document, get its `data` back. */
|
|
17
|
+
interface ShopifyGraphQL {
|
|
18
|
+
query<T, V extends Record<string, unknown> = Record<string, unknown>>(document: string, variables?: V, options?: ShopifyRequestOptions): Promise<T>;
|
|
19
|
+
}
|
|
20
|
+
export interface ShopifyClient {
|
|
21
|
+
storefront: ShopifyGraphQL;
|
|
22
|
+
/** Throws when called without `adminAccessToken` in the config. */
|
|
23
|
+
admin: ShopifyGraphQL;
|
|
24
|
+
}
|
|
25
|
+
/** A failed request. Carries the operation, the HTTP status and Shopify's error codes; never bodies or tokens. */
|
|
26
|
+
export declare class ShopifyError extends Error {
|
|
27
|
+
readonly operation: string;
|
|
28
|
+
readonly status: number;
|
|
29
|
+
readonly codes: string[];
|
|
30
|
+
constructor(operation: string, status: number, codes?: string[]);
|
|
31
|
+
}
|
|
32
|
+
export declare function createShopifyClient(config: ShopifyClientConfig, options?: {
|
|
33
|
+
fetch?: typeof globalThis.fetch;
|
|
34
|
+
}): ShopifyClient;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC;IACnC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qGAAqG;IACrG,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,qBAAqB;IAC7B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,kEAAkE;AAClE,UAAU,cAAc;IACtB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,CAAC,EACb,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,CAAC,CAAC,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,cAAc,CAAC;IAC3B,mEAAmE;IACnE,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,kHAAkH;AAClH,qBAAa,YAAa,SAAQ,KAAK;IAEnC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE;IAH1B,YACW,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,MAAM,EAAO,EAQ9B;CACF;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAAO,GAChD,aAAa,CA0Df"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Shopify upstream client (/next/upstream-clients): the Storefront and
|
|
3
|
+
* Admin GraphQL APIs over the framework's instrumented fetch, and nothing
|
|
4
|
+
* else. Converters to commerce types, cart and customer flows, hooks and
|
|
5
|
+
* loaders live in the Shopify platform template and site code.
|
|
6
|
+
*
|
|
7
|
+
* Every request is measured as provider "shopify", labeled with the GraphQL
|
|
8
|
+
* operation's own name (`query ProductByHandle { … }` → "ProductByHandle"),
|
|
9
|
+
* or "storefront.graphql" / "admin.graphql" for an unnamed document. Retries
|
|
10
|
+
* and the circuit breaker stay off, as for every client but VTEX's; caching
|
|
11
|
+
* is the site's job.
|
|
12
|
+
*/
|
|
13
|
+
import { createInstrumentedFetch } from "@decocms/blocks/fetch";
|
|
14
|
+
import { extractGraphqlOperationName } from "./graphqlOperationName.js";
|
|
15
|
+
/** A failed request. Carries the operation, the HTTP status and Shopify's error codes; never bodies or tokens. */
|
|
16
|
+
export class ShopifyError extends Error {
|
|
17
|
+
operation;
|
|
18
|
+
status;
|
|
19
|
+
codes;
|
|
20
|
+
constructor(operation, status, codes = []) {
|
|
21
|
+
super(codes.length > 0
|
|
22
|
+
? `shopify ${operation} returned GraphQL errors (${codes.join(", ")})`
|
|
23
|
+
: `shopify ${operation} failed with HTTP ${status}`);
|
|
24
|
+
this.operation = operation;
|
|
25
|
+
this.status = status;
|
|
26
|
+
this.codes = codes;
|
|
27
|
+
this.name = "ShopifyError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function createShopifyClient(config, options = {}) {
|
|
31
|
+
const request = createInstrumentedFetch({ provider: "shopify", fetch: options.fetch });
|
|
32
|
+
const origin = `https://${config.storeName}.myshopify.com`;
|
|
33
|
+
const version = config.apiVersion;
|
|
34
|
+
const endpoint = (surface, url, auth) => ({
|
|
35
|
+
async query(document, variables, { headers, signal } = {}) {
|
|
36
|
+
const operation = extractGraphqlOperationName(document) ?? `${surface}.graphql`;
|
|
37
|
+
const response = await request(url, {
|
|
38
|
+
operation,
|
|
39
|
+
method: "POST",
|
|
40
|
+
headers: { "content-type": "application/json", ...headers, ...auth },
|
|
41
|
+
body: JSON.stringify({ query: document, variables }),
|
|
42
|
+
signal,
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
void response.body?.cancel().catch(() => { });
|
|
46
|
+
throw new ShopifyError(operation, response.status);
|
|
47
|
+
}
|
|
48
|
+
// A non-JSON body (an HTML error page) must not reach the error: the
|
|
49
|
+
// SyntaxError's message quotes the start of the body.
|
|
50
|
+
let body;
|
|
51
|
+
try {
|
|
52
|
+
body = await response.json();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
throw new ShopifyError(operation, response.status, ["INVALID_JSON"]);
|
|
56
|
+
}
|
|
57
|
+
// Partial data alongside errors is rejected as a whole, deliberately:
|
|
58
|
+
// a thin client doesn't guess which fields are still trustworthy.
|
|
59
|
+
if (body.errors?.length || body.data == null) {
|
|
60
|
+
const codes = body.errors?.length
|
|
61
|
+
? body.errors.map((e) => typeof e.extensions?.code === "string" ? e.extensions.code : "UNKNOWN")
|
|
62
|
+
: ["MISSING_DATA"];
|
|
63
|
+
throw new ShopifyError(operation, response.status, [...new Set(codes)]);
|
|
64
|
+
}
|
|
65
|
+
return body.data;
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
const adminToken = config.adminAccessToken;
|
|
69
|
+
return {
|
|
70
|
+
storefront: endpoint("storefront", `${origin}/api/${version}/graphql.json`, {
|
|
71
|
+
"x-shopify-storefront-access-token": config.storefrontAccessToken,
|
|
72
|
+
}),
|
|
73
|
+
admin: adminToken
|
|
74
|
+
? endpoint("admin", `${origin}/admin/api/${version}/graphql.json`, {
|
|
75
|
+
"x-shopify-access-token": adminToken,
|
|
76
|
+
})
|
|
77
|
+
: {
|
|
78
|
+
query: () => Promise.reject(new Error("shopify admin: pass adminAccessToken to createShopifyClient")),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAkCxE,kHAAkH;AAClH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAE1B,SAAS;IACT,MAAM;IACN,KAAK;IAHhB,YACW,SAAiB,EACjB,MAAc,EACd,KAAK,GAAa,EAAE;QAE7B,KAAK,CACH,KAAK,CAAC,MAAM,GAAG,CAAC;YACd,CAAC,CAAC,WAAW,SAAS,6BAA6B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACtE,CAAC,CAAC,WAAW,SAAS,qBAAqB,MAAM,EAAE,CACtD,CAAC;yBARO,SAAS;sBACT,MAAM;qBACN,KAAK;QAOd,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CACjC,MAA2B,EAC3B,OAAO,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1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract a semantic operation name from a GraphQL document.
|
|
3
|
+
*
|
|
4
|
+
* Used at the Shopify GraphQL client layer to stamp `init.operation`
|
|
5
|
+
* on the outbound fetch. The framework then suffixes the integration
|
|
6
|
+
* name (`shopify.<operation>`) onto the span and uses the same string
|
|
7
|
+
* as the `fetch.operation` attribute + histogram label.
|
|
8
|
+
*
|
|
9
|
+
* Resolution order:
|
|
10
|
+
*
|
|
11
|
+
* 1. An explicit `operationName` argument (e.g. when the client
|
|
12
|
+
* received one alongside a multi-operation document) wins.
|
|
13
|
+
* 2. If the document has exactly one named operation, that name
|
|
14
|
+
* is used.
|
|
15
|
+
* 3. If the document has zero or many anonymous operations, we
|
|
16
|
+
* return `undefined` so the caller can fall back (typically to
|
|
17
|
+
* the URL-derived `storefront.graphql` / `admin.graphql`).
|
|
18
|
+
*
|
|
19
|
+
* The parser is deliberately a small regex pass, not a full GraphQL
|
|
20
|
+
* tokenizer:
|
|
21
|
+
*
|
|
22
|
+
* - GraphQL operation definitions live at the top level of the
|
|
23
|
+
* document, never nested inside other operations, fragments, or
|
|
24
|
+
* selection sets, so positional context isn't required to find
|
|
25
|
+
* them — only to not match the literal words `query` /
|
|
26
|
+
* `mutation` / `subscription` inside string values.
|
|
27
|
+
* - We strip block strings (`""" … """`), string literals
|
|
28
|
+
* (`"…"`), and `# …` comments before matching, which is enough
|
|
29
|
+
* to make false-positive matches inside comments / docs vanish.
|
|
30
|
+
*
|
|
31
|
+
* If a Shopify operation is ever sufficiently mis-named to break
|
|
32
|
+
* this (unlikely, since the storefront SDK names them deliberately),
|
|
33
|
+
* the caller can always set `init.operation` explicitly.
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractGraphqlOperationName(document: string, explicit?: string): string | undefined;
|
|
36
|
+
//# sourceMappingURL=graphqlOperationName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphqlOperationName.d.ts","sourceRoot":"","sources":["../src/graphqlOperationName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAUH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAoBpB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract a semantic operation name from a GraphQL document.
|
|
3
|
+
*
|
|
4
|
+
* Used at the Shopify GraphQL client layer to stamp `init.operation`
|
|
5
|
+
* on the outbound fetch. The framework then suffixes the integration
|
|
6
|
+
* name (`shopify.<operation>`) onto the span and uses the same string
|
|
7
|
+
* as the `fetch.operation` attribute + histogram label.
|
|
8
|
+
*
|
|
9
|
+
* Resolution order:
|
|
10
|
+
*
|
|
11
|
+
* 1. An explicit `operationName` argument (e.g. when the client
|
|
12
|
+
* received one alongside a multi-operation document) wins.
|
|
13
|
+
* 2. If the document has exactly one named operation, that name
|
|
14
|
+
* is used.
|
|
15
|
+
* 3. If the document has zero or many anonymous operations, we
|
|
16
|
+
* return `undefined` so the caller can fall back (typically to
|
|
17
|
+
* the URL-derived `storefront.graphql` / `admin.graphql`).
|
|
18
|
+
*
|
|
19
|
+
* The parser is deliberately a small regex pass, not a full GraphQL
|
|
20
|
+
* tokenizer:
|
|
21
|
+
*
|
|
22
|
+
* - GraphQL operation definitions live at the top level of the
|
|
23
|
+
* document, never nested inside other operations, fragments, or
|
|
24
|
+
* selection sets, so positional context isn't required to find
|
|
25
|
+
* them — only to not match the literal words `query` /
|
|
26
|
+
* `mutation` / `subscription` inside string values.
|
|
27
|
+
* - We strip block strings (`""" … """`), string literals
|
|
28
|
+
* (`"…"`), and `# …` comments before matching, which is enough
|
|
29
|
+
* to make false-positive matches inside comments / docs vanish.
|
|
30
|
+
*
|
|
31
|
+
* If a Shopify operation is ever sufficiently mis-named to break
|
|
32
|
+
* this (unlikely, since the storefront SDK names them deliberately),
|
|
33
|
+
* the caller can always set `init.operation` explicitly.
|
|
34
|
+
*/
|
|
35
|
+
const OPERATION_RE = /\b(?:query|mutation|subscription)\s+([A-Za-z_][A-Za-z0-9_]*)/g;
|
|
36
|
+
const stripCommentsAndStrings = (doc) => doc
|
|
37
|
+
.replace(/"""[\s\S]*?"""/g, '""')
|
|
38
|
+
.replace(/"(?:\\.|[^"\\])*"/g, '""')
|
|
39
|
+
.replace(/#[^\n]*/g, "");
|
|
40
|
+
export function extractGraphqlOperationName(document, explicit) {
|
|
41
|
+
if (explicit)
|
|
42
|
+
return explicit;
|
|
43
|
+
if (!document)
|
|
44
|
+
return undefined;
|
|
45
|
+
const stripped = stripCommentsAndStrings(document);
|
|
46
|
+
const names = [];
|
|
47
|
+
OPERATION_RE.lastIndex = 0;
|
|
48
|
+
for (let match = OPERATION_RE.exec(stripped); match !== null; match = OPERATION_RE.exec(stripped)) {
|
|
49
|
+
const [, name] = match;
|
|
50
|
+
if (name)
|
|
51
|
+
names.push(name);
|
|
52
|
+
if (names.length > 1)
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
if (names.length === 1)
|
|
56
|
+
return names[0];
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=graphqlOperationName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphqlOperationName.js","sourceRoot":"","sources":["../src/graphqlOperationName.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,YAAY,GAAG,+DAA+D,CAAC;AAErF,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAU,EAAE,CACtD,GAAG;KACA,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;KAChC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC;KACnC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAE7B,MAAM,UAAU,2BAA2B,CACzC,QAAgB,EAChB,QAAiB;IAEjB,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAEhC,MAAM,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC;IAC3B,KACE,IAAI,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EACvC,KAAK,KAAK,IAAI,EACd,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EACnC,CAAC;QACD,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;QACvB,IAAI,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM;IAC9B,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,YAAY,GACb,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,mBAAmB,EAGnB,YAAY,GACb,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/apps-shopify",
|
|
3
|
-
"version": "8.1.0-next.
|
|
3
|
+
"version": "8.1.0-next.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Thin Shopify Storefront API client for Deco sites",
|
|
6
6
|
"repository": {
|
|
@@ -9,24 +9,28 @@
|
|
|
9
9
|
"directory": "packages/apps-shopify"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
+
"dist",
|
|
12
13
|
"src",
|
|
13
14
|
"!src/**/*.test.ts",
|
|
14
15
|
"!src/**/__tests__"
|
|
15
16
|
],
|
|
16
|
-
"main": "./
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
17
19
|
"exports": {
|
|
18
|
-
".":
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"source": "./src/index.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
19
25
|
},
|
|
20
26
|
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
27
|
+
"build": "node ../../scripts/tsc.mjs --clean dist -p tsconfig.build.json",
|
|
28
|
+
"prepack": "npm run build",
|
|
22
29
|
"test": "vitest run --root ../.. packages/apps-shopify/",
|
|
23
|
-
"typecheck": "tsc
|
|
30
|
+
"typecheck": "node ../../scripts/tsc.mjs -p tsconfig.json"
|
|
24
31
|
},
|
|
25
32
|
"dependencies": {
|
|
26
|
-
"@decocms/blocks": "8.1.0-next.
|
|
27
|
-
},
|
|
28
|
-
"devDependencies": {
|
|
29
|
-
"typescript": "^5.9.0"
|
|
33
|
+
"@decocms/blocks": "8.1.0-next.2"
|
|
30
34
|
},
|
|
31
35
|
"publishConfig": {
|
|
32
36
|
"registry": "https://registry.npmjs.org",
|
package/src/client.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* is the site's job.
|
|
12
12
|
*/
|
|
13
13
|
import { createInstrumentedFetch } from "@decocms/blocks/fetch";
|
|
14
|
-
import { extractGraphqlOperationName } from "./graphqlOperationName";
|
|
14
|
+
import { extractGraphqlOperationName } from "./graphqlOperationName.ts";
|
|
15
15
|
|
|
16
16
|
export interface ShopifyClientConfig {
|
|
17
17
|
/** The store's subdomain: "acme" for acme.myshopify.com. */
|
package/src/index.ts
CHANGED