simply-apex-core
Apex execute, log-purge, and trace-flag logic. Full signatures and types are in the API reference.
npm install @simplysf/simply-apex-coreEvery example below assumes you already have an authenticated @salesforce/core Connection — see
Get Started.
Executing anonymous Apex
Section titled “Executing anonymous Apex”import { executeApex } from '@simplysf/simply-apex-core';
const result = await executeApex(connection, './scripts/apex/backfill.apex');
if (!result.success) { throw new Error(result.exceptionMessage || result.compileProblem);}
console.log(result.logs);Purging debug logs
Section titled “Purging debug logs”import { queryApexLogIdsViaRest, deleteApexLogsViaCollections } from '@simplysf/simply-apex-core';
const logIds = await queryApexLogIdsViaRest(connection, 'SELECT Id FROM ApexLog');
const results = await deleteApexLogsViaCollections(connection, logIds, (purged, total) => { console.log(`purged ${purged}/${total}`);});Setting up a trace flag
Section titled “Setting up a trace flag”import { setupApexTrace } from '@simplysf/simply-apex-core';
const trace = await setupApexTrace(connection, { logLevel: 'ReplayDebuggerLevels',});Silencing noisy framework classes in debug logs
Section titled “Silencing noisy framework classes in debug logs”import { silenceApexClasses, FFLIB_CLASSES, AT4DX_CLASSES } from '@simplysf/simply-apex-core';
const outcome = await silenceApexClasses(connection, [...FFLIB_CLASSES, ...AT4DX_CLASSES]);Generating an Apex test suite from source
Section titled “Generating an Apex test suite from source”import { generateApexTestSuite } from '@simplysf/simply-apex-core';
const result = await generateApexTestSuite(['force-app'], 'force-app/main/default/testSuites', 'AllTests');