import { URI } from '../model/uri'; import { CreateNoteFunction } from './note-creation-types'; /** * Error thrown when there are issues loading or executing JavaScript templates */ export declare class JSTemplateError extends Error { readonly templatePath: string; constructor(message: string, templatePath: string); } /** * Loader for JavaScript template functions. * * Execution uses Node's `vm` module. This is NOT a security sandbox — `vm` is * not a security boundary, but provides a clean global namespace and * a wall-clock execution timeout that interrupts an accidental infinite loop. */ export declare class JSTemplateLoader { private readonly readFile; private static readonly EXECUTION_TIMEOUT; private static readonly VM_OPTIONS; constructor(readFile: (uri: URI) => Promise); /** * Loads and returns a note creation function from a JavaScript template file * * @param template Path to the JavaScript template file * @returns The createNote function from the template */ loadFunction(template: URI): Promise; /** * Creates a note creation function from JavaScript code * SECURITY: This is not a sandbox; this runs with full RCE potential and * should only be called behind a trust gate (e.g. VS Code Workspace Trust). * * @param code The JavaScript code containing the createNote function * @param template Path for error reporting * @returns The createNote function */ private createFunctionFromCode; /** * Checks that the template source defines a `createNote` function, so a * common authoring mistake fails with a clear message before the code runs. * This is a structural sanity check, not a security control. */ private validateTemplateCode; /** * Validates the result returned by a template function */ private validateResult; } //# sourceMappingURL=js-template-loader.d.ts.map