import type { AuditContext } from '@cclabsnz/sf-core'; /** * How an Apex class's record sharing and CRUD/FLS are controlled (spec/apex-access-mode.md). * * Record sharing follows the class's own sharing keyword. WITH SYSTEM_MODE and * AccessLevel.SYSTEM_MODE switch off only CRUD/FLS for the operation they are on. A class with no * keyword runs with its caller's sharing, and as an entry point (Aura, REST, guest) without it, * unless it is compiled at API 67.0 or later (Summer '26), where an omitted keyword means with sharing. */ export type SharingKeyword = 'with' | 'without' | 'inherited' | 'none'; export declare const SYSTEM_MODE: RegExp; /** * The body with comments removed. A class's keywords and access modes are read from code only: * a `without sharing` class with "with sharing" in a comment must not read as protected. * String literals are kept (dynamic SOQL carries WITH SYSTEM_MODE inside one), and scanned past * correctly, so `@RestResource(urlMapping='/x/*')` does not open a comment. */ export declare function apexCode(body: string): string; /** The code with string literals blanked, for matching declarations and enforcement that must not hide in text. */ export declare function codeWithoutStrings(body: string): string; interface ClassDeclaration { name: string; /** The modifiers before `class`, from the previous statement or block boundary. */ modifiers: string; /** The parent class named by `extends`, if any. */ parent?: string; } /** * Every class declared in the body, outer and inner, found with literal patterns in one linear * pass (a regex built around the name backtracked badly on long runs of words). */ export declare function classDeclarations(body: string): ClassDeclaration[]; /** * The sharing keyword on the declaration of `className` itself, or null when the body declares no * class of that name (an interface, enum or trigger). Modifiers may sit on either side of the * keyword (`public virtual without sharing class`, `global with sharing virtual class`). */ export declare function sharingKeyword(className: string, body: string): SharingKeyword | null; /** The class `className` extends, as written in its declaration (namespace and outer class stripped). */ export declare function parentClass(className: string, body: string): string | undefined; /** * The sharing a class actually runs with. A class with no keyword takes its parent's when it * extends one: Apex classes inherit the sharing setting of the class they extend (spec MN-001). * `lookup` returns a class body by name; unknown parents leave the keyword as declared. */ export declare function effectiveSharing(className: string, body: string, lookup: (name: string) => string | undefined): SharingKeyword | null; /** From Summer '26 (API 67.0), a class compiled at this version or later with no sharing keyword runs with sharing. */ export declare const OMITTED_SHARING_ENFORCED_FROM = 67; /** * Whether a class whose effective sharing is 'none' still enforces sharing because every class * that decides it (the class, and each parent it inherits from while none declares a keyword) is * compiled at API 67.0 or later. A class whose version is unknown, such as a parent outside the * org's own code, keeps the old default: the answer errs towards reporting. */ export declare function omittedSharingEnforced(className: string, body: string, lookup: (name: string) => string | undefined, versionOf: (name: string) => number | undefined): boolean; /** Each org-local Apex class's API version, keyed by lower-cased name; empty when it cannot be read. */ export declare function apexApiVersions(ctx: AuditContext): Promise>; /** * Whether a keyword-less class can be entered only through @AuraEnabled methods. Since the "Use with * sharing for @AuraEnabled Apex Controllers with Implicit Sharing" update (enforced from Winter '21), * an Aura or LWC call into a class with no keyword runs with sharing, so such a class does not run * without sharing whatever its API version. A class that can also be entered another way can. */ export declare function enteredOnlyThroughAura(body: string): boolean; /** Whether the class's code (not its comments) uses SYSTEM_MODE anywhere. */ export declare function usesSystemMode(body: string): boolean; /** * Whether any class declared in the body, outer or inner, is `without sharing`. An inner class * keeps its own keyword, so a `with sharing` class can still run queries without sharing through * one (spec MN-002). */ export declare function declaresWithoutSharing(body: string): boolean; export declare const DML_AS_SYSTEM: RegExp; export declare const DML_AS_USER: RegExp; export {}; //# sourceMappingURL=apexAccess.d.ts.map