@websolutespa/bom-core 1.7.0 → 1.7.2
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +29 -0
- package/dist/index.mjs +29 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -570,11 +570,27 @@ declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
|
570
570
|
protected decorateMany_<B extends T = T>(items: B[], params?: QueryParams): Promise<B[]>;
|
|
571
571
|
protected newUUID_(): number;
|
|
572
572
|
protected evaluateValue_(value: unknown): unknown;
|
|
573
|
+
/**
|
|
574
|
+
equals The value must be exactly equal.
|
|
575
|
+
not_equals The query will return all documents where the value is not equal.
|
|
576
|
+
greater_than For numeric or date-based fields.
|
|
577
|
+
greater_than_equal For numeric or date-based fields.
|
|
578
|
+
less_than For numeric or date-based fields.
|
|
579
|
+
less_than_equal For numeric or date-based fields.
|
|
580
|
+
like Case-insensitive string must be present. If string of words, all words must be present, in any order.
|
|
581
|
+
contains Must contain the value entered, case-insensitive.
|
|
582
|
+
in The value must be found within the provided comma-delimited list of values.
|
|
583
|
+
not_in The value must NOT be within the provided comma-delimited list of values.
|
|
584
|
+
all The value must contain all values provided in the comma-delimited list.
|
|
585
|
+
exists Only return documents where the value either exists (true) or does not exist (false).
|
|
586
|
+
near For distance related to a point field comma separated as <longitude>, <latitude>, <maxDistance in meters (nullable)>, <minDistance in meters (nullable)>.
|
|
587
|
+
*/
|
|
573
588
|
protected existsClause_(value: unknown, exists?: boolean): boolean;
|
|
574
589
|
protected equalsClause_(value: unknown, equals?: unknown): boolean;
|
|
575
590
|
protected inClause_(value: unknown, values?: unknown[]): boolean;
|
|
576
591
|
protected notInClause_(value: unknown, values?: unknown[]): boolean;
|
|
577
592
|
protected likeClause_(value: unknown, query?: string): boolean;
|
|
593
|
+
protected containsClause_(value: unknown, contains?: IEquatable): boolean;
|
|
578
594
|
protected whereItem_<B extends T = T>(item: B, where?: Where): boolean;
|
|
579
595
|
protected whereItems_<B extends T = T>(items: B[], where?: Where): B[];
|
|
580
596
|
protected sortCollection_<B extends T = T>(items: B[], sort?: string): B[];
|
package/dist/index.js
CHANGED
|
@@ -652,6 +652,21 @@ var JsonService = class {
|
|
|
652
652
|
return value;
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
equals The value must be exactly equal.
|
|
657
|
+
not_equals The query will return all documents where the value is not equal.
|
|
658
|
+
greater_than For numeric or date-based fields.
|
|
659
|
+
greater_than_equal For numeric or date-based fields.
|
|
660
|
+
less_than For numeric or date-based fields.
|
|
661
|
+
less_than_equal For numeric or date-based fields.
|
|
662
|
+
like Case-insensitive string must be present. If string of words, all words must be present, in any order.
|
|
663
|
+
contains Must contain the value entered, case-insensitive.
|
|
664
|
+
in The value must be found within the provided comma-delimited list of values.
|
|
665
|
+
not_in The value must NOT be within the provided comma-delimited list of values.
|
|
666
|
+
all The value must contain all values provided in the comma-delimited list.
|
|
667
|
+
exists Only return documents where the value either exists (true) or does not exist (false).
|
|
668
|
+
near For distance related to a point field comma separated as <longitude>, <latitude>, <maxDistance in meters (nullable)>, <minDistance in meters (nullable)>.
|
|
669
|
+
*/
|
|
655
670
|
existsClause_(value, exists) {
|
|
656
671
|
if (typeof exists === "boolean") {
|
|
657
672
|
return value != null === exists;
|
|
@@ -682,6 +697,19 @@ var JsonService = class {
|
|
|
682
697
|
}
|
|
683
698
|
return true;
|
|
684
699
|
}
|
|
700
|
+
containsClause_(value, contains) {
|
|
701
|
+
if (typeof contains !== "undefined") {
|
|
702
|
+
contains = String(contains).toLowerCase();
|
|
703
|
+
if (Array.isArray(value)) {
|
|
704
|
+
return value.reduce((p, c) => p || String(c).toLowerCase() === contains, false);
|
|
705
|
+
} else if (typeof value === "string") {
|
|
706
|
+
return value.toLowerCase().includes(contains);
|
|
707
|
+
} else {
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
685
713
|
whereItem_(item, where) {
|
|
686
714
|
let has = true;
|
|
687
715
|
if (typeof where === "object") {
|
|
@@ -710,6 +738,7 @@ var JsonService = class {
|
|
|
710
738
|
has = has && this.inClause_(value, v.in);
|
|
711
739
|
has = has && this.notInClause_(value, v.not_in);
|
|
712
740
|
has = has && this.likeClause_(value, v.like);
|
|
741
|
+
has = has && this.containsClause_(value, v.contains);
|
|
713
742
|
}
|
|
714
743
|
}
|
|
715
744
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -534,6 +534,21 @@ var JsonService = class {
|
|
|
534
534
|
return value;
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
equals The value must be exactly equal.
|
|
539
|
+
not_equals The query will return all documents where the value is not equal.
|
|
540
|
+
greater_than For numeric or date-based fields.
|
|
541
|
+
greater_than_equal For numeric or date-based fields.
|
|
542
|
+
less_than For numeric or date-based fields.
|
|
543
|
+
less_than_equal For numeric or date-based fields.
|
|
544
|
+
like Case-insensitive string must be present. If string of words, all words must be present, in any order.
|
|
545
|
+
contains Must contain the value entered, case-insensitive.
|
|
546
|
+
in The value must be found within the provided comma-delimited list of values.
|
|
547
|
+
not_in The value must NOT be within the provided comma-delimited list of values.
|
|
548
|
+
all The value must contain all values provided in the comma-delimited list.
|
|
549
|
+
exists Only return documents where the value either exists (true) or does not exist (false).
|
|
550
|
+
near For distance related to a point field comma separated as <longitude>, <latitude>, <maxDistance in meters (nullable)>, <minDistance in meters (nullable)>.
|
|
551
|
+
*/
|
|
537
552
|
existsClause_(value, exists) {
|
|
538
553
|
if (typeof exists === "boolean") {
|
|
539
554
|
return value != null === exists;
|
|
@@ -564,6 +579,19 @@ var JsonService = class {
|
|
|
564
579
|
}
|
|
565
580
|
return true;
|
|
566
581
|
}
|
|
582
|
+
containsClause_(value, contains) {
|
|
583
|
+
if (typeof contains !== "undefined") {
|
|
584
|
+
contains = String(contains).toLowerCase();
|
|
585
|
+
if (Array.isArray(value)) {
|
|
586
|
+
return value.reduce((p, c) => p || String(c).toLowerCase() === contains, false);
|
|
587
|
+
} else if (typeof value === "string") {
|
|
588
|
+
return value.toLowerCase().includes(contains);
|
|
589
|
+
} else {
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return true;
|
|
594
|
+
}
|
|
567
595
|
whereItem_(item, where) {
|
|
568
596
|
let has = true;
|
|
569
597
|
if (typeof where === "object") {
|
|
@@ -592,6 +620,7 @@ var JsonService = class {
|
|
|
592
620
|
has = has && this.inClause_(value, v.in);
|
|
593
621
|
has = has && this.notInClause_(value, v.not_in);
|
|
594
622
|
has = has && this.likeClause_(value, v.like);
|
|
623
|
+
has = has && this.containsClause_(value, v.contains);
|
|
595
624
|
}
|
|
596
625
|
}
|
|
597
626
|
});
|