feat(storage): add comprehensive tests for StorageManager with memory, filesystem, and custom function backends
feat(email): implement EmailSendJob class for robust email delivery with retry logic and MX record resolution feat(mail): restructure mail module exports for simplified access to core and delivery functionalities
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import * as plugins from '../../plugins.ts';
|
||||
import { EventEmitter } from 'node:events';
|
||||
import type { IEmailRoute, IEmailMatch, IEmailAction, IEmailContext } from './interfaces.ts';
|
||||
import type { Email } from '../core/classes.email.ts';
|
||||
|
||||
/**
|
||||
* Email router that evaluates routes and determines actions
|
||||
*/
|
||||
export class EmailRouter extends plugins.EventEmitter {
|
||||
export class EmailRouter extends EventEmitter {
|
||||
private routes: IEmailRoute[];
|
||||
private patternCache: Map<string, boolean> = new Map();
|
||||
private storageManager?: any; // StorageManager instance
|
||||
@@ -407,7 +408,7 @@ export class EmailRouter extends plugins.EventEmitter {
|
||||
}
|
||||
|
||||
const routesData = JSON.stringify(this.routes, null, 2);
|
||||
await this.storageManager.set('/email/routes/config.tson', routesData);
|
||||
await this.storageManager.set('/email/routes/config.json', routesData);
|
||||
|
||||
this.emit('routesPersisted', this.routes.length);
|
||||
} catch (error) {
|
||||
@@ -430,7 +431,7 @@ export class EmailRouter extends plugins.EventEmitter {
|
||||
}
|
||||
|
||||
try {
|
||||
const routesData = await this.storageManager.get('/email/routes/config.tson');
|
||||
const routesData = await this.storageManager.get('/email/routes/config.json');
|
||||
|
||||
if (!routesData) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user