fix(mail/delivery): Centralize runtime/plugin imports and switch modules to use plugins exports; unify EventEmitter usage; update Deno dependencies and small path/server refactors

This commit is contained in:
2025-10-24 10:00:25 +00:00
parent d4778d15fc
commit 27b6bb779e
17 changed files with 87 additions and 62 deletions

View File

@@ -3,7 +3,7 @@
* SMTP command sending and response parsing
*/
import { EventEmitter } from 'node:events';
import * as plugins from '../../../plugins.ts';
import { SMTP_COMMANDS, SMTP_CODES, LINE_ENDINGS } from './constants.ts';
import type {
ISmtpConnection,
@@ -19,7 +19,7 @@ import {
} from './utils/helpers.ts';
import { logCommand, logDebug } from './utils/logging.ts';
export class CommandHandler extends EventEmitter {
export class CommandHandler extends plugins.EventEmitter {
private options: ISmtpClientOptions;
private responseBuffer: string = '';
private pendingCommand: { resolve: Function; reject: Function; command: string } | null = null;

View File

@@ -3,20 +3,18 @@
* Connection pooling and lifecycle management
*/
import * as net from 'node:net';
import * as tls from 'node:tls';
import { EventEmitter } from 'node:events';
import * as plugins from '../../../plugins.ts';
import { DEFAULTS, CONNECTION_STATES } from './constants.ts';
import type {
ISmtpClientOptions,
ISmtpConnection,
import type {
ISmtpClientOptions,
ISmtpConnection,
IConnectionPoolStatus,
ConnectionState
ConnectionState
} from './interfaces.ts';
import { logConnection, logDebug } from './utils/logging.ts';
import { generateConnectionId } from './utils/helpers.ts';
export class ConnectionManager extends EventEmitter {
export class ConnectionManager extends plugins.EventEmitter {
private options: ISmtpClientOptions;
private connections: Map<string, ISmtpConnection> = new Map();
private pendingConnections: Set<string> = new Set();

View File

@@ -3,7 +3,7 @@
* Main client class with delegation to handlers
*/
import { EventEmitter } from 'node:events';
import * as plugins from '../../../plugins.ts';
import type { Email } from '../../core/classes.email.ts';
import type {
ISmtpClientOptions,
@@ -30,7 +30,7 @@ interface ISmtpClientDependencies {
errorHandler: SmtpErrorHandler;
}
export class SmtpClient extends EventEmitter {
export class SmtpClient extends plugins.EventEmitter {
private options: ISmtpClientOptions;
private connectionManager: ConnectionManager;
private commandHandler: CommandHandler;