Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@apexdevtools/apex-parser

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apexdevtools/apex-parser - npm Package Compare versions

Comparing version 3.6.0 to 4.0.0

lib/__tests__/ApexTriggerTest.d.ts

6

CHANGELOG.md
# apex-parser - Changelog
## 4.0.0 - 2023-03-28
- Correct trigger body parsing to allow member declarations
- Add support for TYPEOF in SOQL subqueries
- Change com.nawforce.apexparser packages to io.github.apexdevtools.apexparser
## 3.6.0 - 2024-02-15

@@ -4,0 +10,0 @@

2

lib/__tests__/system/SampleParseSys.js

@@ -48,3 +48,3 @@ "use strict";

"jvm/target/dependency/*:jvm/target/apex-parser.jar",
"com.nawforce.apexparser.Check",
"io.github.apexdevtools.apexparser.Check",
(0, path_1.resolve)(path, r.path)

@@ -51,0 +51,0 @@ ], {

@@ -36,2 +36,4 @@ import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";

import { TriggerCaseContext } from "./ApexParser";
import { TriggerBlockContext } from "./ApexParser";
import { TriggerBlockMemberContext } from "./ApexParser";
import { CompilationUnitContext } from "./ApexParser";

@@ -49,2 +51,3 @@ import { TypeDeclarationContext } from "./ApexParser";

import { MemberDeclarationContext } from "./ApexParser";
import { TriggerMemberDeclarationContext } from "./ApexParser";
import { MethodDeclarationContext } from "./ApexParser";

@@ -425,2 +428,14 @@ import { ConstructorDeclarationContext } from "./ApexParser";

/**
* Visit a parse tree produced by `ApexParser.triggerBlock`.
* @param ctx the parse tree
* @return the visitor result
*/
visitTriggerBlock?: (ctx: TriggerBlockContext) => Result;
/**
* Visit a parse tree produced by `ApexParser.triggerBlockMember`.
* @param ctx the parse tree
* @return the visitor result
*/
visitTriggerBlockMember?: (ctx: TriggerBlockMemberContext) => Result;
/**
* Visit a parse tree produced by `ApexParser.compilationUnit`.

@@ -498,2 +513,8 @@ * @param ctx the parse tree

/**
* Visit a parse tree produced by `ApexParser.triggerMemberDeclaration`.
* @param ctx the parse tree
* @return the visitor result
*/
visitTriggerMemberDeclaration?: (ctx: TriggerMemberDeclarationContext) => Result;
/**
* Visit a parse tree produced by `ApexParser.methodDeclaration`.

@@ -500,0 +521,0 @@ * @param ctx the parse tree

@@ -105,3 +105,3 @@ "use strict";

if (packages.length == 0) {
console.log(`[${name}]: No valid SFDX project, checking all cls files`);
console.log(`[${name}]: No valid SFDX project, checking all cls & trigger files`);
const result = yield check(path);

@@ -127,29 +127,34 @@ return [Object.assign({ name, path: "." }, result)];

const files = yield dir.promiseFiles(path);
let parsedCount = 0;
const errors = [];
files.filter(name => name.endsWith(".cls")).forEach(file => {
if ((0, fs_1.lstatSync)(file).isFile()) {
const content = (0, fs_1.readFileSync)(file);
const lexer = new ApexLexer_1.ApexLexer(new CaseInsensitiveInputStream_1.CaseInsensitiveInputStream(antlr4ts_1.CharStreams.fromString(content.toString())));
const tokens = new antlr4ts_1.CommonTokenStream(lexer);
const parser = new ApexParser_1.ApexParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(new ThrowingErrorListener_1.ThrowingErrorListener());
try {
parser.compilationUnit();
}
catch (err) {
console.log(`Error parsing: ${file}`);
console.log(err);
errors.push({
path: (0, path_1.relative)(path, file),
error: JSON.stringify(err)
});
}
parsedCount += 1;
const classErrors = parseByType(path, files, ".cls", (parser) => { parser.compilationUnit(); });
const triggerErrors = parseByType(path, files, ".trigger", (parser) => { parser.triggerUnit(); });
return classErrors.concat(triggerErrors);
});
}
function parseByType(rootPath, files, endsWith, operation) {
let parsedCount = 0;
const errors = [];
files.filter(name => name.endsWith(endsWith)).forEach(file => {
if ((0, fs_1.lstatSync)(file).isFile()) {
const content = (0, fs_1.readFileSync)(file);
const lexer = new ApexLexer_1.ApexLexer(new CaseInsensitiveInputStream_1.CaseInsensitiveInputStream(antlr4ts_1.CharStreams.fromString(content.toString())));
const tokens = new antlr4ts_1.CommonTokenStream(lexer);
const parser = new ApexParser_1.ApexParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(new ThrowingErrorListener_1.ThrowingErrorListener());
try {
operation(parser);
}
});
console.log(`Parsed ${parsedCount} files in: ${path}`);
return errors;
catch (err) {
console.log(`Error parsing: ${file}`);
console.log(err);
errors.push({
path: (0, path_1.relative)(rootPath, file),
error: JSON.stringify(err)
});
}
parsedCount += 1;
}
});
console.log(`Parsed ${parsedCount} '${endsWith}' files in: ${rootPath}`);
return errors;
}

@@ -156,0 +161,0 @@ function findProjectFile(wd, depth) {

{
"name": "@apexdevtools/apex-parser",
"version": "3.6.0",
"version": "4.0.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>3.6.0</version>
<version>4.0.0</version>
</dependency>

@@ -57,3 +57,3 @@

"@apexdevtools/apex-parser": "^3.6.0"
"@apexdevtools/apex-parser": "^4.0.0"

@@ -60,0 +60,0 @@ ## Building

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

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc