@react-querybuilder/core 8.15.0 → 8.16.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 +114 -53
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +95 -17
- package/dist/cjs/react-querybuilder_core.cjs.development.js +425 -24
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +95 -17
- 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-BeJJH9BI.mjs.map +1 -1
- package/dist/convertQuery-Lx2HQa0m.js.map +1 -1
- package/dist/formatQuery.d.mts +72 -2
- package/dist/formatQuery.d.ts +72 -2
- package/dist/formatQuery.js +425 -24
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +418 -25
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-0wp72lLT.d.mts → import-BC_bAKQ8.d.mts} +2 -2
- package/dist/{import-yRVJh7E1.d.ts → import-D1KnXhkQ.d.ts} +2 -2
- package/dist/{index-D5TXNIzF.d.ts → index-AAZg4Uh1.d.mts} +15 -8
- package/dist/{index-Lht_Wq3V.d.mts → index-Ds06V0zO.d.ts} +15 -8
- package/dist/objectUtils-Bzug_QfX.js.map +1 -1
- package/dist/objectUtils-D96eEEzL.mjs.map +1 -1
- package/dist/parseCEL.d.mts +2 -2
- package/dist/parseCEL.d.ts +2 -2
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.d.mts +49 -0
- package/dist/parseCypher.d.ts +49 -0
- package/dist/parseCypher.js +578 -0
- package/dist/parseCypher.js.map +1 -0
- package/dist/parseCypher.mjs +575 -0
- package/dist/parseCypher.mjs.map +1 -0
- package/dist/parseGremlin.d.mts +35 -0
- package/dist/parseGremlin.d.ts +35 -0
- package/dist/parseGremlin.js +192 -0
- package/dist/parseGremlin.js.map +1 -0
- package/dist/parseGremlin.mjs +191 -0
- package/dist/parseGremlin.mjs.map +1 -0
- package/dist/parseJSONata.d.mts +2 -2
- package/dist/parseJSONata.d.ts +2 -2
- package/dist/parseJSONata.js.map +1 -1
- package/dist/parseJSONata.mjs.map +1 -1
- package/dist/parseJsonLogic.d.mts +2 -2
- package/dist/parseJsonLogic.d.ts +2 -2
- package/dist/parseJsonLogic.js.map +1 -1
- package/dist/parseJsonLogic.mjs.map +1 -1
- package/dist/parseMongoDB.d.mts +2 -2
- package/dist/parseMongoDB.d.ts +2 -2
- package/dist/parseMongoDB.js.map +1 -1
- package/dist/parseMongoDB.mjs.map +1 -1
- package/dist/parseSPARQL.d.mts +34 -0
- package/dist/parseSPARQL.d.ts +34 -0
- package/dist/parseSPARQL.js +253 -0
- package/dist/parseSPARQL.js.map +1 -0
- package/dist/parseSPARQL.mjs +251 -0
- package/dist/parseSPARQL.mjs.map +1 -0
- package/dist/parseSQL.d.mts +2 -2
- package/dist/parseSQL.d.ts +2 -2
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +2 -2
- package/dist/parseSpEL.d.ts +2 -2
- package/dist/parseSpEL.js.map +1 -1
- package/dist/parseSpEL.mjs.map +1 -1
- package/dist/prepareQueryObjects-BoG5Rt8z.js.map +1 -1
- package/dist/prepareQueryObjects-uA10ZpZX.mjs.map +1 -1
- package/dist/react-querybuilder_core.d.mts +95 -17
- package/dist/react-querybuilder_core.legacy-esm.d.ts +95 -17
- package/dist/react-querybuilder_core.legacy-esm.js +435 -37
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +418 -25
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +95 -17
- 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/dist/transformQuery.js.map +1 -1
- package/dist/transformQuery.mjs.map +1 -1
- package/dist/utils-ChLG90DP.mjs.map +1 -1
- package/dist/utils-Qwkq2Q0F.js.map +1 -1
- package/formatQuery/package.json +1 -1
- package/package.json +51 -7
- package/parseCEL/package.json +1 -1
- package/parseCypher/package.json +4 -0
- package/parseGremlin/package.json +4 -0
- package/parseJSONata/package.json +1 -1
- package/parseJsonLogic/package.json +1 -1
- package/parseMongoDB/package.json +1 -1
- package/parseSPARQL/package.json +4 -0
- package/parseSQL/package.json +1 -1
- package/parseSpEL/package.json +1 -1
- package/transformQuery/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertQuery-BeJJH9BI.mjs","names":[],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as ToRuleGroupTypeIC<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;
|
|
1
|
+
{"version":3,"file":"convertQuery-BeJJH9BI.mjs","names":[],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as ToRuleGroupTypeIC<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;AAAK;AAE5C,MAAM,gBAAgB,GAAY,MAAc,GAAG,CAAC,MAAM;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;CAGxC,IAAI,CAAC,GAAG,MAAM,SAAS,cAAqB,GAG1C,OAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,CAAC,IACxE;CAGN,MAAM,WAAW,CAAC,GAAG,GAAG,KAAK;CAC7B,IAAI,SAAS;CAGb,OAAO,SAAS,SAAS,SAAS,GAAG;EACnC,IAAI,aAAa,SAAS,SAAS,IAAI,cAAc,GAAG;GACtD,UAAU;GACV;EACF;EAEA,IAAI,0BAA0B;EAC9B,KAAK,IAAI,IAAI,SAAS,GAAG,IAAI,SAAS,QAAQ,KAC5C,IAAI,OAAO,SAAS,OAAO,YAAY,GAAG,SAAS,EAAE,MAAM,gBAAgB;GACzE,0BAA0B;GAC1B;EACF;EAGF,IAAI,4BAA4B,IAAI;GAElC,SAAS,OACP,QACA,SAAS,QACT,6CAEE,EAAE,OAAO,SAAS,MAAM,MAAM,EAAS,GACvC,sBAAsB,CACxB,CACF;GACA;EACF,OAEE,SAAS,OACP,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,SAAS,MAAM,QAAQ,uBAAuB,EAAS,GAChE,sBAAsB,CACxB,CACF;CAEJ;CAEA,OAAO;EAAE,GAAG;EAAI,OAAO;CAAS;AAClC;;;;;;;;;AAUA,MAAa,iBAA8C,OAAgC;CACzF,IAAI,gBAAgB,EAAE,GACpB,OAAO;CAET,MAAM,cAAc,6CAA6C,EAAE;CACnE,MAAM,QAAwB,CAAC;CAC/B,IAAI,aAAa;CACjB,KAAK,MAAM,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ,GAC/C,IAAI,OAAO,MAAM;MACX,QAAQ,GAAG,aAAa;CAAA,OAE5B,MAAM,KAAK,YAAY,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;CAGpD,OAAO;EAAE,GAAG;EAAa;EAAY;CAAM;AAC7C;;;;;;;;;AAUA,MAAa,eAA4C,OAAkC;CACzF,IAAI,kBAAkB,EAAE,GACtB,OAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAM,QAAiD,CAAC;CACxD,MAAM,EAAE,WAAW,GAAG;CACtB,KAAK,IAAI,MAAM,GAAG,MAAM,QAAQ,OAAO;EACrC,MAAM,IAAI,GAAG,MAAM;EACnB,IAAI,YAAY,CAAC,GACf,MAAM,KAAK,YAAY,CAAC,CAAC;OAEzB,MAAM,KAAK,CAAC;EAEd,IAAI,cAAc,MAAM,SAAS,GAC/B,MAAM,KAAK,UAAU;CAEzB;CACA,OAAO;EAAE,GAAG;EAAwB;CAAM;AAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertQuery-Lx2HQa0m.js","names":["lc","isRuleGroupType","isRuleGroup","isRuleGroupTypeIC"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as ToRuleGroupTypeIC<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;
|
|
1
|
+
{"version":3,"file":"convertQuery-Lx2HQa0m.js","names":["lc","isRuleGroupType","isRuleGroup","isRuleGroupTypeIC"],"sources":["../src/utils/convertQuery.ts"],"sourcesContent":["import type {\n RuleGroupArray,\n RuleGroupICArray,\n RuleGroupType,\n RuleGroupTypeAny,\n RuleGroupTypeIC,\n RuleType,\n ToRuleGroupType,\n ToRuleGroupTypeIC,\n} from '../types';\nimport { isRuleGroup, isRuleGroupType, isRuleGroupTypeIC } from './isRuleGroup';\nimport { lc } from './misc';\n\nconst combinatorLevels = ['or', 'xor', 'and'] as const;\n\nconst isSameString = (a: unknown, b: string) => lc(a) === b;\n\nconst generateRuleGroupICWithConsistentCombinators = (\n rg: RuleGroupTypeIC,\n baseCombinatorLevel: number = 0\n): RuleGroupTypeIC => {\n const baseCombinator = combinatorLevels[baseCombinatorLevel];\n\n // oxlint-disable-next-line typescript/no-explicit-any\n if (!rg.rules.includes(baseCombinator as any)) {\n // No instances of this combinator, so group based on the next\n // combinator level if at least two levels remain\n return baseCombinatorLevel < combinatorLevels.length - 2\n ? generateRuleGroupICWithConsistentCombinators(rg, baseCombinatorLevel + 1)\n : rg;\n }\n\n const newRules = [...rg.rules] as RuleGroupICArray;\n let cursor = 0;\n\n // Group all chains of combinators in the rule array that are not the base combinator\n while (cursor < newRules.length - 2) {\n if (isSameString(newRules[cursor + 1], baseCombinator)) {\n cursor += 2;\n continue;\n }\n\n let nextBaseCombinatorIndex = -1;\n for (let i = cursor + 2; i < newRules.length; i++) {\n if (typeof newRules[i] === 'string' && lc(newRules[i]) === baseCombinator) {\n nextBaseCombinatorIndex = i;\n break;\n }\n }\n\n if (nextBaseCombinatorIndex === -1) {\n // No more instances of this combinator, so group all remaining rules and exit the loop\n newRules.splice(\n cursor,\n newRules.length,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor) as any },\n baseCombinatorLevel + 1\n )\n );\n break;\n } else {\n // Group all rules between the current cursor and the next instance of the base combinator\n newRules.splice(\n cursor,\n nextBaseCombinatorIndex - cursor,\n generateRuleGroupICWithConsistentCombinators(\n // oxlint-disable-next-line typescript/no-explicit-any\n { rules: newRules.slice(cursor, nextBaseCombinatorIndex) as any },\n baseCombinatorLevel + 1\n )\n );\n }\n }\n\n return { ...rg, rules: newRules };\n};\n\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}.\n *\n * This function is idempotent: {@link RuleGroupType} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertFromIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupType<RG> => {\n if (isRuleGroupType(rg)) {\n return rg as ToRuleGroupType<RG>;\n }\n const processedRG = generateRuleGroupICWithConsistentCombinators(rg);\n const rules: RuleGroupArray = [];\n let combinator = 'and';\n for (const [idx, r] of processedRG.rules.entries()) {\n if (typeof r === 'string') {\n if (idx === 1) combinator = r;\n } else {\n rules.push(isRuleGroup(r) ? convertFromIC(r) : r);\n }\n }\n return { ...processedRG, combinator, rules } as ToRuleGroupType<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}.\n *\n * This function is idempotent: {@link RuleGroupTypeIC} queries will be\n * returned as-is.\n *\n * @group Query Tools\n */\nexport const convertToIC = <RG extends RuleGroupTypeAny>(rg: RG): ToRuleGroupTypeIC<RG> => {\n if (isRuleGroupTypeIC(rg)) {\n return rg as ToRuleGroupTypeIC<RG>;\n }\n const { combinator, ...queryWithoutCombinator } = rg;\n const rules: (RuleGroupTypeIC | RuleType | string)[] = [];\n const { length } = rg.rules;\n for (let idx = 0; idx < length; idx++) {\n const r = rg.rules[idx];\n if (isRuleGroup(r)) {\n rules.push(convertToIC(r));\n } else {\n rules.push(r);\n }\n if (combinator && idx < length - 1) {\n rules.push(combinator);\n }\n }\n return { ...queryWithoutCombinator, rules } as ToRuleGroupTypeIC<RG>;\n};\n\n/**\n * Converts a {@link RuleGroupType} to {@link RuleGroupTypeIC}. For a more explicit\n * operation, use {@link convertToIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupType): RuleGroupTypeIC;\n/**\n * Converts a {@link RuleGroupTypeIC} to {@link RuleGroupType}. For a more explicit\n * operation, use {@link convertFromIC}.\n *\n * @group Query Tools\n */\nfunction convertQuery(query: RuleGroupTypeIC): RuleGroupType;\nfunction convertQuery(query: RuleGroupType | RuleGroupTypeIC): RuleGroupType | RuleGroupTypeIC {\n return isRuleGroupTypeIC(query) ? convertFromIC(query) : convertToIC(query);\n}\n\nexport { convertQuery };\n"],"mappings":";;AAaA,MAAM,mBAAmB;CAAC;CAAM;CAAO;AAAK;AAE5C,MAAM,gBAAgB,GAAY,MAAcA,oBAAAA,GAAG,CAAC,MAAM;AAE1D,MAAM,gDACJ,IACA,sBAA8B,MACV;CACpB,MAAM,iBAAiB,iBAAiB;CAGxC,IAAI,CAAC,GAAG,MAAM,SAAS,cAAqB,GAG1C,OAAO,sBAAsB,iBAAiB,SAAS,IACnD,6CAA6C,IAAI,sBAAsB,CAAC,IACxE;CAGN,MAAM,WAAW,CAAC,GAAG,GAAG,KAAK;CAC7B,IAAI,SAAS;CAGb,OAAO,SAAS,SAAS,SAAS,GAAG;EACnC,IAAI,aAAa,SAAS,SAAS,IAAI,cAAc,GAAG;GACtD,UAAU;GACV;EACF;EAEA,IAAI,0BAA0B;EAC9B,KAAK,IAAI,IAAI,SAAS,GAAG,IAAI,SAAS,QAAQ,KAC5C,IAAI,OAAO,SAAS,OAAO,YAAYA,oBAAAA,GAAG,SAAS,EAAE,MAAM,gBAAgB;GACzE,0BAA0B;GAC1B;EACF;EAGF,IAAI,4BAA4B,IAAI;GAElC,SAAS,OACP,QACA,SAAS,QACT,6CAEE,EAAE,OAAO,SAAS,MAAM,MAAM,EAAS,GACvC,sBAAsB,CACxB,CACF;GACA;EACF,OAEE,SAAS,OACP,QACA,0BAA0B,QAC1B,6CAEE,EAAE,OAAO,SAAS,MAAM,QAAQ,uBAAuB,EAAS,GAChE,sBAAsB,CACxB,CACF;CAEJ;CAEA,OAAO;EAAE,GAAG;EAAI,OAAO;CAAS;AAClC;;;;;;;;;AAUA,MAAa,iBAA8C,OAAgC;CACzF,IAAIC,oBAAAA,gBAAgB,EAAE,GACpB,OAAO;CAET,MAAM,cAAc,6CAA6C,EAAE;CACnE,MAAM,QAAwB,CAAC;CAC/B,IAAI,aAAa;CACjB,KAAK,MAAM,CAAC,KAAK,MAAM,YAAY,MAAM,QAAQ,GAC/C,IAAI,OAAO,MAAM;MACX,QAAQ,GAAG,aAAa;CAAA,OAE5B,MAAM,KAAKC,oBAAAA,YAAY,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC;CAGpD,OAAO;EAAE,GAAG;EAAa;EAAY;CAAM;AAC7C;;;;;;;;;AAUA,MAAa,eAA4C,OAAkC;CACzF,IAAIC,oBAAAA,kBAAkB,EAAE,GACtB,OAAO;CAET,MAAM,EAAE,YAAY,GAAG,2BAA2B;CAClD,MAAM,QAAiD,CAAC;CACxD,MAAM,EAAE,WAAW,GAAG;CACtB,KAAK,IAAI,MAAM,GAAG,MAAM,QAAQ,OAAO;EACrC,MAAM,IAAI,GAAG,MAAM;EACnB,IAAID,oBAAAA,YAAY,CAAC,GACf,MAAM,KAAK,YAAY,CAAC,CAAC;OAEzB,MAAM,KAAK,CAAC;EAEd,IAAI,cAAc,MAAM,SAAS,GAC/B,MAAM,KAAK,UAAU;CAEzB;CACA,OAAO;EAAE,GAAG;EAAwB;CAAM;AAC5C"}
|
package/dist/formatQuery.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-AAZg4Uh1.mjs";
|
|
2
2
|
import { Column, Operators, SQL, Table } from "drizzle-orm";
|
|
3
3
|
import { WhereOptions } from "sequelize";
|
|
4
4
|
|
|
@@ -44,6 +44,23 @@ declare const defaultValueProcessorByRule: ValueProcessorByRule;
|
|
|
44
44
|
*/
|
|
45
45
|
declare const defaultRuleGroupProcessorCEL: RuleGroupProcessor<string>;
|
|
46
46
|
//#endregion
|
|
47
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCypher.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* Maps a {@link DefaultCombinatorName} to a Cypher combinator keyword.
|
|
50
|
+
*
|
|
51
|
+
* @group Export
|
|
52
|
+
*/
|
|
53
|
+
declare const cypherCombinatorMap: {
|
|
54
|
+
and: "AND";
|
|
55
|
+
or: "OR";
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Rule group processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
59
|
+
*
|
|
60
|
+
* @group Export
|
|
61
|
+
*/
|
|
62
|
+
declare const defaultRuleGroupProcessorCypher: RuleGroupProcessor<string>;
|
|
63
|
+
//#endregion
|
|
47
64
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.d.ts
|
|
48
65
|
/**
|
|
49
66
|
* Default rule group processor used by {@link formatQuery} for the "drizzle" format. The returned
|
|
@@ -67,6 +84,18 @@ declare const defaultRuleGroupProcessorDrizzle: RuleGroupProcessor<(columns: Rec
|
|
|
67
84
|
*/
|
|
68
85
|
declare const defaultRuleGroupProcessorElasticSearch: RuleGroupProcessor<Record<string, unknown>>;
|
|
69
86
|
//#endregion
|
|
87
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorGremlin.d.ts
|
|
88
|
+
/**
|
|
89
|
+
* Rule group processor used by {@link formatQuery} for "gremlin" format.
|
|
90
|
+
*
|
|
91
|
+
* At the top level, filter rules produce chained `.has()` steps (implicit AND).
|
|
92
|
+
* Nested groups use `.and()` / `.or()` / `.not()` compound traversals with
|
|
93
|
+
* `__` anonymous traversal prefixes.
|
|
94
|
+
*
|
|
95
|
+
* @group Export
|
|
96
|
+
*/
|
|
97
|
+
declare const defaultRuleGroupProcessorGremlin: RuleGroupProcessor<string>;
|
|
98
|
+
//#endregion
|
|
70
99
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.d.ts
|
|
71
100
|
/**
|
|
72
101
|
* Rule group processor used by {@link formatQuery} for "jsonata" format.
|
|
@@ -158,6 +187,16 @@ declare const defaultRuleGroupProcessorPrisma: RuleGroupProcessor<Record<string,
|
|
|
158
187
|
*/
|
|
159
188
|
declare const defaultRuleGroupProcessorSequelize: RuleGroupProcessor<WhereOptions | undefined>;
|
|
160
189
|
//#endregion
|
|
190
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSPARQL.d.ts
|
|
191
|
+
/**
|
|
192
|
+
* Rule group processor used by {@link formatQuery} for "sparql" format.
|
|
193
|
+
*
|
|
194
|
+
* SPARQL uses the same combinators as CEL (`&&` / `||`) and `!()` for negation.
|
|
195
|
+
*
|
|
196
|
+
* @group Export
|
|
197
|
+
*/
|
|
198
|
+
declare const defaultRuleGroupProcessorSPARQL: RuleGroupProcessor<string>;
|
|
199
|
+
//#endregion
|
|
161
200
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.d.ts
|
|
162
201
|
/**
|
|
163
202
|
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
@@ -187,6 +226,14 @@ declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
|
187
226
|
*/
|
|
188
227
|
declare const defaultRuleGroupProcessorDiagnostics: RuleGroupProcessor<DiagnosticsResult>;
|
|
189
228
|
//#endregion
|
|
229
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCypher.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Default rule processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
232
|
+
*
|
|
233
|
+
* @group Export
|
|
234
|
+
*/
|
|
235
|
+
declare const defaultRuleProcessorCypher: RuleProcessor;
|
|
236
|
+
//#endregion
|
|
190
237
|
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
191
238
|
/**
|
|
192
239
|
* Default rule processor used by {@link formatQuery} for the "drizzle" format.
|
|
@@ -203,6 +250,16 @@ declare const defaultRuleProcessorDrizzle: RuleProcessor;
|
|
|
203
250
|
*/
|
|
204
251
|
declare const defaultRuleProcessorElasticSearch: RuleProcessor;
|
|
205
252
|
//#endregion
|
|
253
|
+
//#region src/utils/formatQuery/defaultRuleProcessorGremlin.d.ts
|
|
254
|
+
/**
|
|
255
|
+
* Default rule processor used by {@link formatQuery} for "gremlin" format.
|
|
256
|
+
*
|
|
257
|
+
* Each rule becomes a `.has()` step (or `.hasNot()`/`.has()` for null checks).
|
|
258
|
+
*
|
|
259
|
+
* @group Export
|
|
260
|
+
*/
|
|
261
|
+
declare const defaultRuleProcessorGremlin: RuleProcessor;
|
|
262
|
+
//#endregion
|
|
206
263
|
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.d.ts
|
|
207
264
|
/**
|
|
208
265
|
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
@@ -280,6 +337,19 @@ declare const defaultRuleProcessorPrisma: RuleProcessor;
|
|
|
280
337
|
*/
|
|
281
338
|
declare const defaultRuleProcessorSequelize: RuleProcessor;
|
|
282
339
|
//#endregion
|
|
340
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSPARQL.d.ts
|
|
341
|
+
/** Auto-prefix a SPARQL variable name with `?` unless it's already prefixed, a URI, or a prefixed name.
|
|
342
|
+
*
|
|
343
|
+
* @group Export
|
|
344
|
+
*/
|
|
345
|
+
declare const sparqlVar: (name: string) => string;
|
|
346
|
+
/**
|
|
347
|
+
* Default rule processor used by {@link formatQuery} for "sparql" format.
|
|
348
|
+
*
|
|
349
|
+
* @group Export
|
|
350
|
+
*/
|
|
351
|
+
declare const defaultRuleProcessorSPARQL: RuleProcessor;
|
|
352
|
+
//#endregion
|
|
283
353
|
//#region src/utils/formatQuery/defaultRuleProcessorSQL.d.ts
|
|
284
354
|
/**
|
|
285
355
|
* Default operator processor used by {@link formatQuery} for "sql" and "parameterized*" formats.
|
|
@@ -697,5 +767,5 @@ declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
|
697
767
|
*/
|
|
698
768
|
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
699
769
|
//#endregion
|
|
700
|
-
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDiagnostics, 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 };
|
|
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 };
|
|
701
771
|
//# sourceMappingURL=formatQuery.d.mts.map
|
package/dist/formatQuery.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-Ds06V0zO.js";
|
|
2
2
|
import { Column, Operators, SQL, Table } from "drizzle-orm";
|
|
3
3
|
import { WhereOptions } from "sequelize";
|
|
4
4
|
|
|
@@ -44,6 +44,23 @@ declare const defaultValueProcessorByRule: ValueProcessorByRule;
|
|
|
44
44
|
*/
|
|
45
45
|
declare const defaultRuleGroupProcessorCEL: RuleGroupProcessor<string>;
|
|
46
46
|
//#endregion
|
|
47
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorCypher.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* Maps a {@link DefaultCombinatorName} to a Cypher combinator keyword.
|
|
50
|
+
*
|
|
51
|
+
* @group Export
|
|
52
|
+
*/
|
|
53
|
+
declare const cypherCombinatorMap: {
|
|
54
|
+
and: "AND";
|
|
55
|
+
or: "OR";
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Rule group processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
59
|
+
*
|
|
60
|
+
* @group Export
|
|
61
|
+
*/
|
|
62
|
+
declare const defaultRuleGroupProcessorCypher: RuleGroupProcessor<string>;
|
|
63
|
+
//#endregion
|
|
47
64
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorDrizzle.d.ts
|
|
48
65
|
/**
|
|
49
66
|
* Default rule group processor used by {@link formatQuery} for the "drizzle" format. The returned
|
|
@@ -67,6 +84,18 @@ declare const defaultRuleGroupProcessorDrizzle: RuleGroupProcessor<(columns: Rec
|
|
|
67
84
|
*/
|
|
68
85
|
declare const defaultRuleGroupProcessorElasticSearch: RuleGroupProcessor<Record<string, unknown>>;
|
|
69
86
|
//#endregion
|
|
87
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorGremlin.d.ts
|
|
88
|
+
/**
|
|
89
|
+
* Rule group processor used by {@link formatQuery} for "gremlin" format.
|
|
90
|
+
*
|
|
91
|
+
* At the top level, filter rules produce chained `.has()` steps (implicit AND).
|
|
92
|
+
* Nested groups use `.and()` / `.or()` / `.not()` compound traversals with
|
|
93
|
+
* `__` anonymous traversal prefixes.
|
|
94
|
+
*
|
|
95
|
+
* @group Export
|
|
96
|
+
*/
|
|
97
|
+
declare const defaultRuleGroupProcessorGremlin: RuleGroupProcessor<string>;
|
|
98
|
+
//#endregion
|
|
70
99
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorJSONata.d.ts
|
|
71
100
|
/**
|
|
72
101
|
* Rule group processor used by {@link formatQuery} for "jsonata" format.
|
|
@@ -158,6 +187,16 @@ declare const defaultRuleGroupProcessorPrisma: RuleGroupProcessor<Record<string,
|
|
|
158
187
|
*/
|
|
159
188
|
declare const defaultRuleGroupProcessorSequelize: RuleGroupProcessor<WhereOptions | undefined>;
|
|
160
189
|
//#endregion
|
|
190
|
+
//#region src/utils/formatQuery/defaultRuleGroupProcessorSPARQL.d.ts
|
|
191
|
+
/**
|
|
192
|
+
* Rule group processor used by {@link formatQuery} for "sparql" format.
|
|
193
|
+
*
|
|
194
|
+
* SPARQL uses the same combinators as CEL (`&&` / `||`) and `!()` for negation.
|
|
195
|
+
*
|
|
196
|
+
* @group Export
|
|
197
|
+
*/
|
|
198
|
+
declare const defaultRuleGroupProcessorSPARQL: RuleGroupProcessor<string>;
|
|
199
|
+
//#endregion
|
|
161
200
|
//#region src/utils/formatQuery/defaultRuleGroupProcessorSpEL.d.ts
|
|
162
201
|
/**
|
|
163
202
|
* Default rule processor used by {@link formatQuery} for "spel" format.
|
|
@@ -187,6 +226,14 @@ declare const defaultRuleGroupProcessorSQL: RuleGroupProcessor<string>;
|
|
|
187
226
|
*/
|
|
188
227
|
declare const defaultRuleGroupProcessorDiagnostics: RuleGroupProcessor<DiagnosticsResult>;
|
|
189
228
|
//#endregion
|
|
229
|
+
//#region src/utils/formatQuery/defaultRuleProcessorCypher.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Default rule processor used by {@link formatQuery} for "cypher" and "gql" formats.
|
|
232
|
+
*
|
|
233
|
+
* @group Export
|
|
234
|
+
*/
|
|
235
|
+
declare const defaultRuleProcessorCypher: RuleProcessor;
|
|
236
|
+
//#endregion
|
|
190
237
|
//#region src/utils/formatQuery/defaultRuleProcessorDrizzle.d.ts
|
|
191
238
|
/**
|
|
192
239
|
* Default rule processor used by {@link formatQuery} for the "drizzle" format.
|
|
@@ -203,6 +250,16 @@ declare const defaultRuleProcessorDrizzle: RuleProcessor;
|
|
|
203
250
|
*/
|
|
204
251
|
declare const defaultRuleProcessorElasticSearch: RuleProcessor;
|
|
205
252
|
//#endregion
|
|
253
|
+
//#region src/utils/formatQuery/defaultRuleProcessorGremlin.d.ts
|
|
254
|
+
/**
|
|
255
|
+
* Default rule processor used by {@link formatQuery} for "gremlin" format.
|
|
256
|
+
*
|
|
257
|
+
* Each rule becomes a `.has()` step (or `.hasNot()`/`.has()` for null checks).
|
|
258
|
+
*
|
|
259
|
+
* @group Export
|
|
260
|
+
*/
|
|
261
|
+
declare const defaultRuleProcessorGremlin: RuleProcessor;
|
|
262
|
+
//#endregion
|
|
206
263
|
//#region src/utils/formatQuery/defaultRuleProcessorJSONata.d.ts
|
|
207
264
|
/**
|
|
208
265
|
* Default rule processor used by {@link formatQuery} for "jsonata" format.
|
|
@@ -280,6 +337,19 @@ declare const defaultRuleProcessorPrisma: RuleProcessor;
|
|
|
280
337
|
*/
|
|
281
338
|
declare const defaultRuleProcessorSequelize: RuleProcessor;
|
|
282
339
|
//#endregion
|
|
340
|
+
//#region src/utils/formatQuery/defaultRuleProcessorSPARQL.d.ts
|
|
341
|
+
/** Auto-prefix a SPARQL variable name with `?` unless it's already prefixed, a URI, or a prefixed name.
|
|
342
|
+
*
|
|
343
|
+
* @group Export
|
|
344
|
+
*/
|
|
345
|
+
declare const sparqlVar: (name: string) => string;
|
|
346
|
+
/**
|
|
347
|
+
* Default rule processor used by {@link formatQuery} for "sparql" format.
|
|
348
|
+
*
|
|
349
|
+
* @group Export
|
|
350
|
+
*/
|
|
351
|
+
declare const defaultRuleProcessorSPARQL: RuleProcessor;
|
|
352
|
+
//#endregion
|
|
283
353
|
//#region src/utils/formatQuery/defaultRuleProcessorSQL.d.ts
|
|
284
354
|
/**
|
|
285
355
|
* Default operator processor used by {@link formatQuery} for "sql" and "parameterized*" formats.
|
|
@@ -697,5 +767,5 @@ declare const defaultValueProcessorMongoDBByRule: RuleProcessor;
|
|
|
697
767
|
*/
|
|
698
768
|
declare const defaultValueProcessorSpELByRule: RuleProcessor;
|
|
699
769
|
//#endregion
|
|
700
|
-
export { bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, defaultCELValueProcessor, defaultExportOperatorMap, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorDiagnostics, 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 };
|
|
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 };
|
|
701
771
|
//# sourceMappingURL=formatQuery.d.ts.map
|