@infrab4a/connect 3.0.0-beta.1 → 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 +287 -149
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/domain/generic/repository/enums/where.enum.d.ts +1 -0
- package/esm2015/domain/catalog/repositories/product.repository.js +1 -1
- package/esm2015/domain/generic/repository/enums/where.enum.js +2 -1
- package/esm2015/domain/shop-settings/models/home.js +1 -1
- package/esm2015/infra/elasticsearch/indexes/products-index.js +2 -2
- package/esm2015/infra/firebase/firestore/repositories/users/index.js +6 -7
- package/esm2015/infra/firebase/firestore/repositories/users/user-firestore.repository.js +4 -6
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +59 -3
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +56 -9
- package/esm2015/infra/hasura-graphql/types/hasura-graphql-fields.type.js +1 -1
- package/fesm2015/infrab4a-connect.js +161 -73
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/infra/firebase/firestore/repositories/users/index.d.ts +5 -6
- package/infra/firebase/firestore/repositories/users/user-firestore.repository.d.ts +1 -3
- package/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.d.ts +4 -1
- package/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.d.ts +2 -1
- package/infra/hasura-graphql/types/hasura-graphql-fields.type.d.ts +1 -1
- package/package.json +1 -1
- package/esm2015/infra/firebase/firestore/models/user-search.js +0 -7
- package/esm2015/infra/firebase/firestore/repositories/users/user-search-firestore.repository.js +0 -12
- package/infra/firebase/firestore/models/user-search.d.ts +0 -9
- package/infra/firebase/firestore/repositories/users/user-search-firestore.repository.d.ts +0 -9
|
@@ -36,6 +36,7 @@ class BaseModel {
|
|
|
36
36
|
var Where;
|
|
37
37
|
(function (Where) {
|
|
38
38
|
Where["EQUALS"] = "==";
|
|
39
|
+
Where["NOTEQUALS"] = "!=";
|
|
39
40
|
Where["GT"] = ">";
|
|
40
41
|
Where["GTE"] = ">=";
|
|
41
42
|
Where["IN"] = "in";
|
|
@@ -1153,7 +1154,7 @@ class ProductsIndex {
|
|
|
1153
1154
|
yield this.adapter.save(`products/_doc/${product.firestoreId}`, product.toPlain());
|
|
1154
1155
|
}
|
|
1155
1156
|
catch (error) {
|
|
1156
|
-
console.
|
|
1157
|
+
console.error(error.message);
|
|
1157
1158
|
yield this.adapter.save(`products/_doc/${product.id}`, product.toPlain());
|
|
1158
1159
|
}
|
|
1159
1160
|
});
|
|
@@ -1422,6 +1423,26 @@ const withCrudFirestore = (MixinBase) => {
|
|
|
1422
1423
|
};
|
|
1423
1424
|
};
|
|
1424
1425
|
|
|
1426
|
+
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1427
|
+
constructor(firestore) {
|
|
1428
|
+
super();
|
|
1429
|
+
this.firestore = firestore;
|
|
1430
|
+
this.collectionName = 'leads';
|
|
1431
|
+
this.model = Lead;
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1436
|
+
constructor(firestore, parentRepository) {
|
|
1437
|
+
super();
|
|
1438
|
+
this.firestore = firestore;
|
|
1439
|
+
this.parentRepository = parentRepository;
|
|
1440
|
+
this.collectionName = 'editions';
|
|
1441
|
+
this.parentIdField = 'subscriptionId';
|
|
1442
|
+
this.model = Edition;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1425
1446
|
class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1426
1447
|
constructor(firestore) {
|
|
1427
1448
|
super();
|
|
@@ -1431,26 +1452,43 @@ class SubscriptionFirestoreRepository extends withCrudFirestore(withHelpers(with
|
|
|
1431
1452
|
}
|
|
1432
1453
|
}
|
|
1433
1454
|
|
|
1434
|
-
class
|
|
1435
|
-
|
|
1436
|
-
|
|
1455
|
+
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1456
|
+
constructor(firestore, parentRepository) {
|
|
1457
|
+
super();
|
|
1458
|
+
this.firestore = firestore;
|
|
1459
|
+
this.parentRepository = parentRepository;
|
|
1460
|
+
this.collectionName = 'payments';
|
|
1461
|
+
this.parentIdField = 'subscriptionId';
|
|
1462
|
+
this.model = SubscriptionPayment;
|
|
1437
1463
|
}
|
|
1438
1464
|
}
|
|
1439
1465
|
|
|
1440
|
-
class
|
|
1441
|
-
constructor(firestore) {
|
|
1466
|
+
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1467
|
+
constructor(firestore, parentRepository) {
|
|
1468
|
+
super();
|
|
1469
|
+
this.firestore = firestore;
|
|
1470
|
+
this.parentRepository = parentRepository;
|
|
1471
|
+
this.collectionName = 'address';
|
|
1472
|
+
this.parentIdField = 'userId';
|
|
1473
|
+
this.model = UserAddress;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1478
|
+
constructor(firestore, parentRepository) {
|
|
1442
1479
|
super();
|
|
1443
1480
|
this.firestore = firestore;
|
|
1444
|
-
this.
|
|
1445
|
-
this.
|
|
1481
|
+
this.parentRepository = parentRepository;
|
|
1482
|
+
this.collectionName = 'CX';
|
|
1483
|
+
this.parentIdField = 'userId';
|
|
1484
|
+
this.model = BeautyProfile;
|
|
1446
1485
|
}
|
|
1447
1486
|
}
|
|
1448
1487
|
|
|
1449
1488
|
class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1450
|
-
constructor(firestore
|
|
1489
|
+
constructor(firestore) {
|
|
1451
1490
|
super();
|
|
1452
1491
|
this.firestore = firestore;
|
|
1453
|
-
this.userSearchFirestoreRepository = userSearchFirestoreRepository;
|
|
1454
1492
|
this.collectionName = 'users';
|
|
1455
1493
|
this.model = User;
|
|
1456
1494
|
}
|
|
@@ -1467,7 +1505,7 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
1467
1505
|
}
|
|
1468
1506
|
checkIfExistsByField(field, value) {
|
|
1469
1507
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1470
|
-
const result = yield this.
|
|
1508
|
+
const result = yield this.find({ filters: { [field]: value } });
|
|
1471
1509
|
return result.count > 0;
|
|
1472
1510
|
});
|
|
1473
1511
|
}
|
|
@@ -1511,39 +1549,6 @@ class UserFirestoreRepository extends withCrudFirestore(withHelpers(withFirestor
|
|
|
1511
1549
|
}
|
|
1512
1550
|
}
|
|
1513
1551
|
|
|
1514
|
-
class SubscriptionEditionFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1515
|
-
constructor(firestore, parentRepository) {
|
|
1516
|
-
super();
|
|
1517
|
-
this.firestore = firestore;
|
|
1518
|
-
this.parentRepository = parentRepository;
|
|
1519
|
-
this.collectionName = 'editions';
|
|
1520
|
-
this.parentIdField = 'subscriptionId';
|
|
1521
|
-
this.model = Edition;
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
class UserBeautyProfileFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1526
|
-
constructor(firestore, parentRepository) {
|
|
1527
|
-
super();
|
|
1528
|
-
this.firestore = firestore;
|
|
1529
|
-
this.parentRepository = parentRepository;
|
|
1530
|
-
this.collectionName = 'CX';
|
|
1531
|
-
this.parentIdField = 'userId';
|
|
1532
|
-
this.model = BeautyProfile;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
class UserAddressFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1537
|
-
constructor(firestore, parentRepository) {
|
|
1538
|
-
super();
|
|
1539
|
-
this.firestore = firestore;
|
|
1540
|
-
this.parentRepository = parentRepository;
|
|
1541
|
-
this.collectionName = 'address';
|
|
1542
|
-
this.parentIdField = 'userId';
|
|
1543
|
-
this.model = UserAddress;
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
1552
|
class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), User) {
|
|
1548
1553
|
constructor(firestore, parentRepository) {
|
|
1549
1554
|
super();
|
|
@@ -1555,26 +1560,6 @@ class UserPaymentMethodFirestoreRepository extends withSubCollection(withCrudFir
|
|
|
1555
1560
|
}
|
|
1556
1561
|
}
|
|
1557
1562
|
|
|
1558
|
-
class SubscriptionPaymentFirestoreRepository extends withSubCollection(withCrudFirestore(withHelpers(withFirestore(Base))), Subscription) {
|
|
1559
|
-
constructor(firestore, parentRepository) {
|
|
1560
|
-
super();
|
|
1561
|
-
this.firestore = firestore;
|
|
1562
|
-
this.parentRepository = parentRepository;
|
|
1563
|
-
this.collectionName = 'payments';
|
|
1564
|
-
this.parentIdField = 'subscriptionId';
|
|
1565
|
-
this.model = SubscriptionPayment;
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
class LeadFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1570
|
-
constructor(firestore) {
|
|
1571
|
-
super();
|
|
1572
|
-
this.firestore = firestore;
|
|
1573
|
-
this.collectionName = 'leads';
|
|
1574
|
-
this.model = Lead;
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
1563
|
class CategoryFirestoreRepository extends withCrudFirestore(withHelpers(withFirestore(Base))) {
|
|
1579
1564
|
constructor(firestore) {
|
|
1580
1565
|
super();
|
|
@@ -2507,6 +2492,19 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2507
2492
|
: _super.get.call(this, identifiers);
|
|
2508
2493
|
});
|
|
2509
2494
|
}
|
|
2495
|
+
update(params) {
|
|
2496
|
+
const _super = Object.create(null, {
|
|
2497
|
+
update: { get: () => super.update }
|
|
2498
|
+
});
|
|
2499
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2500
|
+
const { products, id: checkId } = params, data = __rest(params, ["products", "id"]);
|
|
2501
|
+
const plainData = this.paramsToPlain({ id: checkId });
|
|
2502
|
+
const id = yield this.getId(plainData.id);
|
|
2503
|
+
const category = yield _super.update.call(this, Object.assign({ id }, data));
|
|
2504
|
+
category.products = products && (yield this.updateProducts(+id, { products }));
|
|
2505
|
+
return category;
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2510
2508
|
getCategoryBySlug(slug, shop) {
|
|
2511
2509
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2512
2510
|
if (!slug)
|
|
@@ -2567,6 +2565,49 @@ class CategoryHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGr
|
|
|
2567
2565
|
return products;
|
|
2568
2566
|
});
|
|
2569
2567
|
}
|
|
2568
|
+
getId(id) {
|
|
2569
|
+
var _a, _b;
|
|
2570
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2571
|
+
if (!Number.isNaN(+id))
|
|
2572
|
+
return id;
|
|
2573
|
+
const { data } = yield this.find({ filters: { firestoreId: id } });
|
|
2574
|
+
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
2575
|
+
return (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.id;
|
|
2576
|
+
throw new NotFoundError(`Category with id ${id} not found`);
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
updateProducts(categoryId, { products }) {
|
|
2580
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2581
|
+
if ('action' in products && products.action === 'remove') {
|
|
2582
|
+
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
2583
|
+
where: {
|
|
2584
|
+
type: 'category_product_bool_exp',
|
|
2585
|
+
required: true,
|
|
2586
|
+
value: { category_id: { _eq: categoryId } },
|
|
2587
|
+
},
|
|
2588
|
+
});
|
|
2589
|
+
return [];
|
|
2590
|
+
}
|
|
2591
|
+
const plainData = this.paramsToPlain({ products });
|
|
2592
|
+
if (!plainData.products || plainData.products.length <= 0)
|
|
2593
|
+
return [];
|
|
2594
|
+
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
2595
|
+
where: {
|
|
2596
|
+
type: 'category_product_bool_exp',
|
|
2597
|
+
required: true,
|
|
2598
|
+
value: { category_id: { _eq: categoryId } },
|
|
2599
|
+
},
|
|
2600
|
+
});
|
|
2601
|
+
yield this.mutation('insert_category_product', ['affected_rows'], {
|
|
2602
|
+
objects: {
|
|
2603
|
+
type: '[category_product_insert_input!]',
|
|
2604
|
+
required: true,
|
|
2605
|
+
value: plainData.products.map((productId) => ({ category_id: categoryId, product_id: productId })),
|
|
2606
|
+
},
|
|
2607
|
+
});
|
|
2608
|
+
return plainData.products;
|
|
2609
|
+
});
|
|
2610
|
+
}
|
|
2570
2611
|
}
|
|
2571
2612
|
|
|
2572
2613
|
class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGraphQL(Base)) {
|
|
@@ -2676,6 +2717,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2676
2717
|
],
|
|
2677
2718
|
},
|
|
2678
2719
|
},
|
|
2720
|
+
{
|
|
2721
|
+
reviews: {
|
|
2722
|
+
columnName: 'reviews',
|
|
2723
|
+
foreignKeyColumn: { product_id: 'id' },
|
|
2724
|
+
fields: this.reviewsFields,
|
|
2725
|
+
},
|
|
2726
|
+
},
|
|
2679
2727
|
{
|
|
2680
2728
|
metadata: {
|
|
2681
2729
|
columnName: 'metadata',
|
|
@@ -2705,12 +2753,13 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2705
2753
|
'updated_at',
|
|
2706
2754
|
];
|
|
2707
2755
|
}
|
|
2708
|
-
create(
|
|
2756
|
+
create(params) {
|
|
2709
2757
|
const _super = Object.create(null, {
|
|
2710
2758
|
create: { get: () => super.create }
|
|
2711
2759
|
});
|
|
2712
2760
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2713
|
-
const
|
|
2761
|
+
const { metadata } = params, data = __rest(params, ["metadata"]);
|
|
2762
|
+
const product = yield _super.create.call(this, omit(Object.assign(Object.assign({}, data), { metadata: metadata || { description: null, title: null } }), ['reviews']));
|
|
2714
2763
|
try {
|
|
2715
2764
|
product.reviews = yield this.updateReviews(+product.id, data);
|
|
2716
2765
|
}
|
|
@@ -2732,7 +2781,7 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2732
2781
|
: yield _super.get.call(this, identifiers);
|
|
2733
2782
|
if (product.productId)
|
|
2734
2783
|
throw new NotFoundError('Product not found, it is a variant');
|
|
2735
|
-
product.reviews = yield this.findReviewsByProduct(+product.id);
|
|
2784
|
+
product.reviews = product.reviews || (yield this.findReviewsByProduct(+product.id));
|
|
2736
2785
|
return product;
|
|
2737
2786
|
});
|
|
2738
2787
|
}
|
|
@@ -2741,8 +2790,12 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2741
2790
|
find: { get: () => super.find }
|
|
2742
2791
|
});
|
|
2743
2792
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2744
|
-
const _a = params || {}, { filters } = _a, options = __rest(_a, ["filters"]);
|
|
2745
|
-
|
|
2793
|
+
const _a = params || {}, { filters, fields } = _a, options = __rest(_a, ["filters", "fields"]);
|
|
2794
|
+
const bindFields = fields ||
|
|
2795
|
+
this.fields
|
|
2796
|
+
.map((field) => (typeof field === 'string' ? field : Object.keys(field).shift()))
|
|
2797
|
+
.filter((field) => field !== 'reviews');
|
|
2798
|
+
return _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: Where.ISNULL } }), fields: bindFields }));
|
|
2746
2799
|
});
|
|
2747
2800
|
}
|
|
2748
2801
|
getBySlug(slug) {
|
|
@@ -2763,25 +2816,26 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2763
2816
|
update: { get: () => super.update }
|
|
2764
2817
|
});
|
|
2765
2818
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2766
|
-
const { categories, kitProducts, reviews, id: checkId, rate } = params, data = __rest(params, ["categories", "kitProducts", "reviews", "id", "rate"]);
|
|
2819
|
+
const { categories, kitProducts, reviews, id: checkId, rate, metadata } = params, data = __rest(params, ["categories", "kitProducts", "reviews", "id", "rate", "metadata"]);
|
|
2767
2820
|
const plainData = this.paramsToPlain({ id: checkId });
|
|
2768
2821
|
const id = yield this.getId(plainData.id);
|
|
2769
2822
|
const product = yield _super.update.call(this, Object.assign({ id }, data));
|
|
2770
2823
|
product.categories = categories && (yield this.updateCategories(+id, { categories }));
|
|
2771
2824
|
product.kitProducts = kitProducts && (yield this.updateKitProducts(+id, { kitProducts }));
|
|
2772
2825
|
product.reviews = reviews && (yield this.updateReviews(+id, { reviews }));
|
|
2826
|
+
product.metadata = metadata && (yield this.updateMetadata(+id, { metadata }));
|
|
2773
2827
|
return product;
|
|
2774
2828
|
});
|
|
2775
2829
|
}
|
|
2776
2830
|
fetchReviews(status) {
|
|
2777
2831
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2778
|
-
const
|
|
2832
|
+
const reviewsExpression = {
|
|
2779
2833
|
status: status === 'pending'
|
|
2780
2834
|
? { [HasuraGraphQLWhere.ISNULL]: true }
|
|
2781
2835
|
: { [HasuraGraphQLWhere.EQUALS]: status === 'approved' },
|
|
2782
2836
|
};
|
|
2783
2837
|
const { product: data } = yield this.query('product', ['id', 'name', 'sku', { reviews: { columnName: 'reviews', fields: this.reviewsFields } }], {
|
|
2784
|
-
where: { value: { reviews }, type: 'product_bool_exp', required: true },
|
|
2838
|
+
where: { value: { reviews: reviewsExpression }, type: 'product_bool_exp', required: true },
|
|
2785
2839
|
});
|
|
2786
2840
|
return data.reduce((reviews, product) => [
|
|
2787
2841
|
...reviews,
|
|
@@ -2795,7 +2849,19 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2795
2849
|
}
|
|
2796
2850
|
updateCategories(productId, { categories }) {
|
|
2797
2851
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2852
|
+
if ('action' in categories && categories.action === 'remove') {
|
|
2853
|
+
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
2854
|
+
where: {
|
|
2855
|
+
type: 'category_product_bool_exp',
|
|
2856
|
+
required: true,
|
|
2857
|
+
value: { product_id: { _eq: productId } },
|
|
2858
|
+
},
|
|
2859
|
+
});
|
|
2860
|
+
return [];
|
|
2861
|
+
}
|
|
2798
2862
|
const plainData = this.paramsToPlain({ categories });
|
|
2863
|
+
if (!plainData.categories || plainData.categories.length <= 0)
|
|
2864
|
+
return [];
|
|
2799
2865
|
yield this.mutation('delete_category_product', ['affected_rows'], {
|
|
2800
2866
|
where: {
|
|
2801
2867
|
type: 'category_product_bool_exp',
|
|
@@ -2852,6 +2918,8 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2852
2918
|
return reviews.value.map((review, index) => !reviewIds[index] && review).filter(Boolean);
|
|
2853
2919
|
}
|
|
2854
2920
|
const plainData = this.paramsToPlain({ reviews });
|
|
2921
|
+
if (!plainData.reviews || plainData.reviews.length <= 0)
|
|
2922
|
+
return [];
|
|
2855
2923
|
return Promise.all(plainData.reviews.map((reviewData) => __awaiter(this, void 0, void 0, function* () {
|
|
2856
2924
|
const review = yield this.findReview(reviewData, productId);
|
|
2857
2925
|
if (review.id)
|
|
@@ -2877,6 +2945,26 @@ class ProductHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
2877
2945
|
})));
|
|
2878
2946
|
});
|
|
2879
2947
|
}
|
|
2948
|
+
updateMetadata(productId, { metadata }) {
|
|
2949
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2950
|
+
const plainData = this.paramsToPlain({ metadata });
|
|
2951
|
+
if (!plainData.metadata)
|
|
2952
|
+
return;
|
|
2953
|
+
yield this.mutation('update_product_metadata_by_pk', ['product_id'], {
|
|
2954
|
+
pk_columns: {
|
|
2955
|
+
value: { product_id: productId },
|
|
2956
|
+
type: 'product_metadata_pk_columns_input',
|
|
2957
|
+
required: true,
|
|
2958
|
+
},
|
|
2959
|
+
_set: {
|
|
2960
|
+
value: omit(metadata, ['product_id']),
|
|
2961
|
+
type: 'product_metadata_set_input',
|
|
2962
|
+
required: true,
|
|
2963
|
+
},
|
|
2964
|
+
});
|
|
2965
|
+
return plainData.metadata;
|
|
2966
|
+
});
|
|
2967
|
+
}
|
|
2880
2968
|
getId(id) {
|
|
2881
2969
|
var _a, _b;
|
|
2882
2970
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3060,5 +3148,5 @@ class VariantHasuraGraphQLRepository extends withCrudHasuraGraphQL(withHasuraGra
|
|
|
3060
3148
|
* Generated bundle index. Do not edit.
|
|
3061
3149
|
*/
|
|
3062
3150
|
|
|
3063
|
-
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository,
|
|
3151
|
+
export { AccessoryImportances, Address, Area, Authentication, AuthenticationFirebaseAuthService, AxiosAdapter, Base, BaseModel, BeardProblems, BeardSizes, BeautyProductImportances, BeautyProfile, BeautyQuestionsHelper, BillingStatus, BodyProblems, BodyShapes, BodyTattoos, Buy2Win, Buy2WinFirestoreRepository, Category, CategoryFirestoreRepository, CategoryHasuraGraphQL, CategoryHasuraGraphQLRepository, Checkout, CheckoutFirestoreRepository, CheckoutSubscription, CheckoutSubscriptionFirestoreRepository, CheckoutTypes, Coupon, CouponFirestoreRepository, CouponSubtypes, CouponTypes, DuplicatedResultsError, Edition, EditionStatus, Exclusivities, FaceSkinOilinesses, FaceSkinProblems, FaceSkinTones, FamilyIncomes, FilterType, FragranceImportances, GenderDestination, HairColors, HairProblems, HairStrands, HairTypes, Home, HomeFirestoreRepository, InvalidArgumentError, KitProduct, KitProductHasuraGraphQL, Lead, LeadFirestoreRepository, LegacyOrderFirestoreRepository, LineItem, NotFoundError, OfficePosition, Order, OrderFirestoreRepository, OrderStatus, Payment, PaymentFirestoreRepository, PaymentType, Product, ProductFirestoreRepository, ProductHasuraGraphQL, ProductHasuraGraphQLRepository, ProductSpents, ProductVariantFirestoreRepository, ProductsIndex, QuestionsFilters, RecoveryPassword, Register, RegisterFirebaseAuthService, RequiredArgumentError, ShippingMethod, ShopMenu, ShopMenuFirestoreRepository, Shops, SignInMethods, SignOut, Status, Subscription, SubscriptionEditionFirestoreRepository, SubscriptionFirestoreRepository, SubscriptionPayment, SubscriptionPaymentFirestoreRepository, SubscriptionPlan, SubscriptionPlanFirestoreRepository, SubscriptionProductFirestoreRepository, UnauthorizedError, UpdateOptionActions, User, UserAddress, UserAddressFirestoreRepository, UserAlreadyRegisteredError, UserBeautyProfileFirestoreRepository, UserFirestoreRepository, UserPaymentMethod, UserPaymentMethodFirestoreRepository, UserType, Variant, VariantHasuraGraphQL, VariantHasuraGraphQLRepository, WeakPasswordError, Where, isUUID, parseDateTime, withCreateFirestore, withCreateHasuraGraphQL, withCrudFirestore, withCrudHasuraGraphQL, withDeleteFirestore, withDeleteHasuraGraphQL, withFindFirestore, withFindHasuraGraphQL, withFirestore, withGetFirestore, withGetHasuraGraphQL, withHasuraGraphQL, withHelpers, withSubCollection, withUpdateFirestore, withUpdateHasuraGraphQL };
|
|
3064
3152
|
//# sourceMappingURL=infrab4a-connect.js.map
|