@msugiura/rawsql-prisma
Version:
Prisma integration for rawsql-ts - Dynamic SQL generation with type safety and hierarchical JSON serialization
50 lines (48 loc) • 1.6 kB
TypeScript
/**
* Model-driven JSON mapping file processor for rawsql-ts integration.
* Handles detection and conversion of ModelDrivenJsonMapping formats.
*/
import { JsonMapping, TypeProtectionConfig } from 'rawsql-ts';
/**
* Supported JSON mapping file formats.
*/
export type MappingFileFormat = 'unified' | 'model-driven' | 'legacy';
/**
* Result of mapping file detection and conversion.
*/
export interface MappingFileResult {
format: MappingFileFormat;
jsonMapping: JsonMapping;
typeProtection: TypeProtectionConfig;
sourceFile: string;
success?: boolean;
errors?: string[];
convertedMapping?: JsonMapping;
}
/**
* Detect the format of a JSON mapping file based on its structure.
*/
export declare function detectMappingFormat(mappingData: any): MappingFileFormat;
/**
* Load and convert a JSON mapping file to the standard JsonMapping format.
* Supports ModelDrivenJsonMapping format.
*/
export declare function loadAndConvertMappingFile(filePath: string): MappingFileResult;
/**
* Search for mapping files in a directory and return conversion results.
* Supports multiple file naming patterns:
* - *.model-driven.json (ModelDrivenJsonMapping format)
* - *.json (legacy JsonMapping format)
*/
export declare function findAndConvertMappingFiles(baseDir: string): MappingFileResult[];
/**
* Get mapping file statistics for a directory.
*/
export declare function getMappingFileStats(baseDir: string): {
totalFiles: number;
byFormat: Record<MappingFileFormat, number>;
files: {
path: string;
format: MappingFileFormat;
}[];
};