@infrab4a/connect 3.0.0-beta.2 → 3.0.0-beta.3
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 +58 -16
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +29 -5
- package/fesm2015/infrab4a-connect.js +28 -4
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +2 -1
- package/package.json +1 -1
|
@@ -3991,7 +3991,7 @@
|
|
|
3991
3991
|
{
|
|
3992
3992
|
reviews: {
|
|
3993
3993
|
columnName: 'reviews',
|
|
3994
|
-
foreignKeyColumn: {
|
|
3994
|
+
foreignKeyColumn: { product_id: 'id' },
|
|
3995
3995
|
fields: _this.reviewsFields,
|
|
3996
3996
|
},
|
|
3997
3997
|
},
|
|
@@ -4029,15 +4029,17 @@
|
|
|
4029
4029
|
enumerable: false,
|
|
4030
4030
|
configurable: true
|
|
4031
4031
|
});
|
|
4032
|
-
ProductHasuraGraphQLRepository.prototype.create = function (
|
|
4032
|
+
ProductHasuraGraphQLRepository.prototype.create = function (params) {
|
|
4033
4033
|
var _super = Object.create(null, {
|
|
4034
4034
|
create: { get: function () { return _super_1.prototype.create; } }
|
|
4035
4035
|
});
|
|
4036
4036
|
return __awaiter(this, void 0, void 0, function () {
|
|
4037
|
-
var product, _c, error_1;
|
|
4037
|
+
var metadata, data, product, _c, error_1;
|
|
4038
4038
|
return __generator(this, function (_d) {
|
|
4039
4039
|
switch (_d.label) {
|
|
4040
|
-
case 0:
|
|
4040
|
+
case 0:
|
|
4041
|
+
metadata = params.metadata, data = __rest(params, ["metadata"]);
|
|
4042
|
+
return [4 /*yield*/, _super.create.call(this, lodash.omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']))];
|
|
4041
4043
|
case 1:
|
|
4042
4044
|
product = _d.sent();
|
|
4043
4045
|
_d.label = 2;
|
|
@@ -4140,25 +4142,25 @@
|
|
|
4140
4142
|
update: { get: function () { return _super_1.prototype.update; } }
|
|
4141
4143
|
});
|
|
4142
4144
|
return __awaiter(this, void 0, void 0, function () {
|
|
4143
|
-
var categories, kitProducts, reviews, checkId, rate, data, plainData, id, product, _c, _d, _e, _f, _g, _h;
|
|
4144
|
-
return __generator(this, function (
|
|
4145
|
-
switch (
|
|
4145
|
+
var categories, kitProducts, reviews, checkId, rate, metadata, data, plainData, id, product, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4146
|
+
return __generator(this, function (_l) {
|
|
4147
|
+
switch (_l.label) {
|
|
4146
4148
|
case 0:
|
|
4147
|
-
categories = params.categories, kitProducts = params.kitProducts, reviews = params.reviews, checkId = params.id, rate = params.rate, data = __rest(params, ["categories", "kitProducts", "reviews", "id", "rate"]);
|
|
4149
|
+
categories = params.categories, kitProducts = params.kitProducts, reviews = params.reviews, checkId = params.id, rate = params.rate, metadata = params.metadata, data = __rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
|
|
4148
4150
|
plainData = this.paramsToPlain({ id: checkId });
|
|
4149
4151
|
return [4 /*yield*/, this.getId(plainData.id)];
|
|
4150
4152
|
case 1:
|
|
4151
|
-
id =
|
|
4153
|
+
id = _l.sent();
|
|
4152
4154
|
return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
|
|
4153
4155
|
case 2:
|
|
4154
|
-
product =
|
|
4156
|
+
product = _l.sent();
|
|
4155
4157
|
_c = product;
|
|
4156
4158
|
_d = categories;
|
|
4157
4159
|
if (!_d) return [3 /*break*/, 4];
|
|
4158
4160
|
return [4 /*yield*/, this.updateCategories(+id, { categories: categories })];
|
|
4159
4161
|
case 3:
|
|
4160
|
-
_d = (
|
|
4161
|
-
|
|
4162
|
+
_d = (_l.sent());
|
|
4163
|
+
_l.label = 4;
|
|
4162
4164
|
case 4:
|
|
4163
4165
|
_c.categories = _d;
|
|
4164
4166
|
_e = product;
|
|
@@ -4166,8 +4168,8 @@
|
|
|
4166
4168
|
if (!_f) return [3 /*break*/, 6];
|
|
4167
4169
|
return [4 /*yield*/, this.updateKitProducts(+id, { kitProducts: kitProducts })];
|
|
4168
4170
|
case 5:
|
|
4169
|
-
_f = (
|
|
4170
|
-
|
|
4171
|
+
_f = (_l.sent());
|
|
4172
|
+
_l.label = 6;
|
|
4171
4173
|
case 6:
|
|
4172
4174
|
_e.kitProducts = _f;
|
|
4173
4175
|
_g = product;
|
|
@@ -4175,10 +4177,19 @@
|
|
|
4175
4177
|
if (!_h) return [3 /*break*/, 8];
|
|
4176
4178
|
return [4 /*yield*/, this.updateReviews(+id, { reviews: reviews })];
|
|
4177
4179
|
case 7:
|
|
4178
|
-
_h = (
|
|
4179
|
-
|
|
4180
|
+
_h = (_l.sent());
|
|
4181
|
+
_l.label = 8;
|
|
4180
4182
|
case 8:
|
|
4181
4183
|
_g.reviews = _h;
|
|
4184
|
+
_j = product;
|
|
4185
|
+
_k = metadata;
|
|
4186
|
+
if (!_k) return [3 /*break*/, 10];
|
|
4187
|
+
return [4 /*yield*/, this.updateMetadata(+id, { metadata: metadata })];
|
|
4188
|
+
case 9:
|
|
4189
|
+
_k = (_l.sent());
|
|
4190
|
+
_l.label = 10;
|
|
4191
|
+
case 10:
|
|
4192
|
+
_j.metadata = _k;
|
|
4182
4193
|
return [2 /*return*/, product];
|
|
4183
4194
|
}
|
|
4184
4195
|
});
|
|
@@ -4298,6 +4309,8 @@
|
|
|
4298
4309
|
return __generator(this, function (_c) {
|
|
4299
4310
|
switch (_c.label) {
|
|
4300
4311
|
case 0:
|
|
4312
|
+
if (!reviews)
|
|
4313
|
+
return [2 /*return*/, []];
|
|
4301
4314
|
if (!('action' in reviews && reviews.action === 'remove')) return [3 /*break*/, 3];
|
|
4302
4315
|
return [4 /*yield*/, Promise.all(reviews.value.map(function (reviewData) { return __awaiter(_this, void 0, void 0, function () {
|
|
4303
4316
|
var review;
|
|
@@ -4361,6 +4374,35 @@
|
|
|
4361
4374
|
});
|
|
4362
4375
|
});
|
|
4363
4376
|
};
|
|
4377
|
+
ProductHasuraGraphQLRepository.prototype.updateMetadata = function (productId, _c) {
|
|
4378
|
+
var metadata = _c.metadata;
|
|
4379
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4380
|
+
var plainData;
|
|
4381
|
+
return __generator(this, function (_c) {
|
|
4382
|
+
switch (_c.label) {
|
|
4383
|
+
case 0:
|
|
4384
|
+
plainData = this.paramsToPlain({ metadata: metadata });
|
|
4385
|
+
if (!plainData.metadata)
|
|
4386
|
+
return [2 /*return*/];
|
|
4387
|
+
return [4 /*yield*/, this.mutation('update_product_metadata_by_pk', ['product_id'], {
|
|
4388
|
+
pk_columns: {
|
|
4389
|
+
value: { product_id: productId },
|
|
4390
|
+
type: 'product_metadata_pk_columns_input',
|
|
4391
|
+
required: true,
|
|
4392
|
+
},
|
|
4393
|
+
_set: {
|
|
4394
|
+
value: lodash.omit(metadata, ['product_id']),
|
|
4395
|
+
type: 'product_metadata_set_input',
|
|
4396
|
+
required: true,
|
|
4397
|
+
},
|
|
4398
|
+
})];
|
|
4399
|
+
case 1:
|
|
4400
|
+
_c.sent();
|
|
4401
|
+
return [2 /*return*/, plainData.metadata];
|
|
4402
|
+
}
|
|
4403
|
+
});
|
|
4404
|
+
});
|
|
4405
|
+
};
|
|
4364
4406
|
ProductHasuraGraphQLRepository.prototype.getId = function (id) {
|
|
4365
4407
|
var _a, _b;
|
|
4366
4408
|
return __awaiter(this, void 0, void 0, function () {
|