@react-querybuilder/core 8.23.1 → 8.24.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/dist/cjs/react-querybuilder_core.cjs.development.d.ts +516 -455
- package/dist/cjs/react-querybuilder_core.cjs.development.js +169 -6
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +516 -455
- package/dist/cjs/react-querybuilder_core.cjs.production.js +74 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/derivations.d.mts +290 -239
- package/dist/derivations.d.ts +290 -239
- package/dist/derivations.js +137 -4
- package/dist/derivations.js.map +1 -1
- package/dist/derivations.mjs +136 -5
- package/dist/derivations.mjs.map +1 -1
- package/dist/formatQuery.d.mts +1 -1
- package/dist/formatQuery.d.ts +1 -1
- package/dist/formatQuery.js +7 -4
- package/dist/formatQuery.js.map +1 -1
- package/dist/formatQuery.mjs +7 -4
- package/dist/formatQuery.mjs.map +1 -1
- package/dist/{import-BfZTwhp2.d.ts → import-BCkipOTY.d.ts} +2 -2
- package/dist/{import-BdKPtLzo.d.mts → import-C9el4B_K.d.mts} +2 -2
- package/dist/{index-DOIE2pwx.d.ts → index-BExDPYEG.d.mts} +10 -8
- package/dist/{index-DOIE2pwx.d.mts → index-BExDPYEG.d.ts} +10 -8
- package/dist/{index-XueTy_XQ.d.ts → index-icv8DBhg.d.mts} +5 -3
- package/dist/{index-OF2Q1gTp.d.mts → index-yXGVO31H.d.ts} +5 -3
- package/dist/parseCEL.d.mts +112 -112
- package/dist/parseCEL.d.ts +112 -112
- package/dist/parseCEL.js +4 -4
- package/dist/parseCEL.js.map +1 -1
- package/dist/parseCEL.mjs +4 -4
- package/dist/parseCEL.mjs.map +1 -1
- package/dist/parseCypher.d.mts +8 -8
- package/dist/parseCypher.d.ts +8 -8
- package/dist/parseGremlin.d.mts +5 -5
- package/dist/parseGremlin.d.ts +5 -5
- package/dist/parseJSONata.d.mts +39 -39
- package/dist/parseJSONata.d.ts +39 -39
- package/dist/parseJSONata.js +2 -2
- package/dist/parseJSONata.mjs +2 -2
- package/dist/parseJsonLogic.d.mts +10 -10
- package/dist/parseJsonLogic.d.ts +10 -10
- package/dist/parseJsonLogic.js +3 -3
- package/dist/parseJsonLogic.mjs +3 -3
- package/dist/parseMongoDB.d.mts +9 -9
- package/dist/parseMongoDB.d.ts +9 -9
- package/dist/parseMongoDB.js +3 -3
- package/dist/parseMongoDB.mjs +3 -3
- package/dist/parseSPARQL.d.mts +5 -5
- package/dist/parseSPARQL.d.ts +5 -5
- package/dist/parseSQL.d.mts +63 -63
- package/dist/parseSQL.d.ts +63 -63
- package/dist/parseSQL.js +4 -4
- package/dist/parseSQL.js.map +1 -1
- package/dist/parseSQL.mjs +4 -4
- package/dist/parseSQL.mjs.map +1 -1
- package/dist/parseSpEL.d.mts +57 -57
- package/dist/parseSpEL.d.ts +57 -57
- package/dist/parseSpEL.js +3 -3
- package/dist/parseSpEL.mjs +3 -3
- package/dist/{parserUtils-DbBXyAht.js → parserUtils-2VtG7m8L.js} +3 -3
- package/dist/{parserUtils-DbBXyAht.js.map → parserUtils-2VtG7m8L.js.map} +1 -1
- package/dist/{parserUtils-BKPstAaO.mjs → parserUtils-BlafvoFb.mjs} +3 -3
- package/dist/{parserUtils-BKPstAaO.mjs.map → parserUtils-BlafvoFb.mjs.map} +1 -1
- package/dist/{prepareQueryObjects-Dj9cTl9D.js → prepareQueryObjects-DJ_VjOLb.js} +2 -2
- package/dist/{prepareQueryObjects-Dj9cTl9D.js.map → prepareQueryObjects-DJ_VjOLb.js.map} +1 -1
- package/dist/{prepareQueryObjects-Dmyf3Wi_.mjs → prepareQueryObjects-DawsH4e3.mjs} +2 -2
- package/dist/{prepareQueryObjects-Dmyf3Wi_.mjs.map → prepareQueryObjects-DawsH4e3.mjs.map} +1 -1
- package/dist/react-querybuilder_core.d.mts +516 -455
- package/dist/react-querybuilder_core.legacy-esm.d.ts +516 -455
- package/dist/react-querybuilder_core.legacy-esm.js +172 -14
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +168 -7
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +516 -455
- package/dist/react-querybuilder_core.production.mjs +74 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/dist/{transformQuery-B7d9AWUf.d.mts → transformQuery-B6PRLRkS.d.mts} +2 -2
- package/dist/{transformQuery-BXDiUBGB.d.ts → transformQuery-DVjJZXnB.d.ts} +2 -2
- package/dist/transformQuery.d.mts +1 -1
- package/dist/transformQuery.d.ts +1 -1
- package/dist/{utils-e-7KHkjV.js → utils-B4E1-ZvU.js} +12 -2
- package/dist/utils-B4E1-ZvU.js.map +1 -0
- package/dist/{utils-CP5Jqy1P.mjs → utils-DLZCoyAh.mjs} +12 -2
- package/dist/utils-DLZCoyAh.mjs.map +1 -0
- package/package.json +20 -19
- package/dist/utils-CP5Jqy1P.mjs.map +0 -1
- package/dist/utils-e-7KHkjV.js.map +0 -1
package/dist/parseMongoDB.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { U as joinWith, ot as defaultOperatorNegationMap } from "./utils-
|
|
1
|
+
import { U as joinWith, ot as defaultOperatorNegationMap } from "./utils-DLZCoyAh.mjs";
|
|
2
2
|
import { a as isRuleGroupType, c as isPojo, r as objectKeys } from "./objectUtils-DDZ-KhV5.mjs";
|
|
3
3
|
import { r as convertToIC } from "./convertQuery-DaXv3h7S.mjs";
|
|
4
|
-
import { n as prepareRuleGroup } from "./prepareQueryObjects-
|
|
5
|
-
import { n as getFieldsArray, t as fieldIsValidUtil } from "./parserUtils-
|
|
4
|
+
import { n as prepareRuleGroup } from "./prepareQueryObjects-DawsH4e3.mjs";
|
|
5
|
+
import { n as getFieldsArray, t as fieldIsValidUtil } from "./parserUtils-BlafvoFb.mjs";
|
|
6
6
|
//#region src/utils/parseMongoDB/utils.ts
|
|
7
7
|
const getRegExStr = (re) => typeof re === "string" ? re : re.source;
|
|
8
8
|
const isPrimitive = (v) => typeof v === "string" || typeof v === "number" || typeof v === "boolean";
|
package/dist/parseSPARQL.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC } from "./index-
|
|
1
|
+
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC } from "./index-BExDPYEG.mjs";
|
|
2
2
|
//#region src/utils/parseSPARQL/parseSPARQL.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Options for {@link parseSPARQL}.
|
|
@@ -21,13 +21,13 @@ interface ParseSPARQLOptions {
|
|
|
21
21
|
* parseSPARQL('?age > 30 && ?name != "Alice"');
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
declare function parseSPARQL(sparql: string): DefaultRuleGroupType;
|
|
25
|
-
declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
24
|
+
export declare function parseSPARQL(sparql: string): DefaultRuleGroupType;
|
|
25
|
+
export declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
26
26
|
independentCombinators?: false;
|
|
27
27
|
}): DefaultRuleGroupType;
|
|
28
|
-
declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
28
|
+
export declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
29
29
|
independentCombinators: true;
|
|
30
30
|
}): DefaultRuleGroupTypeIC;
|
|
31
31
|
//#endregion
|
|
32
|
-
export {
|
|
32
|
+
export type { ParseSPARQLOptions };
|
|
33
33
|
//# sourceMappingURL=parseSPARQL.d.mts.map
|
package/dist/parseSPARQL.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC } from "./index-
|
|
1
|
+
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC } from "./index-BExDPYEG.js";
|
|
2
2
|
//#region src/utils/parseSPARQL/parseSPARQL.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Options for {@link parseSPARQL}.
|
|
@@ -21,13 +21,13 @@ interface ParseSPARQLOptions {
|
|
|
21
21
|
* parseSPARQL('?age > 30 && ?name != "Alice"');
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
declare function parseSPARQL(sparql: string): DefaultRuleGroupType;
|
|
25
|
-
declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
24
|
+
export declare function parseSPARQL(sparql: string): DefaultRuleGroupType;
|
|
25
|
+
export declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
26
26
|
independentCombinators?: false;
|
|
27
27
|
}): DefaultRuleGroupType;
|
|
28
|
-
declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
28
|
+
export declare function parseSPARQL(sparql: string, options: Omit<ParseSPARQLOptions, "independentCombinators"> & {
|
|
29
29
|
independentCombinators: true;
|
|
30
30
|
}): DefaultRuleGroupTypeIC;
|
|
31
31
|
//#endregion
|
|
32
|
-
export {
|
|
32
|
+
export type { ParseSPARQLOptions };
|
|
33
33
|
//# sourceMappingURL=parseSPARQL.d.ts.map
|
package/dist/parseSQL.d.mts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC, Yt as DefaultCombinatorNameExtended, Zt as DefaultOperatorName, jn as Except, on as ExpressionNode } from "./index-
|
|
2
|
-
import { t as ParserCommonOptions } from "./import-
|
|
1
|
+
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC, Yt as DefaultCombinatorNameExtended, Zt as DefaultOperatorName, jn as Except, on as ExpressionNode } from "./index-BExDPYEG.mjs";
|
|
2
|
+
import { t as ParserCommonOptions } from "./import-C9el4B_K.mjs";
|
|
3
3
|
//#region src/utils/parseSQL/types.d.ts
|
|
4
4
|
type AnyCase<T extends string> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` : "";
|
|
5
5
|
type TokenType = "AndExpression" | "BetweenPredicate" | "BitExpression" | "Boolean" | "BooleanExtra" | "CaseWhen" | "ComparisonBooleanPrimary" | "ComparisonSubQueryBooleanPrimary" | "ContainsExpr" | "EndsWithExpr" | "ExpressionList" | "ForceIndexHint" | "ForOptIndexHint" | "FunctionCall" | "FunctionCallParam" | "GroupBy" | "GroupByOrderByItem" | "Identifier" | "IdentifierExpr" | "IdentifierList" | "IgnoreIndexHint" | "IndexHintList" | "InExpressionListPredicate" | "InnerCrossJoinTable" | "InSubQueryPredicate" | "IsExpression" | "IsNullBooleanPrimary" | "LeftRightJoinTable" | "LikePredicate" | "Limit" | "Main" | "NaturalJoinTable" | "NotExpression" | "Null" | "Number" | "OnJoinCondition" | "OrderBy" | "OrExpression" | "Partitions" | "PlaceHolder" | "Prefix" | "RegexpPredicate" | "Select" | "SelectExpr" | "SelectParenthesized" | "SimpleExprParentheses" | "SoundsLikePredicate" | "StartsWithExpr" | "StraightJoinTable" | "String" | "SubQuery" | "TableFactor" | "TableReference" | "TableReferences" | "Union" | "UseIndexHint" | "UsingJoinCondition" | "WhenThenList" | "XorExpression";
|
|
6
|
-
type ComparisonOperator = "=" | ">=" | ">" | "<=" | "<" | "<>" | "!=";
|
|
7
|
-
type NotOpt = AnyCase<"NOT"> | null;
|
|
8
|
-
type AndOperator = AnyCase<"AND">;
|
|
9
|
-
type OrOperator = AnyCase<"OR">;
|
|
10
|
-
type XorOperator = AnyCase<"XOR">;
|
|
11
|
-
interface SQLWhereObject {
|
|
6
|
+
export type ComparisonOperator = "=" | ">=" | ">" | "<=" | "<" | "<>" | "!=";
|
|
7
|
+
export type NotOpt = AnyCase<"NOT"> | null;
|
|
8
|
+
export type AndOperator = AnyCase<"AND">;
|
|
9
|
+
export type OrOperator = AnyCase<"OR">;
|
|
10
|
+
export type XorOperator = AnyCase<"XOR">;
|
|
11
|
+
export interface SQLWhereObject {
|
|
12
12
|
type: TokenType;
|
|
13
13
|
}
|
|
14
|
-
interface SQLIdentifier extends SQLWhereObject {
|
|
14
|
+
export interface SQLIdentifier extends SQLWhereObject {
|
|
15
15
|
type: "Identifier";
|
|
16
16
|
value: string;
|
|
17
17
|
}
|
|
18
|
-
interface SQLWhereObjectAny extends SQLWhereObject {
|
|
18
|
+
export interface SQLWhereObjectAny extends SQLWhereObject {
|
|
19
19
|
[k: string]: any;
|
|
20
20
|
}
|
|
21
|
-
interface SQLStringValue extends SQLWhereObject {
|
|
21
|
+
export interface SQLStringValue extends SQLWhereObject {
|
|
22
22
|
type: "String";
|
|
23
23
|
value: string;
|
|
24
24
|
}
|
|
25
|
-
interface SQLNumberValue extends SQLWhereObject {
|
|
25
|
+
export interface SQLNumberValue extends SQLWhereObject {
|
|
26
26
|
type: "Number";
|
|
27
27
|
value: string;
|
|
28
28
|
}
|
|
29
|
-
interface SQLSignedNumberValue extends SQLWhereObject {
|
|
29
|
+
export interface SQLSignedNumberValue extends SQLWhereObject {
|
|
30
30
|
type: "Prefix";
|
|
31
31
|
prefix: "+" | "-";
|
|
32
32
|
value: SQLNumberValue;
|
|
33
33
|
}
|
|
34
|
-
interface SQLBooleanValue extends SQLWhereObject {
|
|
34
|
+
export interface SQLBooleanValue extends SQLWhereObject {
|
|
35
35
|
type: "Boolean";
|
|
36
36
|
value: AnyCase<"TRUE"> | AnyCase<"FALSE">;
|
|
37
37
|
}
|
|
38
|
-
interface SQLBooleanExtra extends SQLWhereObject {
|
|
38
|
+
export interface SQLBooleanExtra extends SQLWhereObject {
|
|
39
39
|
type: "BooleanExtra";
|
|
40
40
|
value: AnyCase<"UNKNOWN">;
|
|
41
41
|
}
|
|
42
|
-
interface SQLSimpleExprParentheses extends SQLWhereObject {
|
|
42
|
+
export interface SQLSimpleExprParentheses extends SQLWhereObject {
|
|
43
43
|
type: "SimpleExprParentheses";
|
|
44
44
|
value: SQLExpressionList;
|
|
45
45
|
}
|
|
46
|
-
interface SQLExpressionList extends SQLWhereObject {
|
|
46
|
+
export interface SQLExpressionList extends SQLWhereObject {
|
|
47
47
|
type: "ExpressionList";
|
|
48
48
|
value: SQLExpression[];
|
|
49
49
|
}
|
|
50
|
-
interface SQLInExpressionListPredicate extends SQLWhereObject {
|
|
50
|
+
export interface SQLInExpressionListPredicate extends SQLWhereObject {
|
|
51
51
|
type: "InExpressionListPredicate";
|
|
52
52
|
hasNot: NotOpt;
|
|
53
53
|
left: SQLSimpleExpression;
|
|
54
54
|
right: SQLExpressionList;
|
|
55
55
|
}
|
|
56
|
-
interface SQLBetweenPredicate extends SQLWhereObject {
|
|
56
|
+
export interface SQLBetweenPredicate extends SQLWhereObject {
|
|
57
57
|
type: "BetweenPredicate";
|
|
58
58
|
hasNot: NotOpt;
|
|
59
59
|
left: SQLSimpleExpression;
|
|
@@ -62,112 +62,112 @@ interface SQLBetweenPredicate extends SQLWhereObject {
|
|
|
62
62
|
right: SQLPredicate;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
interface SQLLikePredicate extends SQLWhereObject {
|
|
65
|
+
export interface SQLLikePredicate extends SQLWhereObject {
|
|
66
66
|
type: "LikePredicate";
|
|
67
67
|
hasNot: NotOpt;
|
|
68
68
|
left: SQLSimpleExpression;
|
|
69
69
|
right: SQLSimpleExpression | SQLStartsWithExpr | SQLEndsWithExpr | SQLContainsExpr;
|
|
70
70
|
escape: SQLStringValue | null;
|
|
71
71
|
}
|
|
72
|
-
interface SQLStartsWithExpr extends SQLWhereObject {
|
|
72
|
+
export interface SQLStartsWithExpr extends SQLWhereObject {
|
|
73
73
|
type: "StartsWithExpr";
|
|
74
74
|
value: SQLStringValue | SQLIdentifier;
|
|
75
75
|
}
|
|
76
|
-
interface SQLEndsWithExpr extends SQLWhereObject {
|
|
76
|
+
export interface SQLEndsWithExpr extends SQLWhereObject {
|
|
77
77
|
type: "EndsWithExpr";
|
|
78
78
|
value: SQLStringValue | SQLIdentifier;
|
|
79
79
|
}
|
|
80
|
-
interface SQLContainsExpr extends SQLWhereObject {
|
|
80
|
+
export interface SQLContainsExpr extends SQLWhereObject {
|
|
81
81
|
type: "ContainsExpr";
|
|
82
82
|
value: SQLStringValue | SQLIdentifier;
|
|
83
83
|
}
|
|
84
|
-
interface SQLIsNullBooleanPrimary extends SQLWhereObject {
|
|
84
|
+
export interface SQLIsNullBooleanPrimary extends SQLWhereObject {
|
|
85
85
|
type: "IsNullBooleanPrimary";
|
|
86
86
|
hasNot: NotOpt;
|
|
87
87
|
value: SQLBooleanPrimary;
|
|
88
88
|
}
|
|
89
|
-
interface SQLComparisonBooleanPrimary extends SQLWhereObject {
|
|
89
|
+
export interface SQLComparisonBooleanPrimary extends SQLWhereObject {
|
|
90
90
|
type: "ComparisonBooleanPrimary";
|
|
91
91
|
left: SQLBooleanPrimary;
|
|
92
92
|
operator: ComparisonOperator;
|
|
93
93
|
right: SQLPredicate;
|
|
94
94
|
}
|
|
95
|
-
interface SQLIsExpression extends SQLWhereObject {
|
|
95
|
+
export interface SQLIsExpression extends SQLWhereObject {
|
|
96
96
|
type: "IsExpression";
|
|
97
97
|
hasNot: NotOpt;
|
|
98
98
|
left: SQLBooleanPrimary;
|
|
99
99
|
right: SQLBooleanExtra;
|
|
100
100
|
}
|
|
101
|
-
interface SQLNotExpression extends SQLWhereObject {
|
|
101
|
+
export interface SQLNotExpression extends SQLWhereObject {
|
|
102
102
|
type: "NotExpression";
|
|
103
103
|
value: SQLExpression;
|
|
104
104
|
}
|
|
105
|
-
interface SQLAndExpression extends SQLWhereObject {
|
|
105
|
+
export interface SQLAndExpression extends SQLWhereObject {
|
|
106
106
|
type: "AndExpression";
|
|
107
107
|
operator: AndOperator;
|
|
108
108
|
left: SQLExpression;
|
|
109
109
|
right: SQLExpression;
|
|
110
110
|
}
|
|
111
|
-
interface SQLOrExpression extends SQLWhereObject {
|
|
111
|
+
export interface SQLOrExpression extends SQLWhereObject {
|
|
112
112
|
type: "OrExpression";
|
|
113
113
|
operator: OrOperator;
|
|
114
114
|
left: SQLExpression;
|
|
115
115
|
right: SQLExpression;
|
|
116
116
|
}
|
|
117
|
-
interface SQLXorExpression extends SQLWhereObject {
|
|
117
|
+
export interface SQLXorExpression extends SQLWhereObject {
|
|
118
118
|
type: "XorExpression";
|
|
119
119
|
operator: XorOperator;
|
|
120
120
|
left: SQLExpression;
|
|
121
121
|
right: SQLExpression;
|
|
122
122
|
}
|
|
123
|
-
interface SQLPlaceHolder extends SQLWhereObject {
|
|
123
|
+
export interface SQLPlaceHolder extends SQLWhereObject {
|
|
124
124
|
type: "PlaceHolder";
|
|
125
125
|
/** Raw token, e.g. `${p1}`. */
|
|
126
126
|
value: string;
|
|
127
127
|
/** Prefix-free placeholder name, e.g. `p1`. */
|
|
128
128
|
param: string;
|
|
129
129
|
}
|
|
130
|
-
interface SQLFunctionCall extends SQLWhereObjectAny {
|
|
130
|
+
export interface SQLFunctionCall extends SQLWhereObjectAny {
|
|
131
131
|
type: "FunctionCall";
|
|
132
132
|
name: string;
|
|
133
133
|
params: SQLExpressionOperand[];
|
|
134
134
|
}
|
|
135
|
-
interface SQLCaseWhen extends SQLWhereObjectAny {
|
|
135
|
+
export interface SQLCaseWhen extends SQLWhereObjectAny {
|
|
136
136
|
type: "CaseWhen";
|
|
137
137
|
}
|
|
138
|
-
interface SQLPrefix extends SQLWhereObjectAny {
|
|
138
|
+
export interface SQLPrefix extends SQLWhereObjectAny {
|
|
139
139
|
type: "Prefix";
|
|
140
140
|
}
|
|
141
|
-
interface SQLSubQuery extends SQLWhereObjectAny {
|
|
141
|
+
export interface SQLSubQuery extends SQLWhereObjectAny {
|
|
142
142
|
type: "SubQuery";
|
|
143
143
|
}
|
|
144
|
-
interface SQLIdentifierExpr extends SQLWhereObjectAny {
|
|
144
|
+
export interface SQLIdentifierExpr extends SQLWhereObjectAny {
|
|
145
145
|
type: "IdentifierExpr";
|
|
146
146
|
}
|
|
147
|
-
interface SQLBitExpression extends SQLWhereObjectAny {
|
|
147
|
+
export interface SQLBitExpression extends SQLWhereObjectAny {
|
|
148
148
|
type: "BitExpression";
|
|
149
149
|
operator: string;
|
|
150
150
|
left: SQLExpressionOperand;
|
|
151
151
|
right: SQLExpressionOperand;
|
|
152
152
|
}
|
|
153
|
-
interface SQLInSubQueryPredicate extends SQLWhereObjectAny {
|
|
153
|
+
export interface SQLInSubQueryPredicate extends SQLWhereObjectAny {
|
|
154
154
|
type: "InSubQueryPredicate";
|
|
155
155
|
}
|
|
156
|
-
interface SQLSoundsLikePredicate extends SQLWhereObjectAny {
|
|
156
|
+
export interface SQLSoundsLikePredicate extends SQLWhereObjectAny {
|
|
157
157
|
type: "SoundsLikePredicate";
|
|
158
158
|
}
|
|
159
|
-
interface SQLRegexpPredicate extends SQLWhereObjectAny {
|
|
159
|
+
export interface SQLRegexpPredicate extends SQLWhereObjectAny {
|
|
160
160
|
type: "RegexpPredicate";
|
|
161
161
|
}
|
|
162
|
-
interface SQLComparisonSubQueryBooleanPrimary extends SQLWhereObjectAny {
|
|
162
|
+
export interface SQLComparisonSubQueryBooleanPrimary extends SQLWhereObjectAny {
|
|
163
163
|
type: "ComparisonSubQueryBooleanPrimary";
|
|
164
164
|
}
|
|
165
|
-
type SQLLiteralValue = SQLStringValue | SQLNumberValue | SQLBooleanValue;
|
|
166
|
-
type SQLSimpleExpression = SQLLiteralValue | SQLIdentifier | SQLFunctionCall | SQLCaseWhen | SQLPrefix | SQLSubQuery | SQLIdentifierExpr | SQLBitExpression | SQLPlaceHolder | SQLSimpleExprParentheses;
|
|
167
|
-
type SQLPredicate = SQLSimpleExpression | SQLInExpressionListPredicate | SQLBetweenPredicate | SQLLikePredicate | SQLInSubQueryPredicate | SQLSoundsLikePredicate | SQLRegexpPredicate;
|
|
168
|
-
type SQLBooleanPrimary = SQLPredicate | SQLIsNullBooleanPrimary | SQLComparisonBooleanPrimary | SQLComparisonSubQueryBooleanPrimary;
|
|
169
|
-
type SQLExpression = SQLBooleanPrimary | SQLIsExpression | SQLNotExpression | SQLAndExpression | SQLOrExpression | SQLXorExpression;
|
|
170
|
-
interface ParsedSQL {
|
|
165
|
+
export type SQLLiteralValue = SQLStringValue | SQLNumberValue | SQLBooleanValue;
|
|
166
|
+
export type SQLSimpleExpression = SQLLiteralValue | SQLIdentifier | SQLFunctionCall | SQLCaseWhen | SQLPrefix | SQLSubQuery | SQLIdentifierExpr | SQLBitExpression | SQLPlaceHolder | SQLSimpleExprParentheses;
|
|
167
|
+
export type SQLPredicate = SQLSimpleExpression | SQLInExpressionListPredicate | SQLBetweenPredicate | SQLLikePredicate | SQLInSubQueryPredicate | SQLSoundsLikePredicate | SQLRegexpPredicate;
|
|
168
|
+
export type SQLBooleanPrimary = SQLPredicate | SQLIsNullBooleanPrimary | SQLComparisonBooleanPrimary | SQLComparisonSubQueryBooleanPrimary;
|
|
169
|
+
export type SQLExpression = SQLBooleanPrimary | SQLIsExpression | SQLNotExpression | SQLAndExpression | SQLOrExpression | SQLXorExpression;
|
|
170
|
+
export interface ParsedSQL {
|
|
171
171
|
nodeType: "Main";
|
|
172
172
|
value: {
|
|
173
173
|
type: "Select";
|
|
@@ -193,7 +193,7 @@ interface ParsedSQL {
|
|
|
193
193
|
};
|
|
194
194
|
hasSemicolon: boolean;
|
|
195
195
|
}
|
|
196
|
-
type MixedAndXorOrList = {
|
|
196
|
+
export type MixedAndXorOrList = {
|
|
197
197
|
combinator: DefaultCombinatorNameExtended;
|
|
198
198
|
expressions: (MixedAndXorOrList | SQLExpression)[];
|
|
199
199
|
};
|
|
@@ -202,13 +202,13 @@ type MixedAndXorOrList = {
|
|
|
202
202
|
* bare identifier, a (signed) literal, a placeholder, an arithmetic {@link SQLBitExpression},
|
|
203
203
|
* a {@link SQLFunctionCall}, or a parenthesized wrapper (unwrapped by the handler).
|
|
204
204
|
*/
|
|
205
|
-
type SQLExpressionOperand = SQLIdentifier | SQLLiteralValue | SQLSignedNumberValue | SQLPlaceHolder | SQLBitExpression | SQLFunctionCall | SQLSimpleExprParentheses;
|
|
205
|
+
export type SQLExpressionOperand = SQLIdentifier | SQLLiteralValue | SQLSignedNumberValue | SQLPlaceHolder | SQLBitExpression | SQLFunctionCall | SQLSimpleExprParentheses;
|
|
206
206
|
/**
|
|
207
207
|
* Context passed to a {@link ParseSQLOptions.getExpression} handler alongside the operand
|
|
208
208
|
* node. Carries the same number-parsing option as the rest of `parseSQL` plus a predicate
|
|
209
209
|
* for validating that `field` leaves inside an expression exist in the configured fields.
|
|
210
210
|
*/
|
|
211
|
-
interface ParseSQLExpressionContext {
|
|
211
|
+
export interface ParseSQLExpressionContext {
|
|
212
212
|
bigIntOnOverflow?: boolean;
|
|
213
213
|
/** `true` when the field exists in the configured fields (or no fields were configured). */
|
|
214
214
|
fieldExists: (fieldName: string) => boolean;
|
|
@@ -218,7 +218,7 @@ interface ParseSQLExpressionContext {
|
|
|
218
218
|
/**
|
|
219
219
|
* Options object for {@link parseSQL}.
|
|
220
220
|
*/
|
|
221
|
-
interface ParseSQLOptions extends ParserCommonOptions {
|
|
221
|
+
export interface ParseSQLOptions extends ParserCommonOptions {
|
|
222
222
|
paramPrefix?: string;
|
|
223
223
|
params?: any[] | Record<string, any>;
|
|
224
224
|
/**
|
|
@@ -267,18 +267,18 @@ declare function parseSQL(sql: string, options: Except<ParseSQLOptions, "indepen
|
|
|
267
267
|
}): DefaultRuleGroupTypeIC;
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/utils/parseSQL/utils.d.ts
|
|
270
|
-
declare const isSQLLiteralValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue;
|
|
271
|
-
declare const isSQLSignedNumber: (v?: SQLWhereObjectAny) => v is SQLSignedNumberValue;
|
|
272
|
-
declare const isSQLLiteralOrSignedNumberValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue | SQLSignedNumberValue;
|
|
273
|
-
declare const isSQLIdentifier: (v?: SQLWhereObjectAny) => v is SQLIdentifier;
|
|
274
|
-
declare const isSQLBitExpression: (v?: SQLWhereObjectAny) => v is SQLBitExpression;
|
|
275
|
-
declare const isSQLFunctionCall: (v?: SQLWhereObjectAny) => v is SQLFunctionCall;
|
|
276
|
-
declare const isSQLPlaceHolder: (v?: SQLWhereObjectAny) => v is SQLPlaceHolder;
|
|
270
|
+
export declare const isSQLLiteralValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue;
|
|
271
|
+
export declare const isSQLSignedNumber: (v?: SQLWhereObjectAny) => v is SQLSignedNumberValue;
|
|
272
|
+
export declare const isSQLLiteralOrSignedNumberValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue | SQLSignedNumberValue;
|
|
273
|
+
export declare const isSQLIdentifier: (v?: SQLWhereObjectAny) => v is SQLIdentifier;
|
|
274
|
+
export declare const isSQLBitExpression: (v?: SQLWhereObjectAny) => v is SQLBitExpression;
|
|
275
|
+
export declare const isSQLFunctionCall: (v?: SQLWhereObjectAny) => v is SQLFunctionCall;
|
|
276
|
+
export declare const isSQLPlaceHolder: (v?: SQLWhereObjectAny) => v is SQLPlaceHolder;
|
|
277
277
|
/** An operand that is neither a bare identifier nor a (signed) literal nor a placeholder. */
|
|
278
|
-
declare const isSQLExpressionOperand: (v?: SQLWhereObjectAny) => boolean;
|
|
279
|
-
declare const getFieldName: (f: string | SQLIdentifier) => string;
|
|
280
|
-
declare const normalizeOperator: (op: ComparisonOperator, flip?: boolean) => DefaultOperatorName;
|
|
281
|
-
declare const evalSQLLiteralValue: (valueObj: SQLLiteralValue | SQLSignedNumberValue, { bigIntOnOverflow }?: ParseSQLOptions) => any;
|
|
278
|
+
export declare const isSQLExpressionOperand: (v?: SQLWhereObjectAny) => boolean;
|
|
279
|
+
export declare const getFieldName: (f: string | SQLIdentifier) => string;
|
|
280
|
+
export declare const normalizeOperator: (op: ComparisonOperator, flip?: boolean) => DefaultOperatorName;
|
|
281
|
+
export declare const evalSQLLiteralValue: (valueObj: SQLLiteralValue | SQLSignedNumberValue, { bigIntOnOverflow }?: ParseSQLOptions) => any;
|
|
282
282
|
//#endregion
|
|
283
|
-
export {
|
|
283
|
+
export { parseSQL };
|
|
284
284
|
//# sourceMappingURL=parseSQL.d.mts.map
|
package/dist/parseSQL.d.ts
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC, Yt as DefaultCombinatorNameExtended, Zt as DefaultOperatorName, jn as Except, on as ExpressionNode } from "./index-
|
|
2
|
-
import { t as ParserCommonOptions } from "./import-
|
|
1
|
+
import { $t as DefaultRuleGroupType, Pt as DefaultRuleGroupTypeIC, Yt as DefaultCombinatorNameExtended, Zt as DefaultOperatorName, jn as Except, on as ExpressionNode } from "./index-BExDPYEG.js";
|
|
2
|
+
import { t as ParserCommonOptions } from "./import-BCkipOTY.js";
|
|
3
3
|
//#region src/utils/parseSQL/types.d.ts
|
|
4
4
|
type AnyCase<T extends string> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` : "";
|
|
5
5
|
type TokenType = "AndExpression" | "BetweenPredicate" | "BitExpression" | "Boolean" | "BooleanExtra" | "CaseWhen" | "ComparisonBooleanPrimary" | "ComparisonSubQueryBooleanPrimary" | "ContainsExpr" | "EndsWithExpr" | "ExpressionList" | "ForceIndexHint" | "ForOptIndexHint" | "FunctionCall" | "FunctionCallParam" | "GroupBy" | "GroupByOrderByItem" | "Identifier" | "IdentifierExpr" | "IdentifierList" | "IgnoreIndexHint" | "IndexHintList" | "InExpressionListPredicate" | "InnerCrossJoinTable" | "InSubQueryPredicate" | "IsExpression" | "IsNullBooleanPrimary" | "LeftRightJoinTable" | "LikePredicate" | "Limit" | "Main" | "NaturalJoinTable" | "NotExpression" | "Null" | "Number" | "OnJoinCondition" | "OrderBy" | "OrExpression" | "Partitions" | "PlaceHolder" | "Prefix" | "RegexpPredicate" | "Select" | "SelectExpr" | "SelectParenthesized" | "SimpleExprParentheses" | "SoundsLikePredicate" | "StartsWithExpr" | "StraightJoinTable" | "String" | "SubQuery" | "TableFactor" | "TableReference" | "TableReferences" | "Union" | "UseIndexHint" | "UsingJoinCondition" | "WhenThenList" | "XorExpression";
|
|
6
|
-
type ComparisonOperator = "=" | ">=" | ">" | "<=" | "<" | "<>" | "!=";
|
|
7
|
-
type NotOpt = AnyCase<"NOT"> | null;
|
|
8
|
-
type AndOperator = AnyCase<"AND">;
|
|
9
|
-
type OrOperator = AnyCase<"OR">;
|
|
10
|
-
type XorOperator = AnyCase<"XOR">;
|
|
11
|
-
interface SQLWhereObject {
|
|
6
|
+
export type ComparisonOperator = "=" | ">=" | ">" | "<=" | "<" | "<>" | "!=";
|
|
7
|
+
export type NotOpt = AnyCase<"NOT"> | null;
|
|
8
|
+
export type AndOperator = AnyCase<"AND">;
|
|
9
|
+
export type OrOperator = AnyCase<"OR">;
|
|
10
|
+
export type XorOperator = AnyCase<"XOR">;
|
|
11
|
+
export interface SQLWhereObject {
|
|
12
12
|
type: TokenType;
|
|
13
13
|
}
|
|
14
|
-
interface SQLIdentifier extends SQLWhereObject {
|
|
14
|
+
export interface SQLIdentifier extends SQLWhereObject {
|
|
15
15
|
type: "Identifier";
|
|
16
16
|
value: string;
|
|
17
17
|
}
|
|
18
|
-
interface SQLWhereObjectAny extends SQLWhereObject {
|
|
18
|
+
export interface SQLWhereObjectAny extends SQLWhereObject {
|
|
19
19
|
[k: string]: any;
|
|
20
20
|
}
|
|
21
|
-
interface SQLStringValue extends SQLWhereObject {
|
|
21
|
+
export interface SQLStringValue extends SQLWhereObject {
|
|
22
22
|
type: "String";
|
|
23
23
|
value: string;
|
|
24
24
|
}
|
|
25
|
-
interface SQLNumberValue extends SQLWhereObject {
|
|
25
|
+
export interface SQLNumberValue extends SQLWhereObject {
|
|
26
26
|
type: "Number";
|
|
27
27
|
value: string;
|
|
28
28
|
}
|
|
29
|
-
interface SQLSignedNumberValue extends SQLWhereObject {
|
|
29
|
+
export interface SQLSignedNumberValue extends SQLWhereObject {
|
|
30
30
|
type: "Prefix";
|
|
31
31
|
prefix: "+" | "-";
|
|
32
32
|
value: SQLNumberValue;
|
|
33
33
|
}
|
|
34
|
-
interface SQLBooleanValue extends SQLWhereObject {
|
|
34
|
+
export interface SQLBooleanValue extends SQLWhereObject {
|
|
35
35
|
type: "Boolean";
|
|
36
36
|
value: AnyCase<"TRUE"> | AnyCase<"FALSE">;
|
|
37
37
|
}
|
|
38
|
-
interface SQLBooleanExtra extends SQLWhereObject {
|
|
38
|
+
export interface SQLBooleanExtra extends SQLWhereObject {
|
|
39
39
|
type: "BooleanExtra";
|
|
40
40
|
value: AnyCase<"UNKNOWN">;
|
|
41
41
|
}
|
|
42
|
-
interface SQLSimpleExprParentheses extends SQLWhereObject {
|
|
42
|
+
export interface SQLSimpleExprParentheses extends SQLWhereObject {
|
|
43
43
|
type: "SimpleExprParentheses";
|
|
44
44
|
value: SQLExpressionList;
|
|
45
45
|
}
|
|
46
|
-
interface SQLExpressionList extends SQLWhereObject {
|
|
46
|
+
export interface SQLExpressionList extends SQLWhereObject {
|
|
47
47
|
type: "ExpressionList";
|
|
48
48
|
value: SQLExpression[];
|
|
49
49
|
}
|
|
50
|
-
interface SQLInExpressionListPredicate extends SQLWhereObject {
|
|
50
|
+
export interface SQLInExpressionListPredicate extends SQLWhereObject {
|
|
51
51
|
type: "InExpressionListPredicate";
|
|
52
52
|
hasNot: NotOpt;
|
|
53
53
|
left: SQLSimpleExpression;
|
|
54
54
|
right: SQLExpressionList;
|
|
55
55
|
}
|
|
56
|
-
interface SQLBetweenPredicate extends SQLWhereObject {
|
|
56
|
+
export interface SQLBetweenPredicate extends SQLWhereObject {
|
|
57
57
|
type: "BetweenPredicate";
|
|
58
58
|
hasNot: NotOpt;
|
|
59
59
|
left: SQLSimpleExpression;
|
|
@@ -62,112 +62,112 @@ interface SQLBetweenPredicate extends SQLWhereObject {
|
|
|
62
62
|
right: SQLPredicate;
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
interface SQLLikePredicate extends SQLWhereObject {
|
|
65
|
+
export interface SQLLikePredicate extends SQLWhereObject {
|
|
66
66
|
type: "LikePredicate";
|
|
67
67
|
hasNot: NotOpt;
|
|
68
68
|
left: SQLSimpleExpression;
|
|
69
69
|
right: SQLSimpleExpression | SQLStartsWithExpr | SQLEndsWithExpr | SQLContainsExpr;
|
|
70
70
|
escape: SQLStringValue | null;
|
|
71
71
|
}
|
|
72
|
-
interface SQLStartsWithExpr extends SQLWhereObject {
|
|
72
|
+
export interface SQLStartsWithExpr extends SQLWhereObject {
|
|
73
73
|
type: "StartsWithExpr";
|
|
74
74
|
value: SQLStringValue | SQLIdentifier;
|
|
75
75
|
}
|
|
76
|
-
interface SQLEndsWithExpr extends SQLWhereObject {
|
|
76
|
+
export interface SQLEndsWithExpr extends SQLWhereObject {
|
|
77
77
|
type: "EndsWithExpr";
|
|
78
78
|
value: SQLStringValue | SQLIdentifier;
|
|
79
79
|
}
|
|
80
|
-
interface SQLContainsExpr extends SQLWhereObject {
|
|
80
|
+
export interface SQLContainsExpr extends SQLWhereObject {
|
|
81
81
|
type: "ContainsExpr";
|
|
82
82
|
value: SQLStringValue | SQLIdentifier;
|
|
83
83
|
}
|
|
84
|
-
interface SQLIsNullBooleanPrimary extends SQLWhereObject {
|
|
84
|
+
export interface SQLIsNullBooleanPrimary extends SQLWhereObject {
|
|
85
85
|
type: "IsNullBooleanPrimary";
|
|
86
86
|
hasNot: NotOpt;
|
|
87
87
|
value: SQLBooleanPrimary;
|
|
88
88
|
}
|
|
89
|
-
interface SQLComparisonBooleanPrimary extends SQLWhereObject {
|
|
89
|
+
export interface SQLComparisonBooleanPrimary extends SQLWhereObject {
|
|
90
90
|
type: "ComparisonBooleanPrimary";
|
|
91
91
|
left: SQLBooleanPrimary;
|
|
92
92
|
operator: ComparisonOperator;
|
|
93
93
|
right: SQLPredicate;
|
|
94
94
|
}
|
|
95
|
-
interface SQLIsExpression extends SQLWhereObject {
|
|
95
|
+
export interface SQLIsExpression extends SQLWhereObject {
|
|
96
96
|
type: "IsExpression";
|
|
97
97
|
hasNot: NotOpt;
|
|
98
98
|
left: SQLBooleanPrimary;
|
|
99
99
|
right: SQLBooleanExtra;
|
|
100
100
|
}
|
|
101
|
-
interface SQLNotExpression extends SQLWhereObject {
|
|
101
|
+
export interface SQLNotExpression extends SQLWhereObject {
|
|
102
102
|
type: "NotExpression";
|
|
103
103
|
value: SQLExpression;
|
|
104
104
|
}
|
|
105
|
-
interface SQLAndExpression extends SQLWhereObject {
|
|
105
|
+
export interface SQLAndExpression extends SQLWhereObject {
|
|
106
106
|
type: "AndExpression";
|
|
107
107
|
operator: AndOperator;
|
|
108
108
|
left: SQLExpression;
|
|
109
109
|
right: SQLExpression;
|
|
110
110
|
}
|
|
111
|
-
interface SQLOrExpression extends SQLWhereObject {
|
|
111
|
+
export interface SQLOrExpression extends SQLWhereObject {
|
|
112
112
|
type: "OrExpression";
|
|
113
113
|
operator: OrOperator;
|
|
114
114
|
left: SQLExpression;
|
|
115
115
|
right: SQLExpression;
|
|
116
116
|
}
|
|
117
|
-
interface SQLXorExpression extends SQLWhereObject {
|
|
117
|
+
export interface SQLXorExpression extends SQLWhereObject {
|
|
118
118
|
type: "XorExpression";
|
|
119
119
|
operator: XorOperator;
|
|
120
120
|
left: SQLExpression;
|
|
121
121
|
right: SQLExpression;
|
|
122
122
|
}
|
|
123
|
-
interface SQLPlaceHolder extends SQLWhereObject {
|
|
123
|
+
export interface SQLPlaceHolder extends SQLWhereObject {
|
|
124
124
|
type: "PlaceHolder";
|
|
125
125
|
/** Raw token, e.g. `${p1}`. */
|
|
126
126
|
value: string;
|
|
127
127
|
/** Prefix-free placeholder name, e.g. `p1`. */
|
|
128
128
|
param: string;
|
|
129
129
|
}
|
|
130
|
-
interface SQLFunctionCall extends SQLWhereObjectAny {
|
|
130
|
+
export interface SQLFunctionCall extends SQLWhereObjectAny {
|
|
131
131
|
type: "FunctionCall";
|
|
132
132
|
name: string;
|
|
133
133
|
params: SQLExpressionOperand[];
|
|
134
134
|
}
|
|
135
|
-
interface SQLCaseWhen extends SQLWhereObjectAny {
|
|
135
|
+
export interface SQLCaseWhen extends SQLWhereObjectAny {
|
|
136
136
|
type: "CaseWhen";
|
|
137
137
|
}
|
|
138
|
-
interface SQLPrefix extends SQLWhereObjectAny {
|
|
138
|
+
export interface SQLPrefix extends SQLWhereObjectAny {
|
|
139
139
|
type: "Prefix";
|
|
140
140
|
}
|
|
141
|
-
interface SQLSubQuery extends SQLWhereObjectAny {
|
|
141
|
+
export interface SQLSubQuery extends SQLWhereObjectAny {
|
|
142
142
|
type: "SubQuery";
|
|
143
143
|
}
|
|
144
|
-
interface SQLIdentifierExpr extends SQLWhereObjectAny {
|
|
144
|
+
export interface SQLIdentifierExpr extends SQLWhereObjectAny {
|
|
145
145
|
type: "IdentifierExpr";
|
|
146
146
|
}
|
|
147
|
-
interface SQLBitExpression extends SQLWhereObjectAny {
|
|
147
|
+
export interface SQLBitExpression extends SQLWhereObjectAny {
|
|
148
148
|
type: "BitExpression";
|
|
149
149
|
operator: string;
|
|
150
150
|
left: SQLExpressionOperand;
|
|
151
151
|
right: SQLExpressionOperand;
|
|
152
152
|
}
|
|
153
|
-
interface SQLInSubQueryPredicate extends SQLWhereObjectAny {
|
|
153
|
+
export interface SQLInSubQueryPredicate extends SQLWhereObjectAny {
|
|
154
154
|
type: "InSubQueryPredicate";
|
|
155
155
|
}
|
|
156
|
-
interface SQLSoundsLikePredicate extends SQLWhereObjectAny {
|
|
156
|
+
export interface SQLSoundsLikePredicate extends SQLWhereObjectAny {
|
|
157
157
|
type: "SoundsLikePredicate";
|
|
158
158
|
}
|
|
159
|
-
interface SQLRegexpPredicate extends SQLWhereObjectAny {
|
|
159
|
+
export interface SQLRegexpPredicate extends SQLWhereObjectAny {
|
|
160
160
|
type: "RegexpPredicate";
|
|
161
161
|
}
|
|
162
|
-
interface SQLComparisonSubQueryBooleanPrimary extends SQLWhereObjectAny {
|
|
162
|
+
export interface SQLComparisonSubQueryBooleanPrimary extends SQLWhereObjectAny {
|
|
163
163
|
type: "ComparisonSubQueryBooleanPrimary";
|
|
164
164
|
}
|
|
165
|
-
type SQLLiteralValue = SQLStringValue | SQLNumberValue | SQLBooleanValue;
|
|
166
|
-
type SQLSimpleExpression = SQLLiteralValue | SQLIdentifier | SQLFunctionCall | SQLCaseWhen | SQLPrefix | SQLSubQuery | SQLIdentifierExpr | SQLBitExpression | SQLPlaceHolder | SQLSimpleExprParentheses;
|
|
167
|
-
type SQLPredicate = SQLSimpleExpression | SQLInExpressionListPredicate | SQLBetweenPredicate | SQLLikePredicate | SQLInSubQueryPredicate | SQLSoundsLikePredicate | SQLRegexpPredicate;
|
|
168
|
-
type SQLBooleanPrimary = SQLPredicate | SQLIsNullBooleanPrimary | SQLComparisonBooleanPrimary | SQLComparisonSubQueryBooleanPrimary;
|
|
169
|
-
type SQLExpression = SQLBooleanPrimary | SQLIsExpression | SQLNotExpression | SQLAndExpression | SQLOrExpression | SQLXorExpression;
|
|
170
|
-
interface ParsedSQL {
|
|
165
|
+
export type SQLLiteralValue = SQLStringValue | SQLNumberValue | SQLBooleanValue;
|
|
166
|
+
export type SQLSimpleExpression = SQLLiteralValue | SQLIdentifier | SQLFunctionCall | SQLCaseWhen | SQLPrefix | SQLSubQuery | SQLIdentifierExpr | SQLBitExpression | SQLPlaceHolder | SQLSimpleExprParentheses;
|
|
167
|
+
export type SQLPredicate = SQLSimpleExpression | SQLInExpressionListPredicate | SQLBetweenPredicate | SQLLikePredicate | SQLInSubQueryPredicate | SQLSoundsLikePredicate | SQLRegexpPredicate;
|
|
168
|
+
export type SQLBooleanPrimary = SQLPredicate | SQLIsNullBooleanPrimary | SQLComparisonBooleanPrimary | SQLComparisonSubQueryBooleanPrimary;
|
|
169
|
+
export type SQLExpression = SQLBooleanPrimary | SQLIsExpression | SQLNotExpression | SQLAndExpression | SQLOrExpression | SQLXorExpression;
|
|
170
|
+
export interface ParsedSQL {
|
|
171
171
|
nodeType: "Main";
|
|
172
172
|
value: {
|
|
173
173
|
type: "Select";
|
|
@@ -193,7 +193,7 @@ interface ParsedSQL {
|
|
|
193
193
|
};
|
|
194
194
|
hasSemicolon: boolean;
|
|
195
195
|
}
|
|
196
|
-
type MixedAndXorOrList = {
|
|
196
|
+
export type MixedAndXorOrList = {
|
|
197
197
|
combinator: DefaultCombinatorNameExtended;
|
|
198
198
|
expressions: (MixedAndXorOrList | SQLExpression)[];
|
|
199
199
|
};
|
|
@@ -202,13 +202,13 @@ type MixedAndXorOrList = {
|
|
|
202
202
|
* bare identifier, a (signed) literal, a placeholder, an arithmetic {@link SQLBitExpression},
|
|
203
203
|
* a {@link SQLFunctionCall}, or a parenthesized wrapper (unwrapped by the handler).
|
|
204
204
|
*/
|
|
205
|
-
type SQLExpressionOperand = SQLIdentifier | SQLLiteralValue | SQLSignedNumberValue | SQLPlaceHolder | SQLBitExpression | SQLFunctionCall | SQLSimpleExprParentheses;
|
|
205
|
+
export type SQLExpressionOperand = SQLIdentifier | SQLLiteralValue | SQLSignedNumberValue | SQLPlaceHolder | SQLBitExpression | SQLFunctionCall | SQLSimpleExprParentheses;
|
|
206
206
|
/**
|
|
207
207
|
* Context passed to a {@link ParseSQLOptions.getExpression} handler alongside the operand
|
|
208
208
|
* node. Carries the same number-parsing option as the rest of `parseSQL` plus a predicate
|
|
209
209
|
* for validating that `field` leaves inside an expression exist in the configured fields.
|
|
210
210
|
*/
|
|
211
|
-
interface ParseSQLExpressionContext {
|
|
211
|
+
export interface ParseSQLExpressionContext {
|
|
212
212
|
bigIntOnOverflow?: boolean;
|
|
213
213
|
/** `true` when the field exists in the configured fields (or no fields were configured). */
|
|
214
214
|
fieldExists: (fieldName: string) => boolean;
|
|
@@ -218,7 +218,7 @@ interface ParseSQLExpressionContext {
|
|
|
218
218
|
/**
|
|
219
219
|
* Options object for {@link parseSQL}.
|
|
220
220
|
*/
|
|
221
|
-
interface ParseSQLOptions extends ParserCommonOptions {
|
|
221
|
+
export interface ParseSQLOptions extends ParserCommonOptions {
|
|
222
222
|
paramPrefix?: string;
|
|
223
223
|
params?: any[] | Record<string, any>;
|
|
224
224
|
/**
|
|
@@ -267,18 +267,18 @@ declare function parseSQL(sql: string, options: Except<ParseSQLOptions, "indepen
|
|
|
267
267
|
}): DefaultRuleGroupTypeIC;
|
|
268
268
|
//#endregion
|
|
269
269
|
//#region src/utils/parseSQL/utils.d.ts
|
|
270
|
-
declare const isSQLLiteralValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue;
|
|
271
|
-
declare const isSQLSignedNumber: (v?: SQLWhereObjectAny) => v is SQLSignedNumberValue;
|
|
272
|
-
declare const isSQLLiteralOrSignedNumberValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue | SQLSignedNumberValue;
|
|
273
|
-
declare const isSQLIdentifier: (v?: SQLWhereObjectAny) => v is SQLIdentifier;
|
|
274
|
-
declare const isSQLBitExpression: (v?: SQLWhereObjectAny) => v is SQLBitExpression;
|
|
275
|
-
declare const isSQLFunctionCall: (v?: SQLWhereObjectAny) => v is SQLFunctionCall;
|
|
276
|
-
declare const isSQLPlaceHolder: (v?: SQLWhereObjectAny) => v is SQLPlaceHolder;
|
|
270
|
+
export declare const isSQLLiteralValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue;
|
|
271
|
+
export declare const isSQLSignedNumber: (v?: SQLWhereObjectAny) => v is SQLSignedNumberValue;
|
|
272
|
+
export declare const isSQLLiteralOrSignedNumberValue: (v?: SQLWhereObjectAny) => v is SQLLiteralValue | SQLSignedNumberValue;
|
|
273
|
+
export declare const isSQLIdentifier: (v?: SQLWhereObjectAny) => v is SQLIdentifier;
|
|
274
|
+
export declare const isSQLBitExpression: (v?: SQLWhereObjectAny) => v is SQLBitExpression;
|
|
275
|
+
export declare const isSQLFunctionCall: (v?: SQLWhereObjectAny) => v is SQLFunctionCall;
|
|
276
|
+
export declare const isSQLPlaceHolder: (v?: SQLWhereObjectAny) => v is SQLPlaceHolder;
|
|
277
277
|
/** An operand that is neither a bare identifier nor a (signed) literal nor a placeholder. */
|
|
278
|
-
declare const isSQLExpressionOperand: (v?: SQLWhereObjectAny) => boolean;
|
|
279
|
-
declare const getFieldName: (f: string | SQLIdentifier) => string;
|
|
280
|
-
declare const normalizeOperator: (op: ComparisonOperator, flip?: boolean) => DefaultOperatorName;
|
|
281
|
-
declare const evalSQLLiteralValue: (valueObj: SQLLiteralValue | SQLSignedNumberValue, { bigIntOnOverflow }?: ParseSQLOptions) => any;
|
|
278
|
+
export declare const isSQLExpressionOperand: (v?: SQLWhereObjectAny) => boolean;
|
|
279
|
+
export declare const getFieldName: (f: string | SQLIdentifier) => string;
|
|
280
|
+
export declare const normalizeOperator: (op: ComparisonOperator, flip?: boolean) => DefaultOperatorName;
|
|
281
|
+
export declare const evalSQLLiteralValue: (valueObj: SQLLiteralValue | SQLSignedNumberValue, { bigIntOnOverflow }?: ParseSQLOptions) => any;
|
|
282
282
|
//#endregion
|
|
283
|
-
export {
|
|
283
|
+
export { parseSQL };
|
|
284
284
|
//# sourceMappingURL=parseSQL.d.ts.map
|