03b569d708
- Remove all sector-specific extensions (construction, ecommerce, export, hotel, restaurant, tech) — only general-purpose extensions remain - Move NE-bilaga and SRU export from extensions to core reports (lib/reports/) - Move moms-box-mapping from extensions/export/shared to lib/vat/ - Replace per-extension API routes with catch-all dispatcher (app/api/extensions/ext/[...path]/route.ts) - Add manifest.json for each extension with metadata, env vars, and deps - Add api-routes.ts pattern for extension-defined API endpoints - Add code generation scripts (generate-extension-registry, create-extension) - Add extensions.config.json for opt-in extension loading - Add extensions.schema.json for config validation - Add email service interface with noop default (lib/email/service.ts) - Add CI workflow (core-build.yml) to verify core builds with zero extensions - Add migration 045: expand account_type CHECK for untaxed_reserves - Update CLAUDE.md with comprehensive extension system documentation - Update all report engines and bookkeeping services for new imports - Clean up extensions.schema.json to only list existing extensions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
/**
|
|
* Email Service Interface
|
|
*
|
|
* Core defines the contract. The email extension registers a real
|
|
* implementation (Resend). Without the extension, a no-op service
|
|
* is used — email-dependent features degrade gracefully.
|
|
*/
|
|
|
|
export interface SendEmailOptions {
|
|
to: string | string[]
|
|
subject: string
|
|
html: string
|
|
text?: string
|
|
replyTo?: string
|
|
fromName?: string
|
|
attachments?: Array<{
|
|
filename: string
|
|
content: Buffer | string
|
|
contentType?: string
|
|
}>
|
|
}
|
|
|
|
export interface SendEmailResult {
|
|
success: boolean
|
|
messageId?: string
|
|
error?: string
|
|
}
|
|
|
|
export interface EmailService {
|
|
sendEmail(options: SendEmailOptions): Promise<SendEmailResult>
|
|
isConfigured(): boolean
|
|
}
|
|
|
|
class NoopEmailService implements EmailService {
|
|
async sendEmail(): Promise<SendEmailResult> {
|
|
return { success: false, error: 'Email service not configured' }
|
|
}
|
|
isConfigured(): boolean {
|
|
return false
|
|
}
|
|
}
|
|
|
|
let emailService: EmailService = new NoopEmailService()
|
|
|
|
export function getEmailService(): EmailService {
|
|
return emailService
|
|
}
|
|
|
|
export function registerEmailService(svc: EmailService): void {
|
|
emailService = svc
|
|
}
|