@react-querybuilder/core 8.16.1 → 8.16.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/dist/cjs/react-querybuilder_core.cjs.development.d.ts +37 -3
- package/dist/cjs/react-querybuilder_core.cjs.development.js +155 -9
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +37 -3
- 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.d.mts +37 -3
- package/dist/formatQuery.d.ts +37 -3
- package/dist/formatQuery.js +155 -9
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +154 -10
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-BC_bAKQ8.d.mts → import-BXXgiPlr.d.mts} +2 -2
- package/dist/{import-D1KnXhkQ.d.ts → import-DqzM2MBd.d.ts} +2 -2
- package/dist/{index-AAZg4Uh1.d.mts → index-CR-tk4Ci.d.mts} +2 -2
- package/dist/{index-Ds06V0zO.d.ts → index-NSVgGj45.d.ts} +2 -2
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCypher.d.mts +1 -1
- package/dist/parseCypher.d.ts +1 -1
- package/dist/parseGremlin.d.mts +1 -1
- package/dist/parseGremlin.d.ts +1 -1
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJsonLogic.d.mts +2 -2
- package/dist/parseJsonLogic.d.ts +2 -2
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseSPARQL.d.mts +1 -1
- package/dist/parseSPARQL.d.ts +1 -1
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/react-querybuilder_core.d.mts +37 -3
- package/dist/react-querybuilder_core.legacy-esm.d.ts +37 -3
- package/dist/react-querybuilder_core.legacy-esm.js +154 -10
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +154 -10
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +37 -3
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/package.json +15 -11
package/dist/formatQuery.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-
|
|
1
|
+
import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-CR-tk4Ci.mjs";
|
|
2
2
|
import { Column, Operators, SQL, Table } from "drizzle-orm";
|
|
3
3
|
import { WhereOptions } from "sequelize";
|
|
4
|
+
import { eq } from "@tanstack/db";
|
|
4
5
|
|
|
5
6
|
//#region src/utils/formatQuery/defaultRuleProcessorCEL.d.ts
|
|
6
7
|
/**
|
|
@@ -213,6 +214,23 @@ declare const defaultRuleGroupProcessorSpEL: RuleGroupProcessor<string>;
|
|
|
213
214
|
*/
|
|
214
215
|
declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
215
216
|
//#endregion
|
|
217
|
+
//#region src/utils/formatQuery/tanStackDbTypes.d.ts
|
|
218
|
+
type TanStackDbWhereCallbackReturnType = ReturnType<typeof eq>;
|
|
219
|
+
type TanStackDbWhereCallback = (refs: Record<string, unknown>) => TanStackDbWhereCallbackReturnType;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.d.ts
|
|
222
|
+
/**
|
|
223
|
+
* Default rule group processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
224
|
+
* Returns a `WhereCallback` suitable for TanStack DB's `.where()` method.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const where = formatQuery(query, { format: 'tanstack_db', context: { tanstackDb: tsdb } });
|
|
228
|
+
* const results = useLiveQuery(q => q.from({ todo: todosCollection }).where(where));
|
|
229
|
+
*
|
|
230
|
+
* @group Export
|
|
231
|
+
*/
|
|
232
|
+
declare const defaultRuleGroupProcessorTanStackDB: RuleGroupProcessor<TanStackDbWhereCallback>;
|
|
233
|
+
//#endregion
|
|
216
234
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.d.ts
|
|
217
235
|
/**
|
|
218
236
|
* Rule group processor used by {@link formatQuery} for "diagnostics" format.
|
|
@@ -364,6 +382,14 @@ declare const defaultOperatorProcessorSQL: RuleProcessor;
|
|
|
364
382
|
*/
|
|
365
383
|
declare const defaultRuleProcessorSQL: RuleProcessor;
|
|
366
384
|
//#endregion
|
|
385
|
+
//#region src/utils/formatQuery/defaultRuleProcessorTanStackDB.d.ts
|
|
386
|
+
/**
|
|
387
|
+
* Default rule processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
388
|
+
*
|
|
389
|
+
* @group Export
|
|
390
|
+
*/
|
|
391
|
+
declare const defaultRuleProcessorTanStackDB: RuleProcessor;
|
|
392
|
+
//#endregion
|
|
367
393
|
//#region src/utils/formatQuery/defaultValueProcessorNL.d.ts
|
|
368
394
|
/**
|
|
369
395
|
* Default value processor used by {@link formatQuery} for "natural_language" format.
|
|
@@ -477,7 +503,15 @@ declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "drizzle" | (
|
|
|
477
503
|
format: "drizzle";
|
|
478
504
|
})): ReturnType<typeof defaultRuleGroupProcessorDrizzle>;
|
|
479
505
|
/**
|
|
480
|
-
* Generates a
|
|
506
|
+
* Generates a TanStack DB WhereCallback from an RQB query object. The callback can
|
|
507
|
+
* be passed directly to TanStack DB's `.where()` method.
|
|
508
|
+
*
|
|
509
|
+
* @group Export
|
|
510
|
+
*/
|
|
511
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "tanstack_db" | (FormatQueryOptions & {
|
|
512
|
+
format: "tanstack_db";
|
|
513
|
+
})): ReturnType<typeof defaultRuleGroupProcessorTanStackDB>;
|
|
514
|
+
/**
|
|
481
515
|
* be assigned to the `where` property in the Sequelize query functions.
|
|
482
516
|
*
|
|
483
517
|
* @group Export
|
|
@@ -767,5 +801,5 @@ declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
|
767
801
|
*/
|
|
768
802
|
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
769
803
|
//#endregion
|
|
770
|
-
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, cypherCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, formatQuery, formatQueryOptionPresets, getNLTranslataion, getQuoteFieldNamesWithArray, getQuotedFieldName, isValidValue, isValueProcessorLegacy, jsonLogicAdditionalOperators, mapSQLOperator, mongoDbFallback, mongoOperators, normalizeConstituentWordOrder, numerifyValues, prismaFallback, prismaOperators, processMatchMode, shouldRenderAsNumber, sparqlVar, sqlDialectPresets };
|
|
804
|
+
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, cypherCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, formatQuery, formatQueryOptionPresets, getNLTranslataion, getQuoteFieldNamesWithArray, getQuotedFieldName, isValidValue, isValueProcessorLegacy, jsonLogicAdditionalOperators, mapSQLOperator, mongoDbFallback, mongoOperators, normalizeConstituentWordOrder, numerifyValues, prismaFallback, prismaOperators, processMatchMode, shouldRenderAsNumber, sparqlVar, sqlDialectPresets };
|
|
771
805
|
//# sourceMappingURL=formatQuery.d.mts.map
|
package/dist/formatQuery.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-
|
|
1
|
+
import { A as SetRequired, O as RuleType, S as RuleGroupTypeAny, _ as ValueProcessorLegacy, a as ExportOperatorMap, c as NLTranslationKey, d as ParameterizedSQL, f as RQBJsonLogic, g as ValueProcessorByRule, h as SQLPreset, i as ExportObjectFormats, l as NLTranslations, m as RuleProcessor, n as DiagnosticsResult, o as FormatQueryOptions, p as RuleGroupProcessor, r as ExportFormat, s as GroupVariantCondition, t as ConstituentWordOrder, u as ParameterizedNamedSQL, v as ValueProcessorOptions } from "./index-NSVgGj45.js";
|
|
2
2
|
import { Column, Operators, SQL, Table } from "drizzle-orm";
|
|
3
3
|
import { WhereOptions } from "sequelize";
|
|
4
|
+
import { eq } from "@tanstack/db";
|
|
4
5
|
|
|
5
6
|
//#region src/utils/formatQuery/defaultRuleProcessorCEL.d.ts
|
|
6
7
|
/**
|
|
@@ -213,6 +214,23 @@ declare const defaultRuleGroupProcessorSpEL: RuleGroupProcessor<string>;
|
|
|
213
214
|
*/
|
|
214
215
|
declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
215
216
|
//#endregion
|
|
217
|
+
//#region src/utils/formatQuery/tanStackDbTypes.d.ts
|
|
218
|
+
type TanStackDbWhereCallbackReturnType = ReturnType<typeof eq>;
|
|
219
|
+
type TanStackDbWhereCallback = (refs: Record<string, unknown>) => TanStackDbWhereCallbackReturnType;
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.d.ts
|
|
222
|
+
/**
|
|
223
|
+
* Default rule group processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
224
|
+
* Returns a `WhereCallback` suitable for TanStack DB's `.where()` method.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const where = formatQuery(query, { format: 'tanstack_db', context: { tanstackDb: tsdb } });
|
|
228
|
+
* const results = useLiveQuery(q => q.from({ todo: todosCollection }).where(where));
|
|
229
|
+
*
|
|
230
|
+
* @group Export
|
|
231
|
+
*/
|
|
232
|
+
declare const defaultRuleGroupProcessorTanStackDB: RuleGroupProcessor<TanStackDbWhereCallback>;
|
|
233
|
+
//#endregion
|
|
216
234
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.d.ts
|
|
217
235
|
/**
|
|
218
236
|
* Rule group processor used by {@link formatQuery} for "diagnostics" format.
|
|
@@ -364,6 +382,14 @@ declare const defaultOperatorProcessorSQL: RuleProcessor;
|
|
|
364
382
|
*/
|
|
365
383
|
declare const defaultRuleProcessorSQL: RuleProcessor;
|
|
366
384
|
//#endregion
|
|
385
|
+
//#region src/utils/formatQuery/defaultRuleProcessorTanStackDB.d.ts
|
|
386
|
+
/**
|
|
387
|
+
* Default rule processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
388
|
+
*
|
|
389
|
+
* @group Export
|
|
390
|
+
*/
|
|
391
|
+
declare const defaultRuleProcessorTanStackDB: RuleProcessor;
|
|
392
|
+
//#endregion
|
|
367
393
|
//#region src/utils/formatQuery/defaultValueProcessorNL.d.ts
|
|
368
394
|
/**
|
|
369
395
|
* Default value processor used by {@link formatQuery} for "natural_language" format.
|
|
@@ -477,7 +503,15 @@ declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "drizzle" | (
|
|
|
477
503
|
format: "drizzle";
|
|
478
504
|
})): ReturnType<typeof defaultRuleGroupProcessorDrizzle>;
|
|
479
505
|
/**
|
|
480
|
-
* Generates a
|
|
506
|
+
* Generates a TanStack DB WhereCallback from an RQB query object. The callback can
|
|
507
|
+
* be passed directly to TanStack DB's `.where()` method.
|
|
508
|
+
*
|
|
509
|
+
* @group Export
|
|
510
|
+
*/
|
|
511
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "tanstack_db" | (FormatQueryOptions & {
|
|
512
|
+
format: "tanstack_db";
|
|
513
|
+
})): ReturnType<typeof defaultRuleGroupProcessorTanStackDB>;
|
|
514
|
+
/**
|
|
481
515
|
* be assigned to the `where` property in the Sequelize query functions.
|
|
482
516
|
*
|
|
483
517
|
* @group Export
|
|
@@ -767,5 +801,5 @@ declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
|
767
801
|
*/
|
|
768
802
|
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
769
803
|
//#endregion
|
|
770
|
-
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, cypherCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultSpELValueProcessor, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, formatQuery, formatQueryOptionPresets, getNLTranslataion, getQuoteFieldNamesWithArray, getQuotedFieldName, isValidValue, isValueProcessorLegacy, jsonLogicAdditionalOperators, mapSQLOperator, mongoDbFallback, mongoOperators, normalizeConstituentWordOrder, numerifyValues, prismaFallback, prismaOperators, processMatchMode, shouldRenderAsNumber, sparqlVar, sqlDialectPresets };
|
|
804
|
+
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, cypherCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, formatQuery, formatQueryOptionPresets, getNLTranslataion, getQuoteFieldNamesWithArray, getQuotedFieldName, isValidValue, isValueProcessorLegacy, jsonLogicAdditionalOperators, mapSQLOperator, mongoDbFallback, mongoOperators, normalizeConstituentWordOrder, numerifyValues, prismaFallback, prismaOperators, processMatchMode, shouldRenderAsNumber, sparqlVar, sqlDialectPresets };
|
|
771
805
|
//# sourceMappingURL=formatQuery.d.ts.map
|
package/dist/formatQuery.js
CHANGED
|
@@ -619,6 +619,10 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
619
619
|
const operatorLC = require_objectUtils.lc(operator);
|
|
620
620
|
const valueIsField = valueSource === "field";
|
|
621
621
|
const asFieldOrValue = (v) => valueIsField ? columns[v] : v;
|
|
622
|
+
const maybeParseNumber = (v) => {
|
|
623
|
+
if (valueIsField || !parseNumbers) return asFieldOrValue(v);
|
|
624
|
+
return require_utils.shouldRenderAsNumber(v, true) ? require_utils.parseNumber(v, { parseNumbers: true }) : v;
|
|
625
|
+
};
|
|
622
626
|
if (!column) return void 0;
|
|
623
627
|
const matchEval = require_utils.processMatchMode(rule);
|
|
624
628
|
if (matchEval === false) return;
|
|
@@ -649,12 +653,12 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
649
653
|
}
|
|
650
654
|
}
|
|
651
655
|
switch (operatorLC) {
|
|
652
|
-
case "=": return eq(column,
|
|
653
|
-
case "!=": return ne(column,
|
|
654
|
-
case ">": return gt(column,
|
|
655
|
-
case "<": return lt(column,
|
|
656
|
-
case ">=": return gte(column,
|
|
657
|
-
case "<=": return lte(column,
|
|
656
|
+
case "=": return eq(column, maybeParseNumber(value));
|
|
657
|
+
case "!=": return ne(column, maybeParseNumber(value));
|
|
658
|
+
case ">": return gt(column, maybeParseNumber(value));
|
|
659
|
+
case "<": return lt(column, maybeParseNumber(value));
|
|
660
|
+
case ">=": return gte(column, maybeParseNumber(value));
|
|
661
|
+
case "<=": return lte(column, maybeParseNumber(value));
|
|
658
662
|
case "beginswith":
|
|
659
663
|
case "doesnotbeginwith": return (operatorLC === "doesnotbeginwith" ? notLike : like)(column, valueIsField ? sql`${asFieldOrValue(value)} || '%'` : `${value}%`);
|
|
660
664
|
case "contains":
|
|
@@ -665,7 +669,7 @@ const defaultRuleProcessorDrizzle = (rule, _options) => {
|
|
|
665
669
|
case "notnull": return isNotNull(column);
|
|
666
670
|
case "in":
|
|
667
671
|
case "notin": {
|
|
668
|
-
const valueAsArray = require_utils.toArray(value).map((v) =>
|
|
672
|
+
const valueAsArray = require_utils.toArray(value).map((v) => maybeParseNumber(v));
|
|
669
673
|
return operatorLC === "notin" ? notInArray(column, valueAsArray) : inArray(column, valueAsArray);
|
|
670
674
|
}
|
|
671
675
|
case "between":
|
|
@@ -1330,6 +1334,142 @@ const defaultRuleGroupProcessorSQL = (ruleGroup, options) => {
|
|
|
1330
1334
|
return processRuleGroup(ruleGroup, true);
|
|
1331
1335
|
};
|
|
1332
1336
|
//#endregion
|
|
1337
|
+
//#region src/utils/formatQuery/defaultRuleProcessorTanStackDB.ts
|
|
1338
|
+
/**
|
|
1339
|
+
* Default rule processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
1340
|
+
*
|
|
1341
|
+
* @group Export
|
|
1342
|
+
*/
|
|
1343
|
+
const defaultRuleProcessorTanStackDB = (rule, _options) => {
|
|
1344
|
+
const { parseNumbers, preserveValueOrder, context = {} } = _options ?? ( /* v8 ignore start -- @preserve */ {});
|
|
1345
|
+
const ops = context.tanStackDbOperators;
|
|
1346
|
+
const refs = context._tanstackDbRefs;
|
|
1347
|
+
const primaryRef = context._tanstackDbPrimaryRef;
|
|
1348
|
+
if (!ops || !refs || !primaryRef) return void 0;
|
|
1349
|
+
const { and, eq, gt, gte, inArray, isNull, like, lt, lte, not } = ops;
|
|
1350
|
+
const resolveField = (fieldName) => {
|
|
1351
|
+
const dotIdx = fieldName.indexOf(".");
|
|
1352
|
+
if (dotIdx > 0) {
|
|
1353
|
+
const prefix = fieldName.slice(0, dotIdx);
|
|
1354
|
+
const rest = fieldName.slice(dotIdx + 1);
|
|
1355
|
+
if (refs[prefix]) return refs[prefix][rest];
|
|
1356
|
+
}
|
|
1357
|
+
return refs[primaryRef][fieldName];
|
|
1358
|
+
};
|
|
1359
|
+
const { field, operator, value, valueSource } = rule;
|
|
1360
|
+
const column = resolveField(field);
|
|
1361
|
+
const operatorLC = require_objectUtils.lc(operator);
|
|
1362
|
+
const valueIsField = valueSource === "field";
|
|
1363
|
+
const asFieldOrValue = (v) => valueIsField ? resolveField(v) : v;
|
|
1364
|
+
const maybeParseNumber = (v) => {
|
|
1365
|
+
if (valueIsField || !parseNumbers) return asFieldOrValue(v);
|
|
1366
|
+
return require_utils.shouldRenderAsNumber(v, true) ? require_utils.parseNumber(v, { parseNumbers: true }) : v;
|
|
1367
|
+
};
|
|
1368
|
+
switch (operatorLC) {
|
|
1369
|
+
case "=": return eq(column, maybeParseNumber(value));
|
|
1370
|
+
case "!=": return not(eq(column, maybeParseNumber(value)));
|
|
1371
|
+
case ">": return gt(column, maybeParseNumber(value));
|
|
1372
|
+
case "<": return lt(column, maybeParseNumber(value));
|
|
1373
|
+
case ">=": return gte(column, maybeParseNumber(value));
|
|
1374
|
+
case "<=": return lte(column, maybeParseNumber(value));
|
|
1375
|
+
case "beginswith":
|
|
1376
|
+
case "doesnotbeginwith": {
|
|
1377
|
+
const expr = like(column, valueIsField ? void 0 : `${value}%`);
|
|
1378
|
+
return operatorLC === "doesnotbeginwith" ? not(expr) : expr;
|
|
1379
|
+
}
|
|
1380
|
+
case "contains":
|
|
1381
|
+
case "doesnotcontain": {
|
|
1382
|
+
const expr = like(column, valueIsField ? void 0 : `%${value}%`);
|
|
1383
|
+
return operatorLC === "doesnotcontain" ? not(expr) : expr;
|
|
1384
|
+
}
|
|
1385
|
+
case "endswith":
|
|
1386
|
+
case "doesnotendwith": {
|
|
1387
|
+
const expr = like(column, valueIsField ? void 0 : `%${value}`);
|
|
1388
|
+
return operatorLC === "doesnotendwith" ? not(expr) : expr;
|
|
1389
|
+
}
|
|
1390
|
+
case "null": return isNull(column);
|
|
1391
|
+
case "notnull": return not(isNull(column));
|
|
1392
|
+
case "in":
|
|
1393
|
+
case "notin": {
|
|
1394
|
+
const expr = inArray(column, require_utils.toArray(value).map((v) => maybeParseNumber(v)));
|
|
1395
|
+
return operatorLC === "notin" ? not(expr) : expr;
|
|
1396
|
+
}
|
|
1397
|
+
case "between":
|
|
1398
|
+
case "notbetween": {
|
|
1399
|
+
const valueAsArray = require_utils.toArray(value);
|
|
1400
|
+
if (valueAsArray.length >= 2 && require_utils.isValidValue(valueAsArray[0]) && require_utils.isValidValue(valueAsArray[1])) {
|
|
1401
|
+
let [first, second] = valueAsArray;
|
|
1402
|
+
const shouldParseNumbers = !(parseNumbers === false);
|
|
1403
|
+
if (!valueIsField && require_utils.shouldRenderAsNumber(first, shouldParseNumbers) && require_utils.shouldRenderAsNumber(second, shouldParseNumbers)) {
|
|
1404
|
+
const firstNum = require_utils.parseNumber(first, { parseNumbers: shouldParseNumbers });
|
|
1405
|
+
const secondNum = require_utils.parseNumber(second, { parseNumbers: shouldParseNumbers });
|
|
1406
|
+
if (!preserveValueOrder && secondNum < firstNum) {
|
|
1407
|
+
const tempNum = secondNum;
|
|
1408
|
+
second = firstNum;
|
|
1409
|
+
first = tempNum;
|
|
1410
|
+
} else {
|
|
1411
|
+
first = firstNum;
|
|
1412
|
+
second = secondNum;
|
|
1413
|
+
}
|
|
1414
|
+
} else if (valueIsField) {
|
|
1415
|
+
first = asFieldOrValue(first);
|
|
1416
|
+
second = asFieldOrValue(second);
|
|
1417
|
+
}
|
|
1418
|
+
const expr = and(gte(column, first), lte(column, second));
|
|
1419
|
+
return operatorLC === "notbetween" ? not(expr) : expr;
|
|
1420
|
+
}
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
default: return;
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorTanStackDB.ts
|
|
1428
|
+
/**
|
|
1429
|
+
* Default rule group processor used by {@link formatQuery} for the "tanstack_db" format.
|
|
1430
|
+
* Returns a `WhereCallback` suitable for TanStack DB's `.where()` method.
|
|
1431
|
+
*
|
|
1432
|
+
* @example
|
|
1433
|
+
* const where = formatQuery(query, { format: 'tanstack_db', context: { tanstackDb: tsdb } });
|
|
1434
|
+
* const results = useLiveQuery(q => q.from({ todo: todosCollection }).where(where));
|
|
1435
|
+
*
|
|
1436
|
+
* @group Export
|
|
1437
|
+
*/
|
|
1438
|
+
const defaultRuleGroupProcessorTanStackDB = (ruleGroup, options) => (refs) => {
|
|
1439
|
+
const { fields, getParseNumberBoolean, placeholderFieldName, placeholderOperatorName, placeholderValueName, validateRule, validationMap, context = {} } = options;
|
|
1440
|
+
const ops = context.tanStackDbOperators;
|
|
1441
|
+
if (!ops) return void 0;
|
|
1442
|
+
const { and, eq, not, or } = ops;
|
|
1443
|
+
const fallback = eq(1, 1);
|
|
1444
|
+
const refKeys = Object.keys(refs);
|
|
1445
|
+
/* v8 ignore next -- @preserve */
|
|
1446
|
+
if (refKeys.length === 0) return fallback;
|
|
1447
|
+
const ruleProcessor = defaultRuleProcessorTanStackDB;
|
|
1448
|
+
const processRuleGroup = (rg) => {
|
|
1449
|
+
if (!isRuleOrGroupValid(rg, validationMap[rg.id ?? ""])) return;
|
|
1450
|
+
const processedRules = rg.rules.map((rule) => {
|
|
1451
|
+
if (require_objectUtils.isRuleGroup(rule)) return processRuleGroup(rule);
|
|
1452
|
+
const [validationResult, fieldValidator] = validateRule(rule);
|
|
1453
|
+
if (!isRuleOrGroupValid(rule, validationResult, fieldValidator) || rule.field === placeholderFieldName || rule.operator === placeholderOperatorName || placeholderValueName !== void 0 && rule.value === placeholderValueName) return;
|
|
1454
|
+
const fieldData = require_utils.getOption(fields, rule.field);
|
|
1455
|
+
return ruleProcessor(rule, {
|
|
1456
|
+
...options,
|
|
1457
|
+
parseNumbers: getParseNumberBoolean(fieldData?.inputType),
|
|
1458
|
+
fieldData,
|
|
1459
|
+
context: {
|
|
1460
|
+
...context,
|
|
1461
|
+
_tanstackDbRefs: refs,
|
|
1462
|
+
_tanstackDbPrimaryRef: refKeys[0]
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
}).filter(Boolean);
|
|
1466
|
+
if (processedRules.length === 0) return fallback;
|
|
1467
|
+
const ruleGroupExpr = processedRules.length === 1 ? processedRules[0] : rg.combinator === "or" ? or(...processedRules) : and(...processedRules);
|
|
1468
|
+
return rg.not ? not(ruleGroupExpr) : ruleGroupExpr;
|
|
1469
|
+
};
|
|
1470
|
+
return processRuleGroup(require_convertQuery.convertFromIC(ruleGroup)) ?? fallback;
|
|
1471
|
+
};
|
|
1472
|
+
//#endregion
|
|
1333
1473
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDiagnostics.ts
|
|
1334
1474
|
const numericInputTypes = new Set([
|
|
1335
1475
|
"number",
|
|
@@ -2718,6 +2858,7 @@ const defaultRuleProcessors = {
|
|
|
2718
2858
|
sequelize: defaultRuleProcessorSequelize,
|
|
2719
2859
|
spel: defaultRuleProcessorSpEL,
|
|
2720
2860
|
sql: defaultRuleProcessorSQL,
|
|
2861
|
+
tanstack_db: defaultRuleProcessorTanStackDB,
|
|
2721
2862
|
cypher: defaultRuleProcessorCypher,
|
|
2722
2863
|
gql: defaultRuleProcessorCypher,
|
|
2723
2864
|
sparql: defaultRuleProcessorSPARQL,
|
|
@@ -2744,6 +2885,7 @@ const defaultOperatorProcessors = {
|
|
|
2744
2885
|
sequelize: defaultOperatorProcessor,
|
|
2745
2886
|
spel: defaultOperatorProcessor,
|
|
2746
2887
|
sql: defaultOperatorProcessorSQL,
|
|
2888
|
+
tanstack_db: defaultOperatorProcessor,
|
|
2747
2889
|
cypher: defaultOperatorProcessor,
|
|
2748
2890
|
gql: defaultOperatorProcessor,
|
|
2749
2891
|
sparql: defaultOperatorProcessor,
|
|
@@ -2790,7 +2932,8 @@ const valueProcessorCanActAsRuleProcessor = new Set([
|
|
|
2790
2932
|
"mongodb",
|
|
2791
2933
|
"prisma",
|
|
2792
2934
|
"sequelize",
|
|
2793
|
-
"spel"
|
|
2935
|
+
"spel",
|
|
2936
|
+
"tanstack_db"
|
|
2794
2937
|
]);
|
|
2795
2938
|
const sqlFormats = new Set([
|
|
2796
2939
|
"sql",
|
|
@@ -2836,7 +2979,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
2836
2979
|
} : format === "parameterized_named" ? {
|
|
2837
2980
|
sql: fallbackExpression,
|
|
2838
2981
|
params: {}
|
|
2839
|
-
} : format === "mongodb" ? `{${fallbackExpression}}` : format === "mongodb_query" ? mongoDbFallback : format === "prisma" ? prismaFallback : format === "jsonlogic" ? false : format === "elasticsearch" ? {} : format === "drizzle" || format === "sequelize" ? void 0 : fallbackExpression;
|
|
2982
|
+
} : format === "mongodb" ? `{${fallbackExpression}}` : format === "mongodb_query" ? mongoDbFallback : format === "prisma" ? prismaFallback : format === "jsonlogic" ? false : format === "elasticsearch" ? {} : format === "drizzle" || format === "sequelize" || format === "tanstack_db" ? void 0 : fallbackExpression;
|
|
2840
2983
|
}
|
|
2841
2984
|
} else validationMap = validationResult;
|
|
2842
2985
|
}
|
|
@@ -2896,6 +3039,7 @@ function formatQuery(ruleGroup, optionParam = {}) {
|
|
|
2896
3039
|
case "ldap": return defaultRuleGroupProcessorLDAP(ruleGroup, finalOptions);
|
|
2897
3040
|
case "prisma": return defaultRuleGroupProcessorPrisma(ruleGroup, finalOptions);
|
|
2898
3041
|
case "drizzle": return defaultRuleGroupProcessorDrizzle(ruleGroup, finalOptions);
|
|
3042
|
+
case "tanstack_db": return defaultRuleGroupProcessorTanStackDB(ruleGroup, finalOptions);
|
|
2899
3043
|
case "sequelize": return defaultRuleGroupProcessorSequelize(ruleGroup, finalOptions);
|
|
2900
3044
|
case "cypher":
|
|
2901
3045
|
case "gql": return defaultRuleGroupProcessorCypher(ruleGroup, finalOptions);
|
|
@@ -2984,6 +3128,7 @@ exports.defaultRuleGroupProcessorSPARQL = defaultRuleGroupProcessorSPARQL;
|
|
|
2984
3128
|
exports.defaultRuleGroupProcessorSQL = defaultRuleGroupProcessorSQL;
|
|
2985
3129
|
exports.defaultRuleGroupProcessorSequelize = defaultRuleGroupProcessorSequelize;
|
|
2986
3130
|
exports.defaultRuleGroupProcessorSpEL = defaultRuleGroupProcessorSpEL;
|
|
3131
|
+
exports.defaultRuleGroupProcessorTanStackDB = defaultRuleGroupProcessorTanStackDB;
|
|
2987
3132
|
exports.defaultRuleProcessorCEL = defaultRuleProcessorCEL;
|
|
2988
3133
|
exports.defaultRuleProcessorCypher = defaultRuleProcessorCypher;
|
|
2989
3134
|
exports.defaultRuleProcessorDrizzle = defaultRuleProcessorDrizzle;
|
|
@@ -3001,6 +3146,7 @@ exports.defaultRuleProcessorSPARQL = defaultRuleProcessorSPARQL;
|
|
|
3001
3146
|
exports.defaultRuleProcessorSQL = defaultRuleProcessorSQL;
|
|
3002
3147
|
exports.defaultRuleProcessorSequelize = defaultRuleProcessorSequelize;
|
|
3003
3148
|
exports.defaultRuleProcessorSpEL = defaultRuleProcessorSpEL;
|
|
3149
|
+
exports.defaultRuleProcessorTanStackDB = defaultRuleProcessorTanStackDB;
|
|
3004
3150
|
exports.defaultSpELValueProcessor = defaultSpELValueProcessor;
|
|
3005
3151
|
exports.defaultValueProcessor = defaultValueProcessor;
|
|
3006
3152
|
exports.defaultValueProcessorByRule = defaultValueProcessorByRule;
|