@trudb/tru-common-lib 0.0.260 → 0.0.262

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.
@@ -642,7 +642,7 @@ TruFormulaEval.compareResultForMismatchedParams = {
642
642
  class TruPredicate {
643
643
  constructor(field, operator, value, propertyQueryPath, overQuoted = false) {
644
644
  this._breezePredicate = null;
645
- this.handleOperator = (fieldOrPredicate, operator, value, oper) => {
645
+ this.handleOperator = (fieldOrPredicate, oper, operator, value) => {
646
646
  var breezePredicate;
647
647
  if (Array.isArray(fieldOrPredicate)) {
648
648
  breezePredicate = new TruPredicate(fieldOrPredicate[0], fieldOrPredicate[1], fieldOrPredicate[2], []);
@@ -658,11 +658,11 @@ class TruPredicate {
658
658
  };
659
659
  this.and = (fieldOrPredicate, operator, value) => {
660
660
  var that = this;
661
- return this.handleOperator(fieldOrPredicate, operator, value, function (p) { return that._breezePredicate.and(p); });
661
+ return this.handleOperator(fieldOrPredicate, function (p) { return that._breezePredicate.and(p); }, operator, value);
662
662
  };
663
663
  this.or = (fieldOrPredicate, operator, value) => {
664
664
  var that = this;
665
- return this.handleOperator(fieldOrPredicate, operator, value, function (p) { return that._breezePredicate.or(p); });
665
+ return this.handleOperator(fieldOrPredicate, function (p) { return that._breezePredicate.and(p); }, operator, value);
666
666
  };
667
667
  this.not = () => {
668
668
  var breezePredicate = this._breezePredicate.not();
@@ -808,12 +808,12 @@ class TruQueryPredicateManager {
808
808
  this.clear = () => {
809
809
  this.setPredicate(null);
810
810
  };
811
- this.set = (queryPredicate) => {
812
- if (this._predicate !== queryPredicate && this._predicateMap !== null) {
813
- this._predicate = queryPredicate;
814
- this._predicateMap[this._predicateName] = this._predicate === null ? null : this._predicate;
815
- }
816
- };
811
+ //set = (queryPredicate: TruPredicate) => {
812
+ // if (this._predicate !== queryPredicate && this._predicateMap !== null) {
813
+ // this._predicate = queryPredicate;
814
+ // this._predicateMap[this._predicateName] = this._predicate === null ? null : this._predicate;
815
+ // }
816
+ //}
817
817
  /**
818
818
  * Returns a new query predicate.
819
819
  *
@@ -824,6 +824,14 @@ class TruQueryPredicateManager {
824
824
  this.create = (field, operator, value, overQuoted) => {
825
825
  return new TruPredicate(field, operator, value, this._propertyQueryPath, overQuoted)._breezePredicate;
826
826
  };
827
+ this.set = (fieldOrPredicate, operator, value, overQuoted = false) => {
828
+ var predicate;
829
+ if (fieldOrPredicate.constructor === TruPredicate)
830
+ predicate = fieldOrPredicate;
831
+ else
832
+ predicate = this.create(fieldOrPredicate, operator, value, overQuoted);
833
+ this.setPredicate(predicate);
834
+ };
827
835
  this._propertyQueryPath = propertyQueryPath;
828
836
  this._predicateName = predicateName;
829
837
  this._predicateMap = predicateMap;