@apexdevtools/apex-parser
Advanced tools
Comparing version 4.2.0 to 4.3.0
# apex-parser - Changelog | ||
## 4.3.0 - 2024-09-26 | ||
- Add `convertCurrency` and `FORMAT` SOQL/SOSL functions | ||
- Support nested functions in `FORMAT` | ||
- Support aliases on SOSL functions | ||
## 4.2.0 - 2024-09-02 | ||
@@ -4,0 +10,0 @@ |
@@ -93,2 +93,24 @@ "use strict"; | ||
}); | ||
test("Convert Currency function", () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)('[ SELECT convertCurrency(Amount) FROM Opportunity ]'); | ||
const context = parser.soqlLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoqlLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
test("Convert Currency with format", () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)(`[ | ||
SELECT Amount, FORMAT(amount) Amt, convertCurrency(amount) convertedAmount, | ||
FORMAT(convertCurrency(amount)) convertedCurrency | ||
FROM Opportunity where id = '006R00000024gDtIAI' | ||
]`); | ||
const context = parser.soqlLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoqlLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
test("Format function with aggregate", () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)('[ SELECT FORMAT(MIN(closedate)) Amt FROM opportunity ]'); | ||
const context = parser.soqlLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoqlLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
//# sourceMappingURL=SOQLParserTest.js.map |
@@ -66,2 +66,37 @@ "use strict"; | ||
}); | ||
test('testToLabelWithAlias', () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)("[FIND :searchTerm IN ALL FIELDS RETURNING Account(Id, toLabel(Name) AliasName) LIMIT 10]"); | ||
const context = parser.soslLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoslLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
test('testConvertCurrency', () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)(`[ | ||
FIND 'test' RETURNING Opportunity( | ||
Name, | ||
convertCurrency(Amount), | ||
convertCurrency(Amount) AliasCurrency | ||
) | ||
]`); | ||
const context = parser.soslLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoslLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
test('testConvertCurrencyWithFormat', () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)(`[ | ||
FIND 'Acme' RETURNING Account( | ||
AnnualRevenue, | ||
FORMAT(convertCurrency(AnnualRevenue)) convertedCurrency | ||
) | ||
]`); | ||
const context = parser.soslLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoslLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
test('testFormatWithAggregate', () => { | ||
const [parser, errorCounter] = (0, SyntaxErrorCounter_1.createParser)("[ FIND 'Acme' RETURNING Account(AnnualRevenue, FORMAT(MIN(CloseDate))) ]"); | ||
const context = parser.soslLiteral(); | ||
expect(context).toBeInstanceOf(ApexParser_1.SoslLiteralContext); | ||
expect(errorCounter.getNumErrors()).toEqual(0); | ||
}); | ||
//# sourceMappingURL=SOSLParserTest.js.map |
@@ -121,136 +121,137 @@ import { ATN } from "antlr4ts/atn/ATN"; | ||
static readonly GROUPING = 115; | ||
static readonly CALENDAR_MONTH = 116; | ||
static readonly CALENDAR_QUARTER = 117; | ||
static readonly CALENDAR_YEAR = 118; | ||
static readonly DAY_IN_MONTH = 119; | ||
static readonly DAY_IN_WEEK = 120; | ||
static readonly DAY_IN_YEAR = 121; | ||
static readonly DAY_ONLY = 122; | ||
static readonly FISCAL_MONTH = 123; | ||
static readonly FISCAL_QUARTER = 124; | ||
static readonly FISCAL_YEAR = 125; | ||
static readonly HOUR_IN_DAY = 126; | ||
static readonly WEEK_IN_MONTH = 127; | ||
static readonly WEEK_IN_YEAR = 128; | ||
static readonly CONVERT_TIMEZONE = 129; | ||
static readonly YESTERDAY = 130; | ||
static readonly TODAY = 131; | ||
static readonly TOMORROW = 132; | ||
static readonly LAST_WEEK = 133; | ||
static readonly THIS_WEEK = 134; | ||
static readonly NEXT_WEEK = 135; | ||
static readonly LAST_MONTH = 136; | ||
static readonly THIS_MONTH = 137; | ||
static readonly NEXT_MONTH = 138; | ||
static readonly LAST_90_DAYS = 139; | ||
static readonly NEXT_90_DAYS = 140; | ||
static readonly LAST_N_DAYS_N = 141; | ||
static readonly NEXT_N_DAYS_N = 142; | ||
static readonly N_DAYS_AGO_N = 143; | ||
static readonly NEXT_N_WEEKS_N = 144; | ||
static readonly LAST_N_WEEKS_N = 145; | ||
static readonly N_WEEKS_AGO_N = 146; | ||
static readonly NEXT_N_MONTHS_N = 147; | ||
static readonly LAST_N_MONTHS_N = 148; | ||
static readonly N_MONTHS_AGO_N = 149; | ||
static readonly THIS_QUARTER = 150; | ||
static readonly LAST_QUARTER = 151; | ||
static readonly NEXT_QUARTER = 152; | ||
static readonly NEXT_N_QUARTERS_N = 153; | ||
static readonly LAST_N_QUARTERS_N = 154; | ||
static readonly N_QUARTERS_AGO_N = 155; | ||
static readonly THIS_YEAR = 156; | ||
static readonly LAST_YEAR = 157; | ||
static readonly NEXT_YEAR = 158; | ||
static readonly NEXT_N_YEARS_N = 159; | ||
static readonly LAST_N_YEARS_N = 160; | ||
static readonly N_YEARS_AGO_N = 161; | ||
static readonly THIS_FISCAL_QUARTER = 162; | ||
static readonly LAST_FISCAL_QUARTER = 163; | ||
static readonly NEXT_FISCAL_QUARTER = 164; | ||
static readonly NEXT_N_FISCAL_QUARTERS_N = 165; | ||
static readonly LAST_N_FISCAL_QUARTERS_N = 166; | ||
static readonly N_FISCAL_QUARTERS_AGO_N = 167; | ||
static readonly THIS_FISCAL_YEAR = 168; | ||
static readonly LAST_FISCAL_YEAR = 169; | ||
static readonly NEXT_FISCAL_YEAR = 170; | ||
static readonly NEXT_N_FISCAL_YEARS_N = 171; | ||
static readonly LAST_N_FISCAL_YEARS_N = 172; | ||
static readonly N_FISCAL_YEARS_AGO_N = 173; | ||
static readonly DateLiteral = 174; | ||
static readonly DateTimeLiteral = 175; | ||
static readonly IntegralCurrencyLiteral = 176; | ||
static readonly FIND = 177; | ||
static readonly EMAIL = 178; | ||
static readonly NAME = 179; | ||
static readonly PHONE = 180; | ||
static readonly SIDEBAR = 181; | ||
static readonly FIELDS = 182; | ||
static readonly METADATA = 183; | ||
static readonly PRICEBOOKID = 184; | ||
static readonly NETWORK = 185; | ||
static readonly SNIPPET = 186; | ||
static readonly TARGET_LENGTH = 187; | ||
static readonly DIVISION = 188; | ||
static readonly RETURNING = 189; | ||
static readonly LISTVIEW = 190; | ||
static readonly FindLiteral = 191; | ||
static readonly FindLiteralAlt = 192; | ||
static readonly IntegerLiteral = 193; | ||
static readonly LongLiteral = 194; | ||
static readonly NumberLiteral = 195; | ||
static readonly BooleanLiteral = 196; | ||
static readonly StringLiteral = 197; | ||
static readonly NullLiteral = 198; | ||
static readonly LPAREN = 199; | ||
static readonly RPAREN = 200; | ||
static readonly LBRACE = 201; | ||
static readonly RBRACE = 202; | ||
static readonly LBRACK = 203; | ||
static readonly RBRACK = 204; | ||
static readonly SEMI = 205; | ||
static readonly COMMA = 206; | ||
static readonly DOT = 207; | ||
static readonly ASSIGN = 208; | ||
static readonly GT = 209; | ||
static readonly LT = 210; | ||
static readonly BANG = 211; | ||
static readonly TILDE = 212; | ||
static readonly QUESTIONDOT = 213; | ||
static readonly QUESTION = 214; | ||
static readonly COLON = 215; | ||
static readonly EQUAL = 216; | ||
static readonly TRIPLEEQUAL = 217; | ||
static readonly NOTEQUAL = 218; | ||
static readonly LESSANDGREATER = 219; | ||
static readonly TRIPLENOTEQUAL = 220; | ||
static readonly AND = 221; | ||
static readonly OR = 222; | ||
static readonly COAL = 223; | ||
static readonly INC = 224; | ||
static readonly DEC = 225; | ||
static readonly ADD = 226; | ||
static readonly SUB = 227; | ||
static readonly MUL = 228; | ||
static readonly DIV = 229; | ||
static readonly BITAND = 230; | ||
static readonly BITOR = 231; | ||
static readonly CARET = 232; | ||
static readonly MAPTO = 233; | ||
static readonly ADD_ASSIGN = 234; | ||
static readonly SUB_ASSIGN = 235; | ||
static readonly MUL_ASSIGN = 236; | ||
static readonly DIV_ASSIGN = 237; | ||
static readonly AND_ASSIGN = 238; | ||
static readonly OR_ASSIGN = 239; | ||
static readonly XOR_ASSIGN = 240; | ||
static readonly LSHIFT_ASSIGN = 241; | ||
static readonly RSHIFT_ASSIGN = 242; | ||
static readonly URSHIFT_ASSIGN = 243; | ||
static readonly ATSIGN = 244; | ||
static readonly Identifier = 245; | ||
static readonly WS = 246; | ||
static readonly DOC_COMMENT = 247; | ||
static readonly COMMENT = 248; | ||
static readonly LINE_COMMENT = 249; | ||
static readonly CONVERT_CURRENCY = 116; | ||
static readonly CALENDAR_MONTH = 117; | ||
static readonly CALENDAR_QUARTER = 118; | ||
static readonly CALENDAR_YEAR = 119; | ||
static readonly DAY_IN_MONTH = 120; | ||
static readonly DAY_IN_WEEK = 121; | ||
static readonly DAY_IN_YEAR = 122; | ||
static readonly DAY_ONLY = 123; | ||
static readonly FISCAL_MONTH = 124; | ||
static readonly FISCAL_QUARTER = 125; | ||
static readonly FISCAL_YEAR = 126; | ||
static readonly HOUR_IN_DAY = 127; | ||
static readonly WEEK_IN_MONTH = 128; | ||
static readonly WEEK_IN_YEAR = 129; | ||
static readonly CONVERT_TIMEZONE = 130; | ||
static readonly YESTERDAY = 131; | ||
static readonly TODAY = 132; | ||
static readonly TOMORROW = 133; | ||
static readonly LAST_WEEK = 134; | ||
static readonly THIS_WEEK = 135; | ||
static readonly NEXT_WEEK = 136; | ||
static readonly LAST_MONTH = 137; | ||
static readonly THIS_MONTH = 138; | ||
static readonly NEXT_MONTH = 139; | ||
static readonly LAST_90_DAYS = 140; | ||
static readonly NEXT_90_DAYS = 141; | ||
static readonly LAST_N_DAYS_N = 142; | ||
static readonly NEXT_N_DAYS_N = 143; | ||
static readonly N_DAYS_AGO_N = 144; | ||
static readonly NEXT_N_WEEKS_N = 145; | ||
static readonly LAST_N_WEEKS_N = 146; | ||
static readonly N_WEEKS_AGO_N = 147; | ||
static readonly NEXT_N_MONTHS_N = 148; | ||
static readonly LAST_N_MONTHS_N = 149; | ||
static readonly N_MONTHS_AGO_N = 150; | ||
static readonly THIS_QUARTER = 151; | ||
static readonly LAST_QUARTER = 152; | ||
static readonly NEXT_QUARTER = 153; | ||
static readonly NEXT_N_QUARTERS_N = 154; | ||
static readonly LAST_N_QUARTERS_N = 155; | ||
static readonly N_QUARTERS_AGO_N = 156; | ||
static readonly THIS_YEAR = 157; | ||
static readonly LAST_YEAR = 158; | ||
static readonly NEXT_YEAR = 159; | ||
static readonly NEXT_N_YEARS_N = 160; | ||
static readonly LAST_N_YEARS_N = 161; | ||
static readonly N_YEARS_AGO_N = 162; | ||
static readonly THIS_FISCAL_QUARTER = 163; | ||
static readonly LAST_FISCAL_QUARTER = 164; | ||
static readonly NEXT_FISCAL_QUARTER = 165; | ||
static readonly NEXT_N_FISCAL_QUARTERS_N = 166; | ||
static readonly LAST_N_FISCAL_QUARTERS_N = 167; | ||
static readonly N_FISCAL_QUARTERS_AGO_N = 168; | ||
static readonly THIS_FISCAL_YEAR = 169; | ||
static readonly LAST_FISCAL_YEAR = 170; | ||
static readonly NEXT_FISCAL_YEAR = 171; | ||
static readonly NEXT_N_FISCAL_YEARS_N = 172; | ||
static readonly LAST_N_FISCAL_YEARS_N = 173; | ||
static readonly N_FISCAL_YEARS_AGO_N = 174; | ||
static readonly DateLiteral = 175; | ||
static readonly DateTimeLiteral = 176; | ||
static readonly IntegralCurrencyLiteral = 177; | ||
static readonly FIND = 178; | ||
static readonly EMAIL = 179; | ||
static readonly NAME = 180; | ||
static readonly PHONE = 181; | ||
static readonly SIDEBAR = 182; | ||
static readonly FIELDS = 183; | ||
static readonly METADATA = 184; | ||
static readonly PRICEBOOKID = 185; | ||
static readonly NETWORK = 186; | ||
static readonly SNIPPET = 187; | ||
static readonly TARGET_LENGTH = 188; | ||
static readonly DIVISION = 189; | ||
static readonly RETURNING = 190; | ||
static readonly LISTVIEW = 191; | ||
static readonly FindLiteral = 192; | ||
static readonly FindLiteralAlt = 193; | ||
static readonly IntegerLiteral = 194; | ||
static readonly LongLiteral = 195; | ||
static readonly NumberLiteral = 196; | ||
static readonly BooleanLiteral = 197; | ||
static readonly StringLiteral = 198; | ||
static readonly NullLiteral = 199; | ||
static readonly LPAREN = 200; | ||
static readonly RPAREN = 201; | ||
static readonly LBRACE = 202; | ||
static readonly RBRACE = 203; | ||
static readonly LBRACK = 204; | ||
static readonly RBRACK = 205; | ||
static readonly SEMI = 206; | ||
static readonly COMMA = 207; | ||
static readonly DOT = 208; | ||
static readonly ASSIGN = 209; | ||
static readonly GT = 210; | ||
static readonly LT = 211; | ||
static readonly BANG = 212; | ||
static readonly TILDE = 213; | ||
static readonly QUESTIONDOT = 214; | ||
static readonly QUESTION = 215; | ||
static readonly COLON = 216; | ||
static readonly EQUAL = 217; | ||
static readonly TRIPLEEQUAL = 218; | ||
static readonly NOTEQUAL = 219; | ||
static readonly LESSANDGREATER = 220; | ||
static readonly TRIPLENOTEQUAL = 221; | ||
static readonly AND = 222; | ||
static readonly OR = 223; | ||
static readonly COAL = 224; | ||
static readonly INC = 225; | ||
static readonly DEC = 226; | ||
static readonly ADD = 227; | ||
static readonly SUB = 228; | ||
static readonly MUL = 229; | ||
static readonly DIV = 230; | ||
static readonly BITAND = 231; | ||
static readonly BITOR = 232; | ||
static readonly CARET = 233; | ||
static readonly MAPTO = 234; | ||
static readonly ADD_ASSIGN = 235; | ||
static readonly SUB_ASSIGN = 236; | ||
static readonly MUL_ASSIGN = 237; | ||
static readonly DIV_ASSIGN = 238; | ||
static readonly AND_ASSIGN = 239; | ||
static readonly OR_ASSIGN = 240; | ||
static readonly XOR_ASSIGN = 241; | ||
static readonly LSHIFT_ASSIGN = 242; | ||
static readonly RSHIFT_ASSIGN = 243; | ||
static readonly URSHIFT_ASSIGN = 244; | ||
static readonly ATSIGN = 245; | ||
static readonly Identifier = 246; | ||
static readonly WS = 247; | ||
static readonly DOC_COMMENT = 248; | ||
static readonly COMMENT = 249; | ||
static readonly LINE_COMMENT = 250; | ||
static readonly WHITESPACE_CHANNEL = 2; | ||
@@ -257,0 +258,0 @@ static readonly COMMENT_CHANNEL = 3; |
{ | ||
"name": "@apexdevtools/apex-parser", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"author": "Apex Dev Tools Team <apexdevtools@gmail.com> (https://github.com/apex-dev-tools)", | ||
@@ -5,0 +5,0 @@ "bugs": "https://github.com/apex-dev-tools/apex-parser/issues", |
@@ -51,3 +51,3 @@ # apex-parser | ||
<artifactId>apex-parser</artifactId> | ||
<version>4.2.0</version> | ||
<version>4.3.0</version> | ||
</dependency> | ||
@@ -57,3 +57,3 @@ | ||
"@apexdevtools/apex-parser": "^4.2.0" | ||
"@apexdevtools/apex-parser": "^4.3.0" | ||
@@ -60,0 +60,0 @@ ## Building |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2216412
29442