@dyrected/core 2.5.8 → 2.5.9
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.cjs +6 -4
- package/dist/index.js +6 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1008,10 +1008,11 @@ function parseSqlWhere(where, getJsonField, placeholder = "?") {
|
|
|
1008
1008
|
function buildClause(w) {
|
|
1009
1009
|
const parts = [];
|
|
1010
1010
|
for (const [field, value] of Object.entries(w)) {
|
|
1011
|
-
|
|
1011
|
+
const upperField = field.toUpperCase();
|
|
1012
|
+
if (upperField === "OR" && Array.isArray(value)) {
|
|
1012
1013
|
const sub = value.map((v) => `(${buildClause(v)})`).join(" OR ");
|
|
1013
1014
|
parts.push(`(${sub})`);
|
|
1014
|
-
} else if (
|
|
1015
|
+
} else if (upperField === "AND" && Array.isArray(value)) {
|
|
1015
1016
|
const sub = value.map((v) => `(${buildClause(v)})`).join(" AND ");
|
|
1016
1017
|
parts.push(`(${sub})`);
|
|
1017
1018
|
} else {
|
|
@@ -1070,9 +1071,10 @@ function parseMongoWhere(where) {
|
|
|
1070
1071
|
function buildClause(w) {
|
|
1071
1072
|
const conditions = [];
|
|
1072
1073
|
for (const [field, value] of Object.entries(w)) {
|
|
1073
|
-
|
|
1074
|
+
const upperField = field.toUpperCase();
|
|
1075
|
+
if (upperField === "OR" && Array.isArray(value)) {
|
|
1074
1076
|
conditions.push({ $or: value.map(buildClause) });
|
|
1075
|
-
} else if (
|
|
1077
|
+
} else if (upperField === "AND" && Array.isArray(value)) {
|
|
1076
1078
|
conditions.push({ $and: value.map(buildClause) });
|
|
1077
1079
|
} else {
|
|
1078
1080
|
conditions.push(buildOperator(field, value));
|
package/dist/index.js
CHANGED
|
@@ -902,10 +902,11 @@ function parseSqlWhere(where, getJsonField, placeholder = "?") {
|
|
|
902
902
|
function buildClause(w) {
|
|
903
903
|
const parts = [];
|
|
904
904
|
for (const [field, value] of Object.entries(w)) {
|
|
905
|
-
|
|
905
|
+
const upperField = field.toUpperCase();
|
|
906
|
+
if (upperField === "OR" && Array.isArray(value)) {
|
|
906
907
|
const sub = value.map((v) => `(${buildClause(v)})`).join(" OR ");
|
|
907
908
|
parts.push(`(${sub})`);
|
|
908
|
-
} else if (
|
|
909
|
+
} else if (upperField === "AND" && Array.isArray(value)) {
|
|
909
910
|
const sub = value.map((v) => `(${buildClause(v)})`).join(" AND ");
|
|
910
911
|
parts.push(`(${sub})`);
|
|
911
912
|
} else {
|
|
@@ -964,9 +965,10 @@ function parseMongoWhere(where) {
|
|
|
964
965
|
function buildClause(w) {
|
|
965
966
|
const conditions = [];
|
|
966
967
|
for (const [field, value] of Object.entries(w)) {
|
|
967
|
-
|
|
968
|
+
const upperField = field.toUpperCase();
|
|
969
|
+
if (upperField === "OR" && Array.isArray(value)) {
|
|
968
970
|
conditions.push({ $or: value.map(buildClause) });
|
|
969
|
-
} else if (
|
|
971
|
+
} else if (upperField === "AND" && Array.isArray(value)) {
|
|
970
972
|
conditions.push({ $and: value.map(buildClause) });
|
|
971
973
|
} else {
|
|
972
974
|
conditions.push(buildOperator(field, value));
|