type MigrationUpdate = { /** * The path of the file which was updated. */ path: string; /** * The original import statement. */ oldImport: string; /** * The updated import statement. */ updatedImport: string; }; export interface UpdateLangChainFields { /** * The path to the project to check. * TypeScript files will be extracted * via this glob pattern: `${projectPath}/{star}{star}/{star}.{ts,tsx,js,jsx}`. * @optional - Not required if `files`, or 'tsConfigPath' is provided. */ projectPath?: string; /** * A list of .ts file paths to check. * @optional - Not required if `projectPath`, or 'tsConfigPath' is provided. */ files?: string[]; /** * Path to the tsConfig file. This will be used to load * all the project files into the script. * @optional - Not required if `projectPath`, or 'files' is provided. */ tsConfigPath?: string; /** * Whether or not to log a message when an import is updated. * @default false */ shouldLog?: boolean; /** * Whether or not the invocation is a test run. * If `testRun` is set to true, the script will NOT save changes. * @default false */ testRun?: boolean; } /** * Migrates a project's LangChain imports from version 0.0.x or 0.1.x to 0.2.x. * This function updates the import statements in the specified project files * based on the provided import map. * * @param {UpdateLangChainFields} fields - The configuration object for the migration. * @param {string} [fields.projectPath] - The path to the project to check. TypeScript files will be extracted * via this glob pattern: `${projectPath}/{star-star}/{star}.{ts,tsx,js,jsx}`. Not required if `files` or `tsConfigPath` is provided. * @param {string[]} [fields.files] - A list of .ts file paths to check. Not required if `projectPath` or `tsConfigPath` is provided. * @param {string} [fields.tsConfigPath] - Path to the tsConfig file. This will be used to load * all the project files into the script. Not required if `projectPath` or `files` is provided. * @param {boolean} [fields.shouldLog=false] - Whether or not to log a message when an import is updated. * @returns {Promise | null>} - A promise that resolves to an array of migration updates if successful, or null if an error occurs. * @throws {Error} - If more than one of `projectPath`, `tsConfigPath`, or `files` is provided, or if none of them are provided. * * @example * ```typescript * import { updateEntrypointsFrom0_x_xTo0_2_x } from "@langchain/scripts/migrations"; * * const pathToMyProject = "..."; * * updateEntrypointsFrom0_x_xTo0_2_x({ * projectPath: pathToMyProject, * shouldLog: true, * }); * ``` */ export declare function updateEntrypointsFrom0_x_xTo0_2_x(fields: UpdateLangChainFields): Promise | null>; export {};