@anker-in/shopify-sdk 0.1.1-beta.0
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/index.d.mts +67 -0
- package/dist/client/index.d.ts +67 -0
- package/dist/client/index.js +94 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +91 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/fragments/index.d.mts +32 -0
- package/dist/fragments/index.d.ts +32 -0
- package/dist/fragments/index.js +567 -0
- package/dist/fragments/index.js.map +1 -0
- package/dist/fragments/index.mjs +553 -0
- package/dist/fragments/index.mjs.map +1 -0
- package/dist/index.d.mts +10530 -0
- package/dist/index.d.ts +10530 -0
- package/dist/index.js +2198 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2126 -0
- package/dist/index.mjs.map +1 -0
- package/dist/mutations/index.d.mts +13 -0
- package/dist/mutations/index.d.ts +13 -0
- package/dist/mutations/index.js +516 -0
- package/dist/mutations/index.js.map +1 -0
- package/dist/mutations/index.mjs +509 -0
- package/dist/mutations/index.mjs.map +1 -0
- package/dist/queries/index.d.mts +11 -0
- package/dist/queries/index.d.ts +11 -0
- package/dist/queries/index.js +600 -0
- package/dist/queries/index.js.map +1 -0
- package/dist/queries/index.mjs +594 -0
- package/dist/queries/index.mjs.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ShopifyConfig } from '@anker-in/shopify-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL client types
|
|
5
|
+
*/
|
|
6
|
+
interface GraphQLResponse<T = any> {
|
|
7
|
+
data?: T;
|
|
8
|
+
errors?: GraphQLError[];
|
|
9
|
+
extensions?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
interface GraphQLError {
|
|
12
|
+
message: string;
|
|
13
|
+
locations?: Array<{
|
|
14
|
+
line: number;
|
|
15
|
+
column: number;
|
|
16
|
+
}>;
|
|
17
|
+
path?: (string | number)[];
|
|
18
|
+
extensions?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
interface GraphQLRequest {
|
|
21
|
+
query: string;
|
|
22
|
+
variables?: Record<string, any>;
|
|
23
|
+
operationName?: string;
|
|
24
|
+
}
|
|
25
|
+
interface FetchOptions extends RequestInit {
|
|
26
|
+
tags?: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Shopify GraphQL Client
|
|
31
|
+
* Handles all GraphQL communication with Shopify Storefront API
|
|
32
|
+
*/
|
|
33
|
+
declare class ShopifyClient {
|
|
34
|
+
private config;
|
|
35
|
+
private locale;
|
|
36
|
+
constructor(config: ShopifyConfig, locale: string);
|
|
37
|
+
/**
|
|
38
|
+
* Execute a GraphQL request
|
|
39
|
+
*/
|
|
40
|
+
request<T = any>(request: GraphQLRequest, options?: FetchOptions): Promise<GraphQLResponse<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* Convenience method for simple queries
|
|
43
|
+
*/
|
|
44
|
+
query<T = any>(query: string, variables?: Record<string, any>, options?: FetchOptions): Promise<T | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Get current locale
|
|
47
|
+
*/
|
|
48
|
+
getLocale(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get config
|
|
51
|
+
*/
|
|
52
|
+
getConfig(): ShopifyConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Get API URL
|
|
55
|
+
*/
|
|
56
|
+
getApiUrl(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new client with different locale
|
|
59
|
+
*/
|
|
60
|
+
withLocale(locale: string): ShopifyClient;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Factory function to create a Shopify client
|
|
64
|
+
*/
|
|
65
|
+
declare function createShopifyClient(config: ShopifyConfig, locale: string): ShopifyClient;
|
|
66
|
+
|
|
67
|
+
export { type FetchOptions, type GraphQLError, type GraphQLRequest, type GraphQLResponse, ShopifyClient, createShopifyClient };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ShopifyConfig } from '@anker-in/shopify-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL client types
|
|
5
|
+
*/
|
|
6
|
+
interface GraphQLResponse<T = any> {
|
|
7
|
+
data?: T;
|
|
8
|
+
errors?: GraphQLError[];
|
|
9
|
+
extensions?: Record<string, any>;
|
|
10
|
+
}
|
|
11
|
+
interface GraphQLError {
|
|
12
|
+
message: string;
|
|
13
|
+
locations?: Array<{
|
|
14
|
+
line: number;
|
|
15
|
+
column: number;
|
|
16
|
+
}>;
|
|
17
|
+
path?: (string | number)[];
|
|
18
|
+
extensions?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
interface GraphQLRequest {
|
|
21
|
+
query: string;
|
|
22
|
+
variables?: Record<string, any>;
|
|
23
|
+
operationName?: string;
|
|
24
|
+
}
|
|
25
|
+
interface FetchOptions extends RequestInit {
|
|
26
|
+
tags?: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Shopify GraphQL Client
|
|
31
|
+
* Handles all GraphQL communication with Shopify Storefront API
|
|
32
|
+
*/
|
|
33
|
+
declare class ShopifyClient {
|
|
34
|
+
private config;
|
|
35
|
+
private locale;
|
|
36
|
+
constructor(config: ShopifyConfig, locale: string);
|
|
37
|
+
/**
|
|
38
|
+
* Execute a GraphQL request
|
|
39
|
+
*/
|
|
40
|
+
request<T = any>(request: GraphQLRequest, options?: FetchOptions): Promise<GraphQLResponse<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* Convenience method for simple queries
|
|
43
|
+
*/
|
|
44
|
+
query<T = any>(query: string, variables?: Record<string, any>, options?: FetchOptions): Promise<T | undefined>;
|
|
45
|
+
/**
|
|
46
|
+
* Get current locale
|
|
47
|
+
*/
|
|
48
|
+
getLocale(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Get config
|
|
51
|
+
*/
|
|
52
|
+
getConfig(): ShopifyConfig;
|
|
53
|
+
/**
|
|
54
|
+
* Get API URL
|
|
55
|
+
*/
|
|
56
|
+
getApiUrl(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new client with different locale
|
|
59
|
+
*/
|
|
60
|
+
withLocale(locale: string): ShopifyClient;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Factory function to create a Shopify client
|
|
64
|
+
*/
|
|
65
|
+
declare function createShopifyClient(config: ShopifyConfig, locale: string): ShopifyClient;
|
|
66
|
+
|
|
67
|
+
export { type FetchOptions, type GraphQLError, type GraphQLRequest, type GraphQLResponse, ShopifyClient, createShopifyClient };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/client/client.ts
|
|
4
|
+
var ShopifyClient = class _ShopifyClient {
|
|
5
|
+
config;
|
|
6
|
+
locale;
|
|
7
|
+
constructor(config, locale) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.locale = locale;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Execute a GraphQL request
|
|
13
|
+
*/
|
|
14
|
+
async request(request, options = {}) {
|
|
15
|
+
const { query, variables, operationName } = request;
|
|
16
|
+
const { tags = [], ...fetchOptions } = options;
|
|
17
|
+
const apiUrl = this.config.getApiUrl(this.locale);
|
|
18
|
+
const token = this.config.getStorefrontToken(this.locale);
|
|
19
|
+
const headers = {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
"X-Shopify-Storefront-Access-Token": token,
|
|
22
|
+
...fetchOptions.headers || {}
|
|
23
|
+
};
|
|
24
|
+
const body = JSON.stringify({
|
|
25
|
+
query,
|
|
26
|
+
variables,
|
|
27
|
+
operationName
|
|
28
|
+
});
|
|
29
|
+
try {
|
|
30
|
+
const response = await fetch(apiUrl, {
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers,
|
|
33
|
+
body,
|
|
34
|
+
...fetchOptions,
|
|
35
|
+
...tags.length > 0 && { next: { tags } }
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const json = await response.json();
|
|
43
|
+
if (json.errors && json.errors.length > 0) {
|
|
44
|
+
console.error("GraphQL Errors:", json.errors);
|
|
45
|
+
}
|
|
46
|
+
return json;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.error("Shopify API Request Failed:", error);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Convenience method for simple queries
|
|
54
|
+
*/
|
|
55
|
+
async query(query, variables, options) {
|
|
56
|
+
const response = await this.request(
|
|
57
|
+
{ query, variables },
|
|
58
|
+
options
|
|
59
|
+
);
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get current locale
|
|
64
|
+
*/
|
|
65
|
+
getLocale() {
|
|
66
|
+
return this.locale;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get config
|
|
70
|
+
*/
|
|
71
|
+
getConfig() {
|
|
72
|
+
return this.config;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get API URL
|
|
76
|
+
*/
|
|
77
|
+
getApiUrl() {
|
|
78
|
+
return this.config.getApiUrl(this.locale);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a new client with different locale
|
|
82
|
+
*/
|
|
83
|
+
withLocale(locale) {
|
|
84
|
+
return new _ShopifyClient(this.config, locale);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function createShopifyClient(config, locale) {
|
|
88
|
+
return new ShopifyClient(config, locale);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
exports.ShopifyClient = ShopifyClient;
|
|
92
|
+
exports.createShopifyClient = createShopifyClient;
|
|
93
|
+
//# sourceMappingURL=index.js.map
|
|
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AA,CAAK,MAAA,EAAQ,MAAM,CAAA;AAAA,EAC9C;AACF;AAKO,SAAS,mBAAA,CACd,QACA,MAAA,EACe;AACf,EAAA,OAAO,IAAI,aAAA,CAAc,MAAA,EAAQ,MAAM,CAAA;AACzC","file":"index.js","sourcesContent":["import type { ShopifyConfig } from '@anker-in/shopify-core'\nimport type { GraphQLResponse, GraphQLRequest, FetchOptions } from './types'\n\n/**\n * Shopify GraphQL Client\n * Handles all GraphQL communication with Shopify Storefront API\n */\nexport class ShopifyClient {\n private config: ShopifyConfig\n private locale: string\n\n constructor(config: ShopifyConfig, locale: string) {\n this.config = config\n this.locale = locale\n }\n\n /**\n * Execute a GraphQL request\n */\n async request<T = any>(\n request: GraphQLRequest,\n options: FetchOptions = {}\n ): Promise<GraphQLResponse<T>> {\n const { query, variables, operationName } = request\n const { tags = [], ...fetchOptions } = options\n\n const apiUrl = this.config.getApiUrl(this.locale)\n const token = this.config.getStorefrontToken(this.locale)\n\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n 'X-Shopify-Storefront-Access-Token': token,\n ...(fetchOptions.headers || {}),\n }\n\n const body = JSON.stringify({\n query,\n variables,\n operationName,\n })\n\n try {\n const response = await fetch(apiUrl, {\n method: 'POST',\n headers,\n body,\n ...fetchOptions,\n ...(tags.length > 0 && { next: { tags } }),\n })\n\n if (!response.ok) {\n throw new Error(\n `HTTP ${response.status}: ${response.statusText}`\n )\n }\n\n const json: GraphQLResponse<T> = await response.json()\n\n if (json.errors && json.errors.length > 0) {\n console.error('GraphQL Errors:', json.errors)\n }\n\n return json\n } catch (error) {\n console.error('Shopify API Request Failed:', error)\n throw error\n }\n }\n\n /**\n * Convenience method for simple queries\n */\n async query<T = any>(\n query: string,\n variables?: Record<string, any>,\n options?: FetchOptions\n ): Promise<T | undefined> {\n const response = await this.request<T>(\n { query, variables },\n options\n )\n return response.data\n }\n\n /**\n * Get current locale\n */\n getLocale(): string {\n return this.locale\n }\n\n /**\n * Get config\n */\n getConfig(): ShopifyConfig {\n return this.config\n }\n\n /**\n * Get API URL\n */\n getApiUrl(): string {\n return this.config.getApiUrl(this.locale)\n }\n\n /**\n * Create a new client with different locale\n */\n withLocale(locale: string): ShopifyClient {\n return new ShopifyClient(this.config, locale)\n }\n}\n\n/**\n * Factory function to create a Shopify client\n */\nexport function createShopifyClient(\n config: ShopifyConfig,\n locale: string\n): ShopifyClient {\n return new ShopifyClient(config, locale)\n}\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/client/client.ts
|
|
2
|
+
var ShopifyClient = class _ShopifyClient {
|
|
3
|
+
config;
|
|
4
|
+
locale;
|
|
5
|
+
constructor(config, locale) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
this.locale = locale;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Execute a GraphQL request
|
|
11
|
+
*/
|
|
12
|
+
async request(request, options = {}) {
|
|
13
|
+
const { query, variables, operationName } = request;
|
|
14
|
+
const { tags = [], ...fetchOptions } = options;
|
|
15
|
+
const apiUrl = this.config.getApiUrl(this.locale);
|
|
16
|
+
const token = this.config.getStorefrontToken(this.locale);
|
|
17
|
+
const headers = {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
"X-Shopify-Storefront-Access-Token": token,
|
|
20
|
+
...fetchOptions.headers || {}
|
|
21
|
+
};
|
|
22
|
+
const body = JSON.stringify({
|
|
23
|
+
query,
|
|
24
|
+
variables,
|
|
25
|
+
operationName
|
|
26
|
+
});
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(apiUrl, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers,
|
|
31
|
+
body,
|
|
32
|
+
...fetchOptions,
|
|
33
|
+
...tags.length > 0 && { next: { tags } }
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`HTTP ${response.status}: ${response.statusText}`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
const json = await response.json();
|
|
41
|
+
if (json.errors && json.errors.length > 0) {
|
|
42
|
+
console.error("GraphQL Errors:", json.errors);
|
|
43
|
+
}
|
|
44
|
+
return json;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error("Shopify API Request Failed:", error);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Convenience method for simple queries
|
|
52
|
+
*/
|
|
53
|
+
async query(query, variables, options) {
|
|
54
|
+
const response = await this.request(
|
|
55
|
+
{ query, variables },
|
|
56
|
+
options
|
|
57
|
+
);
|
|
58
|
+
return response.data;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get current locale
|
|
62
|
+
*/
|
|
63
|
+
getLocale() {
|
|
64
|
+
return this.locale;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get config
|
|
68
|
+
*/
|
|
69
|
+
getConfig() {
|
|
70
|
+
return this.config;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get API URL
|
|
74
|
+
*/
|
|
75
|
+
getApiUrl() {
|
|
76
|
+
return this.config.getApiUrl(this.locale);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create a new client with different locale
|
|
80
|
+
*/
|
|
81
|
+
withLocale(locale) {
|
|
82
|
+
return new _ShopifyClient(this.config, locale);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
function createShopifyClient(config, locale) {
|
|
86
|
+
return new ShopifyClient(config, locale);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { ShopifyClient, createShopifyClient };
|
|
90
|
+
//# sourceMappingURL=index.mjs.map
|
|
91
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/client/client.ts"],"names":[],"mappings":";AAOO,IAAM,aAAA,GAAN,MAAM,cAAA,CAAc;AAAA,EACjB,MAAA;AAAA,EACA,MAAA;AAAA,EAER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from '@anker-in/shopify-core'\nimport type { GraphQLResponse, GraphQLRequest, FetchOptions } from './types'\n\n/**\n * Shopify GraphQL Client\n * Handles all GraphQL communication with Shopify Storefront API\n */\nexport class ShopifyClient {\n private config: ShopifyConfig\n private locale: string\n\n constructor(config: ShopifyConfig, locale: string) {\n this.config = config\n this.locale = locale\n }\n\n /**\n * Execute a GraphQL request\n */\n async request<T = any>(\n request: GraphQLRequest,\n options: FetchOptions = {}\n ): Promise<GraphQLResponse<T>> {\n const { query, variables, operationName } = request\n const { tags = [], ...fetchOptions } = options\n\n const apiUrl = this.config.getApiUrl(this.locale)\n const token = this.config.getStorefrontToken(this.locale)\n\n const headers: HeadersInit = {\n 'Content-Type': 'application/json',\n 'X-Shopify-Storefront-Access-Token': token,\n ...(fetchOptions.headers || {}),\n }\n\n const body = JSON.stringify({\n query,\n variables,\n operationName,\n })\n\n try {\n const response = await fetch(apiUrl, {\n method: 'POST',\n headers,\n body,\n ...fetchOptions,\n ...(tags.length > 0 && { next: { tags } }),\n })\n\n if (!response.ok) {\n throw new Error(\n `HTTP ${response.status}: ${response.statusText}`\n )\n }\n\n const json: GraphQLResponse<T> = await response.json()\n\n if (json.errors && json.errors.length > 0) {\n console.error('GraphQL Errors:', json.errors)\n }\n\n return json\n } catch (error) {\n console.error('Shopify API Request Failed:', error)\n throw error\n }\n }\n\n /**\n * Convenience method for simple queries\n */\n async query<T = any>(\n query: string,\n variables?: Record<string, any>,\n options?: FetchOptions\n ): Promise<T | undefined> {\n const response = await this.request<T>(\n { query, variables },\n options\n )\n return response.data\n }\n\n /**\n * Get current locale\n */\n getLocale(): string {\n return this.locale\n }\n\n /**\n * Get config\n */\n getConfig(): ShopifyConfig {\n return this.config\n }\n\n /**\n * Get API URL\n */\n getApiUrl(): string {\n return this.config.getApiUrl(this.locale)\n }\n\n /**\n * Create a new client with different locale\n */\n withLocale(locale: string): ShopifyClient {\n return new ShopifyClient(this.config, locale)\n }\n}\n\n/**\n * Factory function to create a Shopify client\n */\nexport function createShopifyClient(\n config: ShopifyConfig,\n locale: string\n): ShopifyClient {\n return new ShopifyClient(config, locale)\n}\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const imageFragment = "\n fragment image on Image {\n url\n altText\n width\n height\n }\n";
|
|
2
|
+
|
|
3
|
+
declare const seoFragment = "\n fragment seo on SEO {\n description\n title\n }\n";
|
|
4
|
+
|
|
5
|
+
declare const metafieldFragment = "\n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n";
|
|
6
|
+
declare const metafieldFragmentStr = "\n value\n type\n description\n namespace\n key\n";
|
|
7
|
+
|
|
8
|
+
declare const variantFragment = "\n fragment variant on ProductVariant {\n id\n sku\n title\n requiresShipping\n quantityAvailable\n currentlyNotInStock\n availableForSale\n barcode\n weight\n selectedOptions {\n name\n value\n }\n image {\n ...image\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n metafields(identifiers: $variantMetafieldIdentifiers) {\n ...metafield\n }\n sellingPlanAllocations(first: 10) {\n edges {\n node {\n sellingPlan {\n id\n name\n options {\n name\n value\n }\n }\n priceAdjustments {\n compareAtPrice {\n amount\n currencyCode\n }\n perDeliveryPrice {\n amount\n currencyCode\n }\n price {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Product GraphQL Fragment
|
|
12
|
+
*/
|
|
13
|
+
declare const productFragment = "\n fragment product on Product {\n id\n handle\n availableForSale\n title\n description\n descriptionHtml\n options {\n id\n name\n values\n }\n productType\n vendor\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n compareAtPriceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n ...image\n }\n images(first: 250) {\n edges {\n node {\n ...image\n }\n }\n }\n metafields(identifiers: $productMetafieldIdentifiers) {\n ...metafield\n }\n media(first: 250) {\n edges {\n node {\n id\n mediaContentType\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n url\n }\n }\n }\n }\n }\n seo {\n ...seo\n }\n tags\n createdAt\n updatedAt\n publishedAt\n requiresSellingPlan\n sellingPlanGroups(first: 250) {\n edges {\n node {\n name\n sellingPlans(first: 250) {\n edges {\n node {\n id\n name\n priceAdjustments {\n adjustmentValue {\n ... on SellingPlanFixedAmountPriceAdjustment {\n __typename\n adjustmentAmount {\n amount\n currencyCode\n }\n }\n ... on SellingPlanFixedPriceAdjustment {\n __typename\n price {\n amount\n currencyCode\n }\n }\n ... on SellingPlanPercentagePriceAdjustment {\n __typename\n adjustmentPercentage\n }\n }\n }\n options {\n name\n value\n }\n }\n }\n }\n }\n }\n }\n }\n";
|
|
14
|
+
|
|
15
|
+
declare const cartFragment = "\n fragment cart on Cart {\n id\n totalQuantity\n updatedAt\n createdAt\n checkoutUrl\n note\n attributes {\n key\n value\n }\n cost {\n checkoutChargeAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n totalTaxAmount {\n amount\n currencyCode\n }\n totalDutyAmount {\n amount\n currencyCode\n }\n totalAmountEstimated\n totalTaxAmountEstimated\n totalDutyAmountEstimated\n subtotalAmountEstimated\n }\n buyerIdentity {\n email\n customer {\n email\n id\n }\n deliveryAddressPreferences {\n ... on MailingAddress {\n address1\n address2\n city\n country\n zip\n }\n }\n }\n discountCodes {\n applicable\n code\n }\n discountAllocations {\n ... on CartCodeDiscountAllocation {\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartAutomaticDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n }\n deliveryGroups(first: 10) {\n nodes {\n deliveryAddress {\n address1\n address2\n city\n country\n zip\n }\n }\n }\n lines(first: 100) {\n edges {\n node {\n id\n quantity\n discountAllocations {\n ... on CartCodeDiscountAllocation {\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartAutomaticDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n }\n attributes {\n key\n value\n }\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n sku\n title\n quantityAvailable\n currentlyNotInStock\n availableForSale\n barcode\n weight\n selectedOptions {\n name\n value\n }\n image {\n ...image\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n metafields(identifiers: $variantMetafieldIdentifiers) {\n ...metafield\n }\n product {\n ...product\n }\n }\n }\n }\n }\n }\n totalQuantity\n }\n \n fragment product on Product {\n id\n handle\n availableForSale\n title\n description\n descriptionHtml\n options {\n id\n name\n values\n }\n productType\n vendor\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n compareAtPriceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n ...image\n }\n images(first: 250) {\n edges {\n node {\n ...image\n }\n }\n }\n metafields(identifiers: $productMetafieldIdentifiers) {\n ...metafield\n }\n media(first: 250) {\n edges {\n node {\n id\n mediaContentType\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n url\n }\n }\n }\n }\n }\n seo {\n ...seo\n }\n tags\n createdAt\n updatedAt\n publishedAt\n requiresSellingPlan\n sellingPlanGroups(first: 250) {\n edges {\n node {\n name\n sellingPlans(first: 250) {\n edges {\n node {\n id\n name\n priceAdjustments {\n adjustmentValue {\n ... on SellingPlanFixedAmountPriceAdjustment {\n __typename\n adjustmentAmount {\n amount\n currencyCode\n }\n }\n ... on SellingPlanFixedPriceAdjustment {\n __typename\n price {\n amount\n currencyCode\n }\n }\n ... on SellingPlanPercentagePriceAdjustment {\n __typename\n adjustmentPercentage\n }\n }\n }\n options {\n name\n value\n }\n }\n }\n }\n }\n }\n }\n }\n\n \n fragment image on Image {\n url\n altText\n width\n height\n }\n\n \n fragment seo on SEO {\n description\n title\n }\n\n \n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n\n";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Collection GraphQL Fragment
|
|
19
|
+
*/
|
|
20
|
+
declare const collectionFragment = "\n fragment collection on Collection {\n id\n handle\n title\n description\n descriptionHtml\n image {\n ...image\n }\n seo {\n ...seo\n }\n updatedAt\n }\n";
|
|
21
|
+
|
|
22
|
+
declare const pageInfoFragment = "\n fragment pageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Blog GraphQL Fragments
|
|
26
|
+
*/
|
|
27
|
+
declare const articleFragment = "\n fragment article on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n image {\n ...image\n }\n seo {\n ...seo\n }\n tags\n author {\n name\n }\n }\n \n fragment image on Image {\n url\n altText\n width\n height\n }\n\n \n fragment seo on SEO {\n description\n title\n }\n\n";
|
|
28
|
+
declare const articleWithMetafieldsFragment = "\n fragment articleWithMetafields on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n image {\n ...image\n }\n seo {\n ...seo\n }\n tags\n author {\n name\n }\n metafields(identifiers: $articleMetafieldIdentifiers) {\n ...metafield\n }\n }\n \n fragment image on Image {\n url\n altText\n width\n height\n }\n\n \n fragment seo on SEO {\n description\n title\n }\n\n \n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n\n";
|
|
29
|
+
declare const blogFragment = "\n fragment blog on Blog {\n id\n handle\n title\n seo {\n ...seo\n }\n }\n \n fragment seo on SEO {\n description\n title\n }\n\n";
|
|
30
|
+
declare const blogWithMetafieldsFragment = "\n fragment blogWithMetafields on Blog {\n id\n handle\n title\n seo {\n ...seo\n }\n metafields(identifiers: $blogMetafieldIdentifiers) {\n ...metafield\n }\n }\n \n fragment seo on SEO {\n description\n title\n }\n\n \n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n\n";
|
|
31
|
+
|
|
32
|
+
export { articleFragment, articleWithMetafieldsFragment, blogFragment, blogWithMetafieldsFragment, cartFragment, collectionFragment, imageFragment, metafieldFragment, metafieldFragmentStr, pageInfoFragment, productFragment, seoFragment, variantFragment };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const imageFragment = "\n fragment image on Image {\n url\n altText\n width\n height\n }\n";
|
|
2
|
+
|
|
3
|
+
declare const seoFragment = "\n fragment seo on SEO {\n description\n title\n }\n";
|
|
4
|
+
|
|
5
|
+
declare const metafieldFragment = "\n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n";
|
|
6
|
+
declare const metafieldFragmentStr = "\n value\n type\n description\n namespace\n key\n";
|
|
7
|
+
|
|
8
|
+
declare const variantFragment = "\n fragment variant on ProductVariant {\n id\n sku\n title\n requiresShipping\n quantityAvailable\n currentlyNotInStock\n availableForSale\n barcode\n weight\n selectedOptions {\n name\n value\n }\n image {\n ...image\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n metafields(identifiers: $variantMetafieldIdentifiers) {\n ...metafield\n }\n sellingPlanAllocations(first: 10) {\n edges {\n node {\n sellingPlan {\n id\n name\n options {\n name\n value\n }\n }\n priceAdjustments {\n compareAtPrice {\n amount\n currencyCode\n }\n perDeliveryPrice {\n amount\n currencyCode\n }\n price {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Product GraphQL Fragment
|
|
12
|
+
*/
|
|
13
|
+
declare const productFragment = "\n fragment product on Product {\n id\n handle\n availableForSale\n title\n description\n descriptionHtml\n options {\n id\n name\n values\n }\n productType\n vendor\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n compareAtPriceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n ...image\n }\n images(first: 250) {\n edges {\n node {\n ...image\n }\n }\n }\n metafields(identifiers: $productMetafieldIdentifiers) {\n ...metafield\n }\n media(first: 250) {\n edges {\n node {\n id\n mediaContentType\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n url\n }\n }\n }\n }\n }\n seo {\n ...seo\n }\n tags\n createdAt\n updatedAt\n publishedAt\n requiresSellingPlan\n sellingPlanGroups(first: 250) {\n edges {\n node {\n name\n sellingPlans(first: 250) {\n edges {\n node {\n id\n name\n priceAdjustments {\n adjustmentValue {\n ... on SellingPlanFixedAmountPriceAdjustment {\n __typename\n adjustmentAmount {\n amount\n currencyCode\n }\n }\n ... on SellingPlanFixedPriceAdjustment {\n __typename\n price {\n amount\n currencyCode\n }\n }\n ... on SellingPlanPercentagePriceAdjustment {\n __typename\n adjustmentPercentage\n }\n }\n }\n options {\n name\n value\n }\n }\n }\n }\n }\n }\n }\n }\n";
|
|
14
|
+
|
|
15
|
+
declare const cartFragment = "\n fragment cart on Cart {\n id\n totalQuantity\n updatedAt\n createdAt\n checkoutUrl\n note\n attributes {\n key\n value\n }\n cost {\n checkoutChargeAmount {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n totalTaxAmount {\n amount\n currencyCode\n }\n totalDutyAmount {\n amount\n currencyCode\n }\n totalAmountEstimated\n totalTaxAmountEstimated\n totalDutyAmountEstimated\n subtotalAmountEstimated\n }\n buyerIdentity {\n email\n customer {\n email\n id\n }\n deliveryAddressPreferences {\n ... on MailingAddress {\n address1\n address2\n city\n country\n zip\n }\n }\n }\n discountCodes {\n applicable\n code\n }\n discountAllocations {\n ... on CartCodeDiscountAllocation {\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartAutomaticDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n }\n deliveryGroups(first: 10) {\n nodes {\n deliveryAddress {\n address1\n address2\n city\n country\n zip\n }\n }\n }\n lines(first: 100) {\n edges {\n node {\n id\n quantity\n discountAllocations {\n ... on CartCodeDiscountAllocation {\n code\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartAutomaticDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n ... on CartCustomDiscountAllocation {\n title\n discountedAmount {\n amount\n currencyCode\n }\n }\n }\n attributes {\n key\n value\n }\n cost {\n amountPerQuantity {\n amount\n currencyCode\n }\n compareAtAmountPerQuantity {\n amount\n currencyCode\n }\n subtotalAmount {\n amount\n currencyCode\n }\n totalAmount {\n amount\n currencyCode\n }\n }\n merchandise {\n ... on ProductVariant {\n id\n sku\n title\n quantityAvailable\n currentlyNotInStock\n availableForSale\n barcode\n weight\n selectedOptions {\n name\n value\n }\n image {\n ...image\n }\n price {\n amount\n currencyCode\n }\n compareAtPrice {\n amount\n currencyCode\n }\n metafields(identifiers: $variantMetafieldIdentifiers) {\n ...metafield\n }\n product {\n ...product\n }\n }\n }\n }\n }\n }\n totalQuantity\n }\n \n fragment product on Product {\n id\n handle\n availableForSale\n title\n description\n descriptionHtml\n options {\n id\n name\n values\n }\n productType\n vendor\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n compareAtPriceRange {\n minVariantPrice {\n amount\n currencyCode\n }\n }\n featuredImage {\n ...image\n }\n images(first: 250) {\n edges {\n node {\n ...image\n }\n }\n }\n metafields(identifiers: $productMetafieldIdentifiers) {\n ...metafield\n }\n media(first: 250) {\n edges {\n node {\n id\n mediaContentType\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n url\n }\n }\n }\n }\n }\n seo {\n ...seo\n }\n tags\n createdAt\n updatedAt\n publishedAt\n requiresSellingPlan\n sellingPlanGroups(first: 250) {\n edges {\n node {\n name\n sellingPlans(first: 250) {\n edges {\n node {\n id\n name\n priceAdjustments {\n adjustmentValue {\n ... on SellingPlanFixedAmountPriceAdjustment {\n __typename\n adjustmentAmount {\n amount\n currencyCode\n }\n }\n ... on SellingPlanFixedPriceAdjustment {\n __typename\n price {\n amount\n currencyCode\n }\n }\n ... on SellingPlanPercentagePriceAdjustment {\n __typename\n adjustmentPercentage\n }\n }\n }\n options {\n name\n value\n }\n }\n }\n }\n }\n }\n }\n }\n\n \n fragment image on Image {\n url\n altText\n width\n height\n }\n\n \n fragment seo on SEO {\n description\n title\n }\n\n \n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n\n";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Collection GraphQL Fragment
|
|
19
|
+
*/
|
|
20
|
+
declare const collectionFragment = "\n fragment collection on Collection {\n id\n handle\n title\n description\n descriptionHtml\n image {\n ...image\n }\n seo {\n ...seo\n }\n updatedAt\n }\n";
|
|
21
|
+
|
|
22
|
+
declare const pageInfoFragment = "\n fragment pageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n";
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Blog GraphQL Fragments
|
|
26
|
+
*/
|
|
27
|
+
declare const articleFragment = "\n fragment article on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n image {\n ...image\n }\n seo {\n ...seo\n }\n tags\n author {\n name\n }\n }\n \n fragment image on Image {\n url\n altText\n width\n height\n }\n\n \n fragment seo on SEO {\n description\n title\n }\n\n";
|
|
28
|
+
declare const articleWithMetafieldsFragment = "\n fragment articleWithMetafields on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n image {\n ...image\n }\n seo {\n ...seo\n }\n tags\n author {\n name\n }\n metafields(identifiers: $articleMetafieldIdentifiers) {\n ...metafield\n }\n }\n \n fragment image on Image {\n url\n altText\n width\n height\n }\n\n \n fragment seo on SEO {\n description\n title\n }\n\n \n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n\n";
|
|
29
|
+
declare const blogFragment = "\n fragment blog on Blog {\n id\n handle\n title\n seo {\n ...seo\n }\n }\n \n fragment seo on SEO {\n description\n title\n }\n\n";
|
|
30
|
+
declare const blogWithMetafieldsFragment = "\n fragment blogWithMetafields on Blog {\n id\n handle\n title\n seo {\n ...seo\n }\n metafields(identifiers: $blogMetafieldIdentifiers) {\n ...metafield\n }\n }\n \n fragment seo on SEO {\n description\n title\n }\n\n \n fragment metafield on Metafield {\n value\n type\n description\n namespace\n key\n }\n\n";
|
|
31
|
+
|
|
32
|
+
export { articleFragment, articleWithMetafieldsFragment, blogFragment, blogWithMetafieldsFragment, cartFragment, collectionFragment, imageFragment, metafieldFragment, metafieldFragmentStr, pageInfoFragment, productFragment, seoFragment, variantFragment };
|