File tree Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Expand file tree Collapse file tree 3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 5.0.0
4+
5+ Jan 13, 2024
6+
7+ 💥 Breaking Changes
8+ Fixed a bug where with typescript types to properly represent that ` WhereClause ` can have a null value for ` left ` in the case of a negation operator.
9+ This was always the case, but prior to enabling strict typescript types, this went under the radar.
10+
11+ For Typescript consumers that have strict null checks enabled, they may need to make code changes depending on usage.
12+
313## 4.10.1
414
515Jan 13, 2024
Original file line number Diff line number Diff line change 1- export type LogicalOperator = 'AND' | 'OR' | 'NOT' ;
1+ export type LogicalOperatorAnd = 'AND' ;
2+ export type LogicalOperatorOr = 'OR' ;
3+ export type LogicalOperatorNot = 'NOT' ;
4+ export type LogicalOperator = LogicalOperatorAnd | LogicalOperatorOr | LogicalOperatorNot ;
25export type Operator = '=' | '!=' | '<=' | '>=' | '>' | '<' | 'LIKE' | 'IN' | 'NOT IN' | 'INCLUDES' | 'EXCLUDES' ;
36export type FieldTypeOfConditionType = 'WHEN' | 'ELSE' ;
47export type GroupSelector = 'ABOVE' | 'AT' | 'BELOW' | 'ABOVE_OR_BELOW' ;
@@ -154,7 +157,7 @@ export interface Subquery extends QueryBase {
154157 sObjectPrefix ?: string [ ] ;
155158}
156159
157- export type WhereClause = WhereClauseWithoutOperator | WhereClauseWithRightCondition ;
160+ export type WhereClause = WhereClauseWithoutOperator | WhereClauseWithoutNegationOperator | WhereClauseWithRightCondition ;
158161
159162export interface WhereClauseWithoutOperator {
160163 left : ConditionWithValueQuery ;
@@ -165,6 +168,15 @@ export interface WhereClauseWithRightCondition extends WhereClauseWithoutOperato
165168 right : WhereClause ;
166169}
167170
171+ /**
172+ * This is a special case where the left side of the where clause can potentially be null if there is a negation without parentheses
173+ */
174+ export interface WhereClauseWithoutNegationOperator {
175+ left : NegationCondition | null ;
176+ operator : LogicalOperatorNot ;
177+ right : WhereClause ;
178+ }
179+
168180export type Condition =
169181 | ValueCondition
170182 | ValueWithDateLiteralCondition
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import {
3030 ValueWithDateNLiteralCondition ,
3131 WhereClause ,
3232 WhereClauseWithRightCondition ,
33+ WhereClauseWithoutNegationOperator ,
3334 WithDataCategoryCondition ,
3435} from '../api/api-models' ;
3536import {
@@ -732,8 +733,8 @@ class SOQLVisitor extends BaseSoqlVisitor {
732733 }
733734
734735 expressionPartWithNegation ( ctx : any ) {
735- const output : Partial < WhereClauseWithRightCondition > = {
736- left : ctx . L_PAREN ? { openParen : ctx . L_PAREN . length } : ( null as any ) , // FIXME: type does not allow null, but changing is a breaking change
736+ const output : Partial < WhereClauseWithoutNegationOperator > = {
737+ left : ctx . L_PAREN ? { openParen : ctx . L_PAREN . length } : null ,
737738 operator : 'NOT' ,
738739 right : {
739740 left : { } as ValueCondition ,
You can’t perform that action at this time.
0 commit comments