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:
@@ -647,12 +647,12 @@ export class BounceManager {
|
||||
|
||||
if (this.storageManager) {
|
||||
// Use storage manager
|
||||
await this.storageManager.set('/email/bounces/suppression-list.tson', suppressionData);
|
||||
await this.storageManager.set('/email/bounces/suppression-list.json', suppressionData);
|
||||
} else {
|
||||
// Fall back to filesystem
|
||||
plugins.smartfile.memory.toFsSync(
|
||||
suppressionData,
|
||||
plugins.path.join(paths.dataDir, 'emails', 'suppression_list.tson')
|
||||
plugins.path.join(paths.dataDir, 'emails', 'suppression_list.json')
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -670,13 +670,13 @@ export class BounceManager {
|
||||
|
||||
if (this.storageManager) {
|
||||
// Try to load from storage manager first
|
||||
const suppressionData = await this.storageManager.get('/email/bounces/suppression-list.tson');
|
||||
const suppressionData = await this.storageManager.get('/email/bounces/suppression-list.json');
|
||||
|
||||
if (suppressionData) {
|
||||
entries = JSON.parse(suppressionData);
|
||||
} else {
|
||||
// Check if data exists in filesystem and migrate
|
||||
const suppressionPath = plugins.path.join(paths.dataDir, 'emails', 'suppression_list.tson');
|
||||
const suppressionPath = plugins.path.join(paths.dataDir, 'emails', 'suppression_list.json');
|
||||
|
||||
if (plugins.fs.existsSync(suppressionPath)) {
|
||||
const data = plugins.fs.readFileSync(suppressionPath, 'utf8');
|
||||
@@ -688,7 +688,7 @@ export class BounceManager {
|
||||
}
|
||||
} else {
|
||||
// No storage manager, use filesystem directly
|
||||
const suppressionPath = plugins.path.join(paths.dataDir, 'emails', 'suppression_list.tson');
|
||||
const suppressionPath = plugins.path.join(paths.dataDir, 'emails', 'suppression_list.json');
|
||||
|
||||
if (plugins.fs.existsSync(suppressionPath)) {
|
||||
const data = plugins.fs.readFileSync(suppressionPath, 'utf8');
|
||||
@@ -732,14 +732,14 @@ export class BounceManager {
|
||||
|
||||
if (this.storageManager) {
|
||||
// Use storage manager
|
||||
await this.storageManager.set(`/email/bounces/records/${bounce.id}.tson`, bounceData);
|
||||
await this.storageManager.set(`/email/bounces/records/${bounce.id}.json`, bounceData);
|
||||
} else {
|
||||
// Fall back to filesystem
|
||||
const bouncePath = plugins.path.join(
|
||||
paths.dataDir,
|
||||
'emails',
|
||||
'bounces',
|
||||
`${bounce.id}.tson`
|
||||
`${bounce.id}.json`
|
||||
);
|
||||
|
||||
// Ensure directory exists
|
||||
|
||||
@@ -291,7 +291,7 @@ export class TemplateManager {
|
||||
|
||||
// Get all JSON files
|
||||
const files = plugins.fs.readdirSync(directory)
|
||||
.filter(file => file.endsWith('.tson'));
|
||||
.filter(file => file.endsWith('.json'));
|
||||
|
||||
for (const file of files) {
|
||||
try {
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/**
|
||||
* Mail core module
|
||||
* Email classes, validation, templates, and bounce management
|
||||
*/
|
||||
|
||||
// Core email components
|
||||
export * from './classes.email.ts';
|
||||
export * from './classes.emailvalidator.ts';
|
||||
|
||||
Reference in New Issue
Block a user