fix: apply consistent-type-imports across API codebase (728 lint errors)

- Convert `import type { X }` to `import { type X }` (inline-type-imports style)
- Suppress consistent-type-imports for `typeof import()` in instrument.ts
- Includes uncommitted agent work: metrics module, redis caching, audit logs,
  saved searches, circuit breaker, rate limiting, and admin enhancements

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-10 23:22:21 +07:00
parent 8cdfe17205
commit 6ebacbc9bf
85 changed files with 3844 additions and 82 deletions

View File

@@ -1,6 +1,5 @@
import { Module } from '@nestjs/common';
import {
PrometheusModule,
makeCounterProvider,
makeHistogramProvider,
makeGaugeProvider,
@@ -16,16 +15,18 @@ import {
DB_QUERY_DURATION,
DB_POOL_ACTIVE_CONNECTIONS,
SEARCH_QUERY_DURATION,
WEB_VITALS_LCP,
WEB_VITALS_FCP,
WEB_VITALS_CLS,
WEB_VITALS_TTFB,
WEB_VITALS_INP,
WEB_VITALS_TOTAL,
} from './metrics.constants';
import { WebVitalsController } from './presentation/controllers/web-vitals.controller';
import { HttpMetricsInterceptor } from './presentation/interceptors/http-metrics.interceptor';
@Module({
imports: [
PrometheusModule.register({
path: '/metrics',
defaultMetrics: { enabled: true },
}),
],
imports: [],
providers: [
// ── HTTP Metrics ──
makeHistogramProvider({
@@ -85,7 +86,45 @@ import { HttpMetricsInterceptor } from './presentation/interceptors/http-metrics
// ── Services & Interceptors ──
MetricsService,
HttpMetricsInterceptor,
// ── Web Vitals / RUM Metrics ──
makeHistogramProvider({
name: WEB_VITALS_LCP,
help: 'Largest Contentful Paint in seconds',
labelNames: ['rating', 'page'],
buckets: [0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 8, 10],
}),
makeHistogramProvider({
name: WEB_VITALS_FCP,
help: 'First Contentful Paint in seconds',
labelNames: ['rating', 'page'],
buckets: [0.1, 0.5, 1, 1.5, 1.8, 2.5, 3, 4, 5, 8],
}),
makeHistogramProvider({
name: WEB_VITALS_CLS,
help: 'Cumulative Layout Shift score (unitless)',
labelNames: ['rating', 'page'],
buckets: [0.01, 0.025, 0.05, 0.1, 0.15, 0.2, 0.25, 0.5, 1],
}),
makeHistogramProvider({
name: WEB_VITALS_TTFB,
help: 'Time to First Byte in seconds',
labelNames: ['rating', 'page'],
buckets: [0.1, 0.2, 0.4, 0.6, 0.8, 1, 1.5, 2, 3, 5],
}),
makeHistogramProvider({
name: WEB_VITALS_INP,
help: 'Interaction to Next Paint in seconds',
labelNames: ['rating', 'page'],
buckets: [0.05, 0.1, 0.15, 0.2, 0.3, 0.5, 0.8, 1],
}),
makeCounterProvider({
name: WEB_VITALS_TOTAL,
help: 'Total web vital events received',
labelNames: ['name', 'rating'],
}),
],
exports: [PrometheusModule, MetricsService, HttpMetricsInterceptor],
controllers: [WebVitalsController],
exports: [MetricsService, HttpMetricsInterceptor],
})
export class MetricsModule {}