weaver-frontend-cli
Version:
🕷️ Weaver CLI - Generador completo de arquitectura Clean Architecture con parser OpenAPI avanzado para entidades CRUD y flujos de negocio complejos
177 lines • 5.52 kB
TypeScript
export interface EntityField {
name: string;
type: string;
required: boolean;
format?: string;
description?: string;
maxLength?: number;
isArray?: boolean;
isEnum?: boolean;
enumValues?: string[];
nestedFields?: EntityField[];
}
export interface EntitySchema {
name: string;
description?: string;
fields: EntityField[];
operations: {
create?: boolean;
read?: boolean;
update?: boolean;
delete?: boolean;
list?: boolean;
};
businessOperations?: {
operationId: string;
method: string;
path: string;
summary?: string;
requestSchema?: string;
responseSchema?: string;
fields: EntityField[];
responseFields?: EntityField[];
isResponseArray?: boolean;
}[];
}
export interface Operation {
path: string;
method: string;
operationId: string;
summary?: string;
description?: string;
tags?: string[];
requestSchema?: string | null;
responseSchema?: string | null;
}
export interface ResponseSchema {
isArray: boolean;
fields: EntityField[];
schemaName?: string;
}
/**
* Analizador de Swagger especializado para Redux Flow Generator
* Incluye lógica de extracción automática del campo "response"
*/
export declare class SwaggerReduxAnalyzer {
private openApiDoc;
private detectedApiName;
loadFromUrl(url: string): Promise<void>;
getAvailableEntities(): string[];
/**
* Obtiene los servicios de negocio disponibles basándose en tags que NO tienen CRUD completo
*/
getAvailableBusinessServices(): string[];
/**
* Mapea un método HTTP y path a una operación CRUD
*/
private mapHttpMethodToCrud;
/**
* Verifica si un conjunto de operaciones incluye CRUD completo
*/
private hasCompleteCrudOperations;
/**
* Obtiene el schema de un servicio de negocio basándose en sus operaciones Request/Response
*/
getBusinessServiceSchema(serviceName: string): EntitySchema | null;
getEntitySchema(entityName: string): EntitySchema | null;
private isEntitySchema;
private extractEntityName;
private hasEntityOperations;
private extractFields;
private parseFieldSchema;
private getTypeFromSchema;
private analyzeOperations;
/**
* Detecta el nombre de la API basándose en el título, URL base o paths
*/
private detectApiName;
/**
* Obtiene el nombre de la API detectado
*/
getDetectedApiName(): string | null;
/**
* Sugiere posibles nombres de API basándose en análisis
*/
suggestApiNames(): string[];
printEntityInfo(entityName: string): void;
/**
* Genera campos de respuesta basándose en el contexto de la operación
*/
private generateContextualResponseFields;
/**
* Parsea un campo resolviendo referencias $ref y allOf
*/
private parseFieldSchemaWithRefs;
/**
* ========================================
* MÉTODOS PARA REDUX FLOW GENERATOR
* ========================================
*/
/**
* Obtiene todos los tags disponibles en el Swagger
* @returns Array de nombres de tags
*/
getAvailableTags(): string[];
/**
* Obtiene todas las operaciones de un tag específico (entity o business service)
* @param tagName - Nombre del tag (User, Availability, etc.)
* @returns Array de operaciones
*/
getOperationsForTag(tagName: string): Operation[];
/**
* Obtiene un resumen del tipo de respuesta de una operación
* @param path - Path del endpoint
* @param method - Método HTTP
* @returns String con el tipo de respuesta
*/
getResponseTypeSummary(path: string, method: string): string;
/**
* Obtiene el nombre del schema de request
* @param operation - Operación del OpenAPI
* @returns Nombre del schema o null
*/
private getRequestSchemaName;
/**
* Obtiene el nombre del schema de response
* @param operation - Operación del OpenAPI
* @returns Nombre del schema o null
*/
private getResponseSchemaNameForOperation;
/**
* Obtiene el schema del response de una operación específica
* @param path - Path del endpoint
* @param method - Método HTTP
* @returns ResponseSchema con información detallada
*/
getResponseSchema(path: string, method: string): ResponseSchema | null;
/**
* Parsea un schema de respuesta
* @param schema - Schema de OpenAPI
* @returns ResponseSchema con estructura analizada
*/
private parseResponseSchema;
/**
* Extrae campos de un schema
* @param schema - Schema de OpenAPI
* @returns Array de EntityField
*/
private extractFieldsFromSchema;
/**
* Carga un archivo YAML/JSON local y lo valida
* @param filePath - Ruta del archivo YAML
* @returns Promise<void>
*/
loadFromFile(filePath: string): Promise<void>;
/**
* Obtiene los schemas disponibles en components.schemas de un archivo cargado
* @returns Array de nombres de schemas
*/
getAvailableSchemasFromFile(): string[];
/**
* Obtiene el schema de un componente específico por nombre
* @param schemaName - Nombre del schema
* @returns ResponseSchema con estructura analizada
*/
getSchemaByName(schemaName: string): ResponseSchema | null;
}
//# sourceMappingURL=swagger-redux-parser.d.ts.map