import * as rpc from "vscode-jsonrpc/node"; import { MessageConnection } from "vscode-jsonrpc/node"; import { Cursor, SourceFile, Tree } from "../tree"; import { RecipeMarketplace } from "../marketplace"; import { RpcRecipe } from "./recipe"; import { ExecutionContext } from "../execution"; import { InstallRecipesResponse } from "./request/install-recipes"; import { ParserInput } from "../parser"; import { ReferenceMap } from "../reference"; export declare class RewriteRpc { readonly connection: MessageConnection; /** * Key for the active {@link RewriteRpc} connection on {@link globalThis}. * * It deliberately lives on `globalThis` rather than as a `static` field: * a recipe package that bundles `@openrewrite/rewrite` (or resolves it from * its own `node_modules`) loads a *separate copy* of this module, with its * own class object and therefore its own statics. A `static` field set by * the host would be invisible to such a copy, so `RewriteRpc.get()` (e.g. * via `prepareJavaRecipe`) would return `undefined` and throw "no active * RewriteRpc connection" — surfacing during `InstallRecipes` as the * misleading "Ensure the constructor can be called without any arguments". * {@link Symbol.for} resolves to the same symbol across every module copy, * so all copies share the one active connection. See gh-7968. */ private static readonly GLOBAL_KEY; private readonly snowflake; readonly localObjects: Map any) | any>; private readonly localObjectIds; readonly remoteObjects: Map; readonly remoteRefs: Map; readonly localRefs: ReferenceMap; readonly refCheckpoints: Map; private remoteLanguages?; private readonly logger?; private traceGetObject; private configuredDataTableStore?; constructor(connection: MessageConnection | undefined, options: { batchSize?: number; marketplace?: RecipeMarketplace; logger?: rpc.Logger; metricsCsv?: string; recipeInstallDir?: string; }); private readonly clearLocalState; /** * Reset both the remote and local RPC caches. Sends a `Reset` request to the * remote — which clears the remote's state without sending one back — and * then clears local caches. Use this between independent operations (e.g. * between tests) so accumulated objects and prepared recipes don't leak * across boundaries. */ reset(): Promise; static set(value: RewriteRpc): void; static get(): RewriteRpc | undefined; end(): RewriteRpc; getObject

(id: string, sourceFileType?: string): Promise

; getCursor(cursorIds: string[] | undefined, sourceFileType?: string): Promise; parse(inputs: ParserInput[], sourceFileType: string, relativeTo?: string): Promise; print(tree: SourceFile): Promise; print(tree: Tree, cursor: Cursor): Promise; languages(): Promise; marketplace(): Promise; prepareRecipe(id: string, options?: any): Promise; visit(tree: Tree, visitorName: string, p: any, cursor?: Cursor): Promise; generate(remoteRecipeId: string, ctx: ExecutionContext): Promise; installRecipes(recipes: string | { packageName: string; version?: string; }): Promise; private localObject; getCursorIds(cursor: Cursor | undefined): string[] | undefined; } //# sourceMappingURL=rewrite-rpc.d.ts.map