@nestjsvn/swagger-sse
Version:
OpenAPI documentation and interactive Swagger UI for NestJS Server-Sent Events endpoints
52 lines (51 loc) • 1.55 kB
TypeScript
import { ApiSseOptions } from '../decorators/api-sse.options';
/**
* Utility functions for SSE decorator validation and processing
*/
/**
* Constructor type for class constructors
*/
export type Constructor<T = Record<string, never>> = new (...args: any[]) => T;
/**
* Validate ApiSse decorator options
*
* @param options SSE configuration options
* @throws Error if options are invalid
*/
export declare function validateSseOptions(options: ApiSseOptions): void;
/**
* Convert event name to a valid schema name
*
* @param eventName Event name (e.g., 'user-created')
* @returns Schema name (e.g., 'UserCreated')
*/
export declare function eventNameToSchemaName(eventName: string): string;
/**
* Check if a class has Swagger decorators
*
* @param dtoClass DTO class constructor
* @returns True if the class has Swagger metadata
*/
export declare function hasSwaggerDecorators(dtoClass: object): boolean;
/**
* Get default content type for SSE
*
* @returns Default SSE content type
*/
export declare function getDefaultSseContentType(): string;
/**
* Create example SSE event data
*
* @param eventName Event name
* @param data Event data
* @returns Formatted SSE event string
*/
export declare function createSseEventExample(eventName: string, data: any): string;
/**
* Get SSE metadata from a method
*
* @param target Target class
* @param propertyKey Method name
* @returns SSE metadata or undefined
*/
export declare function getSseMetadata(target: object, propertyKey: string | symbol): ApiSseOptions | undefined;