@infrab4a/connect 1.0.0 → 1.0.1-beta.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.
@@ -1990,13 +1990,22 @@
1990
1990
  FindFirestore.prototype.find = function (_a) {
1991
1991
  var _b = _a === void 0 ? {} : _a, filters = _b.filters, limits = _b.limits, orderBy = _b.orderBy;
1992
1992
  return __awaiter(this, void 0, void 0, function () {
1993
- var query, docs, data;
1993
+ var orderByKeys, query, filtersKeysWithUnordered, docs, data;
1994
1994
  return __generator(this, function (_a) {
1995
1995
  switch (_a.label) {
1996
1996
  case 0:
1997
+ orderByKeys = Object.keys(orderBy || {});
1997
1998
  query = this.collection(this.buildCollectionPathForFind(filters || {}));
1998
1999
  query = this.makeFirestoreWhere(query, filters || {});
1999
- Object.keys(orderBy || {}).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
2000
+ if (orderByKeys.length) {
2001
+ filtersKeysWithUnordered = Object.keys(filters || {}).filter(function (filterKey) { return !orderByKeys.includes(filterKey); });
2002
+ if (filtersKeysWithUnordered.length)
2003
+ filtersKeysWithUnordered.forEach(function (filterKey) {
2004
+ var _a;
2005
+ return (orderBy = Object.assign((_a = {}, _a[filterKey] = 'asc', _a), orderBy));
2006
+ });
2007
+ Object.keys(orderBy).forEach(function (fieldName) { return (query = query.orderBy(fieldName, orderBy[fieldName])); });
2008
+ }
2000
2009
  return [4 /*yield*/, this.defineLimits(query, filters, limits)];
2001
2010
  case 1:
2002
2011
  query = _a.sent();
@@ -3076,7 +3085,9 @@
3076
3085
  return true;
3077
3086
  if (filter.operator === exports.Where.ISNOTNULL)
3078
3087
  return false;
3079
- var converter = fieldOption.to ? fieldOption.to : function (value) { return value; };
3088
+ var converter = fieldOption.to
3089
+ ? fieldOption.to
3090
+ : function (value) { return (filter.operator === exports.Where.LIKE && value.indexOf('%') < 0 ? "%" + value + "%" : value); };
3080
3091
  return Array.isArray(filter.value) && !fieldOption.fields && [exports.Where.IN, exports.Where.NOTIN].includes(filter.operator)
3081
3092
  ? filter.value.map(function (fieldValue) { return converter(fieldValue); })
3082
3093
  : converter(filter.value);
@@ -3825,6 +3836,7 @@
3825
3836
  var commonFields = [
3826
3837
  { id: { columnName: 'id', to: function (value) { return +value; }, from: function (value) { return value.toString(); } } },
3827
3838
  { firestoreId: { columnName: 'firestore_id' } },
3839
+ { productId: { columnName: 'main_product_id' } },
3828
3840
  { CEST: { columnName: 'cest' } },
3829
3841
  { EAN: { columnName: 'ean' } },
3830
3842
  { NCM: { columnName: 'ncm' } },
@@ -4018,6 +4030,18 @@
4018
4030
  });
4019
4031
  });
4020
4032
  };
4033
+ ProductHasuraGraphQLRepository.prototype.find = function (params) {
4034
+ var _super = Object.create(null, {
4035
+ find: { get: function () { return _super_1.prototype.find; } }
4036
+ });
4037
+ return __awaiter(this, void 0, void 0, function () {
4038
+ var _a, filters, options;
4039
+ return __generator(this, function (_c) {
4040
+ _a = params || {}, filters = _a.filters, options = __rest(_a, ["filters"]);
4041
+ return [2 /*return*/, _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: exports.Where.ISNULL } }) }))];
4042
+ });
4043
+ });
4044
+ };
4021
4045
  ProductHasuraGraphQLRepository.prototype.getBySlug = function (slug) {
4022
4046
  var _a;
4023
4047
  return __awaiter(this, void 0, void 0, function () {
@@ -4456,6 +4480,18 @@
4456
4480
  });
4457
4481
  });
4458
4482
  };
4483
+ VariantHasuraGraphQLRepository.prototype.find = function (params) {
4484
+ var _super = Object.create(null, {
4485
+ find: { get: function () { return _super_1.prototype.find; } }
4486
+ });
4487
+ return __awaiter(this, void 0, void 0, function () {
4488
+ var _a, filters, options;
4489
+ return __generator(this, function (_c) {
4490
+ _a = params || {}, filters = _a.filters, options = __rest(_a, ["filters"]);
4491
+ return [2 /*return*/, _super.find.call(this, Object.assign(Object.assign({}, options), { filters: Object.assign(Object.assign({}, filters), { productId: { operator: exports.Where.ISNOTNULL } }) }))];
4492
+ });
4493
+ });
4494
+ };
4459
4495
  VariantHasuraGraphQLRepository.prototype.update = function (params) {
4460
4496
  var _super = Object.create(null, {
4461
4497
  update: { get: function () { return _super_1.prototype.update; } }