export type TestType = 'api' | 'e2e' | 'integration' | 'custom'; export type TestFramework = 'jest' | 'vitest'; export type SeedStrategy = 'once' | 'per-file' | 'per-test' | 'custom'; export type DBIsolationStrategy = 'savepoint' | 'schema' | 'database' | 'snapshot' | 'custom'; export type DBRestore = 'none' | 'rollback' | 'reset' | 'snapshot'; export type MessagingType = 'kafka' | 'rabbitmq' | 'redis-streams' | 'grpc' | 'nats' | 'sqs' | 'pubsub' | string; export type AuthType = 'jwt' | 'oauth2' | 'apikey' | 'basic' | 'session' | string; export type HttpRequestOptions = { method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; headers?: Record; body?: any; timeout?: number; retries?: number; retryDelay?: number; }; export type HttpResponse = { status: number; headers: Record; data: any; duration: number; }; export type Integr8Config = { services: ServiceConfig[]; databases?: DatabaseConfig[]; messaging?: MessagingConfig[]; storages?: StorageConfig[]; testType?: TestType; testDir?: string; testFramework?: 'jest' | 'vitest'; testTimeout?: number; setupTimeout?: number; teardownTimeout?: number; scan?: ScanConfig; coverage?: CoverageConfig; }; export type ScanConfig = { decorators?: { enabled?: boolean; framework?: 'nestjs' | 'express' | 'custom'; decorators?: { controllers?: string[]; routes?: string[]; statusCodes?: string[]; apiDocs?: string[]; routers?: string[]; custom?: Record; }; paths?: string[]; exclude?: string[]; }; discovery?: { command?: string; timeout?: number; outputFormat?: 'json' | 'text'; }; output?: string; generateTests?: boolean; }; export type CoverageConfig = { output: string; threshold?: number; }; export type CoverageReport = { timestamp: string; summary: { total: number; tested: number; untested: number; percentage: number; }; byMethod: Record; untested: Array<{ method: string; path: string; source?: string; }>; tested: Array<{ method: string; path: string; testFile?: string; }>; }; export type ExtendedRouteInfo = RouteInfo & { resource?: string; endpoint?: string; request?: { headers?: Record; query?: Record; body?: any; }; response?: Record; description?: string; testScenarios?: TestScenario[]; }; export type LocalProcessConfig = { command: string; cwd: string; args?: string[]; }; export type ContainerConfig = { image: string; containerName: string; volumes?: VolumeConfig[]; ports?: { host: number; container: number; }[]; environment?: Record; envMapping?: Record; }; export interface ComponentConfig { name: string; category: 'service' | 'database' | 'storage' | 'messaging'; type: string; adapter?: AdapterConfig; local?: LocalProcessConfig; container?: ContainerConfig; environment?: Record; readiness?: ReadinessConfig; dependsOn?: string[]; logging?: 'debug' | 'error' | 'log' | 'info' | 'warn' | boolean; } export type HttpConfig = { baseUrl: string; port?: number; prefix?: string; framework?: string; }; export type SocketConfig = { baseUrl: string; port?: number; prefix?: string; framework?: string; }; export type ServiceConfig = ComponentConfig & { category: 'service'; http?: HttpConfig; ws?: SocketConfig; auth?: AuthConfig; testMode?: ServiceTestModeConfig; }; export type DatabaseConfig = ComponentConfig & { category: 'database'; isolation?: DBIsolationStrategy; seed?: SeedConfig; container?: ContainerConfig & { envMapping?: DatabaseEnvMapping; }; }; export type StorageConfig = ComponentConfig & { category: 'storage'; container?: ContainerConfig & { envMapping?: StorageEnvMapping; }; }; export type MessagingConfig = ComponentConfig & { category: 'messaging'; container?: ContainerConfig & { envMapping?: MessagingEnvMapping; }; connection?: { brokers?: string[]; clusterId?: string; endpoint?: string; region?: string; }; topics?: string[]; queues?: string[]; streams?: string[]; services?: string[]; auth?: { username?: string; password?: string; apiKey?: string; certificates?: string[]; }; testMode?: { mockPublishers?: boolean; captureMessages?: boolean; isolation?: 'topic' | 'queue' | 'stream' | 'none'; }; }; export type DatabaseEnvMapping = { host?: string; port?: string; username?: string; password?: string; database?: string; url?: string; }; export type MessagingEnvMapping = { brokers?: string[]; clusterId?: string; endpoint?: string; region?: string; }; export type StorageEnvMapping = { endpoint?: string; region?: string; accessKey?: string; secretKey?: string; }; export type VolumeConfig = { host: string; container: string; mode?: 'ro' | 'rw'; }; export type ReadinessConfig = { command?: string; endpoint?: string; interval?: number; timeout?: number; retries?: number; }; export type SeedConfig = { command?: string | ((...args: any[]) => void); timeout?: number; condition?: (...args: any[]) => boolean; strategy?: SeedStrategy; restore?: DBRestore; }; export type AdapterConfig = { type: string; config?: Record; }; export type ServiceTestModeConfig = { controlPort?: number; overrideEndpoint?: string; enableFakeTimers?: boolean; }; export type IEnvironmentContext = { getHttp(serviceName: string): IHttpClient; getDb(serviceName: string): IDatabaseManager; getMessaging(serviceName: string): IMessagingManager; getStorage(serviceName: string): IStorageManager; getCtx(): ITestContext; getClock(): IClockManager; getBus(): IEventBusManager; }; export interface ITestContext { override: IOverrideManager; snapshot: ISnapshotManager; workerId: string; scenarioId: string; } export interface IHttpClient { request(options: HttpRequestOptions): Promise; get(url: string, options?: Partial): Promise; post(url: string, data?: any, options?: Partial): Promise; put(url: string, data?: any, options?: Partial): Promise; delete(url: string, options?: Partial): Promise; patch(url: string, data?: any, options?: Partial): Promise; } export interface IAuthOverrideBuilder extends IOverrideBuilder { withUsers(...users: any[]): Promise; withRoles(...roles: string[]): Promise; withPermissions(permissions: string[]): Promise; withMockAuth(config: AuthOverrideConfig): Promise; withProfile(profileName: string): Promise; withProfile(profile: AuthProfile): Promise; asAdmin(): Promise; asUser(): Promise; asGuest(): Promise; } export interface IDatabaseManager { query(sql: string, params?: any[]): Promise; transaction(fn: (tx: ITransaction) => Promise): Promise; snapshot(name: string): Promise; restore(name: string): Promise; reset(): Promise; getConnectionString(): string; seedForFile(fileName: string): Promise; seedForTest(testName: string, filePath: string): Promise; restoreAfterFile(fileName: string): Promise; restoreAfterTest(testName: string, filePath: string): Promise; getSeedingStatus(): { hasSeededOnce: boolean; seededFiles: string[]; seededTests: string[]; currentSnapshot: string | null; }; } export interface ITransaction { query(sql: string, params?: any[]): Promise; commit(): Promise; rollback(): Promise; } export interface IOverrideManager { module(moduleName: string): IOverrideBuilder; middleware(middlewareName: string): IOverrideBuilder; service(serviceName: string): IOverrideBuilder; repository(repositoryName: string): IOverrideBuilder; dataSource(dataSourceName: string): IOverrideBuilder; provider(providerName: string): IOverrideBuilder; auth(middlewareName?: string): IAuthOverrideBuilder; clear(): Promise; } export interface IOverrideBuilder { with(implementation: any): Promise; withMock(mockFn: (...args: any[]) => any): Promise; withValue(value: any): Promise; } export interface ISnapshotManager { create(name: string): Promise; restore(name: string): Promise; list(): Promise; delete(name: string): Promise; } export interface IClockManager { fake(): void; restore(): void; advance(ms: number): void; setSystemTime(date: Date): void; } export interface IEventBusManager { publish(topic: string, data: any): Promise; subscribe(topic: string, handler: (data: any) => void): Promise; unsubscribe(topic: string, handler: (data: any) => void): Promise; } export interface ScenarioDefinition { name: string; fn: (env: IEnvironmentContext) => Promise | void; timeout?: number; retries?: number; } export interface IRunner { start(fast: boolean): Promise; stop(): Promise; isReady(serviceName: string): Promise; } export interface IOrchestrator { start(fast: boolean): Promise; stop(): Promise; isReady(serviceName: string): Promise; startService(service: ServiceConfig | DatabaseConfig | MessagingConfig | StorageConfig, fast: boolean): Promise; stopService(service: ServiceConfig | DatabaseConfig | MessagingConfig | StorageConfig): Promise; } export interface IServiceManager { start(fast: boolean): Promise; stop(): Promise; isServiceReady(serviceName: string): Promise; getServiceStatus(serviceName: string): ServiceStatus; } export declare enum ServiceStatus { PENDING = "pending", STARTING = "starting", RUNNING = "running", FAILED = "failed", STOPPING = "stopping", STOPPED = "stopped" } export interface ServiceEvent { serviceName: string; service: ServiceConfig | DatabaseConfig | MessagingConfig | StorageConfig; error?: string; } export interface IEnvironmentOrchestrator extends IOrchestrator { getContext(): IEnvironmentContext; } export interface IDBStateManager { initialize(): Promise; createSavepoint(): Promise; rollbackToSavepoint(savepointId: string): Promise; createSchema(schemaName: string): Promise; dropSchema(schemaName: string): Promise; copySchema(fromSchema: string, toSchema: string): Promise; createDatabase(dbName: string): Promise; dropDatabase(dbName: string): Promise; cleanup(): Promise; beginTransaction(): Promise; commitTransaction(): Promise; rollbackTransaction(): Promise; getPerformanceMetrics(): PerformanceMetrics[]; getAverageOperationTime(operation: string): number; getStrategyPerformance(): Record; } export interface IMessagingManager { publish(topic: string, message: any): Promise; subscribe(topic: string, handler: (message: any) => void): Promise; unsubscribe(topic: string, handler: (message: any) => void): Promise; send(queue: string, message: any): Promise; receive(queue: string, handler: (message: any) => void): Promise; clear(): Promise; } export interface IStorageManager { upload(key: string, data: Buffer | string): Promise; download(key: string): Promise; delete(key: string): Promise; list(prefix?: string): Promise; exists(key: string): Promise; clear(): Promise; } export interface Adapter { name: string; initialize(config: AdapterConfig): Promise; applyOverride(type: string, name: string, implementation: any): Promise; teardown(): Promise; } export interface RoutesConfig { command?: string; outputFormat?: 'json' | 'text' | 'auto'; timeout?: number; workingDirectory?: string; environment?: Record; } export interface RouteInfo { method: string; path: string; controller?: string; handler?: string; group?: string; } export interface TestScenario { description: string; expectedStatus: number; requestData?: any; queryParams?: any; pathParams?: any; expectedResponse?: any; } export interface PerformanceMetrics { operation: string; duration: number; timestamp: number; workerId: string; strategy: string; } export interface AuthConfig { override?: AuthOverrideConfig[]; profiles?: AuthProfile[]; defaultProfile?: string; } export interface AuthOverrideConfig { name: string; middleware?: string; mockUser?: any; mockPermissions?: string[]; condition?: (context: any) => boolean; } export interface AuthProfile { name: string; type: AuthType; clientId?: string; clientSecret?: string; tokenUrl?: string; scope?: string; token?: string; apiKey?: string; headerName?: string; username?: string; password?: string; cookies?: Record; } //# sourceMappingURL=index.d.ts.map