import { HttpContextToken, HttpInterceptorFn, HttpContext, HttpRequest, HttpClient } from '@angular/common/http'; import * as i0 from '@angular/core'; import { InjectionToken } from '@angular/core'; import { Observable } from 'rxjs'; import { RepositoryConfig, PaginationParams, PagedResult, HttpPort, HttpOptions, CoreConfig } from '@acontplus/core'; import { BaseRepository, SearchableRepository } from '@acontplus/ng-config'; /** * Skip all toast notifications for a specific request. * Usage: new HttpContext().set(SKIP_NOTIFICATION, true) */ declare const SKIP_NOTIFICATION: HttpContextToken; /** * Force-show or force-hide notifications, overriding URL/method exclusion logic. * Usage: new HttpContext().set(SHOW_NOTIFICATIONS, true) */ declare const SHOW_NOTIFICATIONS: HttpContextToken; declare const apiInterceptor: HttpInterceptorFn; declare function customUrl(): HttpContext; declare function skipContextHeaders(): HttpContext; declare function withCustomHeaders(headers: Record): HttpContext; interface HttpContextConfig { enableCorrelationTracking?: boolean; enableRequestLogging?: boolean; enableErrorLogging?: boolean; customHeaders?: Record string)>; clientVersion?: string; tenantIdHeader?: string; correlationIdHeader?: string; requestIdHeader?: string; timestampHeader?: string; /** URL substrings or regex patterns to exclude from header injection. */ excludeUrls?: string[]; /** URL substrings that should NOT receive an Authorization header. */ skipAuthUrls?: string[]; includeAuthToken?: boolean; baseUrlInjection?: boolean; /** Called when a 401 is received and a refresh token is available. */ refreshTokenCallback?: () => Observable<{ token: string; refreshToken?: string; }>; /** Called after a failed token refresh — should clear auth state. */ logoutCallback?: () => void; } declare const HTTP_CONTEXT_CONFIG: InjectionToken; declare const httpContextInterceptor: HttpInterceptorFn; interface HttpRequestLog { method: string; url: string; originalUrl: string; requestId: string; correlationId: string; tenantId: string; timestamp: string; headers: string[]; isCustomUrl: boolean; } interface HttpErrorLog extends HttpRequestLog { status: number; statusText: string; message: string; errorDetails: unknown; environment: string; } declare function createHttpContextConfig(overrides?: Partial): HttpContextConfig; /** * Register the interceptor configuration in your app providers. * * @example * // app.config.ts * provideHttpClient( * withInterceptors([ * httpContextInterceptor, // 1st — adds headers, handles 401 refresh * apiInterceptor, // 2nd — normalises response, shows toasts * ]) * ), * ...provideHttpContext({ clientVersion: '2.0.0' }), */ declare function provideHttpContext(config?: Partial): { provide: InjectionToken; useValue: HttpContextConfig; }[]; declare const SHOW_SPINNER: HttpContextToken; declare function withoutSpinner(): HttpContext; declare class ActiveRequestsTracker { private readonly requests; get count(): number; /** Retorna true si se pasa de 0 → 1 (primera request activa). */ add(request: HttpRequest): boolean; /** Retorna true si se pasa de 1 → 0 (última request completada). */ remove(request: HttpRequest): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const spinnerInterceptor: HttpInterceptorFn; declare abstract class BaseHttpRepository { protected http: HttpClient; protected abstract config: RepositoryConfig; protected buildUrl(path?: string): string; protected get(path?: string, params?: Record): Observable; protected post(path: string | undefined, body: unknown): Observable; protected put(path: string | undefined, body: unknown): Observable; protected patch(path?: string, body?: unknown): Observable; protected delete(path?: string): Observable; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const REPOSITORY_CONFIG: InjectionToken; declare class GenericRepository extends BaseHttpRepository implements BaseRepository { protected config: RepositoryConfig; constructor(); getById(id: TId): Observable; getAll(pagination?: PaginationParams): Observable>; create(entity: Partial): Observable; update(id: TId, entity: Partial): Observable; remove(id: TId): Observable; protected buildParams(pagination?: PaginationParams, filters?: Record): any; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } declare class SearchableGenericRepository extends GenericRepository implements SearchableRepository { search(query: string, pagination: PaginationParams): Observable>; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵprov: i0.ɵɵInjectableDeclaration>; } declare class RepositoryFactory { private http; create(config: RepositoryConfig): BaseRepository; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class AngularHttpAdapter implements HttpPort { private readonly http; private readonly baseURL?; constructor(http: HttpClient, baseURL?: string | undefined); private buildOptions; private request; /** GET */ get(url: string, options?: HttpOptions): Promise; /** POST */ post(url: string, data?: unknown, options?: HttpOptions): Promise; /** PUT */ put(url: string, data?: unknown, options?: HttpOptions): Promise; /** DELETE */ delete(url: string, options?: HttpOptions): Promise; } declare class CoreConfigService { private config; private environment; constructor(); /** * Initialize configuration with defaults and environment overrides */ private initializeConfig; /** * Get the current configuration */ getConfig(): Required; /** * Update configuration at runtime */ updateConfig(updates: Partial): void; /** * Get a specific configuration value */ get(key: K): CoreConfig[K]; /** * Check if a feature is enabled */ isFeatureEnabled(feature: keyof CoreConfig): boolean; /** * Get API URL for a specific entity */ getApiUrl(entityName?: string): string; /** * Check if a URL should be excluded from processing */ shouldExcludeUrl(url: string): boolean; /** * Check if a method should be excluded from processing */ shouldExcludeMethod(method: string): boolean; /** * Get custom headers with dynamic values resolved */ getCustomHeaders(): Record; /** * Reset configuration to defaults */ resetConfig(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare function provideCoreConfig(config?: Partial): { provide: i0.InjectionToken; useValue: Partial; }[]; declare function createCoreConfig(overrides?: Partial): CoreConfig; declare class CorrelationInfo { private correlationId; private readonly CORRELATION_KEY; readonly currentCorrelationId: i0.Signal; getOrCreateCorrelationId(): string; setCorrelationId(correlationId: string): void; resetCorrelationId(): void; getId(): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class LoggingService { private environment; log(level: 'info' | 'warn' | 'error', message: string, context?: unknown): void; info(message: string, context?: unknown): void; warn(message: string, context?: unknown): void; error(message: string, context?: unknown): void; logHttpRequest(log: HttpRequestLog): void; logHttpError(error: HttpErrorLog): void; logNetworkError(correlationId: string): void; logRateLimitError(correlationId: string, url: string): void; private logToExternalService; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } interface UseCase { execute(request: TRequest): Observable; } declare abstract class BaseUseCase implements UseCase { abstract execute(request: TRequest): Observable; } declare abstract class Command extends BaseUseCase { protected validate(_request: TRequest): string[]; execute(request: TRequest): Observable; protected abstract executeInternal(request: TRequest): Observable; } declare abstract class Query extends BaseUseCase { execute(request: TRequest): Observable; protected abstract executeInternal(request: TRequest): Observable; } export { ActiveRequestsTracker, AngularHttpAdapter, BaseHttpRepository, BaseUseCase, Command, CoreConfigService, CorrelationInfo, GenericRepository, HTTP_CONTEXT_CONFIG, LoggingService, Query, REPOSITORY_CONFIG, RepositoryFactory, SHOW_NOTIFICATIONS, SHOW_SPINNER, SKIP_NOTIFICATION, SearchableGenericRepository, apiInterceptor, createCoreConfig, createHttpContextConfig, customUrl, httpContextInterceptor, provideCoreConfig, provideHttpContext, skipContextHeaders, spinnerInterceptor, withCustomHeaders, withoutSpinner }; export type { HttpContextConfig, HttpErrorLog, HttpRequestLog, UseCase };