@infrab4a/connect 2.0.7 → 2.0.8
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 +34 -6
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +13 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +15 -3
- package/fesm2015/infrab4a-connect.js +26 -2
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -3880,7 +3880,7 @@
|
|
|
3880
3880
|
return __generator(this, function (_c) {
|
|
3881
3881
|
switch (_c.label) {
|
|
3882
3882
|
case 0:
|
|
3883
|
-
|
|
3883
|
+
if (!('action' in products && products.action === 'remove')) return [3 /*break*/, 2];
|
|
3884
3884
|
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
3885
3885
|
where: {
|
|
3886
3886
|
type: 'category_product_bool_exp',
|
|
@@ -3889,6 +3889,20 @@
|
|
|
3889
3889
|
},
|
|
3890
3890
|
})];
|
|
3891
3891
|
case 1:
|
|
3892
|
+
_c.sent();
|
|
3893
|
+
return [2 /*return*/, []];
|
|
3894
|
+
case 2:
|
|
3895
|
+
plainData = this.paramsToPlain({ products: products });
|
|
3896
|
+
if (!plainData.products || plainData.products.length <= 0)
|
|
3897
|
+
return [2 /*return*/, []];
|
|
3898
|
+
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
3899
|
+
where: {
|
|
3900
|
+
type: 'category_product_bool_exp',
|
|
3901
|
+
required: true,
|
|
3902
|
+
value: { category_id: { _eq: categoryId } },
|
|
3903
|
+
},
|
|
3904
|
+
})];
|
|
3905
|
+
case 3:
|
|
3892
3906
|
_c.sent();
|
|
3893
3907
|
return [4 /*yield*/, this.mutation('insert_category_product', ['affected_rows'], {
|
|
3894
3908
|
objects: {
|
|
@@ -3897,7 +3911,7 @@
|
|
|
3897
3911
|
value: plainData.products.map(function (productId) { return ({ category_id: categoryId, product_id: productId }); }),
|
|
3898
3912
|
},
|
|
3899
3913
|
})];
|
|
3900
|
-
case
|
|
3914
|
+
case 4:
|
|
3901
3915
|
_c.sent();
|
|
3902
3916
|
return [2 /*return*/, plainData.products];
|
|
3903
3917
|
}
|
|
@@ -4236,7 +4250,7 @@
|
|
|
4236
4250
|
return __generator(this, function (_c) {
|
|
4237
4251
|
switch (_c.label) {
|
|
4238
4252
|
case 0:
|
|
4239
|
-
|
|
4253
|
+
if (!('action' in categories && categories.action === 'remove')) return [3 /*break*/, 2];
|
|
4240
4254
|
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
4241
4255
|
where: {
|
|
4242
4256
|
type: 'category_product_bool_exp',
|
|
@@ -4245,6 +4259,20 @@
|
|
|
4245
4259
|
},
|
|
4246
4260
|
})];
|
|
4247
4261
|
case 1:
|
|
4262
|
+
_c.sent();
|
|
4263
|
+
return [2 /*return*/, []];
|
|
4264
|
+
case 2:
|
|
4265
|
+
plainData = this.paramsToPlain({ categories: categories });
|
|
4266
|
+
if (!plainData.categories || plainData.categories.length <= 0)
|
|
4267
|
+
return [2 /*return*/, []];
|
|
4268
|
+
return [4 /*yield*/, this.mutation('delete_category_product', ['affected_rows'], {
|
|
4269
|
+
where: {
|
|
4270
|
+
type: 'category_product_bool_exp',
|
|
4271
|
+
required: true,
|
|
4272
|
+
value: { product_id: { _eq: productId } },
|
|
4273
|
+
},
|
|
4274
|
+
})];
|
|
4275
|
+
case 3:
|
|
4248
4276
|
_c.sent();
|
|
4249
4277
|
return [4 /*yield*/, this.mutation('insert_category_product', ['affected_rows'], {
|
|
4250
4278
|
objects: {
|
|
@@ -4253,7 +4281,7 @@
|
|
|
4253
4281
|
value: plainData.categories.map(function (categoryId) { return ({ category_id: categoryId, product_id: productId }); }),
|
|
4254
4282
|
},
|
|
4255
4283
|
})];
|
|
4256
|
-
case
|
|
4284
|
+
case 4:
|
|
4257
4285
|
_c.sent();
|
|
4258
4286
|
return [2 /*return*/, plainData.categories];
|
|
4259
4287
|
}
|
|
@@ -4303,8 +4331,6 @@
|
|
|
4303
4331
|
return __generator(this, function (_c) {
|
|
4304
4332
|
switch (_c.label) {
|
|
4305
4333
|
case 0:
|
|
4306
|
-
if (!reviews)
|
|
4307
|
-
return [2 /*return*/, []];
|
|
4308
4334
|
if (!('action' in reviews && reviews.action === 'remove')) return [3 /*break*/, 3];
|
|
4309
4335
|
return [4 /*yield*/, Promise.all(reviews.value.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
|
|
4310
4336
|
var review;
|
|
@@ -4327,6 +4353,8 @@
|
|
|
4327
4353
|
return [2 /*return*/, reviews.value.map(function (review, index) { return !reviewIds_1[index] && review; }).filter(Boolean)];
|
|
4328
4354
|
case 3:
|
|
4329
4355
|
plainData = this.paramsToPlain({ reviews: reviews });
|
|
4356
|
+
if (!plainData.reviews || plainData.reviews.length <= 0)
|
|
4357
|
+
return [2 /*return*/, []];
|
|
4330
4358
|
return [2 /*return*/, Promise.all(plainData.reviews.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
|
|
4331
4359
|
var review, _c, _d;
|
|
4332
4360
|
return __generator(this, function (_e) {
|