/** * @file * * Typed context identifiers for persisting non-serializable values * across {@link evalInObsidian} calls. */ /** * Wraps a {@link ContextOf} extraction into an object with a `context` property. */ export interface ContextArguments | undefined = undefined> { context: ContextOf; } /** * Extracts the context type from a {@link ContextId}. */ export type ContextOf = T extends ContextId ? Context : never; /** * A typed context identifier for persisting non-serializable values * across {@link evalInObsidian} calls. * * The context is a persistent object stored on `window` in the Obsidian process. * All calls sharing the same `ContextId` share the same context object, * allowing non-serializable values (e.g. `TFile`, `Editor`) to survive across calls. * * Implements `AsyncDisposable` for use with `await using`. */ export declare class ContextId<_Context> implements AsyncDisposable { private readonly id; /** * Creates a new context id. */ constructor(); /** * Removes this context from the Obsidian process. * * @param vaultPath - The path to the Obsidian vault. Defaults to `process.cwd()`. */ dispose(vaultPath?: string): Promise; /** * Disposes this context id. * * @returns A promise that resolves when the context id is disposed. */ [Symbol.asyncDispose](): Promise; /** * Returns the JSON representation of the context id. * * @returns The JSON representation of the context id. */ toJSON(): string; /** * Returns the string representation of the context id. * * @returns The string representation of the context id. */ toString(): string; }