inibase 1.4.4 → 1.4.6
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/dist/index.js +1 -1
- package/dist/utils.server.js +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1087,7 +1087,7 @@ export default class Inibase {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
}
|
|
1089
1089
|
if (criteriaAND && Utils.isObject(criteriaAND)) {
|
|
1090
|
-
const searchResult = await this.applyCriteria(tableName, options, criteriaAND, true, searchIn);
|
|
1090
|
+
const searchResult = await this.applyCriteria(tableName, criteriaOR ? { ...(options ?? {}), perPage: -1 } : options, criteriaAND, true, searchIn);
|
|
1091
1091
|
if (searchResult) {
|
|
1092
1092
|
searchIn = new Set(Object.keys(searchResult).map(Number));
|
|
1093
1093
|
RETURN = Utils.deepMerge(RETURN, Object.fromEntries(Object.entries(searchResult).filter(([_k, v], _i) => Object.keys(v).filter((key) => Object.keys(criteriaAND).find((criteriaKey) => criteriaKey === key || criteriaKey.startsWith(`${key}.`))).length)));
|
package/dist/utils.server.js
CHANGED
|
@@ -87,10 +87,16 @@ export const compare = (operator, originalValue, comparedValue, fieldType) => {
|
|
|
87
87
|
// Determine the field type if it's an array of potential types.
|
|
88
88
|
if (Array.isArray(fieldType))
|
|
89
89
|
fieldType = detectFieldType(String(originalValue), fieldType);
|
|
90
|
-
//
|
|
90
|
+
// Special handling when the compared value is an array.
|
|
91
|
+
if (Array.isArray(comparedValue) &&
|
|
92
|
+
!Array.isArray(originalValue) &&
|
|
93
|
+
!["[]", "![]"].includes(operator))
|
|
94
|
+
return comparedValue.some((value) => compare(operator, originalValue, value, fieldType));
|
|
95
|
+
// Special handling when the original value is an array.
|
|
91
96
|
if (Array.isArray(originalValue) &&
|
|
92
97
|
!Array.isArray(comparedValue) &&
|
|
93
|
-
!["[]", "![]"].includes(operator)
|
|
98
|
+
!["[]", "![]"].includes(operator) &&
|
|
99
|
+
fieldType !== "array")
|
|
94
100
|
return originalValue.some((value) => compare(operator, value, comparedValue, fieldType));
|
|
95
101
|
// Switch statement for different comparison operators.
|
|
96
102
|
switch (operator) {
|