@infrab4a/connect 3.3.1-beta.2 → 3.3.1

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.
@@ -3794,7 +3794,7 @@
3794
3794
  switch (_d.label) {
3795
3795
  case 0:
3796
3796
  if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
3797
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
3797
+ return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })];
3798
3798
  case 1:
3799
3799
  _c = (_a = (_d.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
3800
3800
  return [3 /*break*/, 3];
@@ -3848,19 +3848,19 @@
3848
3848
  };
3849
3849
  CategoryHasuraGraphQLRepository.prototype.getCategoryBySlug = function (slug, shop) {
3850
3850
  return __awaiter(this, void 0, void 0, function () {
3851
- var _c, data, count;
3852
- return __generator(this, function (_d) {
3853
- switch (_d.label) {
3851
+ var data;
3852
+ return __generator(this, function (_c) {
3853
+ switch (_c.label) {
3854
3854
  case 0:
3855
3855
  if (!slug)
3856
3856
  return [2 /*return*/];
3857
- 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 } })];
3858
3858
  case 1:
3859
- _c = _d.sent(), data = _c.data, count = _c.count;
3860
- if (count > 1)
3861
- throw new DuplicatedResultsError('Query returned duplicated values');
3862
- if (!count)
3859
+ data = (_c.sent()).data;
3860
+ if (!data.length)
3863
3861
  throw new NotFoundError("Category with slug " + slug + " not found");
3862
+ if (data.length > 1)
3863
+ throw new DuplicatedResultsError('Query returned duplicated values');
3864
3864
  return [2 /*return*/, data.shift()];
3865
3865
  }
3866
3866
  });
@@ -3940,7 +3940,7 @@
3940
3940
  if (!((_a = category === null || category === void 0 ? void 0 : category.products) === null || _a === void 0 ? void 0 : _a.length))
3941
3941
  return [2 /*return*/, []];
3942
3942
  products = [];
3943
- 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: [
3944
3944
  'id',
3945
3945
  'name',
3946
3946
  'slug',
@@ -3964,7 +3964,7 @@
3964
3964
  'tags',
3965
3965
  'type',
3966
3966
  'shoppingCount',
3967
- ] }, ((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 } }))];
3968
3968
  case 1:
3969
3969
  productsData = (_c.sent()).data;
3970
3970
  products.push.apply(products, __spreadArray([], __read(productsData)));
@@ -3982,7 +3982,7 @@
3982
3982
  case 0:
3983
3983
  if (!Number.isNaN(+id))
3984
3984
  return [2 /*return*/, id];
3985
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
3985
+ return [4 /*yield*/, this.find({ filters: { firestoreId: id }, options: { enableCount: false } })];
3986
3986
  case 1:
3987
3987
  data = (_c.sent()).data;
3988
3988
  if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
@@ -4302,7 +4302,7 @@
4302
4302
  switch (_f.label) {
4303
4303
  case 0:
4304
4304
  if (!Number.isNaN(+identifiers.id)) return [3 /*break*/, 2];
4305
- return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id } })];
4305
+ return [4 /*yield*/, this.find({ filters: { firestoreId: identifiers.id }, options: { enableCount: false } })];
4306
4306
  case 1:
4307
4307
  _c = (_a = (_f.sent()).data) === null || _a === void 0 ? void 0 : _a[0];
4308
4308
  return [3 /*break*/, 4];
@@ -4642,7 +4642,7 @@
4642
4642
  case 0:
4643
4643
  if (!Number.isNaN(+id))
4644
4644
  return [2 /*return*/, id];
4645
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
4645
+ return [4 /*yield*/, this.find({ filters: { firestoreId: id }, options: { enableCount: false } })];
4646
4646
  case 1:
4647
4647
  data = (_c.sent()).data;
4648
4648
  if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)
@@ -4872,7 +4872,7 @@
4872
4872
  case 0:
4873
4873
  if (!Number.isNaN(+id))
4874
4874
  return [2 /*return*/, id];
4875
- return [4 /*yield*/, this.find({ filters: { firestoreId: id } })];
4875
+ return [4 /*yield*/, this.find({ filters: { firestoreId: id }, options: { enableCount: false } })];
4876
4876
  case 1:
4877
4877
  data = (_c.sent()).data;
4878
4878
  if ((_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.id)