@infrab4a/connect 1.0.0-beta.16 → 1.0.0-beta.17
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 +305 -136
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/catalog/models/index.d.ts +3 -2
- package/domain/catalog/models/kit-product.d.ts +12 -0
- package/domain/catalog/models/product.d.ts +3 -0
- package/domain/generic/repository/types/repository-find-filters.type.d.ts +3 -3
- package/esm2015/domain/catalog/models/index.js +4 -3
- package/esm2015/domain/catalog/models/kit-product.js +18 -0
- package/esm2015/domain/catalog/models/product.js +8 -1
- package/esm2015/domain/generic/repository/types/repository-find-filters.type.js +1 -1
- package/esm2015/infra/hasura-graphql/index.js +3 -2
- package/esm2015/infra/hasura-graphql/mixins/helpers/attribute-option.helper.js +2 -3
- package/esm2015/infra/hasura-graphql/mixins/helpers/graphql-field.helper.js +8 -10
- package/esm2015/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.js +1 -1
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +3 -3
- package/esm2015/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.js +2 -2
- package/esm2015/infra/hasura-graphql/mixins/with-update-hasura-graphql.mixin.js +6 -3
- package/esm2015/infra/hasura-graphql/models/index.js +2 -1
- package/esm2015/infra/hasura-graphql/models/kit-product-hasura-graphql.js +15 -0
- package/esm2015/infra/hasura-graphql/models/product-hasura-graphql.js +8 -1
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +109 -68
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/esm2015/infra/index.js +2 -1
- package/esm2015/infra/millenium/index.js +2 -0
- package/esm2015/infra/millenium/millenium.js +42 -0
- package/fesm2015/infrab4a-connect.js +213 -102
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/hasura-graphql/index.d.ts +2 -1
- package/infra/hasura-graphql/mixins/helpers/attribute-option.helper.d.ts +1 -5
- package/infra/hasura-graphql/mixins/with-create-hasura-graphql.mixin.d.ts +1 -1
- package/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/mixins/with-hasura-graphql.mixin.d.ts +2 -2
- package/infra/hasura-graphql/models/index.d.ts +1 -0
- package/infra/hasura-graphql/models/kit-product-hasura-graphql.d.ts +6 -0
- package/infra/hasura-graphql/models/product-hasura-graphql.d.ts +2 -0
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +1 -0
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +8 -14
- package/infra/index.d.ts +1 -0
- package/infra/millenium/index.d.ts +1 -0
- package/infra/millenium/millenium.d.ts +25 -0
- package/package.json +1 -1
|
@@ -1204,13 +1204,6 @@
|
|
|
1204
1204
|
return RecoveryPassword;
|
|
1205
1205
|
}());
|
|
1206
1206
|
|
|
1207
|
-
exports.Shops = void 0;
|
|
1208
|
-
(function (Shops) {
|
|
1209
|
-
Shops["MENSMARKET"] = "mensmarket";
|
|
1210
|
-
Shops["GLAMSHOP"] = "Glamshop";
|
|
1211
|
-
Shops["GLAMPOINTS"] = "Glampoints";
|
|
1212
|
-
})(exports.Shops || (exports.Shops = {}));
|
|
1213
|
-
|
|
1214
1207
|
var Category = /** @class */ (function (_super) {
|
|
1215
1208
|
__extends(Category, _super);
|
|
1216
1209
|
function Category() {
|
|
@@ -1229,6 +1222,13 @@
|
|
|
1229
1222
|
return Category;
|
|
1230
1223
|
}(BaseModel));
|
|
1231
1224
|
|
|
1225
|
+
exports.Shops = void 0;
|
|
1226
|
+
(function (Shops) {
|
|
1227
|
+
Shops["MENSMARKET"] = "mensmarket";
|
|
1228
|
+
Shops["GLAMSHOP"] = "Glamshop";
|
|
1229
|
+
Shops["GLAMPOINTS"] = "Glampoints";
|
|
1230
|
+
})(exports.Shops || (exports.Shops = {}));
|
|
1231
|
+
|
|
1232
1232
|
var Product = /** @class */ (function (_super) {
|
|
1233
1233
|
__extends(Product, _super);
|
|
1234
1234
|
function Product() {
|
|
@@ -1250,6 +1250,33 @@
|
|
|
1250
1250
|
});
|
|
1251
1251
|
return Product;
|
|
1252
1252
|
}(BaseModel));
|
|
1253
|
+
__decorate([
|
|
1254
|
+
classTransformer.Type(function () { return KitProduct; }),
|
|
1255
|
+
__metadata("design:type", Array)
|
|
1256
|
+
], Product.prototype, "kitProducts", void 0);
|
|
1257
|
+
|
|
1258
|
+
var KitProduct = /** @class */ (function (_super) {
|
|
1259
|
+
__extends(KitProduct, _super);
|
|
1260
|
+
function KitProduct() {
|
|
1261
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1262
|
+
}
|
|
1263
|
+
Object.defineProperty(KitProduct, "identifiersFields", {
|
|
1264
|
+
get: function () {
|
|
1265
|
+
return ['productId', 'kitProducId'];
|
|
1266
|
+
},
|
|
1267
|
+
enumerable: false,
|
|
1268
|
+
configurable: true
|
|
1269
|
+
});
|
|
1270
|
+
return KitProduct;
|
|
1271
|
+
}(BaseModel));
|
|
1272
|
+
__decorate([
|
|
1273
|
+
classTransformer.Type(function () { return Product; }),
|
|
1274
|
+
__metadata("design:type", Product)
|
|
1275
|
+
], KitProduct.prototype, "kit", void 0);
|
|
1276
|
+
__decorate([
|
|
1277
|
+
classTransformer.Type(function () { return Product; }),
|
|
1278
|
+
__metadata("design:type", Product)
|
|
1279
|
+
], KitProduct.prototype, "product", void 0);
|
|
1253
1280
|
|
|
1254
1281
|
var Variant = /** @class */ (function (_super) {
|
|
1255
1282
|
__extends(Variant, _super);
|
|
@@ -2777,8 +2804,7 @@
|
|
|
2777
2804
|
return { columnName: attributeName.toString(), attributeName: attributeName, fields: fieldOption };
|
|
2778
2805
|
return Object.assign({ attributeName: attributeName, columnName: attributeName.toString() }, fieldOption);
|
|
2779
2806
|
};
|
|
2780
|
-
AttributeOptionHelper.
|
|
2781
|
-
AttributeOptionHelper.CheckIsColumnOption = function (fieldValue) { return AttributeOptionHelper.CheckIsColumnModelOption(fieldValue) || !!fieldValue.columnName; };
|
|
2807
|
+
AttributeOptionHelper.CheckIsColumnOption = function (fieldValue) { return !!fieldValue.columnName; };
|
|
2782
2808
|
AttributeOptionHelper.FindColumnOptionFromList = function (columnName, fields) {
|
|
2783
2809
|
if (fields.includes(columnName))
|
|
2784
2810
|
return { columnName: columnName, attributeName: columnName };
|
|
@@ -2802,8 +2828,7 @@
|
|
|
2802
2828
|
}());
|
|
2803
2829
|
GraphQLFieldHelper.CheckIsGraphQLParams = function (params) { return !lodash.isString(params) && Array.isArray(params) && params.length >= 0 && !!params[0].operation; };
|
|
2804
2830
|
GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields = function (fields) {
|
|
2805
|
-
return fields
|
|
2806
|
-
.map(function (field) {
|
|
2831
|
+
return fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
|
|
2807
2832
|
var _b, _c;
|
|
2808
2833
|
if (lodash.isString(field))
|
|
2809
2834
|
return field.toString();
|
|
@@ -2811,15 +2836,14 @@
|
|
|
2811
2836
|
var fieldValue = field[fieldName];
|
|
2812
2837
|
if (Array.isArray(fieldValue))
|
|
2813
2838
|
return _b = {}, _b[fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue), _b;
|
|
2814
|
-
if (AttributeOptionHelper.
|
|
2839
|
+
if (!AttributeOptionHelper.CheckIsColumnOption(fieldValue))
|
|
2840
|
+
return;
|
|
2841
|
+
if (fieldValue.fields)
|
|
2815
2842
|
return _c = {},
|
|
2816
2843
|
_c[fieldValue.columnName || fieldName] = GraphQLFieldHelper.ConvertModelFieldsToGraphQLFields(fieldValue.fields),
|
|
2817
2844
|
_c;
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
return;
|
|
2821
|
-
})
|
|
2822
|
-
.filter(function (field) { return !!field; });
|
|
2845
|
+
return fieldValue.columnName;
|
|
2846
|
+
}).filter(function (field) { return !!field; });
|
|
2823
2847
|
};
|
|
2824
2848
|
GraphQLFieldHelper.ConvertFieldValueFrom = function (data, fields) { return Object.keys(data).reduce(function (result, columnName) {
|
|
2825
2849
|
var _b, _c, _d, _e;
|
|
@@ -2863,7 +2887,7 @@
|
|
|
2863
2887
|
return Object.assign(Object.assign({}, result), (converted !== undefined
|
|
2864
2888
|
? (_b = {},
|
|
2865
2889
|
_b[columnName] = {
|
|
2866
|
-
data:
|
|
2890
|
+
data: instance[attributeName] instanceof BaseModel
|
|
2867
2891
|
? GraphQLFieldHelper.ConvertFieldValueTo(data[attributeName], attributeFields)
|
|
2868
2892
|
: converted,
|
|
2869
2893
|
},
|
|
@@ -3107,6 +3131,8 @@
|
|
|
3107
3131
|
|
|
3108
3132
|
var withUpdateHasuraGraphQL = function (MixinBase) {
|
|
3109
3133
|
var getValueByAction = function (options) {
|
|
3134
|
+
if (options instanceof BaseModel)
|
|
3135
|
+
return options.toPlain();
|
|
3110
3136
|
if (lodash.isNil(options.action))
|
|
3111
3137
|
return options;
|
|
3112
3138
|
if (options.action === exports.UpdateOptionActions.REMOVE_FIELD)
|
|
@@ -3132,8 +3158,8 @@
|
|
|
3132
3158
|
return __awaiter(this, void 0, void 0, function () {
|
|
3133
3159
|
var plainData;
|
|
3134
3160
|
var _this = this;
|
|
3135
|
-
return __generator(this, function (
|
|
3136
|
-
switch (
|
|
3161
|
+
return __generator(this, function (_b) {
|
|
3162
|
+
switch (_b.label) {
|
|
3137
3163
|
case 0:
|
|
3138
3164
|
plainData = this.paramsToPlain(data);
|
|
3139
3165
|
return [4 /*yield*/, this.mutation(this.updateGraphQLOperation, this.model.identifiersFields.map(function (field) { return AttributeOptionHelper.FindByAttribute(field, _this.fields).columnName; }), {
|
|
@@ -3145,7 +3171,7 @@
|
|
|
3145
3171
|
pk_columns: { type: this.updateGraphQLPKType, value: this.getUpdateModelKeys(plainData), required: true },
|
|
3146
3172
|
})];
|
|
3147
3173
|
case 1:
|
|
3148
|
-
|
|
3174
|
+
_b.sent();
|
|
3149
3175
|
return [2 /*return*/, this.model.toInstance(plainData)];
|
|
3150
3176
|
}
|
|
3151
3177
|
});
|
|
@@ -3156,20 +3182,21 @@
|
|
|
3156
3182
|
if (model.isModel(params))
|
|
3157
3183
|
return params.toPlain();
|
|
3158
3184
|
return Object.keys(params).reduce(function (data, currentKey) {
|
|
3159
|
-
var
|
|
3160
|
-
return (Object.assign(Object.assign({}, data), (params[currentKey] && (
|
|
3185
|
+
var _b;
|
|
3186
|
+
return (Object.assign(Object.assign({}, data), (params[currentKey] && (_b = {}, _b[currentKey] = getValueByAction(params[currentKey]), _b))));
|
|
3161
3187
|
}, {});
|
|
3162
3188
|
};
|
|
3163
3189
|
UpdateHasuraGraphQLMixin.prototype.getUpdateModelKeys = function (data) {
|
|
3164
3190
|
var _this = this;
|
|
3165
3191
|
var instance = this.model.toInstance(data);
|
|
3166
3192
|
return this.model.identifiersFields.reduce(function (ids, identifier) {
|
|
3193
|
+
var _b;
|
|
3167
3194
|
var _a;
|
|
3168
3195
|
if (lodash.isNil(instance[identifier]))
|
|
3169
3196
|
return ids;
|
|
3170
3197
|
var columnOption = AttributeOptionHelper.FindByAttribute(identifier, _this.fields);
|
|
3171
|
-
var value = columnOption.to(data[identifier.toString()], instance);
|
|
3172
|
-
return Object.assign(Object.assign({}, ids), (
|
|
3198
|
+
var value = ((_a = columnOption === null || columnOption === void 0 ? void 0 : columnOption.to) === null || _a === void 0 ? void 0 : _a.call(columnOption, data[identifier.toString()], instance)) || data[columnOption.attributeName];
|
|
3199
|
+
return Object.assign(Object.assign({}, ids), (_b = {}, _b[columnOption.columnName] = value, _b));
|
|
3173
3200
|
}, {});
|
|
3174
3201
|
};
|
|
3175
3202
|
return UpdateHasuraGraphQLMixin;
|
|
@@ -3278,7 +3305,7 @@
|
|
|
3278
3305
|
lodash.isNil(fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.to))
|
|
3279
3306
|
return Object.keys(options).reduce(function (variables, key) {
|
|
3280
3307
|
var _a;
|
|
3281
|
-
var fieldOptions = AttributeOptionHelper.FindByAttribute(key, fields);
|
|
3308
|
+
var fieldOptions = AttributeOptionHelper.FindByAttribute(key, (fieldSentenceOptions === null || fieldSentenceOptions === void 0 ? void 0 : fieldSentenceOptions.fields) || fields);
|
|
3282
3309
|
var columnName = fieldOptions.columnName;
|
|
3283
3310
|
var columnFields = fieldOptions.fields;
|
|
3284
3311
|
return Object.assign(Object.assign({}, variables), (_a = {}, _a[columnName] = _this.buildWhereSentence(key, options[key], columnFields || []), _a));
|
|
@@ -3364,6 +3391,53 @@
|
|
|
3364
3391
|
}(withUpdateHasuraGraphQL(withGetHasuraGraphQL(withFindHasuraGraphQL(withDeleteHasuraGraphQL(withCreateHasuraGraphQL(MixinBase)))))));
|
|
3365
3392
|
};
|
|
3366
3393
|
|
|
3394
|
+
var CategoryHasuraGraphQL = /** @class */ (function (_super) {
|
|
3395
|
+
__extends(CategoryHasuraGraphQL, _super);
|
|
3396
|
+
function CategoryHasuraGraphQL() {
|
|
3397
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3398
|
+
}
|
|
3399
|
+
return CategoryHasuraGraphQL;
|
|
3400
|
+
}(Category));
|
|
3401
|
+
|
|
3402
|
+
var ProductHasuraGraphQL = /** @class */ (function (_super) {
|
|
3403
|
+
__extends(ProductHasuraGraphQL, _super);
|
|
3404
|
+
function ProductHasuraGraphQL() {
|
|
3405
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3406
|
+
}
|
|
3407
|
+
return ProductHasuraGraphQL;
|
|
3408
|
+
}(Product));
|
|
3409
|
+
__decorate([
|
|
3410
|
+
classTransformer.Type(function () { return KitProductHasuraGraphQL; }),
|
|
3411
|
+
__metadata("design:type", Array)
|
|
3412
|
+
], ProductHasuraGraphQL.prototype, "kitProducts", void 0);
|
|
3413
|
+
|
|
3414
|
+
var KitProductHasuraGraphQL = /** @class */ (function (_super) {
|
|
3415
|
+
__extends(KitProductHasuraGraphQL, _super);
|
|
3416
|
+
function KitProductHasuraGraphQL() {
|
|
3417
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
3418
|
+
}
|
|
3419
|
+
return KitProductHasuraGraphQL;
|
|
3420
|
+
}(KitProduct));
|
|
3421
|
+
__decorate([
|
|
3422
|
+
classTransformer.Type(function () { return ProductHasuraGraphQL; }),
|
|
3423
|
+
__metadata("design:type", ProductHasuraGraphQL)
|
|
3424
|
+
], KitProductHasuraGraphQL.prototype, "kit", void 0);
|
|
3425
|
+
__decorate([
|
|
3426
|
+
classTransformer.Type(function () { return ProductHasuraGraphQL; }),
|
|
3427
|
+
__metadata("design:type", ProductHasuraGraphQL)
|
|
3428
|
+
], KitProductHasuraGraphQL.prototype, "product", void 0);
|
|
3429
|
+
|
|
3430
|
+
var VariantHasuraGraphQL = /** @class */ (function (_super) {
|
|
3431
|
+
__extends(VariantHasuraGraphQL, _super);
|
|
3432
|
+
function VariantHasuraGraphQL() {
|
|
3433
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3434
|
+
_this.name = '';
|
|
3435
|
+
_this.hasVariants = false;
|
|
3436
|
+
return _this;
|
|
3437
|
+
}
|
|
3438
|
+
return VariantHasuraGraphQL;
|
|
3439
|
+
}(Variant));
|
|
3440
|
+
|
|
3367
3441
|
var CategoryHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
3368
3442
|
__extends(CategoryHasuraGraphQLRepository, _super_1);
|
|
3369
3443
|
function CategoryHasuraGraphQLRepository(endpoint, authOptions, productRepository) {
|
|
@@ -3521,106 +3595,94 @@
|
|
|
3521
3595
|
return CategoryHasuraGraphQLRepository;
|
|
3522
3596
|
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
3523
3597
|
|
|
3524
|
-
var CategoryHasuraGraphQL = /** @class */ (function (_super) {
|
|
3525
|
-
__extends(CategoryHasuraGraphQL, _super);
|
|
3526
|
-
function CategoryHasuraGraphQL() {
|
|
3527
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3528
|
-
}
|
|
3529
|
-
return CategoryHasuraGraphQL;
|
|
3530
|
-
}(Category));
|
|
3531
|
-
|
|
3532
|
-
var ProductHasuraGraphQL = /** @class */ (function (_super) {
|
|
3533
|
-
__extends(ProductHasuraGraphQL, _super);
|
|
3534
|
-
function ProductHasuraGraphQL() {
|
|
3535
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
3536
|
-
}
|
|
3537
|
-
return ProductHasuraGraphQL;
|
|
3538
|
-
}(Product));
|
|
3539
|
-
|
|
3540
|
-
var VariantHasuraGraphQL = /** @class */ (function (_super) {
|
|
3541
|
-
__extends(VariantHasuraGraphQL, _super);
|
|
3542
|
-
function VariantHasuraGraphQL() {
|
|
3543
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
3544
|
-
_this.name = '';
|
|
3545
|
-
_this.hasVariants = false;
|
|
3546
|
-
return _this;
|
|
3547
|
-
}
|
|
3548
|
-
return VariantHasuraGraphQL;
|
|
3549
|
-
}(Variant));
|
|
3550
|
-
|
|
3551
3598
|
var ProductHasuraGraphQLRepository = /** @class */ (function (_super_1) {
|
|
3552
3599
|
__extends(ProductHasuraGraphQLRepository, _super_1);
|
|
3553
3600
|
function ProductHasuraGraphQLRepository(endpoint, authOptions) {
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
var _c;
|
|
3572
|
-
return (Object.assign(Object.assign({}, shops), (_c = {}, _c[shop] = { description: description }, _c)));
|
|
3573
|
-
}, {}); },
|
|
3574
|
-
to: function (value) { return Object.values(value).shift().description; },
|
|
3575
|
-
},
|
|
3601
|
+
var _this = this;
|
|
3602
|
+
var commonFields = [
|
|
3603
|
+
{ id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
|
|
3604
|
+
{ firestoreId: { columnName: 'firestore_id' } },
|
|
3605
|
+
{ CEST: { columnName: 'cest' } },
|
|
3606
|
+
{ EAN: { columnName: 'ean' } },
|
|
3607
|
+
{ NCM: { columnName: 'ncm' } },
|
|
3608
|
+
'brand',
|
|
3609
|
+
{ costPrice: { columnName: 'cost_price' } },
|
|
3610
|
+
{
|
|
3611
|
+
description: {
|
|
3612
|
+
columnName: 'description',
|
|
3613
|
+
from: function (description) { return Object.values(exports.Shops).reduce(function (shops, shop) {
|
|
3614
|
+
var _c;
|
|
3615
|
+
return (Object.assign(Object.assign({}, shops), (_c = {}, _c[shop] = { description: description }, _c)));
|
|
3616
|
+
}, {}); },
|
|
3617
|
+
to: function (value) { return Object.values(value).shift().description; },
|
|
3576
3618
|
},
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
},
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
},
|
|
3599
|
-
bindPersistData: function (value) {
|
|
3600
|
-
var priceData = Object.values(value).shift();
|
|
3601
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) && { price: priceData.price })), (priceData.fullPrice && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage && {
|
|
3602
|
-
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
3603
|
-
})), (priceData.subscriberPrice && { subscriber_price: priceData.subscriberPrice }));
|
|
3604
|
-
},
|
|
3619
|
+
},
|
|
3620
|
+
{ hasVariants: { columnName: 'has_variants' } },
|
|
3621
|
+
{ images: { columnName: 'images', to: function (value) { return "{\"" + value.join("\",\"") + "\"}"; } } },
|
|
3622
|
+
{ miniatures: { columnName: 'miniatures', to: function (value) { return "{\"" + value.join("\",\"") + "\"}"; } } },
|
|
3623
|
+
'name',
|
|
3624
|
+
{
|
|
3625
|
+
price: {
|
|
3626
|
+
columnName: 'price',
|
|
3627
|
+
from: function (price, data) { return Object.values(exports.Shops).reduce(function (prices, shop) {
|
|
3628
|
+
var _c;
|
|
3629
|
+
return (Object.assign(Object.assign({}, prices), (_c = {}, _c[shop] = {
|
|
3630
|
+
price: price,
|
|
3631
|
+
fullPrice: data.full_price,
|
|
3632
|
+
subscriberDiscountPercentage: data.subscriber_discount_percentage,
|
|
3633
|
+
subscriberPrice: data.subscriber_price,
|
|
3634
|
+
}, _c)));
|
|
3635
|
+
}, {}); },
|
|
3636
|
+
bindFindFilter: function (sentence) {
|
|
3637
|
+
var filters = Object.values(sentence).shift();
|
|
3638
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((filters === null || filters === void 0 ? void 0 : filters.price) && { price: filters.price })), (filters.fullPrice && { full_price: filters.fullPrice })), (filters.subscriberDiscountPercentage && {
|
|
3639
|
+
subscriber_discount_percentage: filters.subscriberDiscountPercentage,
|
|
3640
|
+
})), (filters.subscriberPrice && { subscriber_price: filters.subscriberPrice }));
|
|
3605
3641
|
},
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
{ publishedGlam: { columnName: 'published_glam' } },
|
|
3612
|
-
'sku',
|
|
3613
|
-
{
|
|
3614
|
-
stock: {
|
|
3615
|
-
columnName: 'stock',
|
|
3616
|
-
from: function (quantity) { return ({ quantity: quantity }); },
|
|
3617
|
-
to: function (value) { return (lodash.isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity); },
|
|
3642
|
+
bindPersistData: function (value) {
|
|
3643
|
+
var priceData = Object.values(value).shift();
|
|
3644
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, ((priceData === null || priceData === void 0 ? void 0 : priceData.price) && { price: priceData.price })), (priceData.fullPrice && { full_price: priceData.fullPrice })), (priceData.subscriberDiscountPercentage && {
|
|
3645
|
+
subscriber_discount_percentage: priceData.subscriberDiscountPercentage,
|
|
3646
|
+
})), (priceData.subscriberPrice && { subscriber_price: priceData.subscriberPrice }));
|
|
3618
3647
|
},
|
|
3619
3648
|
},
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3649
|
+
},
|
|
3650
|
+
{ fullPrice: { columnName: 'full_price' } },
|
|
3651
|
+
{ subscriberDiscountPercentage: { columnName: 'subscriber_discount_percentage' } },
|
|
3652
|
+
{ subscriberPrice: { columnName: 'subscriber_price' } },
|
|
3653
|
+
'published',
|
|
3654
|
+
{ publishedGlam: { columnName: 'published_glam' } },
|
|
3655
|
+
'sku',
|
|
3656
|
+
{
|
|
3657
|
+
stock: {
|
|
3658
|
+
columnName: 'stock',
|
|
3659
|
+
from: function (quantity) { return ({ quantity: quantity }); },
|
|
3660
|
+
to: function (value) { return (lodash.isNil(value === null || value === void 0 ? void 0 : value.quantity) ? value : value === null || value === void 0 ? void 0 : value.quantity); },
|
|
3661
|
+
},
|
|
3662
|
+
},
|
|
3663
|
+
'slug',
|
|
3664
|
+
'type',
|
|
3665
|
+
'video',
|
|
3666
|
+
'weight',
|
|
3667
|
+
{
|
|
3668
|
+
shopAvailability: {
|
|
3669
|
+
columnName: 'shop_availabilities',
|
|
3670
|
+
fields: ['shop'],
|
|
3671
|
+
from: function (shop) { return (Array.isArray(shop) ? shop.map(function (row) { return row.shop; }) : []); },
|
|
3672
|
+
to: function (shops) { return shops.map(function (shop) { return ({ shop: shop }); }); },
|
|
3673
|
+
},
|
|
3674
|
+
},
|
|
3675
|
+
{ tags: { columnName: 'tags', type: HasuraGraphQLColumnType.Jsonb } },
|
|
3676
|
+
{ isKit: { columnName: 'is_kit' } },
|
|
3677
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
3678
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
3679
|
+
];
|
|
3680
|
+
_this = _super_1.call(this, {
|
|
3681
|
+
tableName: 'product',
|
|
3682
|
+
model: ProductHasuraGraphQL,
|
|
3683
|
+
endpoint: endpoint,
|
|
3684
|
+
authOptions: authOptions,
|
|
3685
|
+
fields: __spreadArray(__spreadArray([], __read(commonFields)), [
|
|
3624
3686
|
{
|
|
3625
3687
|
categories: {
|
|
3626
3688
|
columnName: 'categories',
|
|
@@ -3633,18 +3695,20 @@
|
|
|
3633
3695
|
},
|
|
3634
3696
|
},
|
|
3635
3697
|
{
|
|
3636
|
-
|
|
3637
|
-
columnName: '
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3698
|
+
kitProducts: {
|
|
3699
|
+
columnName: 'kit_products',
|
|
3700
|
+
foreignKeyColumn: { productId: 'id' },
|
|
3701
|
+
fields: [
|
|
3702
|
+
{ productId: { columnName: 'product_id' } },
|
|
3703
|
+
{ kitProductId: { columnName: 'kit_product_id' } },
|
|
3704
|
+
'quantity',
|
|
3705
|
+
{ product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: commonFields } },
|
|
3706
|
+
],
|
|
3641
3707
|
},
|
|
3642
3708
|
},
|
|
3643
|
-
|
|
3644
|
-
{ createdAt: { columnName: 'created_at' } },
|
|
3645
|
-
{ updatedAt: { columnName: 'updated_at' } },
|
|
3646
|
-
],
|
|
3709
|
+
]),
|
|
3647
3710
|
}) || this;
|
|
3711
|
+
return _this;
|
|
3648
3712
|
}
|
|
3649
3713
|
ProductHasuraGraphQLRepository.prototype.get = function (identifiers) {
|
|
3650
3714
|
var _super = Object.create(null, {
|
|
@@ -3693,27 +3757,36 @@
|
|
|
3693
3757
|
update: { get: function () { return _super_1.prototype.update; } }
|
|
3694
3758
|
});
|
|
3695
3759
|
return __awaiter(this, void 0, void 0, function () {
|
|
3696
|
-
var categories, checkId, data, plainData, id, product, _c, _d;
|
|
3697
|
-
return __generator(this, function (
|
|
3698
|
-
switch (
|
|
3760
|
+
var categories, kitProducts, checkId, data, plainData, id, product, _c, _d, _e, _f;
|
|
3761
|
+
return __generator(this, function (_g) {
|
|
3762
|
+
switch (_g.label) {
|
|
3699
3763
|
case 0:
|
|
3700
|
-
categories = params.categories, checkId = params.id, data = __rest(params, ["categories", "id"]);
|
|
3764
|
+
categories = params.categories, kitProducts = params.kitProducts, checkId = params.id, data = __rest(params, ["categories", "kitProducts", "id"]);
|
|
3701
3765
|
plainData = this.paramsToPlain({ id: checkId });
|
|
3702
3766
|
return [4 /*yield*/, this.getId(plainData.id)];
|
|
3703
3767
|
case 1:
|
|
3704
|
-
id =
|
|
3768
|
+
id = _g.sent();
|
|
3705
3769
|
return [4 /*yield*/, _super.update.call(this, Object.assign({ id: id }, data))];
|
|
3706
3770
|
case 2:
|
|
3707
|
-
product =
|
|
3771
|
+
product = _g.sent();
|
|
3708
3772
|
_c = product;
|
|
3709
3773
|
_d = categories;
|
|
3710
3774
|
if (!_d) return [3 /*break*/, 4];
|
|
3711
3775
|
return [4 /*yield*/, this.updateCategories(+id, { categories: categories })];
|
|
3712
3776
|
case 3:
|
|
3713
|
-
_d = (
|
|
3714
|
-
|
|
3777
|
+
_d = (_g.sent());
|
|
3778
|
+
_g.label = 4;
|
|
3715
3779
|
case 4:
|
|
3716
3780
|
_c.categories = _d;
|
|
3781
|
+
_e = product;
|
|
3782
|
+
_f = kitProducts;
|
|
3783
|
+
if (!_f) return [3 /*break*/, 6];
|
|
3784
|
+
return [4 /*yield*/, this.updateKitProducts(+id, { kitProducts: kitProducts })];
|
|
3785
|
+
case 5:
|
|
3786
|
+
_f = (_g.sent());
|
|
3787
|
+
_g.label = 6;
|
|
3788
|
+
case 6:
|
|
3789
|
+
_e.kitProducts = _f;
|
|
3717
3790
|
return [2 /*return*/, product];
|
|
3718
3791
|
}
|
|
3719
3792
|
});
|
|
@@ -3750,6 +3823,41 @@
|
|
|
3750
3823
|
});
|
|
3751
3824
|
});
|
|
3752
3825
|
};
|
|
3826
|
+
ProductHasuraGraphQLRepository.prototype.updateKitProducts = function (productId, _c) {
|
|
3827
|
+
var kitProducts = _c.kitProducts;
|
|
3828
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3829
|
+
var plainData;
|
|
3830
|
+
return __generator(this, function (_c) {
|
|
3831
|
+
switch (_c.label) {
|
|
3832
|
+
case 0:
|
|
3833
|
+
plainData = this.paramsToPlain({ kitProducts: kitProducts });
|
|
3834
|
+
return [4 /*yield*/, this.mutation('delete_product_kit', ['affected_rows'], {
|
|
3835
|
+
where: {
|
|
3836
|
+
type: 'product_kit_bool_exp',
|
|
3837
|
+
required: true,
|
|
3838
|
+
value: { product_id: { _eq: productId } },
|
|
3839
|
+
},
|
|
3840
|
+
})];
|
|
3841
|
+
case 1:
|
|
3842
|
+
_c.sent();
|
|
3843
|
+
return [4 /*yield*/, this.mutation('insert_product_kit', ['affected_rows'], {
|
|
3844
|
+
objects: {
|
|
3845
|
+
type: '[product_kit_insert_input!]',
|
|
3846
|
+
required: true,
|
|
3847
|
+
value: plainData.kitProducts.map(function (kitProduct) { return ({
|
|
3848
|
+
kit_product_id: kitProduct.kitProductId,
|
|
3849
|
+
product_id: productId,
|
|
3850
|
+
quantity: kitProduct.quantity,
|
|
3851
|
+
}); }),
|
|
3852
|
+
},
|
|
3853
|
+
})];
|
|
3854
|
+
case 2:
|
|
3855
|
+
_c.sent();
|
|
3856
|
+
return [2 /*return*/, plainData.kitProducts];
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
});
|
|
3860
|
+
};
|
|
3753
3861
|
ProductHasuraGraphQLRepository.prototype.getId = function (id) {
|
|
3754
3862
|
var _a, _b;
|
|
3755
3863
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -3899,6 +4007,59 @@
|
|
|
3899
4007
|
return VariantHasuraGraphQLRepository;
|
|
3900
4008
|
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
3901
4009
|
|
|
4010
|
+
var MilleniumProduct = /** @class */ (function (_super) {
|
|
4011
|
+
__extends(MilleniumProduct, _super);
|
|
4012
|
+
function MilleniumProduct() {
|
|
4013
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4014
|
+
}
|
|
4015
|
+
Object.defineProperty(MilleniumProduct, "identifiersFields", {
|
|
4016
|
+
get: function () {
|
|
4017
|
+
return ['id'];
|
|
4018
|
+
},
|
|
4019
|
+
enumerable: false,
|
|
4020
|
+
configurable: true
|
|
4021
|
+
});
|
|
4022
|
+
return MilleniumProduct;
|
|
4023
|
+
}(BaseModel));
|
|
4024
|
+
__decorate([
|
|
4025
|
+
classTransformer.Type(function () { return Product; }),
|
|
4026
|
+
__metadata("design:type", Product)
|
|
4027
|
+
], MilleniumProduct.prototype, "product", void 0);
|
|
4028
|
+
var MilleniumProductHasuraGraphQL = /** @class */ (function (_super) {
|
|
4029
|
+
__extends(MilleniumProductHasuraGraphQL, _super);
|
|
4030
|
+
function MilleniumProductHasuraGraphQL() {
|
|
4031
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
4032
|
+
}
|
|
4033
|
+
return MilleniumProductHasuraGraphQL;
|
|
4034
|
+
}(MilleniumProduct));
|
|
4035
|
+
__decorate([
|
|
4036
|
+
classTransformer.Type(function () { return ProductHasuraGraphQL; }),
|
|
4037
|
+
__metadata("design:type", ProductHasuraGraphQL)
|
|
4038
|
+
], MilleniumProductHasuraGraphQL.prototype, "product", void 0);
|
|
4039
|
+
var MilleniumProductHasuraGraphQLRepository = /** @class */ (function (_super) {
|
|
4040
|
+
__extends(MilleniumProductHasuraGraphQLRepository, _super);
|
|
4041
|
+
function MilleniumProductHasuraGraphQLRepository(endpoint, authOptions, productRepository) {
|
|
4042
|
+
return _super.call(this, {
|
|
4043
|
+
endpoint: endpoint,
|
|
4044
|
+
authOptions: authOptions,
|
|
4045
|
+
model: MilleniumProduct,
|
|
4046
|
+
tableName: 'product_milleniun',
|
|
4047
|
+
fields: [
|
|
4048
|
+
'id',
|
|
4049
|
+
{ productId: { columnName: 'product_id' } },
|
|
4050
|
+
{ codProduct: { columnName: 'cod_product' } },
|
|
4051
|
+
{ internalId: { columnName: 'internal_id' } },
|
|
4052
|
+
{ createdAt: { columnName: 'created_at' } },
|
|
4053
|
+
{ updatedAt: { columnName: 'updated_at' } },
|
|
4054
|
+
{
|
|
4055
|
+
product: { columnName: 'product', foreignKeyColumn: { id: 'product_id' }, fields: productRepository.fields },
|
|
4056
|
+
},
|
|
4057
|
+
],
|
|
4058
|
+
}) || this;
|
|
4059
|
+
}
|
|
4060
|
+
return MilleniumProductHasuraGraphQLRepository;
|
|
4061
|
+
}(withCrudHasuraGraphQL(withHasuraGraphQL(Base))));
|
|
4062
|
+
|
|
3902
4063
|
/**
|
|
3903
4064
|
* Generated bundle index. Do not edit.
|
|
3904
4065
|
*/
|
|
@@ -4015,6 +4176,7 @@
|
|
|
4015
4176
|
exports.Buy2WinFirestoreRepository = Buy2WinFirestoreRepository;
|
|
4016
4177
|
exports.Category = Category;
|
|
4017
4178
|
exports.CategoryFirestoreRepository = CategoryFirestoreRepository;
|
|
4179
|
+
exports.CategoryHasuraGraphQL = CategoryHasuraGraphQL;
|
|
4018
4180
|
exports.CategoryHasuraGraphQLRepository = CategoryHasuraGraphQLRepository;
|
|
4019
4181
|
exports.Checkout = Checkout;
|
|
4020
4182
|
exports.CheckoutFirestoreRepository = CheckoutFirestoreRepository;
|
|
@@ -4028,10 +4190,15 @@
|
|
|
4028
4190
|
exports.Home = Home;
|
|
4029
4191
|
exports.HomeFirestoreRepository = HomeFirestoreRepository;
|
|
4030
4192
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
4193
|
+
exports.KitProduct = KitProduct;
|
|
4194
|
+
exports.KitProductHasuraGraphQL = KitProductHasuraGraphQL;
|
|
4031
4195
|
exports.Lead = Lead;
|
|
4032
4196
|
exports.LeadFirestoreRepository = LeadFirestoreRepository;
|
|
4033
4197
|
exports.LegacyOrderFirestoreRepository = LegacyOrderFirestoreRepository;
|
|
4034
4198
|
exports.LineItem = LineItem;
|
|
4199
|
+
exports.MilleniumProduct = MilleniumProduct;
|
|
4200
|
+
exports.MilleniumProductHasuraGraphQL = MilleniumProductHasuraGraphQL;
|
|
4201
|
+
exports.MilleniumProductHasuraGraphQLRepository = MilleniumProductHasuraGraphQLRepository;
|
|
4035
4202
|
exports.NotFoundError = NotFoundError;
|
|
4036
4203
|
exports.Order = Order;
|
|
4037
4204
|
exports.OrderFirestoreRepository = OrderFirestoreRepository;
|
|
@@ -4039,6 +4206,7 @@
|
|
|
4039
4206
|
exports.PaymentFirestoreRepository = PaymentFirestoreRepository;
|
|
4040
4207
|
exports.Product = Product;
|
|
4041
4208
|
exports.ProductFirestoreRepository = ProductFirestoreRepository;
|
|
4209
|
+
exports.ProductHasuraGraphQL = ProductHasuraGraphQL;
|
|
4042
4210
|
exports.ProductHasuraGraphQLRepository = ProductHasuraGraphQLRepository;
|
|
4043
4211
|
exports.ProductVariantFirestoreRepository = ProductVariantFirestoreRepository;
|
|
4044
4212
|
exports.ProductsIndex = ProductsIndex;
|
|
@@ -4069,6 +4237,7 @@
|
|
|
4069
4237
|
exports.UserPaymentMethodFirestoreRepository = UserPaymentMethodFirestoreRepository;
|
|
4070
4238
|
exports.UserSearchFirestoreRepository = UserSearchFirestoreRepository;
|
|
4071
4239
|
exports.Variant = Variant;
|
|
4240
|
+
exports.VariantHasuraGraphQL = VariantHasuraGraphQL;
|
|
4072
4241
|
exports.VariantHasuraGraphQLRepository = VariantHasuraGraphQLRepository;
|
|
4073
4242
|
exports.WeakPasswordError = WeakPasswordError;
|
|
4074
4243
|
exports.isUUID = isUUID;
|