import { type IFileSystem, type ILogger } from '@breadstone-infrastructure/utilities'; import type { IResourceInfo, ResourceReader, ResourceTransformer } from '@breadstone-tools/localizator-core'; import type { IResourceGeneratorOptions } from './Interfaces/IResourceGeneratorOptions.js'; import type { IResourceGeneratorResult } from './Interfaces/IResourceGeneratorResult.js'; /** * Class responsible for generating translated resources using AI. * * @public */ export declare class ResourceGenerator { private readonly _logger; private readonly _fileSystem; private readonly _transformer; private readonly _reader; private readonly _options; private readonly _strategies; /** * Constructs a new instance of the `ResourceGenerator` class. * * @param logger The logger service. * @param fileSystem The service to handle file operations. * @param transformer The service to handle resource transformations. * @param reader The service to read resources. * @param options The configuration options for the generator. */ constructor(logger: ILogger, fileSystem: IFileSystem, transformer: ResourceTransformer, reader: ResourceReader, options: IResourceGeneratorOptions); /** * Generates resources using the specified strategy. * * @public * @param resource The resource to generate. * @param locales The locales to generate the resource for. * @param strategy The strategy to use for generation. * @param onlyNew The optional flag to indicate if only new resources should be generated. * @returns The generated resources. */ run(resource: IResourceInfo, locales: Array, strategy: string, onlyNew?: boolean): Promise>; /** * Processes a resource using the specified strategy. * * @private * @param strategy The strategy to use for processing. * @param resource The resource to process. * @param locale The locale to process the resource for. * @param onlyNew The optional flag to indicate if only new resources should be generated. * @returns The processed resource. */ private processResource; /** * Gets the strategy for the specified strategy name. * * @private * @param strategy The strategy name. * @returns The strategy. */ private getStrategy; /** * Gets the target file path for the specified resource and locale. * * @private * @param resource The resource to generate the target file path for. * @param locale The locale to generate the target file path for. * @returns The target file path. */ private getTargetFilePath; /** * Creates a local dump of the ai resource. * Is is used for analysis purposes. * It could be that the serialization is not correct, so we can check the output. */ private dumpResult; /** * Loads existing translated models from the target file, if it exists. * * @private * @param targetFilePath The path to the target file. * @param resource The source resource info (used to determine the file type). * @returns The existing models, or an empty array if the file does not exist. */ private loadExistingModels; /** * Merges newly translated models into the existing target models and writes the * result to the original target file. New translations overwrite existing entries * by key; keys that were not re-translated keep their previous value. * * @private * @param existingModels The models already present in the target file. * @param newModels The models that were successfully translated in this run. * @param targetFilePath The target file path. * @param locale The target locale. * @param resource The source resource info. */ private mergeAndSave; } //# sourceMappingURL=ResourceGenerator.d.ts.map