av6-core 2.0.6 → 2.0.7
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 +4 -3
- package/dist/index.mjs +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -428,11 +428,12 @@ function normalizeWhere(where) {
|
|
|
428
428
|
const commonKey = keysArr[0][0];
|
|
429
429
|
const allSameKey = keysArr.every((ks) => ks[0] === commonKey);
|
|
430
430
|
const isLogicalKey = commonKey === "AND" || commonKey === "OR" || commonKey === "NOT";
|
|
431
|
-
if (allSameKey && !isLogicalKey) {
|
|
431
|
+
if (allSameKey && !isLogicalKey && orItems.length > 1) {
|
|
432
432
|
const innerList = orItems.map((it) => it[commonKey]).filter((v) => isPlainObject(v));
|
|
433
433
|
const anyScalar = innerList.some(isScalarFilterObject);
|
|
434
|
-
|
|
435
|
-
|
|
434
|
+
const anyRelation = innerList.some(isRelationFilterObject);
|
|
435
|
+
if (!anyScalar && !anyRelation) {
|
|
436
|
+
const shouldFold = innerList.some(
|
|
436
437
|
(o) => Object.keys(o).some((k) => !SCALAR_OPS.has(k) && k !== "AND" && k !== "OR" && k !== "NOT")
|
|
437
438
|
);
|
|
438
439
|
if (shouldFold) {
|
package/dist/index.mjs
CHANGED
|
@@ -365,11 +365,12 @@ function normalizeWhere(where) {
|
|
|
365
365
|
const commonKey = keysArr[0][0];
|
|
366
366
|
const allSameKey = keysArr.every((ks) => ks[0] === commonKey);
|
|
367
367
|
const isLogicalKey = commonKey === "AND" || commonKey === "OR" || commonKey === "NOT";
|
|
368
|
-
if (allSameKey && !isLogicalKey) {
|
|
368
|
+
if (allSameKey && !isLogicalKey && orItems.length > 1) {
|
|
369
369
|
const innerList = orItems.map((it) => it[commonKey]).filter((v) => isPlainObject(v));
|
|
370
370
|
const anyScalar = innerList.some(isScalarFilterObject);
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
const anyRelation = innerList.some(isRelationFilterObject);
|
|
372
|
+
if (!anyScalar && !anyRelation) {
|
|
373
|
+
const shouldFold = innerList.some(
|
|
373
374
|
(o) => Object.keys(o).some((k) => !SCALAR_OPS.has(k) && k !== "AND" && k !== "OR" && k !== "NOT")
|
|
374
375
|
);
|
|
375
376
|
if (shouldFold) {
|