import type { GrpcErrorCode } from '../constants'; import type { GrpcLogLevel } from '../utils/enums'; import type { Options } from '@grpc/proto-loader'; import type { DynamicModule, ModuleMetadata, Provider, Type } from '@nestjs/common'; export { GrpcLogLevel } from '../utils/enums'; export type GrpcMetadata = Record; export interface CachedClient { client: any; createdAt: number; lastUsed: number; config: string; } export interface TypeOptions { useClasses?: boolean; includeComments?: boolean; packageFilter?: string; includeClientInterfaces?: boolean; } export interface GrpcLoggerOptions { enabled?: boolean; level?: GrpcLogLevel; context?: string; } export interface GrpcLoggingOptions { enabled?: boolean; level?: GrpcLogLevel; context?: string; } export interface GrpcOptions { protoPath: string; package: string; url?: string; secure?: boolean; rootCerts?: Buffer; privateKey?: Buffer; certChain?: Buffer; maxSendMessageSize?: number; maxReceiveMessageSize?: number; loaderOptions?: Options; logging?: GrpcLoggingOptions; } export interface GrpcClientOptions { service: string; package?: string; protoPath?: string; url?: string; maxRetries?: number; retryDelay?: number; secure?: boolean; rootCerts?: Buffer; privateKey?: Buffer; certChain?: Buffer; timeout?: number; channelOptions?: Record; } export interface GrpcOptionsFactory { createGrpcOptions(): Promise | GrpcOptions; } export interface GrpcModuleAsyncOptions extends Pick { useFactory?: (...args: any[]) => Promise | GrpcOptions; useClass?: Type; useExisting?: Type; inject?: any[]; } export interface GrpcFeatureOptions { services?: Type[]; providers?: Provider[]; imports?: Array | DynamicModule>; exports?: Array | string | symbol>; serviceRegistrations?: GrpcServiceRegistrationConfig[]; } export interface GrpcLocalServiceConfig { protoPath: string; package: string; url?: string; logging?: GrpcLoggingOptions; options?: { secure?: boolean; rootCerts?: Buffer; privateKey?: Buffer; certChain?: Buffer; maxSendMessageSize?: number; maxReceiveMessageSize?: number; }; } export interface GrpcServiceRegistrationConfig { serviceName: string; package: string; protoPath: string; url: string; options?: { secure?: boolean; rootCerts?: Buffer; privateKey?: Buffer; certChain?: Buffer; maxSendMessageSize?: number; maxReceiveMessageSize?: number; timeout?: number; maxRetries?: number; retryDelay?: number; }; } export interface GrpcMethodOptions { methodName?: string; streaming?: boolean; timeout?: number; } export interface GrpcControllerOptions { serviceName: string; package?: string; url?: string; } export interface GrpcServiceOptions { serviceName: string; package?: string; url?: string; clientOptions?: Partial; } export interface GrpcExceptionOptions { code: GrpcErrorCode; message: string; details?: any; metadata?: Record; } export interface GenerateCommandOptions { proto: string; output: string; watch: boolean; recursive?: boolean; classes?: boolean; comments?: boolean; packageFilter?: string; verbose?: boolean; silent?: boolean; noClientInterfaces?: boolean; } export interface ControllerMetadata { serviceName: string; package?: string; url?: string; methods: Map; } export interface ServiceClientMetadata { serviceName: string; package?: string; url?: string; clientOptions?: Partial; } export interface GrpcErrorResponse { code: number; message: string; details?: any; metadata?: any; } export interface GrpcExceptionFilterOptions { enableLogging?: boolean; maxMessageLength?: number; fallbackMessage?: string; fallbackCode?: number; } export interface GrpcErrorDetails { value?: string; error?: string; httpStatus?: number; [key: string]: any; } export interface HttpToGrpcStatusMapping { httpStatus: number; grpcStatus: number; description?: string; } export interface GrpcFeatureAsyncOptions extends Pick { useFactory?: (...args: any[]) => Promise | GrpcFeatureOptions; useClass?: Type; useExisting?: Type; inject?: any[]; } export interface GrpcConsumerOptions { serviceName: string; protoPath: string; package: string; url: string; secure?: boolean; rootCerts?: Buffer; privateKey?: Buffer; certChain?: Buffer; timeout?: number; maxRetries?: number; retryDelay?: number; loaderOptions?: Options; logging?: GrpcLoggingOptions; channelOptions?: Record; } export interface GrpcConsumerOptionsFactory { createGrpcConsumerOptions(): Promise | GrpcConsumerOptions; } export interface GrpcConsumerModuleAsyncOptions extends Pick { useFactory?: (...args: any[]) => Promise | GrpcConsumerOptions; useClass?: Type; useExisting?: Type; inject?: any[]; } export interface GrpcConsumerMethodOptions { timeout?: number; maxRetries?: number; retryDelay?: number; enableDetailedLogging?: boolean; } export interface GrpcConsumerError { code: number; message: string; serviceName: string; methodName: string; details?: any; metadata?: any; timestamp: Date; duration: number; }