@infrab4a/connect 3.3.1-beta.1 → 3.3.1-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 +20 -21
- package/bundles/infrab4a-connect.umd.js.map +1 -1
- package/esm2015/infra/hasura-graphql/mixins/with-find-hasura-graphql.mixin.js +5 -6
- package/esm2015/infra/hasura-graphql/repositories/catalog/category-hasura-graphql.repository.js +9 -9
- package/esm2015/infra/hasura-graphql/repositories/catalog/product-hasura-graphql.repository.js +3 -3
- package/esm2015/infra/hasura-graphql/repositories/catalog/variant-hasura-graphql.repository.js +2 -2
- package/fesm2015/infrab4a-connect.js +15 -16
- package/fesm2015/infrab4a-connect.js.map +1 -1
- package/package.json +1 -1
|
@@ -3598,7 +3598,7 @@
|
|
|
3598
3598
|
FindHasuraGraphQLMixin.prototype.find = function (params) {
|
|
3599
3599
|
var _a;
|
|
3600
3600
|
return __awaiter(this, void 0, void 0, function () {
|
|
3601
|
-
var _b, filters, limits, orderBy, options, enableCount, variablesCount, variables, result, data
|
|
3601
|
+
var _b, filters, limits, orderBy, options, enableCount, variablesCount, variables, result, data;
|
|
3602
3602
|
var _this = this;
|
|
3603
3603
|
return __generator(this, function (_c) {
|
|
3604
3604
|
switch (_c.label) {
|
|
@@ -3629,19 +3629,18 @@
|
|
|
3629
3629
|
variables: variables,
|
|
3630
3630
|
}
|
|
3631
3631
|
], __read((enableCount
|
|
3632
|
-
? [
|
|
3633
|
-
: [
|
|
3632
|
+
? [
|
|
3634
3633
|
{
|
|
3635
3634
|
operation: this.tableName + "_aggregate",
|
|
3636
3635
|
fields: [{ aggregate: ['count'] }],
|
|
3637
3636
|
variables: variablesCount,
|
|
3638
3637
|
},
|
|
3639
|
-
]
|
|
3638
|
+
]
|
|
3639
|
+
: []))))];
|
|
3640
3640
|
case 1:
|
|
3641
3641
|
result = _c.sent();
|
|
3642
3642
|
data = result[this.tableName].map(function (row) { return _this.convertDataFromHasura(row); });
|
|
3643
|
-
count
|
|
3644
|
-
return [2 /*return*/, { data: data, count: enableCount ? count : Infinity }];
|
|
3643
|
+
return [2 /*return*/, { data: data, count: enableCount ? result[this.tableName + "_aggregate"].aggregate.count : Infinity }];
|
|
3645
3644
|
}
|
|
3646
3645
|
});
|
|
3647
3646
|
});
|
|
@@ -3795,7 +3794,7 @@
|
|
|
3795
3794
|
switch (_d.label) {
|
|
3796
3795
|
case 0:
|
|
3797
3796
|
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
3798
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
3797
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })];
|
|
3799
3798
|
case 1:
|
|
3800
3799
|
_c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
3801
3800
|
return [3 /*break*/, 3];
|
|
@@ -3849,19 +3848,19 @@
|
|
|
3849
3848
|
};
|
|
3850
3849
|
CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
|
|
3851
3850
|
return __awaiter(this, void 0, void 0, function () {
|
|
3852
|
-
var
|
|
3853
|
-
return __generator(this, function (
|
|
3854
|
-
switch (
|
|
3851
|
+
var data;
|
|
3852
|
+
return __generator(this, function (_c) {
|
|
3853
|
+
switch (_c.label) {
|
|
3855
3854
|
case 0:
|
|
3856
3855
|
if (!slug)
|
|
3857
3856
|
return [2 /*return*/];
|
|
3858
|
-
return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true } })];
|
|
3857
|
+
return [4 /*yield*/, this.find({ filters: { slug: slug, shop: shop, published: true }, options: { enableCount: false } })];
|
|
3859
3858
|
case 1:
|
|
3860
|
-
|
|
3861
|
-
if (
|
|
3862
|
-
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
3863
|
-
if (!count)
|
|
3859
|
+
data = (_c.sent()).data;
|
|
3860
|
+
if (!data.length)
|
|
3864
3861
|
throw new NotFoundError("Category with slug " + slug + " not found");
|
|
3862
|
+
if (data.length > 1)
|
|
3863
|
+
throw new DuplicatedResultsError('Query returned duplicated values');
|
|
3865
3864
|
return [2 /*return*/, data.shift()];
|
|
3866
3865
|
}
|
|
3867
3866
|
});
|
|
@@ -3941,7 +3940,7 @@
|
|
|
3941
3940
|
if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
|
|
3942
3941
|
return [2 /*return*/, []];
|
|
3943
3942
|
products = [];
|
|
3944
|
-
return [4 /*yield*/, this.productRepository.find(Object.assign({ filters: Object.assign({ id: { operator: exports.Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: exports.Where.GT, value: 0 } } } : {})), fields: [
|
|
3943
|
+
return [4 /*yield*/, this.productRepository.find(Object.assign(Object.assign({ filters: Object.assign({ id: { operator: exports.Where.IN, value: category.products }, published: true }, ((options === null || options === void 0 ? void 0 : options.hasStock) ? { stock: { quantity: { operator: exports.Where.GT, value: 0 } } } : {})), fields: [
|
|
3945
3944
|
'id',
|
|
3946
3945
|
'name',
|
|
3947
3946
|
'slug',
|
|
@@ -3965,7 +3964,7 @@
|
|
|
3965
3964
|
'tags',
|
|
3966
3965
|
'type',
|
|
3967
3966
|
'shoppingCount',
|
|
3968
|
-
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})))];
|
|
3967
|
+
] }, ((options === null || options === void 0 ? void 0 : options.limit) ? { limits: { limit: options === null || options === void 0 ? void 0 : options.limit } } : {})), { options: { enableCount: false } }))];
|
|
3969
3968
|
case 1:
|
|
3970
3969
|
productsData = (_c.sent()).data;
|
|
3971
3970
|
products.push.apply(products, __spreadArray([], __read(productsData)));
|
|
@@ -3983,7 +3982,7 @@
|
|
|
3983
3982
|
case 0:
|
|
3984
3983
|
if (!Number.isNaN(+id))
|
|
3985
3984
|
return [2 /*return*/, id];
|
|
3986
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
|
|
3985
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: id }, options: { enableCount: false } })];
|
|
3987
3986
|
case 1:
|
|
3988
3987
|
data = (_c.sent()).data;
|
|
3989
3988
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
@@ -4303,7 +4302,7 @@
|
|
|
4303
4302
|
switch (_f.label) {
|
|
4304
4303
|
case 0:
|
|
4305
4304
|
if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
|
|
4306
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
|
|
4305
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })];
|
|
4307
4306
|
case 1:
|
|
4308
4307
|
_c = (_a = (_f.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
|
|
4309
4308
|
return [3 /*break*/, 4];
|
|
@@ -4643,7 +4642,7 @@
|
|
|
4643
4642
|
case 0:
|
|
4644
4643
|
if (!Number.isNaN(+id))
|
|
4645
4644
|
return [2 /*return*/, id];
|
|
4646
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
|
|
4645
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: id }, options: { enableCount: false } })];
|
|
4647
4646
|
case 1:
|
|
4648
4647
|
data = (_c.sent()).data;
|
|
4649
4648
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|
|
@@ -4873,7 +4872,7 @@
|
|
|
4873
4872
|
case 0:
|
|
4874
4873
|
if (!Number.isNaN(+id))
|
|
4875
4874
|
return [2 /*return*/, id];
|
|
4876
|
-
return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
|
|
4875
|
+
return [4 /*yield*/, this.find({ filters: { firestoreId: id }, options: { enableCount: false } })];
|
|
4877
4876
|
case 1:
|
|
4878
4877
|
data = (_c.sent()).data;
|
|
4879
4878
|
if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
|