@infrab4a/connect 3.0.0 → 3.1.0
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 +67 -8
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/category.d.ts +2 -1
- package/domain/catalog/models/types/category-metadata.type.d.ts +4 -0
- package/domain/catalog/models/types/index.d.ts +1 -0
- package/esm2015/domain/catalog/models/category.js +1 -1
- package/esm2015/domain/catalog/models/types/category-metadata.type.js +2 -0
- package/esm2015/domain/catalog/models/types/index.js +2 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +42 -3
- package/fesm2015/infrab4a-connect.js +40 -1
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +3 -1
- package/package.json +1 -1
|
@@ -3660,11 +3660,32 @@
|
|
|
3660
3660
|
}); }); },
|
|
3661
3661
|
},
|
|
3662
3662
|
},
|
|
3663
|
+
{
|
|
3664
|
+
metadata: {
|
|
3665
|
+
columnName: 'metadata',
|
|
3666
|
+
fields: ['title', 'description'],
|
|
3667
|
+
bindPersistData: function (value) { return ({
|
|
3668
|
+
metadata: { data: value },
|
|
3669
|
+
}); },
|
|
3670
|
+
},
|
|
3671
|
+
},
|
|
3663
3672
|
],
|
|
3664
3673
|
}) || this;
|
|
3665
3674
|
_this.productRepository = productRepository;
|
|
3666
3675
|
return _this;
|
|
3667
3676
|
}
|
|
3677
|
+
CategoryHasuraGraphQLRepository.prototype.create = function (params) {
|
|
3678
|
+
var _super = Object.create(null, {
|
|
3679
|
+
create: { get: function () { return _super_1.prototype.create; } }
|
|
3680
|
+
});
|
|
3681
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3682
|
+
var metadata, data;
|
|
3683
|
+
return __generator(this, function (_c) {
|
|
3684
|
+
metadata = params.metadata, data = __rest(params, ["metadata"]);
|
|
3685
|
+
return [2 /*return*/, _super.create.call(this, Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }))];
|
|
3686
|
+
});
|
|
3687
|
+
});
|
|
3688
|
+
};
|
|
3668
3689
|
CategoryHasuraGraphQLRepository.prototype.get = function (identifiers) {
|
|
3669
3690
|
var _super = Object.create(null, {
|
|
3670
3691
|
get: { get: function () { return _super_1.prototype.get; } }
|
|
@@ -3693,27 +3714,36 @@
|
|
|
3693
3714
|
update: { get: function () { return _super_1.prototype.update; } }
|
|
3694
3715
|
});
|
|
3695
3716
|
return __awaiter(this, void 0, void 0, function () {
|
|
3696
|
-
var products, checkId, data, plainData, id, category, _c, _d;
|
|
3697
|
-
return __generator(this, function (
|
|
3698
|
-
switch (
|
|
3717
|
+
var products, checkId, metadata, data, plainData, id, category, _c, _d, _e, _f;
|
|
3718
|
+
return __generator(this, function (_g) {
|
|
3719
|
+
switch (_g.label) {
|
|
3699
3720
|
case 0:
|
|
3700
|
-
products = params.products, checkId = params.id, data = __rest(params, ["products", "id"]);
|
|
3721
|
+
products = params.products, checkId = params.id, metadata = params.metadata, data = __rest(params, ["products", "id", "metadata"]);
|
|
3701
3722
|
plainData = this.paramsToPlain({ id: checkId });
|
|
3702
3723
|
return [4 /*yield*/, this.getId(plainData.id)];
|
|
3703
3724
|
case 1:
|
|
3704
|
-
id =
|
|
3725
|
+
id = _g.sent();
|
|
3705
3726
|
return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
|
|
3706
3727
|
case 2:
|
|
3707
|
-
category =
|
|
3728
|
+
category = _g.sent();
|
|
3708
3729
|
_c = category;
|
|
3709
3730
|
_d = products;
|
|
3710
3731
|
if (!_d) return [3 /*break*/, 4];
|
|
3711
3732
|
return [4 /*yield*/, this.updateProducts(+id, { products: products })];
|
|
3712
3733
|
case 3:
|
|
3713
|
-
_d = (
|
|
3714
|
-
|
|
3734
|
+
_d = (_g.sent());
|
|
3735
|
+
_g.label = 4;
|
|
3715
3736
|
case 4:
|
|
3716
3737
|
_c.products = _d;
|
|
3738
|
+
_e = category;
|
|
3739
|
+
_f = metadata;
|
|
3740
|
+
if (!_f) return [3 /*break*/, 6];
|
|
3741
|
+
return [4 /*yield*/, this.updateMetadata(+id, { metadata: metadata })];
|
|
3742
|
+
case 5:
|
|
3743
|
+
_f = (_g.sent());
|
|
3744
|
+
_g.label = 6;
|
|
3745
|
+
case 6:
|
|
3746
|
+
_e.metadata = _f;
|
|
3717
3747
|
return [2 /*return*/, category];
|
|
3718
3748
|
}
|
|
3719
3749
|
});
|
|
@@ -3878,6 +3908,35 @@
|
|
|
3878
3908
|
});
|
|
3879
3909
|
});
|
|
3880
3910
|
};
|
|
3911
|
+
CategoryHasuraGraphQLRepository.prototype.updateMetadata = function (categoryId, _c) {
|
|
3912
|
+
var metadata = _c.metadata;
|
|
3913
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3914
|
+
var plainData;
|
|
3915
|
+
return __generator(this, function (_c) {
|
|
3916
|
+
switch (_c.label) {
|
|
3917
|
+
case 0:
|
|
3918
|
+
plainData = this.paramsToPlain({ metadata: metadata });
|
|
3919
|
+
if (!plainData.metadata)
|
|
3920
|
+
return [2 /*return*/];
|
|
3921
|
+
return [4 /*yield*/, this.mutation('update_category_metadata_by_pk', ['category_id'], {
|
|
3922
|
+
pk_columns: {
|
|
3923
|
+
value: { category_id: categoryId },
|
|
3924
|
+
type: 'category_metadata_pk_columns_input',
|
|
3925
|
+
required: true,
|
|
3926
|
+
},
|
|
3927
|
+
_set: {
|
|
3928
|
+
value: lodash.omit(metadata, ['category_id']),
|
|
3929
|
+
type: 'category_metadata_set_input',
|
|
3930
|
+
required: true,
|
|
3931
|
+
},
|
|
3932
|
+
})];
|
|
3933
|
+
case 1:
|
|
3934
|
+
_c.sent();
|
|
3935
|
+
return [2 /*return*/, plainData.metadata];
|
|
3936
|
+
}
|
|
3937
|
+
});
|
|
3938
|
+
});
|
|
3939
|
+
};
|
|
3881
3940
|
return CategoryHasuraGraphQLRepository;
|
|
3882
3941
|
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
3883
3942
|
|