Files
Kordant/packages/db/src/index.ts
Michael Freno 2521c4e998 Add Protection Report Generator with HTML/PDF output and scheduled delivery (FRE-4575)
- Report service: data collection from all three engines, HTML rendering (Handlebars), PDF generation (pdfkit)
- REST API: /reports endpoints for generate, history, view, PDF download, scheduling
- BullMQ workers: queued report generation with retry, monthly/annual scheduler triggers
- DB: SecurityReport model with Prisma schema and type exports
- Email: report_ready template in shared-notifications
- All dependencies wired through existing packages

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-09 22:54:46 -04:00

75 lines
1.8 KiB
TypeScript

// ============================================
// Consolidated @shieldai/db package
// ============================================
// Merges functionality from:
// - @shieldai/db (Prisma v6.2.0, FieldEncryptionService)
// - @shieldsai/shared-db (singleton pattern, type exports)
// ============================================
import { PrismaClient } from '@prisma/client';
import { FieldEncryptionService } from './services/field-encryption.service';
// ============================================
// Singleton Pattern (from shared-db)
// ============================================
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma =
globalForPrisma.prisma ??
new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
});
if (process.env.NODE_ENV === 'development') {
globalForPrisma.prisma = prisma;
}
export default prisma;
// ============================================
// Services (from @shieldai/db)
// ============================================
export { FieldEncryptionService };
// ============================================
// Type Exports (from shared-db)
// ============================================
export type {
User,
Account,
Session,
FamilyGroup,
FamilyGroupMember,
Subscription,
WatchlistItem,
Exposure,
Alert,
VoiceEnrollment,
VoiceAnalysis,
SpamFeedback,
SpamRule,
AuditLog,
KPISnapshot,
SecurityReport,
UserRole,
FamilyMemberRole,
SubscriptionTier,
SubscriptionStatus,
WatchlistType,
ExposureSource,
ExposureSeverity,
AlertType,
AlertSeverity,
AlertChannel,
FeedbackType,
RuleType,
RuleAction,
ReportType,
ReportStatus,
} from '@prisma/client';
export * as PrismaModels from '@prisma/client';
export type { PrismaClient };