@infrab4a/connect 2.0.9-beta.1 → 2.0.9
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 +16 -11
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/elasticsearch/indexes/products-index.js +2 -2
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +4 -4
- package/fesm2015/infrab4a-connect.js +4 -4
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -1831,7 +1831,7 @@
|
|
|
1831
1831
|
return [3 /*break*/, 6];
|
|
1832
1832
|
case 4:
|
|
1833
1833
|
error_1 = _a.sent();
|
|
1834
|
-
console.
|
|
1834
|
+
console.error(error_1.message);
|
|
1835
1835
|
return [4 /*yield*/, this.adapter.save("products/_doc/" + product.id, product.toPlain())];
|
|
1836
1836
|
case 5:
|
|
1837
1837
|
_a.sent();
|
|
@@ -4114,27 +4114,32 @@
|
|
|
4114
4114
|
});
|
|
4115
4115
|
var _a;
|
|
4116
4116
|
return __awaiter(this, void 0, void 0, function () {
|
|
4117
|
-
var product, _c, _d;
|
|
4118
|
-
return __generator(this, function (
|
|
4119
|
-
switch (
|
|
4117
|
+
var product, _c, _d, _e;
|
|
4118
|
+
return __generator(this, function (_f) {
|
|
4119
|
+
switch (_f.label) {
|
|
4120
4120
|
case 0:
|
|
4121
4121
|
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
4122
4122
|
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
4123
4123
|
case 1:
|
|
4124
|
-
_c = (_a = (
|
|
4124
|
+
_c = (_a = (_f.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
4125
4125
|
return [3 /*break*/, 4];
|
|
4126
4126
|
case 2: return [4 /*yield*/, _super.get.call(this, identifiers)];
|
|
4127
4127
|
case 3:
|
|
4128
|
-
_c =
|
|
4129
|
-
|
|
4128
|
+
_c = _f.sent();
|
|
4129
|
+
_f.label = 4;
|
|
4130
4130
|
case 4:
|
|
4131
4131
|
product = _c;
|
|
4132
4132
|
if (product.productId)
|
|
4133
4133
|
throw new NotFoundError('Product not found, it is a variant');
|
|
4134
4134
|
_d = product;
|
|
4135
|
+
_e = product.reviews;
|
|
4136
|
+
if (_e) return [3 /*break*/, 6];
|
|
4135
4137
|
return [4 /*yield*/, this.findReviewsByProduct(+product.id)];
|
|
4136
4138
|
case 5:
|
|
4137
|
-
|
|
4139
|
+
_e = (_f.sent());
|
|
4140
|
+
_f.label = 6;
|
|
4141
|
+
case 6:
|
|
4142
|
+
_d.reviews = _e;
|
|
4138
4143
|
return [2 /*return*/, product];
|
|
4139
4144
|
}
|
|
4140
4145
|
});
|
|
@@ -4230,18 +4235,18 @@
|
|
|
4230
4235
|
};
|
|
4231
4236
|
ProductHasuraGraphQLRepository.prototype.fetchReviews = function (status) {
|
|
4232
4237
|
return __awaiter(this, void 0, void 0, function () {
|
|
4233
|
-
var
|
|
4238
|
+
var reviewsExpression, data;
|
|
4234
4239
|
var _c, _d;
|
|
4235
4240
|
var _this = this;
|
|
4236
4241
|
return __generator(this, function (_e) {
|
|
4237
4242
|
switch (_e.label) {
|
|
4238
4243
|
case 0:
|
|
4239
|
-
|
|
4244
|
+
reviewsExpression = {
|
|
4240
4245
|
status: status === 'pending'
|
|
4241
4246
|
? (_c = {}, _c[HasuraGraphQLWhere.ISNULL] = true, _c) : (_d = {}, _d[HasuraGraphQLWhere.EQUALS] = status === 'approved', _d),
|
|
4242
4247
|
};
|
|
4243
4248
|
return [4 /*yield*/, this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
|
|
4244
|
-
where: { value: { reviews:
|
|
4249
|
+
where: { value: { reviews: reviewsExpression }, type: 'product_bool_exp', required: true },
|
|
4245
4250
|
})];
|
|
4246
4251
|
case 1:
|
|
4247
4252
|
data = (_e.sent()).product;
|