@react-querybuilder/core 8.9.1 → 8.9.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/arrayUtils-BF1P8iHS.mjs +122 -0
- package/dist/arrayUtils-BF1P8iHS.mjs.map +1 -0
- package/dist/basic-BfD-7CN3.d.mts +1235 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +21 -10
- package/dist/cjs/react-querybuilder_core.cjs.development.js +22 -19
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +21 -10
- 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/convertQuery-H7RhQiIc.mjs +75 -0
- package/dist/convertQuery-H7RhQiIc.mjs.map +1 -0
- package/dist/export-r-V7bU31.d.mts +452 -0
- package/dist/formatQuery.d.mts +667 -0
- package/dist/formatQuery.mjs +2366 -0
- package/dist/formatQuery.mjs.map +1 -0
- package/dist/import-BwbbP4oU.d.mts +28 -0
- package/dist/isRuleGroup-CnhYpLOM.mjs +40 -0
- package/dist/isRuleGroup-CnhYpLOM.mjs.map +1 -0
- package/dist/isRuleGroup-DqAs2x4E.js.map +1 -1
- package/dist/objectUtils-BtWdcZVG.mjs +11 -0
- package/dist/objectUtils-BtWdcZVG.mjs.map +1 -0
- package/dist/optGroupUtils-Duv-M8rf.mjs +102 -0
- package/dist/optGroupUtils-Duv-M8rf.mjs.map +1 -0
- package/dist/parseCEL.d.mts +34 -0
- package/dist/parseCEL.mjs +2593 -0
- package/dist/parseCEL.mjs.map +1 -0
- package/dist/parseJSONata.d.mts +36 -0
- package/dist/parseJSONata.mjs +268 -0
- package/dist/parseJSONata.mjs.map +1 -0
- package/dist/parseJsonLogic.d.mts +36 -0
- package/dist/parseJsonLogic.mjs +191 -0
- package/dist/parseJsonLogic.mjs.map +1 -0
- package/dist/parseMongoDB.d.mts +79 -0
- package/dist/parseMongoDB.mjs +267 -0
- package/dist/parseMongoDB.mjs.map +1 -0
- package/dist/parseNumber-BtGKa58z.mjs +24 -0
- package/dist/parseNumber-BtGKa58z.mjs.map +1 -0
- package/dist/parseSQL.d.mts +37 -0
- package/dist/parseSQL.mjs +6626 -0
- package/dist/parseSQL.mjs.map +1 -0
- package/dist/parseSpEL.d.mts +34 -0
- package/dist/parseSpEL.mjs +273 -0
- package/dist/parseSpEL.mjs.map +1 -0
- package/dist/prepareQueryObjects-CS6Wmhmf.mjs +154 -0
- package/dist/prepareQueryObjects-CS6Wmhmf.mjs.map +1 -0
- package/dist/react-querybuilder_core.d.mts +21 -10
- package/dist/react-querybuilder_core.legacy-esm.d.ts +21 -10
- package/dist/react-querybuilder_core.legacy-esm.js +19 -18
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +22 -20
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +21 -10
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/transformQuery-DdMvmrCh.mjs +41 -0
- package/dist/transformQuery-DdMvmrCh.mjs.map +1 -0
- package/dist/transformQuery.d.mts +118 -0
- package/dist/transformQuery.mjs +4 -0
- package/package.json +66 -18
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
import { RuleGroupTypeAny, RuleType, SetRequired } from "./basic-BfD-7CN3.mjs";
|
|
2
|
+
import { ConstituentWordOrder, ExportFormat, ExportObjectFormats, ExportOperatorMap, FormatQueryOptions, GroupVariantCondition, NLTranslationKey, NLTranslations, ParameterizedNamedSQL, ParameterizedSQL, RQBJsonLogic, RuleGroupProcessor, RuleProcessor, SQLPreset, ValueProcessorByRule, ValueProcessorLegacy, ValueProcessorOptions } from "./export-r-V7bU31.mjs";
|
|
3
|
+
import { Column, Operators, SQL, Table } from "drizzle-orm";
|
|
4
|
+
import { WhereOptions } from "sequelize";
|
|
5
|
+
|
|
6
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCEL.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Default rule processor used by {@link formatQuery} for "cel" format.
|
|
9
|
+
*
|
|
10
|
+
* @group Export
|
|
11
|
+
*/
|
|
12
|
+
declare const defaultRuleProcessorCEL: RuleProcessor;
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/utils/formatQuery/defaultRuleProcessorMongoDB.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* Default rule processor used by {@link formatQuery} for "mongodb" format.
|
|
17
|
+
*
|
|
18
|
+
* Note that the "mongodb" format is deprecated in favor of the "mongodb_query" format.
|
|
19
|
+
*
|
|
20
|
+
* @group Export
|
|
21
|
+
*/
|
|
22
|
+
declare const defaultRuleProcessorMongoDB: RuleProcessor;
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSpEL.d.ts
|
|
25
|
+
/**
|
|
26
|
+
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
27
|
+
*
|
|
28
|
+
* @group Export
|
|
29
|
+
*/
|
|
30
|
+
declare const defaultRuleProcessorSpEL: RuleProcessor;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/utils/formatQuery/defaultValueProcessorByRule.d.ts
|
|
33
|
+
/**
|
|
34
|
+
* Default value processor used by {@link formatQuery} for "sql" format.
|
|
35
|
+
*
|
|
36
|
+
* @group Export
|
|
37
|
+
*/
|
|
38
|
+
declare const defaultValueProcessorByRule: ValueProcessorByRule;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCEL.d.ts
|
|
41
|
+
/**
|
|
42
|
+
* Rule group processor used by {@link formatQuery} for "cel" format.
|
|
43
|
+
*
|
|
44
|
+
* @group Export
|
|
45
|
+
*/
|
|
46
|
+
declare const defaultRuleGroupProcessorCEL: RuleGroupProcessor<string>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* Default rule group processor used by {@link formatQuery} for the "drizzle" format. The returned
|
|
51
|
+
* function can be assigned to the `where` property in the Drizzle relational queries API.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* const where = formatQuery(query, 'drizzle');
|
|
55
|
+
* const results = db.query.users.findMany({ where });
|
|
56
|
+
*
|
|
57
|
+
* @returns Function that takes a Drizzle table config and an object of Drizzle operators.
|
|
58
|
+
*
|
|
59
|
+
* @group Export
|
|
60
|
+
*/
|
|
61
|
+
declare const defaultRuleGroupProcessorDrizzle: RuleGroupProcessor<(columns: Record<string, Column> | Table, drizzleOperators: Operators) => SQL | undefined>;
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorElasticSearch.d.ts
|
|
64
|
+
/**
|
|
65
|
+
* Rule group processor used by {@link formatQuery} for "elasticsearch" format.
|
|
66
|
+
*
|
|
67
|
+
* @group Export
|
|
68
|
+
*/
|
|
69
|
+
declare const defaultRuleGroupProcessorElasticSearch: RuleGroupProcessor<Record<string, unknown>>;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.d.ts
|
|
72
|
+
/**
|
|
73
|
+
* Rule group processor used by {@link formatQuery} for "jsonata" format.
|
|
74
|
+
*
|
|
75
|
+
* @group Export
|
|
76
|
+
*/
|
|
77
|
+
declare const defaultRuleGroupProcessorJSONata: RuleGroupProcessor<string>;
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorJsonLogic.d.ts
|
|
80
|
+
/**
|
|
81
|
+
* Rule group processor used by {@link formatQuery} for "jsonlogic" format.
|
|
82
|
+
*
|
|
83
|
+
* @group Export
|
|
84
|
+
*/
|
|
85
|
+
declare const defaultRuleGroupProcessorJsonLogic: RuleGroupProcessor<RQBJsonLogic>;
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorLDAP.d.ts
|
|
88
|
+
/**
|
|
89
|
+
* Rule group processor used by {@link formatQuery} for "ldap" format.
|
|
90
|
+
*
|
|
91
|
+
* @group Export
|
|
92
|
+
*/
|
|
93
|
+
declare const defaultRuleGroupProcessorLDAP: RuleGroupProcessor<string>;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDB.d.ts
|
|
96
|
+
/**
|
|
97
|
+
* Rule group processor used by {@link formatQuery} for "mongodb" format.
|
|
98
|
+
*
|
|
99
|
+
* Note that the "mongodb" format is deprecated in favor of the "mongodb_query" format.
|
|
100
|
+
*
|
|
101
|
+
* @group Export
|
|
102
|
+
*/
|
|
103
|
+
declare const defaultRuleGroupProcessorMongoDB: RuleGroupProcessor<string>;
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorMongoDBQuery.d.ts
|
|
106
|
+
/**
|
|
107
|
+
* Default fallback object used by {@link formatQuery} for "mongodb_query" format.
|
|
108
|
+
*
|
|
109
|
+
* @group Export
|
|
110
|
+
*/
|
|
111
|
+
declare const mongoDbFallback: {
|
|
112
|
+
readonly $and: readonly [{
|
|
113
|
+
readonly $expr: true;
|
|
114
|
+
}];
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Rule group processor used by {@link formatQuery} for "mongodb_query" format.
|
|
118
|
+
*
|
|
119
|
+
* @group Export
|
|
120
|
+
*/
|
|
121
|
+
declare const defaultRuleGroupProcessorMongoDBQuery: RuleGroupProcessor;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorNL.d.ts
|
|
124
|
+
/**
|
|
125
|
+
* Rule group processor used by {@link formatQuery} for "natural_language" format.
|
|
126
|
+
*
|
|
127
|
+
* @group Export
|
|
128
|
+
*/
|
|
129
|
+
declare const defaultRuleGroupProcessorNL: RuleGroupProcessor<string>;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorParameterized.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* Rule group processor used by {@link formatQuery} for "parameterized" and
|
|
134
|
+
* "parameterized_named" formats.
|
|
135
|
+
*
|
|
136
|
+
* @group Export
|
|
137
|
+
*/
|
|
138
|
+
declare const defaultRuleGroupProcessorParameterized: RuleGroupProcessor<ParameterizedSQL | ParameterizedNamedSQL>;
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorPrisma.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* Default fallback object used by {@link formatQuery} for "prisma" format.
|
|
143
|
+
*
|
|
144
|
+
* @group Export
|
|
145
|
+
*/
|
|
146
|
+
declare const prismaFallback: {};
|
|
147
|
+
/**
|
|
148
|
+
* Rule group processor used by {@link formatQuery} for "prisma" format.
|
|
149
|
+
*
|
|
150
|
+
* @group Export
|
|
151
|
+
*/
|
|
152
|
+
declare const defaultRuleGroupProcessorPrisma: RuleGroupProcessor<Record<string, unknown> | undefined>;
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSequelize.d.ts
|
|
155
|
+
/**
|
|
156
|
+
* Rule group processor used by {@link formatQuery} for "sequelize" format.
|
|
157
|
+
*
|
|
158
|
+
* @group Export
|
|
159
|
+
*/
|
|
160
|
+
declare const defaultRuleGroupProcessorSequelize: RuleGroupProcessor<WhereOptions | undefined>;
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.d.ts
|
|
163
|
+
/**
|
|
164
|
+
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
165
|
+
*
|
|
166
|
+
* @group Export
|
|
167
|
+
*/
|
|
168
|
+
declare const defaultRuleGroupProcessorSpEL: RuleGroupProcessor<string>;
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSQL.d.ts
|
|
171
|
+
/**
|
|
172
|
+
* Default rule processor used by {@link formatQuery} for "sql" format.
|
|
173
|
+
*
|
|
174
|
+
* @group Export
|
|
175
|
+
*/
|
|
176
|
+
declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
179
|
+
/**
|
|
180
|
+
* Default rule processor used by {@link formatQuery} for the "drizzle" format.
|
|
181
|
+
*
|
|
182
|
+
* @group Export
|
|
183
|
+
*/
|
|
184
|
+
declare const defaultRuleProcessorDrizzle: RuleProcessor;
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region src/utils/formatQuery/defaultRuleProcessorElasticSearch.d.ts
|
|
187
|
+
/**
|
|
188
|
+
* Default rule processor used by {@link formatQuery} for "elasticsearch" format.
|
|
189
|
+
*
|
|
190
|
+
* @group Export
|
|
191
|
+
*/
|
|
192
|
+
declare const defaultRuleProcessorElasticSearch: RuleProcessor;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.d.ts
|
|
195
|
+
/**
|
|
196
|
+
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
197
|
+
*
|
|
198
|
+
* @group Export
|
|
199
|
+
*/
|
|
200
|
+
declare const defaultRuleProcessorJSONata: RuleProcessor;
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/utils/formatQuery/defaultRuleProcessorJsonLogic.d.ts
|
|
203
|
+
/**
|
|
204
|
+
* Default rule processor used by {@link formatQuery} for "jsonlogic" format.
|
|
205
|
+
*
|
|
206
|
+
* @group Export
|
|
207
|
+
*/
|
|
208
|
+
declare const defaultRuleProcessorJsonLogic: RuleProcessor;
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/utils/formatQuery/defaultRuleProcessorLDAP.d.ts
|
|
211
|
+
/**
|
|
212
|
+
* Default rule processor used by {@link formatQuery} for "ldap" format.
|
|
213
|
+
*
|
|
214
|
+
* @group Export
|
|
215
|
+
*/
|
|
216
|
+
declare const defaultRuleProcessorLDAP: RuleProcessor;
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/utils/formatQuery/defaultRuleProcessorMongoDBQuery.d.ts
|
|
219
|
+
/**
|
|
220
|
+
* Default rule processor used by {@link formatQuery} for "mongodb_query" format.
|
|
221
|
+
*
|
|
222
|
+
* @group Export
|
|
223
|
+
*/
|
|
224
|
+
declare const defaultRuleProcessorMongoDBQuery: RuleProcessor;
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/utils/formatQuery/defaultRuleProcessorNL.d.ts
|
|
227
|
+
/**
|
|
228
|
+
* Default operator map used by {@link formatQuery} for "natural_language" format.
|
|
229
|
+
*
|
|
230
|
+
* @group Export
|
|
231
|
+
*/
|
|
232
|
+
declare const defaultExportOperatorMap: ExportOperatorMap;
|
|
233
|
+
/**
|
|
234
|
+
* Default operator processor used by {@link formatQuery} for "natural_language" format.
|
|
235
|
+
*
|
|
236
|
+
* @group Export
|
|
237
|
+
*/
|
|
238
|
+
declare const defaultOperatorProcessorNL: RuleProcessor;
|
|
239
|
+
/**
|
|
240
|
+
* Default rule processor used by {@link formatQuery} for "natural_language" format.
|
|
241
|
+
*
|
|
242
|
+
* @group Export
|
|
243
|
+
*/
|
|
244
|
+
declare const defaultRuleProcessorNL: RuleProcessor;
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/utils/formatQuery/defaultRuleProcessorParameterized.d.ts
|
|
247
|
+
/**
|
|
248
|
+
* Default rule processor used by {@link formatQuery} for "parameterized" and
|
|
249
|
+
* "parameterized_named" formats.
|
|
250
|
+
*
|
|
251
|
+
* @group Export
|
|
252
|
+
*/
|
|
253
|
+
declare const defaultRuleProcessorParameterized: RuleProcessor;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/utils/formatQuery/defaultRuleProcessorPrisma.d.ts
|
|
256
|
+
/**
|
|
257
|
+
* Default rule processor used by {@link formatQuery} for "prisma" format.
|
|
258
|
+
*
|
|
259
|
+
* @group Export
|
|
260
|
+
*/
|
|
261
|
+
declare const defaultRuleProcessorPrisma: RuleProcessor;
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSequelize.d.ts
|
|
264
|
+
/**
|
|
265
|
+
* Default rule processor used by {@link formatQuery} for the "sequelize" format.
|
|
266
|
+
*
|
|
267
|
+
* @group Export
|
|
268
|
+
*/
|
|
269
|
+
declare const defaultRuleProcessorSequelize: RuleProcessor;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSQL.d.ts
|
|
272
|
+
/**
|
|
273
|
+
* Default operator processor used by {@link formatQuery} for "sql" and "parameterized*" formats.
|
|
274
|
+
*
|
|
275
|
+
* @group Export
|
|
276
|
+
*/
|
|
277
|
+
declare const defaultOperatorProcessorSQL: RuleProcessor;
|
|
278
|
+
/**
|
|
279
|
+
* Default rule processor used by {@link formatQuery} for "sql" format.
|
|
280
|
+
*
|
|
281
|
+
* @group Export
|
|
282
|
+
*/
|
|
283
|
+
declare const defaultRuleProcessorSQL: RuleProcessor;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/utils/formatQuery/defaultValueProcessorNL.d.ts
|
|
286
|
+
/**
|
|
287
|
+
* Default value processor used by {@link formatQuery} for "natural_language" format.
|
|
288
|
+
*
|
|
289
|
+
* @group Export
|
|
290
|
+
*/
|
|
291
|
+
declare const defaultValueProcessorNL: ValueProcessorByRule;
|
|
292
|
+
//#endregion
|
|
293
|
+
//#region src/utils/formatQuery/formatQuery.d.ts
|
|
294
|
+
/**
|
|
295
|
+
* A collection of option presets for {@link formatQuery}, specifically for SQL-based formats.
|
|
296
|
+
*
|
|
297
|
+
* @group Export
|
|
298
|
+
*/
|
|
299
|
+
declare const sqlDialectPresets: Record<SQLPreset, FormatQueryOptions>;
|
|
300
|
+
/**
|
|
301
|
+
* A collection of option presets for {@link formatQuery}.
|
|
302
|
+
*
|
|
303
|
+
* @group Export
|
|
304
|
+
*/
|
|
305
|
+
declare const formatQueryOptionPresets: Record<string, FormatQueryOptions>;
|
|
306
|
+
/**
|
|
307
|
+
* Generates a formatted (indented two spaces) JSON string from a query object.
|
|
308
|
+
*
|
|
309
|
+
* @group Export
|
|
310
|
+
*/
|
|
311
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny): string;
|
|
312
|
+
/**
|
|
313
|
+
* Generates a result based on the provided rule group processor.
|
|
314
|
+
*
|
|
315
|
+
* @group Export
|
|
316
|
+
*/
|
|
317
|
+
declare function formatQuery<TResult = unknown>(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & {
|
|
318
|
+
ruleGroupProcessor: RuleGroupProcessor<TResult>;
|
|
319
|
+
}): TResult;
|
|
320
|
+
/**
|
|
321
|
+
* Generates a {@link index!ParameterizedSQL ParameterizedSQL} object from a query object.
|
|
322
|
+
*
|
|
323
|
+
* @group Export
|
|
324
|
+
*/
|
|
325
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized" | (FormatQueryOptions & {
|
|
326
|
+
format: "parameterized";
|
|
327
|
+
})): ParameterizedSQL;
|
|
328
|
+
/**
|
|
329
|
+
* Generates a {@link index!ParameterizedNamedSQL ParameterizedNamedSQL} object from a query object.
|
|
330
|
+
*
|
|
331
|
+
* @group Export
|
|
332
|
+
*/
|
|
333
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "parameterized_named" | (FormatQueryOptions & {
|
|
334
|
+
format: "parameterized_named";
|
|
335
|
+
})): ParameterizedNamedSQL;
|
|
336
|
+
/**
|
|
337
|
+
* Generates a {@link index!RQBJsonLogic JsonLogic} object from a query object.
|
|
338
|
+
*
|
|
339
|
+
* @group Export
|
|
340
|
+
*/
|
|
341
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonlogic" | (FormatQueryOptions & {
|
|
342
|
+
format: "jsonlogic";
|
|
343
|
+
})): RQBJsonLogic;
|
|
344
|
+
/**
|
|
345
|
+
* Generates an ElasticSearch query object from an RQB query object.
|
|
346
|
+
*
|
|
347
|
+
* NOTE: Support for the ElasticSearch format is experimental.
|
|
348
|
+
* You may have better results exporting "sql" format then using
|
|
349
|
+
* [ElasticSearch SQL](https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html).
|
|
350
|
+
*
|
|
351
|
+
* @group Export
|
|
352
|
+
*/
|
|
353
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "elasticsearch" | (FormatQueryOptions & {
|
|
354
|
+
format: "elasticsearch";
|
|
355
|
+
})): Record<string, any>;
|
|
356
|
+
/**
|
|
357
|
+
* Generates a MongoDB query object from an RQB query object.
|
|
358
|
+
*
|
|
359
|
+
* This is equivalent to the "mongodb" format, but returns a JSON object
|
|
360
|
+
* instead of a string.
|
|
361
|
+
*
|
|
362
|
+
* @group Export
|
|
363
|
+
*/
|
|
364
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb_query" | (FormatQueryOptions & {
|
|
365
|
+
format: "mongodb_query";
|
|
366
|
+
})): Record<string, any>;
|
|
367
|
+
/**
|
|
368
|
+
* Generates a JSON.stringify'd MongoDB query object from an RQB query object.
|
|
369
|
+
*
|
|
370
|
+
* This is equivalent to the "mongodb_query" format, but returns a string
|
|
371
|
+
* instead of a JSON object.
|
|
372
|
+
*
|
|
373
|
+
* @deprecated Use the "mongodb_query" format for greater flexibility.
|
|
374
|
+
*
|
|
375
|
+
* @group Export
|
|
376
|
+
*/
|
|
377
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "mongodb" | (FormatQueryOptions & {
|
|
378
|
+
format: "mongodb";
|
|
379
|
+
})): string;
|
|
380
|
+
/**
|
|
381
|
+
* Generates a Prisma ORM query object from an RQB query object.
|
|
382
|
+
*
|
|
383
|
+
* @group Export
|
|
384
|
+
*/
|
|
385
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "prisma" | (FormatQueryOptions & {
|
|
386
|
+
format: "prisma";
|
|
387
|
+
})): Record<string, any>;
|
|
388
|
+
/**
|
|
389
|
+
* Generates a Drizzle ORM query function from an RQB query object. The function can
|
|
390
|
+
* be assigned to the `where` property in the Drizzle relational queries API.
|
|
391
|
+
*
|
|
392
|
+
* @group Export
|
|
393
|
+
*/
|
|
394
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "drizzle" | (FormatQueryOptions & {
|
|
395
|
+
format: "drizzle";
|
|
396
|
+
})): ReturnType<typeof defaultRuleGroupProcessorDrizzle>;
|
|
397
|
+
/**
|
|
398
|
+
* Generates a Sequelize query object from an RQB query object. The object can
|
|
399
|
+
* be assigned to the `where` property in the Sequelize query functions.
|
|
400
|
+
*
|
|
401
|
+
* @group Export
|
|
402
|
+
*/
|
|
403
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "sequelize" | (FormatQueryOptions & {
|
|
404
|
+
format: "sequelize";
|
|
405
|
+
})): ReturnType<typeof defaultRuleGroupProcessorSequelize>;
|
|
406
|
+
/**
|
|
407
|
+
* Generates a JSONata query string from an RQB query object.
|
|
408
|
+
*
|
|
409
|
+
* NOTE: Either `parseNumbers: "strict-limited"` or `parseNumbers: true`
|
|
410
|
+
* are recommended for this format.
|
|
411
|
+
*
|
|
412
|
+
* @group Export
|
|
413
|
+
*/
|
|
414
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "jsonata" | (FormatQueryOptions & {
|
|
415
|
+
format: "jsonata";
|
|
416
|
+
})): string;
|
|
417
|
+
/**
|
|
418
|
+
* Generates an LDAP query string from an RQB query object.
|
|
419
|
+
*
|
|
420
|
+
* @group Export
|
|
421
|
+
*/
|
|
422
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: "ldap" | (FormatQueryOptions & {
|
|
423
|
+
format: "ldap";
|
|
424
|
+
})): string;
|
|
425
|
+
/**
|
|
426
|
+
* Generates a formatted (indented two spaces) JSON string from a query object.
|
|
427
|
+
*
|
|
428
|
+
* @group Export
|
|
429
|
+
*/
|
|
430
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions): string;
|
|
431
|
+
/**
|
|
432
|
+
* Generates a query string in the requested format.
|
|
433
|
+
*
|
|
434
|
+
* @group Export
|
|
435
|
+
*/
|
|
436
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: Exclude<ExportFormat, ExportObjectFormats>): string;
|
|
437
|
+
/**
|
|
438
|
+
* Generates a query string in the requested format.
|
|
439
|
+
*
|
|
440
|
+
* @group Export
|
|
441
|
+
*/
|
|
442
|
+
declare function formatQuery(ruleGroup: RuleGroupTypeAny, options: FormatQueryOptions & {
|
|
443
|
+
format: Exclude<ExportFormat, ExportObjectFormats>;
|
|
444
|
+
}): string;
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/utils/formatQuery/utils.d.ts
|
|
447
|
+
/**
|
|
448
|
+
* Maps a {@link DefaultOperatorName} to a SQL operator.
|
|
449
|
+
*
|
|
450
|
+
* @group Export
|
|
451
|
+
*/
|
|
452
|
+
declare const mapSQLOperator: (rqbOperator: string) => string;
|
|
453
|
+
/**
|
|
454
|
+
* Maps a (lowercase) {@link DefaultOperatorName} to a MongoDB operator.
|
|
455
|
+
*
|
|
456
|
+
* @group Export
|
|
457
|
+
*/
|
|
458
|
+
declare const mongoOperators: {
|
|
459
|
+
"=": string;
|
|
460
|
+
"!=": string;
|
|
461
|
+
"<": string;
|
|
462
|
+
"<=": string;
|
|
463
|
+
">": string;
|
|
464
|
+
">=": string;
|
|
465
|
+
in: string;
|
|
466
|
+
notin: string;
|
|
467
|
+
notIn: string;
|
|
468
|
+
};
|
|
469
|
+
/**
|
|
470
|
+
* Maps a (lowercase) {@link DefaultOperatorName} to a Prisma ORM operator.
|
|
471
|
+
*
|
|
472
|
+
* @group Export
|
|
473
|
+
*/
|
|
474
|
+
declare const prismaOperators: {
|
|
475
|
+
"=": string;
|
|
476
|
+
"!=": string;
|
|
477
|
+
"<": string;
|
|
478
|
+
"<=": string;
|
|
479
|
+
">": string;
|
|
480
|
+
">=": string;
|
|
481
|
+
in: string;
|
|
482
|
+
notin: string;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Maps a {@link DefaultCombinatorName} to a CEL combinator.
|
|
486
|
+
*
|
|
487
|
+
* @group Export
|
|
488
|
+
*/
|
|
489
|
+
declare const celCombinatorMap: {
|
|
490
|
+
and: "&&";
|
|
491
|
+
or: "||";
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* Register these operators with `jsonLogic` before applying the result
|
|
495
|
+
* of `formatQuery(query, 'jsonlogic')`.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```
|
|
499
|
+
* for (const [op, func] of Object.entries(jsonLogicAdditionalOperators)) {
|
|
500
|
+
* jsonLogic.add_operation(op, func);
|
|
501
|
+
* }
|
|
502
|
+
* jsonLogic.apply({ "startsWith": [{ "var": "firstName" }, "Stev"] }, data);
|
|
503
|
+
* ```
|
|
504
|
+
*
|
|
505
|
+
* @group Export
|
|
506
|
+
*/
|
|
507
|
+
declare const jsonLogicAdditionalOperators: Record<"startsWith" | "endsWith", (a: string, b: string) => boolean>;
|
|
508
|
+
/**
|
|
509
|
+
* Converts all `string`-type `value` properties of a query object into `number` where appropriate.
|
|
510
|
+
*
|
|
511
|
+
* Used by {@link formatQuery} for the `json*` formats when `parseNumbers` is `true`.
|
|
512
|
+
*
|
|
513
|
+
* @group Export
|
|
514
|
+
*/
|
|
515
|
+
declare const numerifyValues: (rg: RuleGroupTypeAny, options: SetRequired<FormatQueryOptions, "fields">) => RuleGroupTypeAny;
|
|
516
|
+
/**
|
|
517
|
+
* Determines whether a value is _anything_ except an empty `string` or `NaN`.
|
|
518
|
+
*
|
|
519
|
+
* @group Export
|
|
520
|
+
*/
|
|
521
|
+
declare const isValidValue: (value: any) => boolean;
|
|
522
|
+
/**
|
|
523
|
+
* Determines whether {@link formatQuery} should render the given value as a number.
|
|
524
|
+
* As long as `parseNumbers` is `true`, `number` and `bigint` values will return `true` and
|
|
525
|
+
* `string` values will return `true` if they test positive against {@link numericRegex}.
|
|
526
|
+
*
|
|
527
|
+
* @group Export
|
|
528
|
+
*/
|
|
529
|
+
declare const shouldRenderAsNumber: (value: any, parseNumbers?: boolean) => boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Used by {@link formatQuery} to determine whether the given value processor is a
|
|
532
|
+
* "legacy" value processor by counting the number of arguments. Legacy value
|
|
533
|
+
* processors take 3 arguments (not counting any arguments with default values), while
|
|
534
|
+
* rule-based value processors take no more than 2 arguments.
|
|
535
|
+
*
|
|
536
|
+
* @group Export
|
|
537
|
+
*/
|
|
538
|
+
declare const isValueProcessorLegacy: (valueProcessor: ValueProcessorLegacy | ValueProcessorByRule) => valueProcessor is ValueProcessorLegacy;
|
|
539
|
+
/**
|
|
540
|
+
* Converts the `quoteFieldNamesWith` option into an array of two strings.
|
|
541
|
+
* If the option is a string, the array elements are both that string.
|
|
542
|
+
*
|
|
543
|
+
* @default
|
|
544
|
+
* ['', '']
|
|
545
|
+
*
|
|
546
|
+
* @group Export
|
|
547
|
+
*/
|
|
548
|
+
declare const getQuoteFieldNamesWithArray: (quoteFieldNamesWith?: null | string | [string, string]) => [string, string];
|
|
549
|
+
/**
|
|
550
|
+
* Given a field name and relevant {@link ValueProcessorOptions}, returns the field name
|
|
551
|
+
* wrapped in the configured quote character(s).
|
|
552
|
+
*
|
|
553
|
+
* @group Export
|
|
554
|
+
*/
|
|
555
|
+
declare const getQuotedFieldName: (fieldName: string, {
|
|
556
|
+
quoteFieldNamesWith,
|
|
557
|
+
fieldIdentifierSeparator
|
|
558
|
+
}: ValueProcessorOptions) => string;
|
|
559
|
+
/**
|
|
560
|
+
* Given a [Constituent word order](https://en.wikipedia.org/wiki/Word_order#Constituent_word_orders)
|
|
561
|
+
* like "svo" or "sov", returns a permutation of `["S", "V", "O"]` based on the first occurrence of
|
|
562
|
+
* each letter in the input string (case insensitive). This widens the valid input from abbreviations
|
|
563
|
+
* like "svo" to more expressive strings like "subject-verb-object" or "sub ver obj". Any missing
|
|
564
|
+
* letters are appended in the default order "SVO" (e.g., "object" would yield `["O", "S", "V"]`).
|
|
565
|
+
*
|
|
566
|
+
* @group Export
|
|
567
|
+
*/
|
|
568
|
+
declare const normalizeConstituentWordOrder: (input: string) => ConstituentWordOrder;
|
|
569
|
+
/**
|
|
570
|
+
* Default translations used by {@link formatQuery} for "natural_language" format.
|
|
571
|
+
*
|
|
572
|
+
* @group Export
|
|
573
|
+
*/
|
|
574
|
+
declare const defaultNLTranslations: NLTranslations;
|
|
575
|
+
/**
|
|
576
|
+
* Used by {@link formatQuery} to get a translation based on certain conditions
|
|
577
|
+
* for the "natural_language" format.
|
|
578
|
+
*
|
|
579
|
+
* @group Export
|
|
580
|
+
*/
|
|
581
|
+
declare const getNLTranslataion: (key: NLTranslationKey, translations: NLTranslations, conditions?: GroupVariantCondition[]) => string;
|
|
582
|
+
type ProcessedMatchMode = {
|
|
583
|
+
mode: "all";
|
|
584
|
+
threshold?: number | null | undefined;
|
|
585
|
+
} | {
|
|
586
|
+
mode: "none";
|
|
587
|
+
threshold?: number | null | undefined;
|
|
588
|
+
} | {
|
|
589
|
+
mode: "some";
|
|
590
|
+
threshold?: number | null | undefined;
|
|
591
|
+
} | {
|
|
592
|
+
mode: "atleast";
|
|
593
|
+
threshold: number;
|
|
594
|
+
} | {
|
|
595
|
+
mode: "atmost";
|
|
596
|
+
threshold: number;
|
|
597
|
+
} | {
|
|
598
|
+
mode: "exactly";
|
|
599
|
+
threshold: number;
|
|
600
|
+
};
|
|
601
|
+
declare const processMatchMode: (rule: RuleType) => void | false | ProcessedMatchMode;
|
|
602
|
+
/**
|
|
603
|
+
* "Replacer" method for JSON.stringify's second argument. Converts `bigint` values to
|
|
604
|
+
* objects with a `$bigint` property having a value of a string representation of
|
|
605
|
+
* the actual `bigint`-type value.
|
|
606
|
+
*
|
|
607
|
+
* Inverse of {@link bigIntJsonParseReviver}.
|
|
608
|
+
*
|
|
609
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
610
|
+
*/
|
|
611
|
+
declare const bigIntJsonStringifyReplacer: (_key: string, value: unknown) => unknown;
|
|
612
|
+
/**
|
|
613
|
+
* "Reviver" method for JSON.parse's second argument. Converts objects having a single
|
|
614
|
+
* `$bigint: string` property to an actual `bigint` value.
|
|
615
|
+
*
|
|
616
|
+
* Inverse of {@link bigIntJsonStringifyReplacer}.
|
|
617
|
+
*
|
|
618
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt#use_within_json
|
|
619
|
+
*/
|
|
620
|
+
declare const bigIntJsonParseReviver: (_key: string, value: unknown) => unknown;
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/utils/formatQuery/index.d.ts
|
|
623
|
+
/**
|
|
624
|
+
* Default value processor used by {@link formatQuery} for "sql" format.
|
|
625
|
+
*
|
|
626
|
+
* @group Export
|
|
627
|
+
*/
|
|
628
|
+
declare const defaultValueProcessor: ValueProcessorLegacy;
|
|
629
|
+
/**
|
|
630
|
+
* @deprecated Prefer {@link defaultRuleProcessorMongoDB}.
|
|
631
|
+
*
|
|
632
|
+
* @group Export
|
|
633
|
+
*/
|
|
634
|
+
declare const defaultMongoDBValueProcessor: ValueProcessorLegacy;
|
|
635
|
+
/**
|
|
636
|
+
* @deprecated Prefer {@link defaultRuleProcessorCEL}.
|
|
637
|
+
*
|
|
638
|
+
* @group Export
|
|
639
|
+
*/
|
|
640
|
+
declare const defaultCELValueProcessor: ValueProcessorLegacy;
|
|
641
|
+
/**
|
|
642
|
+
* @deprecated Prefer {@link defaultRuleProcessorSpEL}.
|
|
643
|
+
*
|
|
644
|
+
* @group Export
|
|
645
|
+
*/
|
|
646
|
+
declare const defaultSpELValueProcessor: ValueProcessorLegacy;
|
|
647
|
+
/**
|
|
648
|
+
* @deprecated Renamed to {@link defaultRuleProcessorCEL}.
|
|
649
|
+
*
|
|
650
|
+
* @group Export
|
|
651
|
+
*/
|
|
652
|
+
declare const defaultValueProcessorCELByRule: RuleProcessor;
|
|
653
|
+
/**
|
|
654
|
+
* @deprecated Renamed to {@link defaultRuleProcessorMongoDB}.
|
|
655
|
+
*
|
|
656
|
+
* @group Export
|
|
657
|
+
*/
|
|
658
|
+
declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
659
|
+
/**
|
|
660
|
+
* @deprecated Renamed to {@link defaultRuleProcessorSpEL}.
|
|
661
|
+
*
|
|
662
|
+
* @group Export
|
|
663
|
+
*/
|
|
664
|
+
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
665
|
+
//#endregion
|
|
666
|
+
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleProcessorCEL, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, 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, sqlDialectPresets };
|
|
667
|
+
//# sourceMappingURL=formatQuery.d.mts.map
|