@infrab4a/connect 0.14.5 → 0.14.6-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.
@@ -1573,6 +1573,9 @@
1573
1573
  var getValueFromFilter = function (filter) {
1574
1574
  return checkIfIsFilterOption(filter) ? filter.value : filter;
1575
1575
  };
1576
+ var getFinalValueFrom = function (value) { return lodash.isNumber(value) || lodash.isString(value) || lodash.isDate(value) || Array.isArray(value)
1577
+ ? value
1578
+ : Object.values(getFinalValueFrom); };
1576
1579
  return /** @class */ (function (_super) {
1577
1580
  __extends(FindFirestore, _super);
1578
1581
  function FindFirestore() {
@@ -1581,18 +1584,26 @@
1581
1584
  _this.buildWhereSentence = function (queryReference, fieldName, options) {
1582
1585
  if (_this.isSubCollection(_this) && fieldName === _this.parentIdField)
1583
1586
  return queryReference;
1587
+ var value = (options === null || options === void 0 ? void 0 : options.value) || options;
1588
+ var object = {};
1589
+ lodash.set(object, fieldName, value);
1590
+ var plainInstance = new _this.model(object).toPlain();
1591
+ var firestoreFieldName = fieldName.toString().indexOf('.') > -1
1592
+ ? fieldName.toString()
1593
+ : Object.keys(plainInstance).find(function (key) { return plainInstance[key]; });
1584
1594
  if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.LIKE) {
1585
1595
  if (Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1586
- return queryReference.where(fieldName.toString(), 'array-contains-any', options.value);
1587
- queryReference = queryReference.where(fieldName.toString(), '>=', options.value);
1588
- queryReference = queryReference.where(fieldName.toString(), '<=', options.value + "~");
1596
+ return queryReference.where(firestoreFieldName, 'array-contains-any', options.value);
1597
+ queryReference = queryReference.where(firestoreFieldName, '>=', options.value);
1598
+ queryReference = queryReference.where(firestoreFieldName, '<=', options.value + "~");
1589
1599
  return queryReference;
1590
1600
  }
1591
1601
  if ((options === null || options === void 0 ? void 0 : options.operator) === exports.Where.IN && Array.isArray(options === null || options === void 0 ? void 0 : options.value))
1592
- return queryReference.where(fieldName.toString(), 'array-contains', options.value);
1593
- if (lodash.isObject(options) && lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) && lodash.isNil(options === null || options === void 0 ? void 0 : options.value))
1602
+ return queryReference.where(firestoreFieldName, 'array-contains', options.value);
1603
+ if (lodash.isObject(options) && lodash.isNil(options === null || options === void 0 ? void 0 : options.operator) && lodash.isNil(options === null || options === void 0 ? void 0 : options.value)) {
1594
1604
  return Object.keys(options).reduce(function (queryReferenceWithWhere, key) { return _this.buildWhereSentence(queryReferenceWithWhere, fieldName + "." + key, options[key]); }, queryReference);
1595
- return queryReference.where(fieldName.toString(), (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
1605
+ }
1606
+ return queryReference.where(firestoreFieldName, (options === null || options === void 0 ? void 0 : options.operator) || '==', (options === null || options === void 0 ? void 0 : options.value) || options);
1596
1607
  };
1597
1608
  return _this;
1598
1609
  }
@@ -2482,6 +2493,14 @@
2482
2493
  enumerable: true,
2483
2494
  get: function () { return lodash.chunk; }
2484
2495
  });
2496
+ Object.defineProperty(exports, 'get', {
2497
+ enumerable: true,
2498
+ get: function () { return lodash.get; }
2499
+ });
2500
+ Object.defineProperty(exports, 'isDate', {
2501
+ enumerable: true,
2502
+ get: function () { return lodash.isDate; }
2503
+ });
2485
2504
  Object.defineProperty(exports, 'isEmpty', {
2486
2505
  enumerable: true,
2487
2506
  get: function () { return lodash.isEmpty; }
@@ -2506,6 +2525,10 @@
2506
2525
  enumerable: true,
2507
2526
  get: function () { return lodash.pick; }
2508
2527
  });
2528
+ Object.defineProperty(exports, 'set', {
2529
+ enumerable: true,
2530
+ get: function () { return lodash.set; }
2531
+ });
2509
2532
  exports.Address = Address;
2510
2533
  exports.Authentication = Authentication;
2511
2534
  exports.AuthenticationFirebaseAuthService = AuthenticationFirebaseAuthService;