UNPKG

@nestjsvn/swagger-sse

Version:

OpenAPI documentation and interactive Swagger UI for NestJS Server-Sent Events endpoints

66 lines (65 loc) 1.98 kB
/** * Constants used throughout the library */ /** * Metadata keys for storing decorator information */ export declare const METADATA_KEYS: { /** Key for storing ApiSse decorator metadata */ readonly API_SSE: "api-sse"; /** Key for storing SSE endpoint configuration */ readonly SSE_CONFIG: "sse-config"; /** Key for storing event type mappings */ readonly SSE_EVENTS: "sse-events"; }; /** * Default SSE configuration values */ export declare const SSE_DEFAULTS: { /** Default retry interval in milliseconds */ readonly RETRY_INTERVAL: 3000; /** Default connection timeout in milliseconds */ readonly CONNECTION_TIMEOUT: 30000; /** Default keep-alive interval in milliseconds */ readonly KEEP_ALIVE_INTERVAL: 15000; /** Default maximum number of retry attempts */ readonly MAX_RETRIES: 5; }; /** * HTTP headers commonly used with SSE */ export declare const SSE_HEADERS: { /** Content-Type for Server-Sent Events */ readonly CONTENT_TYPE: "text/event-stream"; /** Cache control header */ readonly CACHE_CONTROL: "no-cache"; /** Connection header */ readonly CONNECTION: "keep-alive"; /** Access control headers for CORS */ readonly ACCESS_CONTROL_ALLOW_ORIGIN: "*"; readonly ACCESS_CONTROL_ALLOW_HEADERS: "Cache-Control"; }; /** * OpenAPI specification constants */ export declare const OPENAPI_CONSTANTS: { /** Media type for SSE in OpenAPI specs */ readonly SSE_MEDIA_TYPE: "text/event-stream"; /** Schema reference prefix */ readonly SCHEMA_REF_PREFIX: "#/components/schemas/"; /** Extension key for SSE metadata */ readonly SSE_EXTENSION: "x-sse-events"; }; /** * Event field names in SSE format */ export declare const SSE_EVENT_FIELDS: { /** Event type field */ readonly EVENT: "event"; /** Data field */ readonly DATA: "data"; /** ID field */ readonly ID: "id"; /** Retry field */ readonly RETRY: "retry"; };