import { D as RuleGroupType, E as DefaultRuleGroupType, O as RuleType, j as Except, x as DefaultRuleGroupTypeIC } from "./index-D5TXNIzF.js"; import { t as ParserCommonOptions } from "./import-yRVJh7E1.js"; //#region src/utils/parseMongoDB/parseMongoDB.d.ts /** * Options object for {@link parseMongoDB}. */ interface ParseMongoDbOptions extends ParserCommonOptions { /** * When `true`, MongoDB rules in the form of `{ fieldName: { $not: { <...rule> } } }` * will be parsed into a rule group with the `not` attribute set to `true`. By default * (i.e., when this attribute is `false`), such "`$not`" rules will be parsed into a * rule with a negated operator. * * For example, with `preventOperatorNegation` set to `true`, a MongoDB rule like this... * * ```ts * { fieldName: { $not: { $eq: 1 } } } * ``` * * ...would yield a rule group like this: * * ```ts * { * combinator: 'and', * not: true, * rules: [{ field: 'fieldName', operator: '=', value: 1 }] * } * ``` * * By default, the same MongoDB rule would yield a rule like this: * * ```ts * { field: 'fieldName', operator: '!=', value: 1 } * // negated operator ^ * ``` * * @default false */ preventOperatorNegation?: boolean; /** * Map of additional operators to their respective processing functions. Operators * must begin with `"$"`. Processing functions should return either a {@link index!RuleType RuleType} * or {@link index!RuleGroupType RuleGroupType}. * * (The functions should _not_ return {@link index!RuleGroupTypeIC RuleGroupTypeIC}, even if using independent * combinators. If the `independentCombinators` option is `true`, `parseMongoDB` * will convert the final query to {@link index!RuleGroupTypeIC RuleGroupTypeIC} before returning it.) * * @default {} */ additionalOperators?: Record<`$${string}`, (field: string, operator: string, value: any, options: ParserCommonOptions) => RuleType | RuleGroupType>; } /** * Converts a MongoDB query object or parseable string into a query suitable * for the {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}). */ declare function parseMongoDB(mongoDbRules: string | Record): DefaultRuleGroupType; /** * Converts a MongoDB query object or parseable string into a query suitable * for the {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupType DefaultRuleGroupType}). */ declare function parseMongoDB(mongoDbRules: string | Record, options: Except & { independentCombinators?: false; }): DefaultRuleGroupType; /** * Converts a MongoDB query object or parseable string into a query suitable * for the {@link index!QueryBuilder QueryBuilder} component's `query` or `defaultQuery` props * ({@link index!DefaultRuleGroupTypeIC DefaultRuleGroupTypeIC}). */ declare function parseMongoDB(mongoDbRules: string | Record, options: Except & { independentCombinators: true; }): DefaultRuleGroupTypeIC; //#endregion export { ParseMongoDbOptions, parseMongoDB }; //# sourceMappingURL=parseMongoDB.d.ts.map