/** * 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. */ 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; /** 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