@infrab4a/connect 3.2.6-beta.3 → 3.2.7
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/bundles/infrab4a-connect.umd.js +17 -13
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +8 -8
- package/fesm2015/infrab4a-connect.js +7 -7
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -3816,18 +3816,20 @@
|
|
|
3816
3816
|
CategoryHasuraGraphQLRepository.prototype.getCategoriesForHome = function (categoryIds, limit) {
|
|
3817
3817
|
if (limit === void 0) { limit = 4; }
|
|
3818
3818
|
return __awaiter(this, void 0, void 0, function () {
|
|
3819
|
-
var categoriesFirestore, categoriesHasura, categories, _c, _d, _e, _f, homeSections;
|
|
3819
|
+
var categoriesFirestore, categoriesHasura, categories, _c, _d, _e, _f, _g, _h, _j, _k, homeSections;
|
|
3820
3820
|
var _this = this;
|
|
3821
|
-
return __generator(this, function (
|
|
3822
|
-
switch (
|
|
3821
|
+
return __generator(this, function (_l) {
|
|
3822
|
+
switch (_l.label) {
|
|
3823
3823
|
case 0:
|
|
3824
|
-
if (!categoryIds)
|
|
3824
|
+
if (!(categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length))
|
|
3825
3825
|
return [2 /*return*/, []];
|
|
3826
3826
|
categoriesFirestore = categoryIds.filter(function (categoryId) { return Number.isNaN(+categoryId); });
|
|
3827
3827
|
categoriesHasura = categoryIds.filter(function (categoryId) { return +categoryId > 0; });
|
|
3828
3828
|
categories = [];
|
|
3829
3829
|
if (!categoriesFirestore.length) return [3 /*break*/, 2];
|
|
3830
|
-
_d = (_c = categories).
|
|
3830
|
+
_d = (_c = categories.push).apply;
|
|
3831
|
+
_e = [categories];
|
|
3832
|
+
_f = [[]];
|
|
3831
3833
|
return [4 /*yield*/, this.find({
|
|
3832
3834
|
filters: { firestoreId: { operator: exports.Where.IN, value: categoriesFirestore.filter(Boolean) }, published: true },
|
|
3833
3835
|
}).then(function (_c) {
|
|
@@ -3835,11 +3837,13 @@
|
|
|
3835
3837
|
return data;
|
|
3836
3838
|
})];
|
|
3837
3839
|
case 1:
|
|
3838
|
-
_d.apply(_c, [
|
|
3839
|
-
|
|
3840
|
+
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_l.sent())])]))]));
|
|
3841
|
+
_l.label = 2;
|
|
3840
3842
|
case 2:
|
|
3841
3843
|
if (!categoriesHasura.length) return [3 /*break*/, 4];
|
|
3842
|
-
|
|
3844
|
+
_h = (_g = categories.push).apply;
|
|
3845
|
+
_j = [categories];
|
|
3846
|
+
_k = [[]];
|
|
3843
3847
|
return [4 /*yield*/, this.find({
|
|
3844
3848
|
filters: { id: { operator: exports.Where.IN, value: categoriesHasura.filter(Boolean) }, published: true },
|
|
3845
3849
|
}).then(function (_c) {
|
|
@@ -3847,10 +3851,10 @@
|
|
|
3847
3851
|
return data;
|
|
3848
3852
|
})];
|
|
3849
3853
|
case 3:
|
|
3850
|
-
|
|
3851
|
-
|
|
3854
|
+
_h.apply(_g, _j.concat([__spreadArray.apply(void 0, _k.concat([__read.apply(void 0, [(_l.sent())])]))]));
|
|
3855
|
+
_l.label = 4;
|
|
3852
3856
|
case 4:
|
|
3853
|
-
if (!
|
|
3857
|
+
if (!categories.length)
|
|
3854
3858
|
return [2 /*return*/, []];
|
|
3855
3859
|
return [4 /*yield*/, Promise.all(categories.map(function (category) { return __awaiter(_this, void 0, void 0, function () {
|
|
3856
3860
|
var _c;
|
|
@@ -3867,7 +3871,7 @@
|
|
|
3867
3871
|
});
|
|
3868
3872
|
}); }))];
|
|
3869
3873
|
case 5:
|
|
3870
|
-
homeSections =
|
|
3874
|
+
homeSections = _l.sent();
|
|
3871
3875
|
return [2 /*return*/, homeSections];
|
|
3872
3876
|
}
|
|
3873
3877
|
});
|
|
@@ -3879,7 +3883,7 @@
|
|
|
3879
3883
|
return __generator(this, function (_c) {
|
|
3880
3884
|
switch (_c.label) {
|
|
3881
3885
|
case 0:
|
|
3882
|
-
if (!(category === null || category === void 0 ? void 0 : category.products))
|
|
3886
|
+
if (!(category === null || category === void 0 ? void 0 : category.products.length))
|
|
3883
3887
|
return [2 /*return*/, []];
|
|
3884
3888
|
products = [];
|
|
3885
3889
|
return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: exports.Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: exports.Where.GT, value: 0 } } } : {})), fields: [
|