@react-querybuilder/core 8.21.2 → 8.22.1
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/README.md +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +1399 -44
- package/dist/cjs/react-querybuilder_core.cjs.development.js +2244 -87
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +1399 -44
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/formatQuery.js +47 -38
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +47 -38
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/parseCEL.js +6 -8
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +6 -8
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.js.map +1 -1
- package/dist/parseJSONata.js +2 -2
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs +1 -1
- package/dist/parseJsonLogic.js +3 -3
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs +3 -3
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.js +2 -2
- package/dist/parseMongoDB.mjs +2 -2
- package/dist/parseSPARQL.js +0 -1
- package/dist/parseSPARQL.js.map +1 -1
- package/dist/parseSPARQL.mjs +0 -1
- package/dist/parseSPARQL.mjs.map +1 -1
- package/dist/parseSQL.js +54 -62
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +54 -62
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.js +3 -3
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs +3 -3
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/{prepareQueryObjects-C5dHLhnC.js → prepareQueryObjects-BnGL91Tt.js} +9 -5
- package/dist/{prepareQueryObjects-C5dHLhnC.js.map → prepareQueryObjects-BnGL91Tt.js.map} +1 -1
- package/dist/{prepareQueryObjects-9emVAGYG.mjs → prepareQueryObjects-ChINDIap.mjs} +9 -5
- package/dist/{prepareQueryObjects-9emVAGYG.mjs.map → prepareQueryObjects-ChINDIap.mjs.map} +1 -1
- package/dist/query-builder-layout.css +1 -1
- package/dist/query-builder-layout.css.map +1 -1
- package/dist/query-builder.css +1 -1
- package/dist/query-builder.css.map +1 -1
- package/dist/react-querybuilder_core.d.mts +1399 -44
- package/dist/react-querybuilder_core.legacy-esm.d.ts +1399 -44
- package/dist/react-querybuilder_core.legacy-esm.js +2266 -81
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +2202 -89
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +1399 -44
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/styles/_layout.scss +5 -2
- package/dist/{utils-CxWs-N47.mjs → utils-4k-j5FBa.mjs} +4 -2
- package/dist/utils-4k-j5FBa.mjs.map +1 -0
- package/dist/{utils-SchkzSCN.js → utils-C79dxwZb.js} +4 -2
- package/dist/utils-C79dxwZb.js.map +1 -0
- package/package.json +9 -8
- package/dist/utils-CxWs-N47.mjs.map +0 -1
- package/dist/utils-SchkzSCN.js.map +0 -1
package/dist/formatQuery.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as withParamPrefix, E as getOption, F as trimIfString, M as parseNumber, P as toArray, S as subqueryElementAliasBase, T as getParseNumberMethod, _ as numerifyValues, a as getLikeWildcards, b as shouldRenderAsNumber, c as getQuotedFieldName, d as isValidValue, f as isValueProcessorLegacy, g as normalizeConstituentWordOrder, h as mongoOperators, i as defaultNLTranslations, j as toFullOptionList, k as toFlatOptionArray, l as getSQLConcat, m as mapSQLOperator, n as bigIntJsonStringifyReplacer, o as getNLTranslataion, p as jsonLogicAdditionalOperators, r as celCombinatorMap, s as getQuoteFieldNamesWithArray, t as bigIntJsonParseReviver, u as getSubqueryElementAlias, v as prismaOperators, w as wrapLikeFragment, x as stripParamPrefix, y as processMatchMode } from "./utils-
|
|
1
|
+
import { C as withParamPrefix, E as getOption, F as trimIfString, M as parseNumber, P as toArray, S as subqueryElementAliasBase, T as getParseNumberMethod, _ as numerifyValues, a as getLikeWildcards, b as shouldRenderAsNumber, c as getQuotedFieldName, d as isValidValue, f as isValueProcessorLegacy, g as normalizeConstituentWordOrder, h as mongoOperators, i as defaultNLTranslations, j as toFullOptionList, k as toFlatOptionArray, l as getSQLConcat, m as mapSQLOperator, n as bigIntJsonStringifyReplacer, o as getNLTranslataion, p as jsonLogicAdditionalOperators, r as celCombinatorMap, s as getQuoteFieldNamesWithArray, t as bigIntJsonParseReviver, u as getSubqueryElementAlias, v as prismaOperators, w as wrapLikeFragment, x as stripParamPrefix, y as processMatchMode } from "./utils-4k-j5FBa.mjs";
|
|
2
2
|
import { a as lc, i as isPojo, n as isRuleGroupType, o as nullOrUndefinedOrEmpty, r as isRuleGroupTypeIC, s as numericRegex, t as isRuleGroup } from "./isRuleGroup-CqLThsbu.mjs";
|
|
3
3
|
import { transformQuery } from "./transformQuery.mjs";
|
|
4
4
|
import { t as convertFromIC } from "./convertQuery-D_4J7E-Z.mjs";
|
|
@@ -34,7 +34,7 @@ const isRuleOrGroupValid = (rg, validationResult, validator) => {
|
|
|
34
34
|
const defaultRuleGroupProcessorCEL = (ruleGroup, options) => {
|
|
35
35
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
36
36
|
const processRuleGroup = (rg, outermost) => {
|
|
37
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
37
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
38
38
|
const processedRules = [];
|
|
39
39
|
let precedingCombinator = "";
|
|
40
40
|
let firstRule = true;
|
|
@@ -100,10 +100,11 @@ const defaultRuleProcessorCEL = (rule, opts = {}) => {
|
|
|
100
100
|
const { mode, threshold } = matchEval;
|
|
101
101
|
const subqueryDepth = opts.subqueryDepth ?? 0;
|
|
102
102
|
const arrayElementAlias = getSubqueryElementAlias(subqueryDepth);
|
|
103
|
-
const
|
|
103
|
+
const celQuery = transformQuery(rule.value, { ruleProcessor: (r) => ({
|
|
104
104
|
...r,
|
|
105
105
|
field: `${arrayElementAlias}${r.field ? `.${r.field}` : ""}`
|
|
106
|
-
}) })
|
|
106
|
+
}) });
|
|
107
|
+
const nestedArrayFilter = defaultRuleGroupProcessorCEL(celQuery, {
|
|
107
108
|
...opts,
|
|
108
109
|
subqueryDepth: subqueryDepth + 1
|
|
109
110
|
});
|
|
@@ -180,7 +181,7 @@ const defaultRuleGroupProcessorMongoDBQuery = (ruleGroup, options, meta) => {
|
|
|
180
181
|
const { context, fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
181
182
|
const { inExpressionContext } = context ?? {};
|
|
182
183
|
const processRuleGroup = (rg, outermost) => {
|
|
183
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? mongoDbFallback : false;
|
|
184
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? mongoDbFallback : false;
|
|
184
185
|
const combinator = `$${lc(rg.combinator)}`;
|
|
185
186
|
let hasChildRules = false;
|
|
186
187
|
const expressions = rg.rules.map((rule) => {
|
|
@@ -358,7 +359,7 @@ const defaultRuleProcessorMongoDB = (rule, options) => {
|
|
|
358
359
|
const defaultRuleGroupProcessorSpEL = (ruleGroup, options) => {
|
|
359
360
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
360
361
|
const processRuleGroup = (rg, outermost) => {
|
|
361
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
362
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
362
363
|
const processedRules = [];
|
|
363
364
|
let precedingCombinator = "";
|
|
364
365
|
let firstRule = true;
|
|
@@ -599,7 +600,7 @@ const cypherCombinatorMap = {
|
|
|
599
600
|
const defaultRuleGroupProcessorCypher = (ruleGroup, options) => {
|
|
600
601
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
601
602
|
const processRuleGroup = (rg, outermost) => {
|
|
602
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
603
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
603
604
|
const processedRules = [];
|
|
604
605
|
let precedingCombinator = "";
|
|
605
606
|
let firstRule = true;
|
|
@@ -663,7 +664,7 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
663
664
|
if (!columns || !drizzleOperators) return void 0;
|
|
664
665
|
const { and, not, or } = drizzleOperators;
|
|
665
666
|
const processRuleGroup = (rg, _outermost) => {
|
|
666
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return;
|
|
667
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return;
|
|
667
668
|
const processedRules = rg.rules.map((rule) => {
|
|
668
669
|
if (isRuleGroup(rule)) return processRuleGroup(rule);
|
|
669
670
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
@@ -696,7 +697,7 @@ const defaultRuleGroupProcessorDrizzle = (ruleGroup, options, _meta) => (columns
|
|
|
696
697
|
const defaultRuleGroupProcessorElasticSearch = (ruleGroup, options) => {
|
|
697
698
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
698
699
|
const processRuleGroup = (rg) => {
|
|
699
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return false;
|
|
700
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return false;
|
|
700
701
|
const processedRules = rg.rules.map((rule) => {
|
|
701
702
|
if (isRuleGroup(rule)) return processRuleGroup(rule);
|
|
702
703
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
@@ -731,7 +732,9 @@ const defaultRuleGroupProcessorGremlin = (ruleGroup, options) => {
|
|
|
731
732
|
// v8 ignore next -- @preserve
|
|
732
733
|
if (typeof rule === "string" || isRuleGroup(rule)) return void 0;
|
|
733
734
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
734
|
-
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) ||
|
|
735
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) ||
|
|
736
|
+
/* v8 ignore next 2 -- @preserve */
|
|
737
|
+
rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return;
|
|
735
738
|
const fieldData = getOption(fields, rule.field);
|
|
736
739
|
return ruleProcessor(rule, {
|
|
737
740
|
...options,
|
|
@@ -742,7 +745,7 @@ const defaultRuleGroupProcessorGremlin = (ruleGroup, options) => {
|
|
|
742
745
|
};
|
|
743
746
|
/** Recursively processes a nested group into `.and()`/`.or()`/`.not()` form. */
|
|
744
747
|
const processNested = (rg) => {
|
|
745
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return "";
|
|
748
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return "";
|
|
746
749
|
const predicates = [];
|
|
747
750
|
for (const rule of rg.rules) {
|
|
748
751
|
if (typeof rule === "string") continue;
|
|
@@ -760,7 +763,7 @@ const defaultRuleGroupProcessorGremlin = (ruleGroup, options) => {
|
|
|
760
763
|
if (predicates.length === 1 && !rg.not) return predicates[0];
|
|
761
764
|
return `.${prefix}(${predicates.map((p) => p.startsWith(".") ? `__${p}` : p).join(", ")})`;
|
|
762
765
|
};
|
|
763
|
-
if (!isRuleOrGroupValid(ruleGroup, validationMap[ruleGroup.id ?? ""])) return fallbackExpression;
|
|
766
|
+
if (!isRuleOrGroupValid(ruleGroup, validationMap[ruleGroup.id ?? /* v8 ignore start -- @preserve */ ""])) return fallbackExpression;
|
|
764
767
|
const steps = [];
|
|
765
768
|
for (const rule of ruleGroup.rules) {
|
|
766
769
|
if (typeof rule === "string") continue;
|
|
@@ -785,7 +788,7 @@ const defaultRuleGroupProcessorGremlin = (ruleGroup, options) => {
|
|
|
785
788
|
const defaultRuleGroupProcessorJSONata = (ruleGroup, options) => {
|
|
786
789
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
787
790
|
const processRuleGroup = (rg, outermost) => {
|
|
788
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
791
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
789
792
|
const processedRules = [];
|
|
790
793
|
let precedingCombinator = "";
|
|
791
794
|
let firstRule = true;
|
|
@@ -841,7 +844,7 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
|
|
|
841
844
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
842
845
|
const query = convertFromIC(ruleGroup);
|
|
843
846
|
const processRuleGroup = (rg, _outermost) => {
|
|
844
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return false;
|
|
847
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return false;
|
|
845
848
|
const processedRules = rg.rules.map((rule) => {
|
|
846
849
|
if (isRuleGroup(rule)) return processRuleGroup(rule);
|
|
847
850
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
@@ -869,7 +872,7 @@ const defaultRuleGroupProcessorJsonLogic = (ruleGroup, options) => {
|
|
|
869
872
|
const defaultRuleGroupProcessorLDAP = (ruleGroup, options) => {
|
|
870
873
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
871
874
|
const processRuleGroup = (rg, outermost) => {
|
|
872
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
875
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
873
876
|
const rules = rg.rules.map((rule) => {
|
|
874
877
|
if (isRuleGroup(rule)) return processRuleGroup(rule);
|
|
875
878
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
@@ -902,7 +905,7 @@ const isBracketed = (str) => str.startsWith("{") && str.endsWith("}");
|
|
|
902
905
|
const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
|
|
903
906
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
904
907
|
const processRuleGroup = (rg, outermost) => {
|
|
905
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
908
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
906
909
|
const combinator = `"$${lc(rg.combinator)}"`;
|
|
907
910
|
let hasChildRules = false;
|
|
908
911
|
const expressions = rg.rules.map((rule) => {
|
|
@@ -939,7 +942,7 @@ const defaultRuleGroupProcessorMongoDB = (ruleGroup, options, meta) => {
|
|
|
939
942
|
const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
940
943
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, translations, validateRule, validationMap } = options;
|
|
941
944
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
942
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
945
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
943
946
|
const rg2 = isRuleGroupTypeIC(rg) && rg.rules.some((r) => typeof r === "string" && lc(r) === "xor") ? convertFromIC(rg) : rg;
|
|
944
947
|
const processedRules = [];
|
|
945
948
|
let precedingCombinator = "";
|
|
@@ -950,7 +953,8 @@ const defaultRuleGroupProcessorNL = (ruleGroup, options) => {
|
|
|
950
953
|
continue;
|
|
951
954
|
}
|
|
952
955
|
if (isRuleGroup(rule)) {
|
|
953
|
-
const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test(rg2.combinator ??
|
|
956
|
+
const processedGroup = processRuleGroup(rule, rg2.rules.length === 1 && !(rg2.not || /^xor$/i.test(rg2.combinator ??
|
|
957
|
+
/* v8 ignore start -- @preserve */ "")));
|
|
954
958
|
// v8 ignore else
|
|
955
959
|
if (processedGroup) {
|
|
956
960
|
if (!firstRule && precedingCombinator) {
|
|
@@ -1037,7 +1041,7 @@ const defaultRuleGroupProcessorParameterized = (ruleGroup, options) => {
|
|
|
1037
1041
|
return sql;
|
|
1038
1042
|
};
|
|
1039
1043
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
1040
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
1044
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
1041
1045
|
const processedRules = [];
|
|
1042
1046
|
let precedingCombinator = "";
|
|
1043
1047
|
let firstRule = true;
|
|
@@ -1097,7 +1101,7 @@ const prismaFallback = {};
|
|
|
1097
1101
|
const defaultRuleGroupProcessorPrisma = (ruleGroup, options) => {
|
|
1098
1102
|
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1099
1103
|
const processRuleGroup = (rg, outermost) => {
|
|
1100
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? prismaFallback : void 0;
|
|
1104
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? prismaFallback : void 0;
|
|
1101
1105
|
const combinator = rg.combinator.toUpperCase();
|
|
1102
1106
|
let hasChildRules = false;
|
|
1103
1107
|
const expressions = rg.rules.map((rule) => {
|
|
@@ -1136,7 +1140,7 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
|
|
|
1136
1140
|
const { sequelizeOperators: Op } = context;
|
|
1137
1141
|
if (!Op) return void 0;
|
|
1138
1142
|
const processRuleGroup = (rg, _outermost) => {
|
|
1139
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return;
|
|
1143
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return;
|
|
1140
1144
|
const combinator = rg.combinator.toUpperCase();
|
|
1141
1145
|
let hasChildRules = false;
|
|
1142
1146
|
const expressions = rg.rules.map((rule) => {
|
|
@@ -1175,7 +1179,7 @@ const defaultRuleGroupProcessorSequelize = (ruleGroup, options) => {
|
|
|
1175
1179
|
const defaultRuleGroupProcessorSPARQL = (ruleGroup, options) => {
|
|
1176
1180
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1177
1181
|
const processRuleGroup = (rg, outermost) => {
|
|
1178
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermost ? fallbackExpression : "";
|
|
1182
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermost ? fallbackExpression : "";
|
|
1179
1183
|
const processedRules = [];
|
|
1180
1184
|
let precedingCombinator = "";
|
|
1181
1185
|
let firstRule = true;
|
|
@@ -1230,7 +1234,7 @@ const defaultRuleGroupProcessorSPARQL = (ruleGroup, options) => {
|
|
|
1230
1234
|
const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
|
|
1231
1235
|
const { fields, fallbackExpression, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, ruleProcessor, validateRule, validationMap } = options;
|
|
1232
1236
|
const processRuleGroup = (rg, outermostOrLonelyInGroup) => {
|
|
1233
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
1237
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return outermostOrLonelyInGroup ? fallbackExpression : "";
|
|
1234
1238
|
const processedRules = [];
|
|
1235
1239
|
let precedingCombinator = "";
|
|
1236
1240
|
let firstRule = true;
|
|
@@ -1298,7 +1302,7 @@ const defaultRuleGroupProcessorTanStackDB = (ruleGroup, options) => (refs) => {
|
|
|
1298
1302
|
/* v8 ignore next -- @preserve */
|
|
1299
1303
|
if (refKeys.length === 0) return fallback;
|
|
1300
1304
|
const processRuleGroup = (rg) => {
|
|
1301
|
-
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return;
|
|
1305
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? /* v8 ignore start -- @preserve */ ""])) return;
|
|
1302
1306
|
const processedRules = rg.rules.map((rule) => {
|
|
1303
1307
|
if (isRuleGroup(rule)) return processRuleGroup(rule);
|
|
1304
1308
|
const [validationResult, fieldValidator] = validateRule(rule);
|
|
@@ -1701,7 +1705,7 @@ const defaultRuleProcessorCypher = (rule, opts = {}) => {
|
|
|
1701
1705
|
* @group Export
|
|
1702
1706
|
*/
|
|
1703
1707
|
const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
1704
|
-
const opts = _options ??
|
|
1708
|
+
const opts = _options ?? /* v8 ignore start -- @preserve */ {};
|
|
1705
1709
|
// v8 ignore next
|
|
1706
1710
|
const { parseNumbers, preserveValueOrder, context = {} } = opts;
|
|
1707
1711
|
const { columns, drizzleOperators, useRawFields } = context;
|
|
@@ -1724,10 +1728,11 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
1724
1728
|
const { mode, threshold } = matchEval;
|
|
1725
1729
|
const subqueryDepth = opts.subqueryDepth ?? 0;
|
|
1726
1730
|
const arrayElementAlias = getSubqueryElementAlias(subqueryDepth);
|
|
1727
|
-
const
|
|
1731
|
+
const sqlQuery = transformQuery(rule.value, { ruleProcessor: (r) => ({
|
|
1728
1732
|
...r,
|
|
1729
1733
|
field: arrayElementAlias
|
|
1730
|
-
}) })
|
|
1734
|
+
}) });
|
|
1735
|
+
const nestedArrayFilter = defaultRuleGroupProcessorDrizzle(sqlQuery, {
|
|
1731
1736
|
...opts,
|
|
1732
1737
|
context: {
|
|
1733
1738
|
...opts.context,
|
|
@@ -2266,7 +2271,7 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
|
|
|
2266
2271
|
const { escapeQuotes, fields, parseNumbers, quoteFieldNamesWith, quoteValuesWith, fieldIdentifierSeparator, translations } = opts;
|
|
2267
2272
|
const valueIsField = rule.valueSource === "field";
|
|
2268
2273
|
const operatorLowerCase = lc(rule.operator);
|
|
2269
|
-
const quoteChar = quoteValuesWith || "'";
|
|
2274
|
+
const quoteChar = quoteValuesWith || /* v8 ignore start -- @preserve */ "'";
|
|
2270
2275
|
const quoteValue = (v) => `${quoteChar}${v}${quoteChar}`;
|
|
2271
2276
|
const escapeValue = (v) => escapeStringValueQuotes(v, quoteChar, escapeQuotes);
|
|
2272
2277
|
const wrapAndEscape = (v) => quoteValue(escapeValue(v));
|
|
@@ -2274,7 +2279,7 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
|
|
|
2274
2279
|
quoteFieldNamesWith,
|
|
2275
2280
|
fieldIdentifierSeparator
|
|
2276
2281
|
});
|
|
2277
|
-
const t = translations ??
|
|
2282
|
+
const t = translations ?? /* v8 ignore start -- @preserve */ {};
|
|
2278
2283
|
const orTL = t.or ?? "or";
|
|
2279
2284
|
const trueTL = t.true ?? "true";
|
|
2280
2285
|
const falseTL = t.false ?? "false";
|
|
@@ -2286,7 +2291,8 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
|
|
|
2286
2291
|
case "between":
|
|
2287
2292
|
case "notbetween": {
|
|
2288
2293
|
if (!valueIsField) return defaultValueProcessorByRule(rule, opts);
|
|
2289
|
-
const valueAsArray = toArray(rule.value, { retainEmptyStrings: true }).slice(0, 2).map((v) => wrapFieldName(getOption(fields ??
|
|
2294
|
+
const valueAsArray = toArray(rule.value, { retainEmptyStrings: true }).slice(0, 2).map((v) => wrapFieldName(getOption(fields ??
|
|
2295
|
+
/* v8 ignore start -- @preserve */ [], v)?.label ?? v));
|
|
2290
2296
|
if (valueAsArray.length < 2 || !isValidValue(valueAsArray[0]) || !isValidValue(valueAsArray[1])) return "";
|
|
2291
2297
|
return defaultValueProcessorByRule({
|
|
2292
2298
|
...rule,
|
|
@@ -2297,14 +2303,16 @@ const defaultValueProcessorNL = (rule, opts = {}) => {
|
|
|
2297
2303
|
case "notin": {
|
|
2298
2304
|
const valueAsArray = toArray(rule.value);
|
|
2299
2305
|
if (valueAsArray.length === 0) return "";
|
|
2300
|
-
const valStringArray = valueAsArray.map((v) => valueIsField ? wrapFieldName(getOption(fields ??
|
|
2306
|
+
const valStringArray = valueAsArray.map((v) => valueIsField ? wrapFieldName(getOption(fields ??
|
|
2307
|
+
/* v8 ignore start -- @preserve */ [], v)?.label ?? v) : shouldRenderAsNumber(v, parseNumbers) ? `${trimIfString(v)}` : `${wrapAndEscape(v)}`);
|
|
2301
2308
|
if (valStringArray.length === 1) return valStringArray[0];
|
|
2302
2309
|
const oxfordComma = useOxfordComma && valStringArray.length > 2 ? "," : "";
|
|
2303
2310
|
return `(${`${valStringArray.slice(0, -1).join(listSep)}${oxfordComma} ${orTL} ${valStringArray.at(-1)}`})`;
|
|
2304
2311
|
}
|
|
2305
2312
|
}
|
|
2306
2313
|
if (typeof rule.value === "boolean") return rule.value ? trueTL : falseTL;
|
|
2307
|
-
return valueIsField ? wrapFieldName(getOption(fields ??
|
|
2314
|
+
return valueIsField ? wrapFieldName(getOption(fields ??
|
|
2315
|
+
/* v8 ignore start -- @preserve */ [], rule.value)?.label ?? rule.value) : shouldRenderAsNumber(rule.value, parseNumbers) ? `${trimIfString(rule.value)}` : `${wrapAndEscape(rule.value)}`;
|
|
2308
2316
|
};
|
|
2309
2317
|
//#endregion
|
|
2310
2318
|
//#region src/utils/formatQuery/defaultRuleProcessorNL.ts
|
|
@@ -2356,7 +2364,7 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
|
|
|
2356
2364
|
name: field,
|
|
2357
2365
|
value: field,
|
|
2358
2366
|
label: field
|
|
2359
|
-
} }) ?? []), normalizedOperator) ?? {
|
|
2367
|
+
} }) ?? /* v8 ignore start -- @preserve */ []), normalizedOperator) ?? {
|
|
2360
2368
|
name: normalizedOperator,
|
|
2361
2369
|
value: normalizedOperator,
|
|
2362
2370
|
label: normalizedOperator
|
|
@@ -2372,7 +2380,7 @@ const defaultOperatorProcessorNL = (rule, opts = {}) => {
|
|
|
2372
2380
|
const defaultRuleProcessorNL = (rule, opts) => {
|
|
2373
2381
|
const { field, operator } = rule;
|
|
2374
2382
|
// v8 ignore next
|
|
2375
|
-
const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", quoteValuesWith = `'`, operatorProcessor = defaultOperatorProcessorNL, valueProcessor = defaultValueProcessorNL, concatOperator = "||", wordOrder = "SVO" } = opts ??
|
|
2383
|
+
const { fieldData, quoteFieldNamesWith = ["", ""], fieldIdentifierSeparator = "", quoteValuesWith = `'`, operatorProcessor = defaultOperatorProcessorNL, valueProcessor = defaultValueProcessorNL, concatOperator = "||", wordOrder = "SVO" } = opts ?? /* v8 ignore start -- @preserve */ {};
|
|
2376
2384
|
const processedField = getQuotedFieldName(fieldData?.label ?? field, {
|
|
2377
2385
|
quoteFieldNamesWith,
|
|
2378
2386
|
fieldIdentifierSeparator
|
|
@@ -2593,7 +2601,7 @@ const defaultRuleProcessorParameterized = (rule, opts, meta) => {
|
|
|
2593
2601
|
}
|
|
2594
2602
|
let paramValue = rule.value;
|
|
2595
2603
|
if (typeof rule.value === "string") if (shouldRenderAsNumber(rule.value, parseNumbers)) paramValue = parseNumber(rule.value, { parseNumbers });
|
|
2596
|
-
else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") :
|
|
2604
|
+
else paramValue = /^'.*'$/g.test(value) ? value.replaceAll(/(^'|'$)/g, "") : /* v8 ignore next -- @preserve */ value;
|
|
2597
2605
|
let paramName = "";
|
|
2598
2606
|
if (parameterized) params.push(paramValue);
|
|
2599
2607
|
else {
|
|
@@ -2810,7 +2818,7 @@ const defaultRuleProcessorSPARQL = (rule, opts = {}) => {
|
|
|
2810
2818
|
* @group Export
|
|
2811
2819
|
*/
|
|
2812
2820
|
const defaultRuleProcessorTanStackDB = (rule, _options) => {
|
|
2813
|
-
const { parseNumbers, preserveValueOrder, context = {} } = _options ??
|
|
2821
|
+
const { parseNumbers, preserveValueOrder, context = {} } = _options ?? /* v8 ignore start -- @preserve */ {};
|
|
2814
2822
|
const ops = context.tanStackDbOperators;
|
|
2815
2823
|
const refs = context._tanstackDbRefs;
|
|
2816
2824
|
const primaryRef = context._tanstackDbPrimaryRef;
|
|
@@ -3046,7 +3054,8 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
3046
3054
|
const ruleProcessor = (typeof ruleProcessor_option === "function" ? ruleProcessor_option : null) ?? (valueProcessorCanActAsRuleProcessor.has(format) && typeof ruleProcessor_option !== "function" && valueProcessor_option ? valueProcessor : null) ?? defaultRuleProcessors[format] ?? defaultRuleProcessorSQL;
|
|
3047
3055
|
const quoteFieldNamesWith = getQuoteFieldNamesWithArray(quoteFieldNamesWith_option);
|
|
3048
3056
|
const fields = toFullOptionList(optObj.fields);
|
|
3049
|
-
const getOperators = (f, m) => toFullOptionList(getOperators_option(f, m) ??
|
|
3057
|
+
const getOperators = (f, m) => toFullOptionList(getOperators_option(f, m) ??
|
|
3058
|
+
/* v8 ignore start -- @preserve */ []);
|
|
3050
3059
|
const fallbackExpression = fallbackExpression_option ?? defaultFallbackExpressions[format] ?? defaultFallbackExpressions.sql;
|
|
3051
3060
|
let validationMap = {};
|
|
3052
3061
|
// v8 ignore else
|
|
@@ -3069,7 +3078,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
3069
3078
|
const uniqueFields = toFlatOptionArray(fields);
|
|
3070
3079
|
for (const f of uniqueFields)
|
|
3071
3080
|
// v8 ignore else
|
|
3072
|
-
if (typeof f.validator === "function") validatorMap[f.value ?? f.name] = f.validator;
|
|
3081
|
+
if (typeof f.validator === "function") validatorMap[f.value ?? /* v8 ignore start -- @preserve */ f.name] = f.validator;
|
|
3073
3082
|
const validateRule = (rule) => {
|
|
3074
3083
|
let validationResult;
|
|
3075
3084
|
let fieldValidator;
|