pinelab-storefront-client
Advanced tools
Comparing version 0.47.2 to 0.47.3
@@ -35,7 +35,7 @@ 'use strict'; | ||
'\n ', | ||
'\n {\n Vendure {\n products {\n items {\n ...ProductFields\n }\n }\n }\n }\n', | ||
'\n query products($options: Vendure_ProductListOptions) {\n Vendure {\n products(options: $options) {\n totalItems\n items {\n ...ProductFields\n }\n }\n }\n }\n', | ||
], | ||
[ | ||
'\n ', | ||
'\n {\n Vendure {\n products {\n items {\n ...ProductFields\n }\n }\n }\n }\n', | ||
'\n query products($options: Vendure_ProductListOptions) {\n Vendure {\n products(options: $options) {\n totalItems\n items {\n ...ProductFields\n }\n }\n }\n }\n', | ||
] | ||
@@ -42,0 +42,0 @@ )), |
@@ -8,3 +8,2 @@ import { CalculatedProduct } from '../'; | ||
Product, | ||
ProductList, | ||
} from '../generated/graphql'; | ||
@@ -32,3 +31,6 @@ interface SortableCollection { | ||
getAllCollections(): Promise<CollectionList>; | ||
getAllProducts(): Promise<ProductList>; | ||
/** | ||
* Get products in batches of 100 | ||
*/ | ||
getAllProducts(): Promise<Product[]>; | ||
getAvailableCountries(): Promise<Country[]>; | ||
@@ -35,0 +37,0 @@ /** |
@@ -165,3 +165,3 @@ 'use strict'; | ||
collectionList, | ||
productList, | ||
allProducts, | ||
availableCountries, | ||
@@ -186,5 +186,5 @@ products, | ||
(collectionList = _a[0]), | ||
(productList = _a[1]), | ||
(allProducts = _a[1]), | ||
(availableCountries = _a[2]); | ||
products = productList.items.map(function (p) { | ||
products = allProducts.map(function (p) { | ||
return __1.setCalculatedFields(p); | ||
@@ -200,3 +200,3 @@ }); | ||
collection, | ||
productList.items | ||
allProducts | ||
); | ||
@@ -264,14 +264,38 @@ return { | ||
}; | ||
/** | ||
* Get products in batches of 100 | ||
*/ | ||
GridsomeService.prototype.getAllProducts = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var products; | ||
var products, hasMore, page, skip, take, productList; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
products = []; | ||
hasMore = true; | ||
page = 1; | ||
skip = 0; | ||
take = 500; | ||
_a.label = 1; | ||
case 1: | ||
if (!hasMore) return [3 /*break*/, 3]; | ||
return [ | ||
4 /*yield*/, | ||
this.graphqlFn(gridsome_queries_1.GET_PRODUCTS), | ||
this.graphqlFn(gridsome_queries_1.GET_PRODUCTS, { | ||
options: { skip: skip, take: take }, | ||
}), | ||
]; | ||
case 1: | ||
products = _a.sent().data.Vendure.products; | ||
case 2: | ||
productList = _a.sent().data.Vendure.products; | ||
products.push.apply(products, productList.items); | ||
console.log( | ||
productList.items.map(function (p) { | ||
return p.slug; | ||
}) | ||
); | ||
skip = page * take; | ||
page++; | ||
hasMore = productList.totalItems > products.length; | ||
return [3 /*break*/, 1]; | ||
case 3: | ||
return [2 /*return*/, products]; | ||
@@ -278,0 +302,0 @@ } |
{ | ||
"name": "pinelab-storefront-client", | ||
"version": "0.47.2", | ||
"version": "0.47.3", | ||
"description": "Generates static html pages with Gridsome and suplied Vue components", | ||
@@ -50,3 +50,3 @@ "author": "Martijn van de Brug <martijn@pinelab.studio>", | ||
}, | ||
"gitHead": "f35f5a5d8653d997125124e6bc081bb7e38bb4fa" | ||
"gitHead": "2f219081d7051c2a708c6585b77d9db64f95baf6" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
634067
8138