@anker-in/shopify-sdk 1.2.0-beta.13 → 1.2.0-beta.14
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.js.map +1 -1
- package/dist/client/index.mjs.map +1 -1
- package/dist/index.d.mts +49 -49
- package/dist/index.d.ts +49 -49
- package/dist/index.js +144 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +144 -90
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -32,10 +32,7 @@ function constructMetafieldIdentifiersQueryParams(metafieldIdentifiers, metafiel
|
|
|
32
32
|
queryInput[`${key}MetafieldIdentifiers`] = uniqueIdentifiers;
|
|
33
33
|
return queryInput;
|
|
34
34
|
},
|
|
35
|
-
{
|
|
36
|
-
productMetafieldIdentifiers: [],
|
|
37
|
-
variantMetafieldIdentifiers: []
|
|
38
|
-
}
|
|
35
|
+
{}
|
|
39
36
|
);
|
|
40
37
|
return identifiers;
|
|
41
38
|
}
|
|
@@ -1410,11 +1407,13 @@ async function getProduct(client, options) {
|
|
|
1410
1407
|
const { handle, graphqlQuery, metafieldIdentifiers } = options;
|
|
1411
1408
|
const query = graphqlQuery || getProductQuery2;
|
|
1412
1409
|
const variables = { handle };
|
|
1413
|
-
|
|
1414
|
-
variables
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1410
|
+
const data = await client.query(query, {
|
|
1411
|
+
...variables,
|
|
1412
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
1413
|
+
metafieldIdentifiers,
|
|
1414
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
1415
|
+
)
|
|
1416
|
+
});
|
|
1418
1417
|
if (!data?.product) {
|
|
1419
1418
|
return void 0;
|
|
1420
1419
|
}
|
|
@@ -1468,7 +1467,7 @@ var getAllProductsQuery = (
|
|
|
1468
1467
|
${imageFragment}
|
|
1469
1468
|
`
|
|
1470
1469
|
);
|
|
1471
|
-
async function
|
|
1470
|
+
async function fetchAllProducts(client, options, afterCursor) {
|
|
1472
1471
|
const { first = 250, query, graphqlQuery, sortKey, reverse, metafieldIdentifiers } = options;
|
|
1473
1472
|
const queryString = graphqlQuery || getAllProductsQuery;
|
|
1474
1473
|
const variables = {
|
|
@@ -1478,26 +1477,36 @@ async function fetchAllPages(client, options, afterCursor) {
|
|
|
1478
1477
|
sortKey,
|
|
1479
1478
|
reverse
|
|
1480
1479
|
};
|
|
1481
|
-
|
|
1482
|
-
variables
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1480
|
+
const data = await client.query(queryString, {
|
|
1481
|
+
...variables,
|
|
1482
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
1483
|
+
metafieldIdentifiers,
|
|
1484
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
1485
|
+
)
|
|
1486
|
+
});
|
|
1486
1487
|
if (!data || !data.products) {
|
|
1487
1488
|
return [];
|
|
1488
1489
|
}
|
|
1489
1490
|
const products = data.products.edges.map((edge) => normalizeProduct(edge.node));
|
|
1490
1491
|
if (data.products.pageInfo.hasNextPage) {
|
|
1491
|
-
const nextProducts = await
|
|
1492
|
+
const nextProducts = await fetchAllProducts(client, options, data.products.pageInfo.endCursor);
|
|
1492
1493
|
return [...products, ...nextProducts];
|
|
1493
1494
|
}
|
|
1494
1495
|
return products;
|
|
1495
1496
|
}
|
|
1496
1497
|
async function getAllProducts(client, options) {
|
|
1497
|
-
return
|
|
1498
|
+
return fetchAllProducts(client, options);
|
|
1498
1499
|
}
|
|
1499
1500
|
async function getProducts(client, options) {
|
|
1500
|
-
const {
|
|
1501
|
+
const {
|
|
1502
|
+
first = 250,
|
|
1503
|
+
after,
|
|
1504
|
+
query,
|
|
1505
|
+
graphqlQuery,
|
|
1506
|
+
sortKey,
|
|
1507
|
+
reverse,
|
|
1508
|
+
metafieldIdentifiers
|
|
1509
|
+
} = options;
|
|
1501
1510
|
const queryString = graphqlQuery || getAllProductsQuery;
|
|
1502
1511
|
const variables = {
|
|
1503
1512
|
first,
|
|
@@ -2070,10 +2079,13 @@ async function getCollection(client, options) {
|
|
|
2070
2079
|
const { handle, graphqlQuery, metafieldIdentifiers } = options;
|
|
2071
2080
|
const query = graphqlQuery || getCollectionQuery;
|
|
2072
2081
|
const variables = { handle };
|
|
2073
|
-
|
|
2074
|
-
variables
|
|
2075
|
-
|
|
2076
|
-
|
|
2082
|
+
const data = await client.query(query, {
|
|
2083
|
+
...variables,
|
|
2084
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2085
|
+
metafieldIdentifiers,
|
|
2086
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2087
|
+
)
|
|
2088
|
+
});
|
|
2077
2089
|
if (!data?.collection) {
|
|
2078
2090
|
return void 0;
|
|
2079
2091
|
}
|
|
@@ -2115,7 +2127,7 @@ var getAllCollectionsQuery = (
|
|
|
2115
2127
|
${imageFragment}
|
|
2116
2128
|
`
|
|
2117
2129
|
);
|
|
2118
|
-
async function
|
|
2130
|
+
async function fetchAllPages(client, options, afterCursor) {
|
|
2119
2131
|
const { first = 250, query, graphqlQuery, sortKey, reverse, metafieldIdentifiers } = options;
|
|
2120
2132
|
const queryString = graphqlQuery || getAllCollectionsQuery;
|
|
2121
2133
|
const variables = {
|
|
@@ -2125,25 +2137,40 @@ async function fetchAllPages2(client, options, afterCursor) {
|
|
|
2125
2137
|
sortKey,
|
|
2126
2138
|
reverse
|
|
2127
2139
|
};
|
|
2128
|
-
|
|
2129
|
-
variables
|
|
2130
|
-
|
|
2131
|
-
|
|
2140
|
+
const data = await client.query(queryString, {
|
|
2141
|
+
...variables,
|
|
2142
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2143
|
+
metafieldIdentifiers,
|
|
2144
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2145
|
+
)
|
|
2146
|
+
});
|
|
2132
2147
|
if (!data || !data.collections) {
|
|
2133
2148
|
return [];
|
|
2134
2149
|
}
|
|
2135
2150
|
const collections = data.collections.edges.map((edge) => normalizeCollection(edge.node));
|
|
2136
2151
|
if (data.collections.pageInfo.hasNextPage) {
|
|
2137
|
-
const nextCollections = await
|
|
2152
|
+
const nextCollections = await fetchAllPages(
|
|
2153
|
+
client,
|
|
2154
|
+
options,
|
|
2155
|
+
data.collections.pageInfo.endCursor
|
|
2156
|
+
);
|
|
2138
2157
|
return [...collections, ...nextCollections];
|
|
2139
2158
|
}
|
|
2140
2159
|
return collections;
|
|
2141
2160
|
}
|
|
2142
2161
|
async function getAllCollections(client, options) {
|
|
2143
|
-
return
|
|
2162
|
+
return fetchAllPages(client, options);
|
|
2144
2163
|
}
|
|
2145
2164
|
async function getCollections(client, options) {
|
|
2146
|
-
const {
|
|
2165
|
+
const {
|
|
2166
|
+
first = 250,
|
|
2167
|
+
after,
|
|
2168
|
+
query,
|
|
2169
|
+
graphqlQuery,
|
|
2170
|
+
sortKey,
|
|
2171
|
+
reverse,
|
|
2172
|
+
metafieldIdentifiers
|
|
2173
|
+
} = options;
|
|
2147
2174
|
const queryString = graphqlQuery || getAllCollectionsQuery;
|
|
2148
2175
|
const variables = {
|
|
2149
2176
|
first,
|
|
@@ -2152,10 +2179,13 @@ async function getCollections(client, options) {
|
|
|
2152
2179
|
sortKey,
|
|
2153
2180
|
reverse
|
|
2154
2181
|
};
|
|
2155
|
-
|
|
2156
|
-
variables
|
|
2157
|
-
|
|
2158
|
-
|
|
2182
|
+
const data = await client.query(queryString, {
|
|
2183
|
+
...variables,
|
|
2184
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2185
|
+
metafieldIdentifiers,
|
|
2186
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2187
|
+
)
|
|
2188
|
+
});
|
|
2159
2189
|
if (!data || !data.collections) {
|
|
2160
2190
|
return {
|
|
2161
2191
|
collections: [],
|
|
@@ -2244,7 +2274,7 @@ function normalizeMetafields2(metafields) {
|
|
|
2244
2274
|
// src/api/blog/get-blog.ts
|
|
2245
2275
|
async function getBlog(client, options) {
|
|
2246
2276
|
const { handle, graphqlQuery, metafieldIdentifiers } = options;
|
|
2247
|
-
const hasMetafields = metafieldIdentifiers
|
|
2277
|
+
const hasMetafields = metafieldIdentifiers?.blog?.length;
|
|
2248
2278
|
const fragment = hasMetafields ? blogWithMetafieldsFragment : blogFragment;
|
|
2249
2279
|
const defaultQuery = (
|
|
2250
2280
|
/* GraphQL */
|
|
@@ -2262,10 +2292,13 @@ async function getBlog(client, options) {
|
|
|
2262
2292
|
);
|
|
2263
2293
|
const query = graphqlQuery || defaultQuery;
|
|
2264
2294
|
const variables = { handle };
|
|
2265
|
-
|
|
2266
|
-
variables
|
|
2267
|
-
|
|
2268
|
-
|
|
2295
|
+
const data = await client.query(query, {
|
|
2296
|
+
...variables,
|
|
2297
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2298
|
+
metafieldIdentifiers,
|
|
2299
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2300
|
+
)
|
|
2301
|
+
});
|
|
2269
2302
|
if (!data || !data.blog) {
|
|
2270
2303
|
return void 0;
|
|
2271
2304
|
}
|
|
@@ -2273,9 +2306,9 @@ async function getBlog(client, options) {
|
|
|
2273
2306
|
}
|
|
2274
2307
|
|
|
2275
2308
|
// src/api/blog/get-all-blogs.ts
|
|
2276
|
-
async function
|
|
2309
|
+
async function fetchAllPages2(client, options, afterCursor) {
|
|
2277
2310
|
const { first = 250, query, graphqlQuery, metafieldIdentifiers } = options;
|
|
2278
|
-
const hasMetafields = metafieldIdentifiers
|
|
2311
|
+
const hasMetafields = !!metafieldIdentifiers?.blog?.length;
|
|
2279
2312
|
const fragment = hasMetafields ? blogWithMetafieldsFragment : blogFragment;
|
|
2280
2313
|
const defaultQueryString = (
|
|
2281
2314
|
/* GraphQL */
|
|
@@ -2310,45 +2343,49 @@ async function fetchAllPages3(client, options, afterCursor) {
|
|
|
2310
2343
|
if (query) {
|
|
2311
2344
|
variables.query = query;
|
|
2312
2345
|
}
|
|
2313
|
-
|
|
2314
|
-
variables
|
|
2315
|
-
|
|
2316
|
-
|
|
2346
|
+
const data = await client.query(queryString, {
|
|
2347
|
+
...variables,
|
|
2348
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2349
|
+
metafieldIdentifiers,
|
|
2350
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2351
|
+
)
|
|
2352
|
+
});
|
|
2317
2353
|
if (!data || !data.blogs) {
|
|
2318
2354
|
return [];
|
|
2319
2355
|
}
|
|
2320
2356
|
const blogs = data.blogs.edges?.map((edge) => normalizeBlog(edge.node)) || [];
|
|
2321
2357
|
if (data.blogs.pageInfo.hasNextPage) {
|
|
2322
|
-
const nextBlogs = await
|
|
2358
|
+
const nextBlogs = await fetchAllPages2(client, options, data.blogs.pageInfo.endCursor);
|
|
2323
2359
|
return [...blogs, ...nextBlogs];
|
|
2324
2360
|
}
|
|
2325
2361
|
return blogs;
|
|
2326
2362
|
}
|
|
2327
2363
|
async function getAllBlogs(client, options) {
|
|
2328
|
-
return
|
|
2364
|
+
return fetchAllPages2(client, options);
|
|
2329
2365
|
}
|
|
2330
2366
|
|
|
2331
2367
|
// src/api/blog/get-article.ts
|
|
2332
2368
|
async function getArticle(client, options) {
|
|
2333
2369
|
const { blogHandle, articleHandle, graphqlQuery, metafieldIdentifiers } = options;
|
|
2334
|
-
const
|
|
2335
|
-
const
|
|
2336
|
-
const
|
|
2370
|
+
const hasArticleMetafields = !!metafieldIdentifiers?.article?.length;
|
|
2371
|
+
const hasBlogMetafields = !!metafieldIdentifiers?.blog?.length;
|
|
2372
|
+
const articleFrag = hasArticleMetafields ? articleWithMetafieldsFragment : articleFragment;
|
|
2373
|
+
const blogFrag = hasBlogMetafields ? blogWithMetafieldsFragment : blogFragment;
|
|
2337
2374
|
const defaultQuery = (
|
|
2338
2375
|
/* GraphQL */
|
|
2339
2376
|
`
|
|
2340
2377
|
query getArticle(
|
|
2341
2378
|
$blogHandle: String!
|
|
2342
2379
|
$articleHandle: String!
|
|
2343
|
-
${
|
|
2344
|
-
${
|
|
2380
|
+
${hasBlogMetafields ? "$blogMetafieldIdentifiers: [HasMetafieldsIdentifier!]!" : ""}
|
|
2381
|
+
${hasArticleMetafields ? "$articleMetafieldIdentifiers: [HasMetafieldsIdentifier!]!" : ""}
|
|
2345
2382
|
) {
|
|
2346
2383
|
blog(handle: $blogHandle) {
|
|
2347
|
-
...${
|
|
2384
|
+
...${hasBlogMetafields ? "blogWithMetafields" : "blog"}
|
|
2348
2385
|
articleByHandle(handle: $articleHandle) {
|
|
2349
|
-
...${
|
|
2386
|
+
...${hasArticleMetafields ? "articleWithMetafields" : "article"}
|
|
2350
2387
|
blog {
|
|
2351
|
-
...${
|
|
2388
|
+
...${hasBlogMetafields ? "blogWithMetafields" : "blog"}
|
|
2352
2389
|
}
|
|
2353
2390
|
}
|
|
2354
2391
|
}
|
|
@@ -2359,11 +2396,13 @@ async function getArticle(client, options) {
|
|
|
2359
2396
|
);
|
|
2360
2397
|
const query = graphqlQuery || defaultQuery;
|
|
2361
2398
|
const variables = { blogHandle, articleHandle };
|
|
2362
|
-
|
|
2363
|
-
variables
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2399
|
+
const data = await client.query(query, {
|
|
2400
|
+
...variables,
|
|
2401
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2402
|
+
metafieldIdentifiers,
|
|
2403
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2404
|
+
)
|
|
2405
|
+
});
|
|
2367
2406
|
if (!data || !data.blog || !data.blog.articleByHandle) {
|
|
2368
2407
|
return void 0;
|
|
2369
2408
|
}
|
|
@@ -2371,7 +2410,7 @@ async function getArticle(client, options) {
|
|
|
2371
2410
|
}
|
|
2372
2411
|
|
|
2373
2412
|
// src/api/blog/get-articles.ts
|
|
2374
|
-
async function
|
|
2413
|
+
async function fetchAllArticles(client, options, afterCursor) {
|
|
2375
2414
|
const {
|
|
2376
2415
|
first = 250,
|
|
2377
2416
|
query,
|
|
@@ -2380,7 +2419,7 @@ async function fetchAllPages4(client, options, afterCursor) {
|
|
|
2380
2419
|
reverse = false,
|
|
2381
2420
|
metafieldIdentifiers
|
|
2382
2421
|
} = options;
|
|
2383
|
-
const hasMetafields = metafieldIdentifiers
|
|
2422
|
+
const hasMetafields = !!metafieldIdentifiers?.article?.length;
|
|
2384
2423
|
const fragment = hasMetafields ? articleWithMetafieldsFragment : articleFragment;
|
|
2385
2424
|
const defaultQueryString = (
|
|
2386
2425
|
/* GraphQL */
|
|
@@ -2424,26 +2463,29 @@ async function fetchAllPages4(client, options, afterCursor) {
|
|
|
2424
2463
|
if (query) {
|
|
2425
2464
|
variables.query = query;
|
|
2426
2465
|
}
|
|
2427
|
-
|
|
2428
|
-
variables
|
|
2429
|
-
|
|
2430
|
-
|
|
2466
|
+
const data = await client.query(queryString, {
|
|
2467
|
+
...variables,
|
|
2468
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2469
|
+
metafieldIdentifiers,
|
|
2470
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2471
|
+
)
|
|
2472
|
+
});
|
|
2431
2473
|
if (!data || !data.articles) {
|
|
2432
2474
|
return [];
|
|
2433
2475
|
}
|
|
2434
2476
|
const articles = data.articles.edges?.map((edge) => normalizeArticle(edge.node)) || [];
|
|
2435
2477
|
if (data.articles.pageInfo.hasNextPage) {
|
|
2436
|
-
const nextArticles = await
|
|
2478
|
+
const nextArticles = await fetchAllArticles(client, options, data.articles.pageInfo.endCursor);
|
|
2437
2479
|
return [...articles, ...nextArticles];
|
|
2438
2480
|
}
|
|
2439
2481
|
return articles;
|
|
2440
2482
|
}
|
|
2441
2483
|
async function getArticles(client, options) {
|
|
2442
|
-
return
|
|
2484
|
+
return fetchAllArticles(client, options);
|
|
2443
2485
|
}
|
|
2444
2486
|
|
|
2445
2487
|
// src/api/blog/get-articles-in-blog.ts
|
|
2446
|
-
async function
|
|
2488
|
+
async function fetchAllPages3(client, options, afterCursor) {
|
|
2447
2489
|
const {
|
|
2448
2490
|
blogHandle,
|
|
2449
2491
|
first = 250,
|
|
@@ -2452,9 +2494,10 @@ async function fetchAllPages5(client, options, afterCursor) {
|
|
|
2452
2494
|
reverse = false,
|
|
2453
2495
|
metafieldIdentifiers
|
|
2454
2496
|
} = options;
|
|
2455
|
-
const
|
|
2456
|
-
const
|
|
2457
|
-
const
|
|
2497
|
+
const hasArticleMetafields = !!metafieldIdentifiers?.article?.length;
|
|
2498
|
+
const hasBlogMetafields = !!metafieldIdentifiers?.blog?.length;
|
|
2499
|
+
const articleFrag = hasArticleMetafields ? articleWithMetafieldsFragment : articleFragment;
|
|
2500
|
+
const blogFrag = hasBlogMetafields ? blogWithMetafieldsFragment : blogFragment;
|
|
2458
2501
|
const defaultQuery = (
|
|
2459
2502
|
/* GraphQL */
|
|
2460
2503
|
`
|
|
@@ -2464,11 +2507,11 @@ async function fetchAllPages5(client, options, afterCursor) {
|
|
|
2464
2507
|
$after: String
|
|
2465
2508
|
$sortKey: ArticleSortKeys!
|
|
2466
2509
|
$reverse: Boolean!
|
|
2467
|
-
${
|
|
2468
|
-
${
|
|
2510
|
+
${hasBlogMetafields ? "$blogMetafieldIdentifiers: [HasMetafieldsIdentifier!]!" : ""}
|
|
2511
|
+
${hasArticleMetafields ? "$articleMetafieldIdentifiers: [HasMetafieldsIdentifier!]!" : ""}
|
|
2469
2512
|
) {
|
|
2470
2513
|
blog(handle: $blogHandle) {
|
|
2471
|
-
...${
|
|
2514
|
+
...${hasBlogMetafields ? "blogWithMetafields" : "blog"}
|
|
2472
2515
|
articles(
|
|
2473
2516
|
first: $first
|
|
2474
2517
|
after: $after
|
|
@@ -2477,7 +2520,7 @@ async function fetchAllPages5(client, options, afterCursor) {
|
|
|
2477
2520
|
) {
|
|
2478
2521
|
edges {
|
|
2479
2522
|
node {
|
|
2480
|
-
...${
|
|
2523
|
+
...${hasArticleMetafields ? "articleWithMetafields" : "article"}
|
|
2481
2524
|
}
|
|
2482
2525
|
}
|
|
2483
2526
|
pageInfo {
|
|
@@ -2499,23 +2542,25 @@ async function fetchAllPages5(client, options, afterCursor) {
|
|
|
2499
2542
|
sortKey,
|
|
2500
2543
|
reverse
|
|
2501
2544
|
};
|
|
2502
|
-
|
|
2503
|
-
variables
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2545
|
+
const data = await client.query(query, {
|
|
2546
|
+
...variables,
|
|
2547
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2548
|
+
metafieldIdentifiers,
|
|
2549
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2550
|
+
)
|
|
2551
|
+
});
|
|
2507
2552
|
if (!data || !data.blog || !data.blog.articles) {
|
|
2508
2553
|
return [];
|
|
2509
2554
|
}
|
|
2510
2555
|
const articles = data.blog.articles.edges?.map((edge) => normalizeArticle(edge.node)) || [];
|
|
2511
2556
|
if (data.blog.articles.pageInfo.hasNextPage) {
|
|
2512
|
-
const nextArticles = await
|
|
2557
|
+
const nextArticles = await fetchAllPages3(client, options, data.blog.articles.pageInfo.endCursor);
|
|
2513
2558
|
return [...articles, ...nextArticles];
|
|
2514
2559
|
}
|
|
2515
2560
|
return articles;
|
|
2516
2561
|
}
|
|
2517
2562
|
async function getArticlesInBlog(client, options) {
|
|
2518
|
-
return
|
|
2563
|
+
return fetchAllPages3(client, options);
|
|
2519
2564
|
}
|
|
2520
2565
|
|
|
2521
2566
|
// src/api/page/normalize.ts
|
|
@@ -2538,7 +2583,7 @@ function normalizePage(page) {
|
|
|
2538
2583
|
// src/api/page/get-page.ts
|
|
2539
2584
|
async function getPage(client, options) {
|
|
2540
2585
|
const { handle, graphqlQuery, metafieldIdentifiers } = options;
|
|
2541
|
-
const hasMetafields = metafieldIdentifiers
|
|
2586
|
+
const hasMetafields = !!metafieldIdentifiers?.page?.length;
|
|
2542
2587
|
const fragment = hasMetafields ? pageWithMetafieldsFragment : pageFragment;
|
|
2543
2588
|
const defaultQuery = (
|
|
2544
2589
|
/* GraphQL */
|
|
@@ -2559,7 +2604,13 @@ async function getPage(client, options) {
|
|
|
2559
2604
|
if (hasMetafields) {
|
|
2560
2605
|
variables.pageMetafieldIdentifiers = metafieldIdentifiers;
|
|
2561
2606
|
}
|
|
2562
|
-
const data = await client.query(query,
|
|
2607
|
+
const data = await client.query(query, {
|
|
2608
|
+
...variables,
|
|
2609
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2610
|
+
metafieldIdentifiers,
|
|
2611
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2612
|
+
)
|
|
2613
|
+
});
|
|
2563
2614
|
if (!data || !data.page) {
|
|
2564
2615
|
return void 0;
|
|
2565
2616
|
}
|
|
@@ -2580,7 +2631,7 @@ function normalizeShop(shop) {
|
|
|
2580
2631
|
// src/api/shop/get-shop.ts
|
|
2581
2632
|
async function getShop(client, options) {
|
|
2582
2633
|
const { graphqlQuery, metafieldIdentifiers } = options;
|
|
2583
|
-
const hasMetafields = metafieldIdentifiers
|
|
2634
|
+
const hasMetafields = !!metafieldIdentifiers?.shop?.length;
|
|
2584
2635
|
const fragment = hasMetafields ? shopWithMetafieldsFragment : shopFragment;
|
|
2585
2636
|
const defaultQuery = (
|
|
2586
2637
|
/* GraphQL */
|
|
@@ -2597,10 +2648,13 @@ async function getShop(client, options) {
|
|
|
2597
2648
|
);
|
|
2598
2649
|
const query = graphqlQuery || defaultQuery;
|
|
2599
2650
|
const variables = {};
|
|
2600
|
-
|
|
2601
|
-
variables
|
|
2602
|
-
|
|
2603
|
-
|
|
2651
|
+
const data = await client.query(query, {
|
|
2652
|
+
...variables,
|
|
2653
|
+
...constructMetafieldIdentifiersQueryParams(
|
|
2654
|
+
metafieldIdentifiers,
|
|
2655
|
+
client.getConfig().getMetafieldNamespacePrefix()
|
|
2656
|
+
)
|
|
2657
|
+
});
|
|
2604
2658
|
if (!data || !data.shop) {
|
|
2605
2659
|
return void 0;
|
|
2606
2660
|
}
|