feat(rust): scaffold Rust workspace and fix TypeScript build errors

- Add @git.zone/tsrust with linux_amd64/linux_arm64 cross-compilation
- Scaffold Rust workspace with 5 crates: mailer-core, mailer-smtp, mailer-security, mailer-napi, mailer-bin
- Fix all TypeScript compilation errors for upgraded dependencies (smartfile v13, mailauth v4.13, smartproxy v23)
- Replace smartfile.fs/memory with @push.rocks/smartfs throughout codebase
- Fix .ts import extensions to .js for NodeNext module resolution
- Update DKIMSignOptions usage to match mailauth v4.13 API
- Add MTA error classes with permissive signatures for legacy SMTP client
- Replace removed DcRouter/StorageManager/deliverability imports with local interfaces
This commit is contained in:
2026-02-10 15:31:31 +00:00
parent bcde137332
commit 237dba3bab
86 changed files with 6518 additions and 2869 deletions

View File

@@ -1,9 +1,9 @@
import * as plugins from '../../plugins.ts';
import * as paths from '../../paths.ts';
import { logger } from '../../logger.ts';
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.ts';
import * as plugins from '../../plugins.js';
import * as paths from '../../paths.js';
import { logger } from '../../logger.js';
import { SecurityLogger, SecurityLogLevel, SecurityEventType } from '../../security/index.js';
import { LRUCache } from 'lru-cache';
import type { Email } from './classes.email.ts';
import type { Email } from './classes.email.js';
/**
* Bounce types for categorizing the reasons for bounces
@@ -650,10 +650,9 @@ export class BounceManager {
await this.storageManager.set('/email/bounces/suppression-list.json', suppressionData);
} else {
// Fall back to filesystem
plugins.smartfile.memory.toFsSync(
suppressionData,
await plugins.smartfs.file(
plugins.path.join(paths.dataDir, 'emails', 'suppression_list.json')
);
).write(suppressionData);
}
} catch (error) {
logger.log('error', `Failed to save suppression list: ${error.message}`);
@@ -744,9 +743,9 @@ export class BounceManager {
// Ensure directory exists
const bounceDir = plugins.path.join(paths.dataDir, 'emails', 'bounces');
plugins.smartfile.fs.ensureDirSync(bounceDir);
plugins.smartfile.memory.toFsSync(bounceData, bouncePath);
await plugins.smartfs.directory(bounceDir).recursive().create();
await plugins.smartfs.file(bouncePath).write(bounceData);
}
} catch (error) {
logger.log('error', `Failed to save bounce record: ${error.message}`);

View File

@@ -1,5 +1,5 @@
import * as plugins from '../../plugins.ts';
import { EmailValidator } from './classes.emailvalidator.ts';
import * as plugins from '../../plugins.js';
import { EmailValidator } from './classes.emailvalidator.js';
export interface IAttachment {
filename: string;
@@ -614,10 +614,11 @@ export class Email {
// Add attachments
for (const attachment of this.attachments) {
const smartAttachment = await plugins.smartfile.SmartFile.fromBuffer(
attachment.filename,
attachment.content
);
const smartAttachment = new plugins.smartfile.SmartFile({
path: attachment.filename,
contentBuffer: attachment.content,
base: process.cwd(),
});
// Set content type if available
if (attachment.contentType) {

View File

@@ -1,5 +1,5 @@
import * as plugins from '../../plugins.ts';
import { logger } from '../../logger.ts';
import * as plugins from '../../plugins.js';
import { logger } from '../../logger.js';
import { LRUCache } from 'lru-cache';
export interface IEmailValidationResult {

View File

@@ -1,7 +1,7 @@
import * as plugins from '../../plugins.ts';
import * as paths from '../../paths.ts';
import { logger } from '../../logger.ts';
import { Email, type IEmailOptions, type IAttachment } from './classes.email.ts';
import * as plugins from '../../plugins.js';
import * as paths from '../../paths.js';
import { logger } from '../../logger.js';
import { Email, type IEmailOptions, type IAttachment } from './classes.email.js';
/**
* Email template type definition

View File

@@ -1,5 +1,5 @@
// Core email components
export * from './classes.email.ts';
export * from './classes.emailvalidator.ts';
export * from './classes.templatemanager.ts';
export * from './classes.bouncemanager.ts';
export * from './classes.email.js';
export * from './classes.emailvalidator.js';
export * from './classes.templatemanager.js';
export * from './classes.bouncemanager.js';