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

@@ -3,22 +3,22 @@
* Authentication mechanisms implementation
*/
import { AUTH_METHODS } from './constants.ts';
import { AUTH_METHODS } from './constants.js';
import type {
ISmtpConnection,
ISmtpAuthOptions,
ISmtpClientOptions,
ISmtpResponse,
IOAuth2Options
} from './interfaces.ts';
} from './interfaces.js';
import {
encodeAuthPlain,
encodeAuthLogin,
generateOAuth2String,
isSuccessCode
} from './utils/helpers.ts';
import { logAuthentication, logDebug } from './utils/logging.ts';
import type { CommandHandler } from './command-handler.ts';
} from './utils/helpers.js';
import { logAuthentication, logDebug } from './utils/logging.js';
import type { CommandHandler } from './command-handler.js';
export class AuthHandler {
private options: ISmtpClientOptions;

View File

@@ -4,20 +4,20 @@
*/
import { EventEmitter } from 'node:events';
import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.ts';
import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.js';
import type {
ISmtpConnection,
ISmtpResponse,
ISmtpClientOptions,
ISmtpCapabilities
} from './interfaces.ts';
} from './interfaces.js';
import {
parseSmtpResponse,
parseEhloResponse,
formatCommand,
isSuccessCode
} from './utils/helpers.ts';
import { logCommand, logDebug } from './utils/logging.ts';
} from './utils/helpers.js';
import { logCommand, logDebug } from './utils/logging.js';
export class CommandHandler extends EventEmitter {
private options: ISmtpClientOptions;

View File

@@ -6,15 +6,15 @@
import * as net from 'node:net';
import * as tls from 'node:tls';
import { EventEmitter } from 'node:events';
import { DEFAULTS, CONNECTION_STATES } from './constants.ts';
import { DEFAULTS, CONNECTION_STATES } from './constants.js';
import type {
ISmtpClientOptions,
ISmtpConnection,
IConnectionPoolStatus,
ConnectionState
} from './interfaces.ts';
import { logConnection, logDebug } from './utils/logging.ts';
import { generateConnectionId } from './utils/helpers.ts';
} from './interfaces.js';
import { logConnection, logDebug } from './utils/logging.js';
import { generateConnectionId } from './utils/helpers.js';
export class ConnectionManager extends EventEmitter {
private options: ISmtpClientOptions;

View File

@@ -3,15 +3,15 @@
* Factory function for client creation and dependency injection
*/
import { SmtpClient } from './smtp-client.ts';
import { ConnectionManager } from './connection-manager.ts';
import { CommandHandler } from './command-handler.ts';
import { AuthHandler } from './auth-handler.ts';
import { TlsHandler } from './tls-handler.ts';
import { SmtpErrorHandler } from './error-handler.ts';
import type { ISmtpClientOptions } from './interfaces.ts';
import { validateClientOptions } from './utils/validation.ts';
import { DEFAULTS } from './constants.ts';
import { SmtpClient } from './smtp-client.js';
import { ConnectionManager } from './connection-manager.js';
import { CommandHandler } from './command-handler.js';
import { AuthHandler } from './auth-handler.js';
import { TlsHandler } from './tls-handler.js';
import { SmtpErrorHandler } from './error-handler.js';
import type { ISmtpClientOptions } from './interfaces.js';
import { validateClientOptions } from './utils/validation.js';
import { DEFAULTS } from './constants.js';
/**
* Create a complete SMTP client with all components

View File

@@ -3,9 +3,9 @@
* Error classification and recovery strategies
*/
import { SmtpErrorType } from './constants.ts';
import type { ISmtpResponse, ISmtpErrorContext, ISmtpClientOptions } from './interfaces.ts';
import { logDebug } from './utils/logging.ts';
import { SmtpErrorType } from './constants.js';
import type { ISmtpResponse, ISmtpErrorContext, ISmtpClientOptions } from './interfaces.js';
import { logDebug } from './utils/logging.js';
export class SmtpErrorHandler {
private options: ISmtpClientOptions;

View File

@@ -4,21 +4,21 @@
*/
// Main client class and factory
export * from './smtp-client.ts';
export * from './create-client.ts';
export * from './smtp-client.js';
export * from './create-client.js';
// Core handlers
export * from './connection-manager.ts';
export * from './command-handler.ts';
export * from './auth-handler.ts';
export * from './tls-handler.ts';
export * from './error-handler.ts';
export * from './connection-manager.js';
export * from './command-handler.js';
export * from './auth-handler.js';
export * from './tls-handler.js';
export * from './error-handler.js';
// Interfaces and types
export * from './interfaces.ts';
export * from './constants.ts';
export * from './interfaces.js';
export * from './constants.js';
// Utilities
export * from './utils/validation.ts';
export * from './utils/logging.ts';
export * from './utils/helpers.ts';
export * from './utils/validation.js';
export * from './utils/logging.js';
export * from './utils/helpers.js';

View File

@@ -5,7 +5,7 @@
import type * as tls from 'node:tls';
import type * as net from 'node:net';
import type { Email } from '../../core/classes.email.ts';
import type { Email } from '../../core/classes.email.js';
/**
* SMTP client connection options

View File

@@ -4,22 +4,22 @@
*/
import { EventEmitter } from 'node:events';
import type { Email } from '../../core/classes.email.ts';
import type { Email } from '../../core/classes.email.js';
import type {
ISmtpClientOptions,
ISmtpSendResult,
ISmtpConnection,
IConnectionPoolStatus,
ConnectionState
} from './interfaces.ts';
import { CONNECTION_STATES, SmtpErrorType } from './constants.ts';
import type { ConnectionManager } from './connection-manager.ts';
import type { CommandHandler } from './command-handler.ts';
import type { AuthHandler } from './auth-handler.ts';
import type { TlsHandler } from './tls-handler.ts';
import type { SmtpErrorHandler } from './error-handler.ts';
import { validateSender, validateRecipients } from './utils/validation.ts';
import { logEmailSend, logPerformance, logDebug } from './utils/logging.ts';
} from './interfaces.js';
import { CONNECTION_STATES, SmtpErrorType } from './constants.js';
import type { ConnectionManager } from './connection-manager.js';
import type { CommandHandler } from './command-handler.js';
import type { AuthHandler } from './auth-handler.js';
import type { TlsHandler } from './tls-handler.js';
import type { SmtpErrorHandler } from './error-handler.js';
import { validateSender, validateRecipients } from './utils/validation.js';
import { logEmailSend, logPerformance, logDebug } from './utils/logging.js';
interface ISmtpClientDependencies {
options: ISmtpClientOptions;

View File

@@ -5,16 +5,16 @@
import * as tls from 'node:tls';
import * as net from 'node:net';
import { DEFAULTS } from './constants.ts';
import { DEFAULTS } from './constants.js';
import type {
ISmtpConnection,
ISmtpClientOptions,
ConnectionState
} from './interfaces.ts';
import { CONNECTION_STATES } from './constants.ts';
import { logTLS, logDebug } from './utils/logging.ts';
import { isSuccessCode } from './utils/helpers.ts';
import type { CommandHandler } from './command-handler.ts';
} from './interfaces.js';
import { CONNECTION_STATES } from './constants.js';
import { logTLS, logDebug } from './utils/logging.js';
import { isSuccessCode } from './utils/helpers.js';
import type { CommandHandler } from './command-handler.js';
export class TlsHandler {
private options: ISmtpClientOptions;

View File

@@ -3,8 +3,8 @@
* Protocol helper functions and utilities
*/
import { SMTP_CODES, REGEX_PATTERNS, LINE_ENDINGS } from '../constants.ts';
import type { ISmtpResponse, ISmtpCapabilities } from '../interfaces.ts';
import { SMTP_CODES, REGEX_PATTERNS, LINE_ENDINGS } from '../constants.js';
import type { ISmtpResponse, ISmtpCapabilities } from '../interfaces.js';
/**
* Parse SMTP server response

View File

@@ -3,8 +3,8 @@
* Client-side logging utilities for SMTP operations
*/
import { logger } from '../../../../logger.ts';
import type { ISmtpResponse, ISmtpClientOptions } from '../interfaces.ts';
import { logger } from '../../../../logger.js';
import type { ISmtpResponse, ISmtpClientOptions } from '../interfaces.js';
export interface ISmtpClientLogData {
component: string;

View File

@@ -3,8 +3,8 @@
* Input validation functions for SMTP client operations
*/
import { REGEX_PATTERNS } from '../constants.ts';
import type { ISmtpClientOptions, ISmtpAuthOptions } from '../interfaces.ts';
import { REGEX_PATTERNS } from '../constants.js';
import type { ISmtpClientOptions, ISmtpAuthOptions } from '../interfaces.js';
/**
* Validate email address format