@serve.zone/dcrouter 2.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +1 -0
- package/.gitea/workflows/docker_nottags.yaml +71 -0
- package/.gitea/workflows/docker_tags.yaml +106 -0
- package/.vscode/launch.json +11 -0
- package/.vscode/settings.json +26 -0
- package/Dockerfile +46 -0
- package/changelog.md +247 -0
- package/cli.child.js +4 -0
- package/cli.child.ts +4 -0
- package/cli.js +4 -0
- package/cli.ts.js +5 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/classes.dcrouter.d.ts +238 -0
- package/dist_ts/classes.dcrouter.js +1008 -0
- package/dist_ts/config/index.d.ts +1 -0
- package/dist_ts/config/index.js +3 -0
- package/dist_ts/config/validator.d.ts +104 -0
- package/dist_ts/config/validator.js +152 -0
- package/dist_ts/deliverability/classes.ipwarmupmanager.d.ts +253 -0
- package/dist_ts/deliverability/classes.ipwarmupmanager.js +639 -0
- package/dist_ts/deliverability/classes.senderreputationmonitor.d.ts +300 -0
- package/dist_ts/deliverability/classes.senderreputationmonitor.js +961 -0
- package/dist_ts/deliverability/index.d.ts +2 -0
- package/dist_ts/deliverability/index.js +3 -0
- package/dist_ts/errors/base.errors.d.ts +224 -0
- package/dist_ts/errors/base.errors.js +310 -0
- package/dist_ts/errors/email.errors.d.ts +175 -0
- package/dist_ts/errors/email.errors.js +265 -0
- package/dist_ts/errors/error-handler.d.ts +98 -0
- package/dist_ts/errors/error-handler.js +282 -0
- package/dist_ts/errors/error.codes.d.ts +115 -0
- package/dist_ts/errors/error.codes.js +136 -0
- package/dist_ts/errors/index.d.ts +56 -0
- package/dist_ts/errors/index.js +138 -0
- package/dist_ts/errors/mta.errors.d.ts +259 -0
- package/dist_ts/errors/mta.errors.js +472 -0
- package/dist_ts/errors/reputation.errors.d.ts +183 -0
- package/dist_ts/errors/reputation.errors.js +292 -0
- package/dist_ts/index.d.ts +4 -0
- package/dist_ts/index.js +6 -0
- package/dist_ts/logger.d.ts +17 -0
- package/dist_ts/logger.js +77 -0
- package/dist_ts/mail/core/classes.bouncemanager.d.ts +200 -0
- package/dist_ts/mail/core/classes.bouncemanager.js +778 -0
- package/dist_ts/mail/core/classes.email.d.ts +291 -0
- package/dist_ts/mail/core/classes.email.js +780 -0
- package/dist_ts/mail/core/classes.emailvalidator.d.ts +61 -0
- package/dist_ts/mail/core/classes.emailvalidator.js +182 -0
- package/dist_ts/mail/core/classes.templatemanager.d.ts +95 -0
- package/dist_ts/mail/core/classes.templatemanager.js +239 -0
- package/dist_ts/mail/core/index.d.ts +4 -0
- package/dist_ts/mail/core/index.js +6 -0
- package/dist_ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
- package/dist_ts/mail/delivery/classes.delivery.queue.js +485 -0
- package/dist_ts/mail/delivery/classes.delivery.system.d.ts +186 -0
- package/dist_ts/mail/delivery/classes.delivery.system.js +846 -0
- package/dist_ts/mail/delivery/classes.emailsendjob.d.ts +84 -0
- package/dist_ts/mail/delivery/classes.emailsendjob.js +362 -0
- package/dist_ts/mail/delivery/classes.emailsignjob.d.ts +18 -0
- package/dist_ts/mail/delivery/classes.emailsignjob.js +44 -0
- package/dist_ts/mail/delivery/classes.mta.config.d.ts +22 -0
- package/dist_ts/mail/delivery/classes.mta.config.js +51 -0
- package/dist_ts/mail/delivery/classes.ratelimiter.d.ts +98 -0
- package/dist_ts/mail/delivery/classes.ratelimiter.js +205 -0
- package/dist_ts/mail/delivery/classes.smtp.client.legacy.d.ts +275 -0
- package/dist_ts/mail/delivery/classes.smtp.client.legacy.js +973 -0
- package/dist_ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
- package/dist_ts/mail/delivery/classes.unified.rate.limiter.js +817 -0
- package/dist_ts/mail/delivery/index.d.ts +12 -0
- package/dist_ts/mail/delivery/index.js +18 -0
- package/dist_ts/mail/delivery/interfaces.d.ts +243 -0
- package/dist_ts/mail/delivery/interfaces.js +17 -0
- package/dist_ts/mail/delivery/smtpclient/auth-handler.d.ts +43 -0
- package/dist_ts/mail/delivery/smtpclient/auth-handler.js +188 -0
- package/dist_ts/mail/delivery/smtpclient/command-handler.d.ts +67 -0
- package/dist_ts/mail/delivery/smtpclient/command-handler.js +276 -0
- package/dist_ts/mail/delivery/smtpclient/connection-manager.d.ts +48 -0
- package/dist_ts/mail/delivery/smtpclient/connection-manager.js +238 -0
- package/dist_ts/mail/delivery/smtpclient/constants.d.ts +129 -0
- package/dist_ts/mail/delivery/smtpclient/constants.js +135 -0
- package/dist_ts/mail/delivery/smtpclient/create-client.d.ts +22 -0
- package/dist_ts/mail/delivery/smtpclient/create-client.js +86 -0
- package/dist_ts/mail/delivery/smtpclient/error-handler.d.ts +28 -0
- package/dist_ts/mail/delivery/smtpclient/error-handler.js +110 -0
- package/dist_ts/mail/delivery/smtpclient/index.d.ts +16 -0
- package/dist_ts/mail/delivery/smtpclient/index.js +21 -0
- package/dist_ts/mail/delivery/smtpclient/interfaces.d.ts +183 -0
- package/dist_ts/mail/delivery/smtpclient/interfaces.js +19 -0
- package/dist_ts/mail/delivery/smtpclient/smtp-client.d.ts +58 -0
- package/dist_ts/mail/delivery/smtpclient/smtp-client.js +279 -0
- package/dist_ts/mail/delivery/smtpclient/tls-handler.d.ts +33 -0
- package/dist_ts/mail/delivery/smtpclient/tls-handler.js +202 -0
- package/dist_ts/mail/delivery/smtpclient/utils/helpers.d.ts +77 -0
- package/dist_ts/mail/delivery/smtpclient/utils/helpers.js +196 -0
- package/dist_ts/mail/delivery/smtpclient/utils/logging.d.ts +46 -0
- package/dist_ts/mail/delivery/smtpclient/utils/logging.js +153 -0
- package/dist_ts/mail/delivery/smtpclient/utils/validation.d.ts +38 -0
- package/dist_ts/mail/delivery/smtpclient/utils/validation.js +139 -0
- package/dist_ts/mail/delivery/smtpserver/certificate-utils.d.ts +45 -0
- package/dist_ts/mail/delivery/smtpserver/certificate-utils.js +345 -0
- package/dist_ts/mail/delivery/smtpserver/command-handler.d.ts +156 -0
- package/dist_ts/mail/delivery/smtpserver/command-handler.js +1159 -0
- package/dist_ts/mail/delivery/smtpserver/connection-manager.d.ts +159 -0
- package/dist_ts/mail/delivery/smtpserver/connection-manager.js +894 -0
- package/dist_ts/mail/delivery/smtpserver/constants.d.ts +130 -0
- package/dist_ts/mail/delivery/smtpserver/constants.js +162 -0
- package/dist_ts/mail/delivery/smtpserver/create-server.d.ts +14 -0
- package/dist_ts/mail/delivery/smtpserver/create-server.js +28 -0
- package/dist_ts/mail/delivery/smtpserver/data-handler.d.ts +123 -0
- package/dist_ts/mail/delivery/smtpserver/data-handler.js +1148 -0
- package/dist_ts/mail/delivery/smtpserver/index.d.ts +20 -0
- package/dist_ts/mail/delivery/smtpserver/index.js +27 -0
- package/dist_ts/mail/delivery/smtpserver/interfaces.d.ts +530 -0
- package/dist_ts/mail/delivery/smtpserver/interfaces.js +10 -0
- package/dist_ts/mail/delivery/smtpserver/secure-server.d.ts +15 -0
- package/dist_ts/mail/delivery/smtpserver/secure-server.js +79 -0
- package/dist_ts/mail/delivery/smtpserver/security-handler.d.ts +86 -0
- package/dist_ts/mail/delivery/smtpserver/security-handler.js +234 -0
- package/dist_ts/mail/delivery/smtpserver/session-manager.d.ts +140 -0
- package/dist_ts/mail/delivery/smtpserver/session-manager.js +469 -0
- package/dist_ts/mail/delivery/smtpserver/smtp-server.d.ts +137 -0
- package/dist_ts/mail/delivery/smtpserver/smtp-server.js +666 -0
- package/dist_ts/mail/delivery/smtpserver/starttls-handler.d.ts +21 -0
- package/dist_ts/mail/delivery/smtpserver/starttls-handler.js +207 -0
- package/dist_ts/mail/delivery/smtpserver/tls-handler.d.ts +66 -0
- package/dist_ts/mail/delivery/smtpserver/tls-handler.js +261 -0
- package/dist_ts/mail/delivery/smtpserver/utils/adaptive-logging.d.ts +117 -0
- package/dist_ts/mail/delivery/smtpserver/utils/adaptive-logging.js +411 -0
- package/dist_ts/mail/delivery/smtpserver/utils/helpers.d.ts +78 -0
- package/dist_ts/mail/delivery/smtpserver/utils/helpers.js +208 -0
- package/dist_ts/mail/delivery/smtpserver/utils/logging.d.ts +106 -0
- package/dist_ts/mail/delivery/smtpserver/utils/logging.js +181 -0
- package/dist_ts/mail/delivery/smtpserver/utils/validation.d.ts +69 -0
- package/dist_ts/mail/delivery/smtpserver/utils/validation.js +360 -0
- package/dist_ts/mail/index.d.ts +8 -0
- package/dist_ts/mail/index.js +13 -0
- package/dist_ts/mail/routing/classes.dns.manager.d.ts +65 -0
- package/dist_ts/mail/routing/classes.dns.manager.js +413 -0
- package/dist_ts/mail/routing/classes.dnsmanager.d.ts +165 -0
- package/dist_ts/mail/routing/classes.dnsmanager.js +430 -0
- package/dist_ts/mail/routing/classes.domain.registry.d.ts +54 -0
- package/dist_ts/mail/routing/classes.domain.registry.js +118 -0
- package/dist_ts/mail/routing/classes.email.config.d.ts +64 -0
- package/dist_ts/mail/routing/classes.email.config.js +2 -0
- package/dist_ts/mail/routing/classes.email.router.d.ts +171 -0
- package/dist_ts/mail/routing/classes.email.router.js +491 -0
- package/dist_ts/mail/routing/classes.unified.email.server.d.ts +426 -0
- package/dist_ts/mail/routing/classes.unified.email.server.js +1454 -0
- package/dist_ts/mail/routing/index.d.ts +5 -0
- package/dist_ts/mail/routing/index.js +7 -0
- package/dist_ts/mail/routing/interfaces.d.ts +187 -0
- package/dist_ts/mail/routing/interfaces.js +2 -0
- package/dist_ts/mail/security/classes.dkimcreator.d.ts +68 -0
- package/dist_ts/mail/security/classes.dkimcreator.js +346 -0
- package/dist_ts/mail/security/classes.dkimverifier.d.ts +46 -0
- package/dist_ts/mail/security/classes.dkimverifier.js +317 -0
- package/dist_ts/mail/security/classes.dmarcverifier.d.ts +123 -0
- package/dist_ts/mail/security/classes.dmarcverifier.js +365 -0
- package/dist_ts/mail/security/classes.spfverifier.d.ts +103 -0
- package/dist_ts/mail/security/classes.spfverifier.js +492 -0
- package/dist_ts/mail/security/index.d.ts +4 -0
- package/dist_ts/mail/security/index.js +6 -0
- package/dist_ts/opsserver/classes.opsserver.d.ts +14 -0
- package/dist_ts/opsserver/classes.opsserver.js +37 -0
- package/dist_ts/opsserver/index.d.ts +1 -0
- package/dist_ts/opsserver/index.js +2 -0
- package/dist_ts/paths.d.ts +14 -0
- package/dist_ts/paths.js +39 -0
- package/dist_ts/plugins.d.ts +43 -0
- package/dist_ts/plugins.js +50 -0
- package/dist_ts/security/classes.contentscanner.d.ts +160 -0
- package/dist_ts/security/classes.contentscanner.js +634 -0
- package/dist_ts/security/classes.ipreputationchecker.d.ts +150 -0
- package/dist_ts/security/classes.ipreputationchecker.js +508 -0
- package/dist_ts/security/classes.securitylogger.d.ts +140 -0
- package/dist_ts/security/classes.securitylogger.js +232 -0
- package/dist_ts/security/index.d.ts +3 -0
- package/dist_ts/security/index.js +4 -0
- package/dist_ts/sms/classes.smsservice.d.ts +15 -0
- package/dist_ts/sms/classes.smsservice.js +72 -0
- package/dist_ts/sms/config/sms.config.d.ts +93 -0
- package/dist_ts/sms/config/sms.config.js +2 -0
- package/dist_ts/sms/config/sms.schema.d.ts +5 -0
- package/dist_ts/sms/config/sms.schema.js +121 -0
- package/dist_ts/sms/index.d.ts +1 -0
- package/dist_ts/sms/index.js +2 -0
- package/dist_ts/storage/classes.storagemanager.d.ts +82 -0
- package/dist_ts/storage/classes.storagemanager.js +341 -0
- package/dist_ts/storage/index.d.ts +1 -0
- package/dist_ts/storage/index.js +3 -0
- package/dist_ts/ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/ts/00_commitinfo_data.js +9 -0
- package/dist_ts/ts/classes.dcrouter.d.ts +238 -0
- package/dist_ts/ts/classes.dcrouter.js +1008 -0
- package/dist_ts/ts/config/index.d.ts +1 -0
- package/dist_ts/ts/config/index.js +3 -0
- package/dist_ts/ts/config/validator.d.ts +104 -0
- package/dist_ts/ts/config/validator.js +152 -0
- package/dist_ts/ts/deliverability/classes.ipwarmupmanager.d.ts +253 -0
- package/dist_ts/ts/deliverability/classes.ipwarmupmanager.js +639 -0
- package/dist_ts/ts/deliverability/classes.senderreputationmonitor.d.ts +300 -0
- package/dist_ts/ts/deliverability/classes.senderreputationmonitor.js +961 -0
- package/dist_ts/ts/deliverability/index.d.ts +2 -0
- package/dist_ts/ts/deliverability/index.js +3 -0
- package/dist_ts/ts/errors/base.errors.d.ts +224 -0
- package/dist_ts/ts/errors/base.errors.js +310 -0
- package/dist_ts/ts/errors/email.errors.d.ts +175 -0
- package/dist_ts/ts/errors/email.errors.js +265 -0
- package/dist_ts/ts/errors/error-handler.d.ts +98 -0
- package/dist_ts/ts/errors/error-handler.js +282 -0
- package/dist_ts/ts/errors/error.codes.d.ts +115 -0
- package/dist_ts/ts/errors/error.codes.js +136 -0
- package/dist_ts/ts/errors/index.d.ts +56 -0
- package/dist_ts/ts/errors/index.js +138 -0
- package/dist_ts/ts/errors/mta.errors.d.ts +259 -0
- package/dist_ts/ts/errors/mta.errors.js +472 -0
- package/dist_ts/ts/errors/reputation.errors.d.ts +183 -0
- package/dist_ts/ts/errors/reputation.errors.js +292 -0
- package/dist_ts/ts/index.d.ts +4 -0
- package/dist_ts/ts/index.js +6 -0
- package/dist_ts/ts/logger.d.ts +17 -0
- package/dist_ts/ts/logger.js +77 -0
- package/dist_ts/ts/mail/core/classes.bouncemanager.d.ts +200 -0
- package/dist_ts/ts/mail/core/classes.bouncemanager.js +778 -0
- package/dist_ts/ts/mail/core/classes.email.d.ts +291 -0
- package/dist_ts/ts/mail/core/classes.email.js +780 -0
- package/dist_ts/ts/mail/core/classes.emailvalidator.d.ts +61 -0
- package/dist_ts/ts/mail/core/classes.emailvalidator.js +182 -0
- package/dist_ts/ts/mail/core/classes.templatemanager.d.ts +95 -0
- package/dist_ts/ts/mail/core/classes.templatemanager.js +239 -0
- package/dist_ts/ts/mail/core/index.d.ts +4 -0
- package/dist_ts/ts/mail/core/index.js +6 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.queue.d.ts +163 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.queue.js +485 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.system.d.ts +186 -0
- package/dist_ts/ts/mail/delivery/classes.delivery.system.js +846 -0
- package/dist_ts/ts/mail/delivery/classes.emailsendjob.d.ts +84 -0
- package/dist_ts/ts/mail/delivery/classes.emailsendjob.js +362 -0
- package/dist_ts/ts/mail/delivery/classes.emailsignjob.d.ts +18 -0
- package/dist_ts/ts/mail/delivery/classes.emailsignjob.js +44 -0
- package/dist_ts/ts/mail/delivery/classes.mta.config.d.ts +22 -0
- package/dist_ts/ts/mail/delivery/classes.mta.config.js +51 -0
- package/dist_ts/ts/mail/delivery/classes.ratelimiter.d.ts +98 -0
- package/dist_ts/ts/mail/delivery/classes.ratelimiter.js +205 -0
- package/dist_ts/ts/mail/delivery/classes.smtp.client.legacy.d.ts +275 -0
- package/dist_ts/ts/mail/delivery/classes.smtp.client.legacy.js +973 -0
- package/dist_ts/ts/mail/delivery/classes.unified.rate.limiter.d.ts +200 -0
- package/dist_ts/ts/mail/delivery/classes.unified.rate.limiter.js +817 -0
- package/dist_ts/ts/mail/delivery/index.d.ts +12 -0
- package/dist_ts/ts/mail/delivery/index.js +18 -0
- package/dist_ts/ts/mail/delivery/interfaces.d.ts +243 -0
- package/dist_ts/ts/mail/delivery/interfaces.js +17 -0
- package/dist_ts/ts/mail/delivery/smtpclient/auth-handler.d.ts +43 -0
- package/dist_ts/ts/mail/delivery/smtpclient/auth-handler.js +188 -0
- package/dist_ts/ts/mail/delivery/smtpclient/command-handler.d.ts +67 -0
- package/dist_ts/ts/mail/delivery/smtpclient/command-handler.js +276 -0
- package/dist_ts/ts/mail/delivery/smtpclient/connection-manager.d.ts +48 -0
- package/dist_ts/ts/mail/delivery/smtpclient/connection-manager.js +238 -0
- package/dist_ts/ts/mail/delivery/smtpclient/constants.d.ts +129 -0
- package/dist_ts/ts/mail/delivery/smtpclient/constants.js +135 -0
- package/dist_ts/ts/mail/delivery/smtpclient/create-client.d.ts +22 -0
- package/dist_ts/ts/mail/delivery/smtpclient/create-client.js +86 -0
- package/dist_ts/ts/mail/delivery/smtpclient/error-handler.d.ts +28 -0
- package/dist_ts/ts/mail/delivery/smtpclient/error-handler.js +110 -0
- package/dist_ts/ts/mail/delivery/smtpclient/index.d.ts +16 -0
- package/dist_ts/ts/mail/delivery/smtpclient/index.js +21 -0
- package/dist_ts/ts/mail/delivery/smtpclient/interfaces.d.ts +183 -0
- package/dist_ts/ts/mail/delivery/smtpclient/interfaces.js +19 -0
- package/dist_ts/ts/mail/delivery/smtpclient/smtp-client.d.ts +58 -0
- package/dist_ts/ts/mail/delivery/smtpclient/smtp-client.js +279 -0
- package/dist_ts/ts/mail/delivery/smtpclient/tls-handler.d.ts +33 -0
- package/dist_ts/ts/mail/delivery/smtpclient/tls-handler.js +202 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/helpers.d.ts +77 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/helpers.js +196 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/logging.d.ts +46 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/logging.js +153 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/validation.d.ts +38 -0
- package/dist_ts/ts/mail/delivery/smtpclient/utils/validation.js +139 -0
- package/dist_ts/ts/mail/delivery/smtpserver/certificate-utils.d.ts +45 -0
- package/dist_ts/ts/mail/delivery/smtpserver/certificate-utils.js +345 -0
- package/dist_ts/ts/mail/delivery/smtpserver/command-handler.d.ts +156 -0
- package/dist_ts/ts/mail/delivery/smtpserver/command-handler.js +1159 -0
- package/dist_ts/ts/mail/delivery/smtpserver/connection-manager.d.ts +159 -0
- package/dist_ts/ts/mail/delivery/smtpserver/connection-manager.js +894 -0
- package/dist_ts/ts/mail/delivery/smtpserver/constants.d.ts +130 -0
- package/dist_ts/ts/mail/delivery/smtpserver/constants.js +162 -0
- package/dist_ts/ts/mail/delivery/smtpserver/create-server.d.ts +14 -0
- package/dist_ts/ts/mail/delivery/smtpserver/create-server.js +28 -0
- package/dist_ts/ts/mail/delivery/smtpserver/data-handler.d.ts +123 -0
- package/dist_ts/ts/mail/delivery/smtpserver/data-handler.js +1148 -0
- package/dist_ts/ts/mail/delivery/smtpserver/index.d.ts +20 -0
- package/dist_ts/ts/mail/delivery/smtpserver/index.js +27 -0
- package/dist_ts/ts/mail/delivery/smtpserver/interfaces.d.ts +530 -0
- package/dist_ts/ts/mail/delivery/smtpserver/interfaces.js +10 -0
- package/dist_ts/ts/mail/delivery/smtpserver/secure-server.d.ts +15 -0
- package/dist_ts/ts/mail/delivery/smtpserver/secure-server.js +79 -0
- package/dist_ts/ts/mail/delivery/smtpserver/security-handler.d.ts +86 -0
- package/dist_ts/ts/mail/delivery/smtpserver/security-handler.js +234 -0
- package/dist_ts/ts/mail/delivery/smtpserver/session-manager.d.ts +140 -0
- package/dist_ts/ts/mail/delivery/smtpserver/session-manager.js +469 -0
- package/dist_ts/ts/mail/delivery/smtpserver/smtp-server.d.ts +137 -0
- package/dist_ts/ts/mail/delivery/smtpserver/smtp-server.js +666 -0
- package/dist_ts/ts/mail/delivery/smtpserver/starttls-handler.d.ts +21 -0
- package/dist_ts/ts/mail/delivery/smtpserver/starttls-handler.js +207 -0
- package/dist_ts/ts/mail/delivery/smtpserver/tls-handler.d.ts +66 -0
- package/dist_ts/ts/mail/delivery/smtpserver/tls-handler.js +261 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/adaptive-logging.d.ts +117 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/adaptive-logging.js +411 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/helpers.d.ts +78 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/helpers.js +208 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/logging.d.ts +106 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/logging.js +181 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/validation.d.ts +69 -0
- package/dist_ts/ts/mail/delivery/smtpserver/utils/validation.js +360 -0
- package/dist_ts/ts/mail/index.d.ts +8 -0
- package/dist_ts/ts/mail/index.js +13 -0
- package/dist_ts/ts/mail/routing/classes.dns.manager.d.ts +65 -0
- package/dist_ts/ts/mail/routing/classes.dns.manager.js +413 -0
- package/dist_ts/ts/mail/routing/classes.dnsmanager.d.ts +165 -0
- package/dist_ts/ts/mail/routing/classes.dnsmanager.js +430 -0
- package/dist_ts/ts/mail/routing/classes.domain.registry.d.ts +54 -0
- package/dist_ts/ts/mail/routing/classes.domain.registry.js +118 -0
- package/dist_ts/ts/mail/routing/classes.email.config.d.ts +64 -0
- package/dist_ts/ts/mail/routing/classes.email.config.js +2 -0
- package/dist_ts/ts/mail/routing/classes.email.router.d.ts +171 -0
- package/dist_ts/ts/mail/routing/classes.email.router.js +491 -0
- package/dist_ts/ts/mail/routing/classes.unified.email.server.d.ts +426 -0
- package/dist_ts/ts/mail/routing/classes.unified.email.server.js +1454 -0
- package/dist_ts/ts/mail/routing/index.d.ts +5 -0
- package/dist_ts/ts/mail/routing/index.js +7 -0
- package/dist_ts/ts/mail/routing/interfaces.d.ts +187 -0
- package/dist_ts/ts/mail/routing/interfaces.js +2 -0
- package/dist_ts/ts/mail/security/classes.dkimcreator.d.ts +68 -0
- package/dist_ts/ts/mail/security/classes.dkimcreator.js +346 -0
- package/dist_ts/ts/mail/security/classes.dkimverifier.d.ts +46 -0
- package/dist_ts/ts/mail/security/classes.dkimverifier.js +317 -0
- package/dist_ts/ts/mail/security/classes.dmarcverifier.d.ts +123 -0
- package/dist_ts/ts/mail/security/classes.dmarcverifier.js +365 -0
- package/dist_ts/ts/mail/security/classes.spfverifier.d.ts +103 -0
- package/dist_ts/ts/mail/security/classes.spfverifier.js +492 -0
- package/dist_ts/ts/mail/security/index.d.ts +4 -0
- package/dist_ts/ts/mail/security/index.js +6 -0
- package/dist_ts/ts/opsserver/classes.opsserver.d.ts +20 -0
- package/dist_ts/ts/opsserver/classes.opsserver.js +44 -0
- package/dist_ts/ts/opsserver/handlers/admin.handler.d.ts +31 -0
- package/dist_ts/ts/opsserver/handlers/admin.handler.js +177 -0
- package/dist_ts/ts/opsserver/handlers/config.handler.d.ts +10 -0
- package/dist_ts/ts/opsserver/handlers/config.handler.js +100 -0
- package/dist_ts/ts/opsserver/handlers/index.d.ts +5 -0
- package/dist_ts/ts/opsserver/handlers/index.js +6 -0
- package/dist_ts/ts/opsserver/handlers/logs.handler.d.ts +10 -0
- package/dist_ts/ts/opsserver/handlers/logs.handler.js +121 -0
- package/dist_ts/ts/opsserver/handlers/security.handler.d.ts +11 -0
- package/dist_ts/ts/opsserver/handlers/security.handler.js +118 -0
- package/dist_ts/ts/opsserver/handlers/stats.handler.d.ts +13 -0
- package/dist_ts/ts/opsserver/handlers/stats.handler.js +233 -0
- package/dist_ts/ts/opsserver/helpers/guards.d.ts +25 -0
- package/dist_ts/ts/opsserver/helpers/guards.js +41 -0
- package/dist_ts/ts/opsserver/index.d.ts +1 -0
- package/dist_ts/ts/opsserver/index.js +2 -0
- package/dist_ts/ts/paths.d.ts +14 -0
- package/dist_ts/ts/paths.js +39 -0
- package/dist_ts/ts/plugins.d.ts +46 -0
- package/dist_ts/ts/plugins.js +53 -0
- package/dist_ts/ts/security/classes.contentscanner.d.ts +160 -0
- package/dist_ts/ts/security/classes.contentscanner.js +634 -0
- package/dist_ts/ts/security/classes.ipreputationchecker.d.ts +150 -0
- package/dist_ts/ts/security/classes.ipreputationchecker.js +508 -0
- package/dist_ts/ts/security/classes.securitylogger.d.ts +140 -0
- package/dist_ts/ts/security/classes.securitylogger.js +232 -0
- package/dist_ts/ts/security/index.d.ts +3 -0
- package/dist_ts/ts/security/index.js +4 -0
- package/dist_ts/ts/sms/classes.smsservice.d.ts +15 -0
- package/dist_ts/ts/sms/classes.smsservice.js +72 -0
- package/dist_ts/ts/sms/config/sms.config.d.ts +93 -0
- package/dist_ts/ts/sms/config/sms.config.js +2 -0
- package/dist_ts/ts/sms/config/sms.schema.d.ts +5 -0
- package/dist_ts/ts/sms/config/sms.schema.js +121 -0
- package/dist_ts/ts/sms/index.d.ts +1 -0
- package/dist_ts/ts/sms/index.js +2 -0
- package/dist_ts/ts/storage/classes.storagemanager.d.ts +82 -0
- package/dist_ts/ts/storage/classes.storagemanager.js +341 -0
- package/dist_ts/ts/storage/index.d.ts +1 -0
- package/dist_ts/ts/storage/index.js +3 -0
- package/dist_ts/ts_interfaces/data/auth.d.ts +8 -0
- package/dist_ts/ts_interfaces/data/auth.js +2 -0
- package/dist_ts/ts_interfaces/data/index.d.ts +2 -0
- package/dist_ts/ts_interfaces/data/index.js +3 -0
- package/dist_ts/ts_interfaces/data/stats.d.ts +93 -0
- package/dist_ts/ts_interfaces/data/stats.js +2 -0
- package/dist_ts/ts_interfaces/index.d.ts +5 -0
- package/dist_ts/ts_interfaces/index.js +8 -0
- package/dist_ts/ts_interfaces/plugins.d.ts +2 -0
- package/dist_ts/ts_interfaces/plugins.js +4 -0
- package/dist_ts/ts_interfaces/requests/admin.d.ts +31 -0
- package/dist_ts/ts_interfaces/requests/admin.js +3 -0
- package/dist_ts/ts_interfaces/requests/config.d.ts +25 -0
- package/dist_ts/ts_interfaces/requests/config.js +3 -0
- package/dist_ts/ts_interfaces/requests/index.d.ts +4 -0
- package/dist_ts/ts_interfaces/requests/index.js +5 -0
- package/dist_ts/ts_interfaces/requests/logs.d.ts +34 -0
- package/dist_ts/ts_interfaces/requests/logs.js +4 -0
- package/dist_ts/ts_interfaces/requests/stats.d.ts +131 -0
- package/dist_ts/ts_interfaces/requests/stats.js +4 -0
- package/html/index.html +121 -0
- package/npmextra.json +45 -0
- package/package.json +83 -0
- package/readme.hints.md +906 -0
- package/readme.md +1253 -0
- package/readme.opsserver.md +351 -0
- package/test/helpers/server.loader.ts +347 -0
- package/test/helpers/smtp.client.ts +209 -0
- package/test/helpers/utils.ts +311 -0
- package/test/readme.md +443 -0
- package/test/suite/smtpclient_commands/test.ccmd-01.ehlo-helo-sending.ts +168 -0
- package/test/suite/smtpclient_commands/test.ccmd-02.mail-from-parameters.ts +277 -0
- package/test/suite/smtpclient_commands/test.ccmd-03.rcpt-to-multiple.ts +283 -0
- package/test/suite/smtpclient_commands/test.ccmd-04.data-transmission.ts +274 -0
- package/test/suite/smtpclient_commands/test.ccmd-05.auth-mechanisms.ts +306 -0
- package/test/suite/smtpclient_commands/test.ccmd-06.command-pipelining.ts +233 -0
- package/test/suite/smtpclient_commands/test.ccmd-07.response-parsing.ts +243 -0
- package/test/suite/smtpclient_commands/test.ccmd-08.rset-command.ts +333 -0
- package/test/suite/smtpclient_commands/test.ccmd-09.noop-command.ts +339 -0
- package/test/suite/smtpclient_commands/test.ccmd-10.vrfy-expn.ts +457 -0
- package/test/suite/smtpclient_commands/test.ccmd-11.help-command.ts +409 -0
- package/test/suite/smtpclient_connection/test.ccm-01.basic-tcp-connection.ts +150 -0
- package/test/suite/smtpclient_connection/test.ccm-02.tls-connection.ts +140 -0
- package/test/suite/smtpclient_connection/test.ccm-03.starttls-upgrade.ts +208 -0
- package/test/suite/smtpclient_connection/test.ccm-04.connection-pooling.ts +250 -0
- package/test/suite/smtpclient_connection/test.ccm-05.connection-reuse.ts +288 -0
- package/test/suite/smtpclient_connection/test.ccm-06.connection-timeout.ts +267 -0
- package/test/suite/smtpclient_connection/test.ccm-07.automatic-reconnection.ts +324 -0
- package/test/suite/smtpclient_connection/test.ccm-08.dns-resolution.ts +139 -0
- package/test/suite/smtpclient_connection/test.ccm-09.ipv6-dual-stack.ts +167 -0
- package/test/suite/smtpclient_connection/test.ccm-10.proxy-support.ts +305 -0
- package/test/suite/smtpclient_connection/test.ccm-11.keepalive.ts +299 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-01.unusual-server-responses.ts +529 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-02.malformed-commands.ts +438 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-03.protocol-violations.ts +446 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-04.resource-constraints.ts +530 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-05.encoding-issues.ts +145 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-06.large-headers.ts +180 -0
- package/test/suite/smtpclient_edge-cases/test.cedge-07.concurrent-operations.ts +204 -0
- package/test/suite/smtpclient_email-composition/test.cep-01.basic-headers.ts +245 -0
- package/test/suite/smtpclient_email-composition/test.cep-02.mime-multipart.ts +321 -0
- package/test/suite/smtpclient_email-composition/test.cep-03.attachment-encoding.ts +334 -0
- package/test/suite/smtpclient_email-composition/test.cep-04.bcc-handling.ts +187 -0
- package/test/suite/smtpclient_email-composition/test.cep-05.reply-to-return-path.ts +277 -0
- package/test/suite/smtpclient_email-composition/test.cep-06.utf8-international.ts +235 -0
- package/test/suite/smtpclient_email-composition/test.cep-07.html-inline-images.ts +489 -0
- package/test/suite/smtpclient_email-composition/test.cep-08.custom-headers.ts +293 -0
- package/test/suite/smtpclient_email-composition/test.cep-09.priority-importance.ts +314 -0
- package/test/suite/smtpclient_email-composition/test.cep-10.receipts-dsn.ts +411 -0
- package/test/suite/smtpclient_error-handling/test.cerr-01.4xx-errors.ts +232 -0
- package/test/suite/smtpclient_error-handling/test.cerr-02.5xx-errors.ts +309 -0
- package/test/suite/smtpclient_error-handling/test.cerr-03.network-failures.ts +299 -0
- package/test/suite/smtpclient_error-handling/test.cerr-04.greylisting-handling.ts +255 -0
- package/test/suite/smtpclient_error-handling/test.cerr-05.quota-exceeded.ts +273 -0
- package/test/suite/smtpclient_error-handling/test.cerr-06.invalid-recipients.ts +320 -0
- package/test/suite/smtpclient_error-handling/test.cerr-07.message-size-limits.ts +320 -0
- package/test/suite/smtpclient_error-handling/test.cerr-08.rate-limiting.ts +261 -0
- package/test/suite/smtpclient_error-handling/test.cerr-09.connection-pool-errors.ts +299 -0
- package/test/suite/smtpclient_error-handling/test.cerr-10.partial-failure.ts +373 -0
- package/test/suite/smtpclient_performance/test.cperf-01.bulk-sending.ts +332 -0
- package/test/suite/smtpclient_performance/test.cperf-02.message-throughput.ts +304 -0
- package/test/suite/smtpclient_performance/test.cperf-03.memory-usage.ts +332 -0
- package/test/suite/smtpclient_performance/test.cperf-04.cpu-utilization.ts +373 -0
- package/test/suite/smtpclient_performance/test.cperf-05.network-efficiency.ts +181 -0
- package/test/suite/smtpclient_performance/test.cperf-06.caching-strategies.ts +190 -0
- package/test/suite/smtpclient_performance/test.cperf-07.queue-management.ts +171 -0
- package/test/suite/smtpclient_performance/test.cperf-08.dns-caching.ts +50 -0
- package/test/suite/smtpclient_reliability/test.crel-01.reconnection-logic.ts +305 -0
- package/test/suite/smtpclient_reliability/test.crel-02.network-interruption.ts +207 -0
- package/test/suite/smtpclient_reliability/test.crel-03.queue-persistence.ts +469 -0
- package/test/suite/smtpclient_reliability/test.crel-04.crash-recovery.ts +520 -0
- package/test/suite/smtpclient_reliability/test.crel-05.memory-leaks.ts +503 -0
- package/test/suite/smtpclient_reliability/test.crel-06.concurrency-safety.ts +558 -0
- package/test/suite/smtpclient_reliability/test.crel-07.resource-cleanup.ts +52 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-01.rfc5321-client.ts +283 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-02.esmtp-compliance.ts +77 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-03.command-syntax.ts +67 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-04.response-codes.ts +54 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-05.state-machine.ts +703 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-06.protocol-negotiation.ts +688 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-07.interoperability.ts +728 -0
- package/test/suite/smtpclient_rfc-compliance/test.crfc-08.smtp-extensions.ts +656 -0
- package/test/suite/smtpclient_security/test.csec-01.tls-verification.ts +88 -0
- package/test/suite/smtpclient_security/test.csec-02.oauth2-authentication.ts +132 -0
- package/test/suite/smtpclient_security/test.csec-03.dkim-signing.ts +138 -0
- package/test/suite/smtpclient_security/test.csec-04.spf-compliance.ts +163 -0
- package/test/suite/smtpclient_security/test.csec-05.dmarc-policy.ts +200 -0
- package/test/suite/smtpclient_security/test.csec-06.certificate-validation.ts +145 -0
- package/test/suite/smtpclient_security/test.csec-07.cipher-suites.ts +153 -0
- package/test/suite/smtpclient_security/test.csec-08.authentication-fallback.ts +154 -0
- package/test/suite/smtpclient_security/test.csec-09.relay-restrictions.ts +166 -0
- package/test/suite/smtpclient_security/test.csec-10.anti-spam-measures.ts +196 -0
- package/test/suite/smtpserver_commands/test.cmd-01.ehlo-command.ts +193 -0
- package/test/suite/smtpserver_commands/test.cmd-02.mail-from.ts +330 -0
- package/test/suite/smtpserver_commands/test.cmd-03.rcpt-to.ts +296 -0
- package/test/suite/smtpserver_commands/test.cmd-04.data-command.ts +395 -0
- package/test/suite/smtpserver_commands/test.cmd-05.noop-command.ts +320 -0
- package/test/suite/smtpserver_commands/test.cmd-06.rset-command.ts +399 -0
- package/test/suite/smtpserver_commands/test.cmd-07.vrfy-command.ts +391 -0
- package/test/suite/smtpserver_commands/test.cmd-08.expn-command.ts +450 -0
- package/test/suite/smtpserver_commands/test.cmd-09.size-extension.ts +465 -0
- package/test/suite/smtpserver_commands/test.cmd-10.help-command.ts +454 -0
- package/test/suite/smtpserver_commands/test.cmd-11.command-pipelining.ts +334 -0
- package/test/suite/smtpserver_commands/test.cmd-12.helo-command.ts +420 -0
- package/test/suite/smtpserver_commands/test.cmd-13.quit-command.ts +384 -0
- package/test/suite/smtpserver_connection/test.cm-01.tls-connection.ts +61 -0
- package/test/suite/smtpserver_connection/test.cm-02.multiple-connections.ts +112 -0
- package/test/suite/smtpserver_connection/test.cm-03.connection-timeout.ts +134 -0
- package/test/suite/smtpserver_connection/test.cm-04.connection-limits.ts +374 -0
- package/test/suite/smtpserver_connection/test.cm-05.connection-rejection.ts +296 -0
- package/test/suite/smtpserver_connection/test.cm-06.starttls-upgrade.ts +468 -0
- package/test/suite/smtpserver_connection/test.cm-07.abrupt-disconnection.ts +321 -0
- package/test/suite/smtpserver_connection/test.cm-08.tls-versions.ts +361 -0
- package/test/suite/smtpserver_connection/test.cm-09.tls-ciphers.ts +556 -0
- package/test/suite/smtpserver_connection/test.cm-10.plain-connection.ts +293 -0
- package/test/suite/smtpserver_connection/test.cm-11.keepalive.ts +382 -0
- package/test/suite/smtpserver_edge-cases/test.edge-01.very-large-email.ts +239 -0
- package/test/suite/smtpserver_edge-cases/test.edge-02.very-small-email.ts +389 -0
- package/test/suite/smtpserver_edge-cases/test.edge-03.invalid-character-handling.ts +479 -0
- package/test/suite/smtpserver_edge-cases/test.edge-04.empty-commands.ts +430 -0
- package/test/suite/smtpserver_edge-cases/test.edge-05.extremely-long-lines.ts +425 -0
- package/test/suite/smtpserver_edge-cases/test.edge-06.extremely-long-headers.ts +404 -0
- package/test/suite/smtpserver_edge-cases/test.edge-07.unusual-mime-types.ts +333 -0
- package/test/suite/smtpserver_edge-cases/test.edge-08.nested-mime-structures.ts +379 -0
- package/test/suite/smtpserver_email-processing/test.ep-01.basic-email-sending.ts +338 -0
- package/test/suite/smtpserver_email-processing/test.ep-02.invalid-email-addresses.ts +315 -0
- package/test/suite/smtpserver_email-processing/test.ep-03.multiple-recipients.ts +493 -0
- package/test/suite/smtpserver_email-processing/test.ep-04.large-email.ts +528 -0
- package/test/suite/smtpserver_email-processing/test.ep-05.mime-handling.ts +515 -0
- package/test/suite/smtpserver_email-processing/test.ep-06.attachment-handling.ts +629 -0
- package/test/suite/smtpserver_email-processing/test.ep-07.special-character-handling.ts +462 -0
- package/test/suite/smtpserver_email-processing/test.ep-08.email-routing.ts +527 -0
- package/test/suite/smtpserver_email-processing/test.ep-09.delivery-status-notifications.ts +486 -0
- package/test/suite/smtpserver_error-handling/test.err-01.syntax-errors.ts +475 -0
- package/test/suite/smtpserver_error-handling/test.err-02.invalid-sequence.ts +450 -0
- package/test/suite/smtpserver_error-handling/test.err-03.temporary-failures.ts +453 -0
- package/test/suite/smtpserver_error-handling/test.err-04.permanent-failures.ts +325 -0
- package/test/suite/smtpserver_error-handling/test.err-05.resource-exhaustion.ts +302 -0
- package/test/suite/smtpserver_error-handling/test.err-06.malformed-mime.ts +374 -0
- package/test/suite/smtpserver_error-handling/test.err-07.exception-handling.ts +333 -0
- package/test/suite/smtpserver_error-handling/test.err-08.error-logging.ts +324 -0
- package/test/suite/smtpserver_performance/test.perf-01.throughput.ts +183 -0
- package/test/suite/smtpserver_performance/test.perf-02.concurrency.ts +388 -0
- package/test/suite/smtpserver_performance/test.perf-03.cpu-utilization.ts +245 -0
- package/test/suite/smtpserver_performance/test.perf-04.memory-usage.ts +238 -0
- package/test/suite/smtpserver_performance/test.perf-05.connection-processing-time.ts +363 -0
- package/test/suite/smtpserver_performance/test.perf-06.message-processing-time.ts +252 -0
- package/test/suite/smtpserver_performance/test.perf-07.resource-cleanup.ts +317 -0
- package/test/suite/smtpserver_reliability/test.rel-01.long-running-operation.ts +344 -0
- package/test/suite/smtpserver_reliability/test.rel-02.restart-recovery.ts +328 -0
- package/test/suite/smtpserver_reliability/test.rel-03.resource-leak-detection.ts +394 -0
- package/test/suite/smtpserver_reliability/test.rel-04.error-recovery.ts +401 -0
- package/test/suite/smtpserver_reliability/test.rel-05.dns-resolution-failure.ts +335 -0
- package/test/suite/smtpserver_reliability/test.rel-06.network-interruption.ts +410 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-01.rfc5321-compliance.ts +382 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-02.rfc5322-compliance.ts +428 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-03.rfc7208-spf-compliance.ts +330 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-04.rfc6376-dkim-compliance.ts +450 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-05.rfc7489-dmarc-compliance.ts +408 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-06.rfc8314-tls-compliance.ts +366 -0
- package/test/suite/smtpserver_rfc-compliance/test.rfc-07.rfc3461-dsn-compliance.ts +399 -0
- package/test/suite/smtpserver_security/test.sec-01.authentication.ts +218 -0
- package/test/suite/smtpserver_security/test.sec-02.authorization.ts +286 -0
- package/test/suite/smtpserver_security/test.sec-03.dkim-processing.ts +414 -0
- package/test/suite/smtpserver_security/test.sec-04.spf-checking.ts +280 -0
- package/test/suite/smtpserver_security/test.sec-05.dmarc-policy.ts +374 -0
- package/test/suite/smtpserver_security/test.sec-06.ip-reputation.ts +303 -0
- package/test/suite/smtpserver_security/test.sec-07.content-scanning.ts +409 -0
- package/test/suite/smtpserver_security/test.sec-08.rate-limiting.ts +324 -0
- package/test/suite/smtpserver_security/test.sec-09.tls-certificate-validation.ts +312 -0
- package/test/suite/smtpserver_security/test.sec-10.header-injection-prevention.ts +332 -0
- package/test/suite/smtpserver_security/test.sec-11.bounce-management.ts +363 -0
- package/test/test.base.ts +65 -0
- package/test/test.bouncemanager.ts +196 -0
- package/test/test.config.md +175 -0
- package/test/test.contentscanner.ts +265 -0
- package/test/test.dcrouter.email.ts +201 -0
- package/test/test.deliverability.ts +55 -0
- package/test/test.dns-manager-creation.ts +141 -0
- package/test/test.dns-mode-switching.ts +257 -0
- package/test/test.dns-server-config.ts +140 -0
- package/test/test.dns-socket-handler.ts +169 -0
- package/test/test.dns-validation.ts +283 -0
- package/test/test.email-socket-handler.ts +228 -0
- package/test/test.email.integration.ts +377 -0
- package/test/test.email.router.ts +283 -0
- package/test/test.emailauth.ts +195 -0
- package/test/test.errors.ts +408 -0
- package/test/test.integration.storage.ts +313 -0
- package/test/test.integration.ts +75 -0
- package/test/test.ipreputationchecker.ts +179 -0
- package/test/test.ipwarmupmanager.ts +323 -0
- package/test/test.jwt-auth.ts +130 -0
- package/test/test.minimal.ts +66 -0
- package/test/test.opsserver-api.ts +83 -0
- package/test/test.protected-endpoint.ts +115 -0
- package/test/test.rate-limiting-integration.ts +236 -0
- package/test/test.ratelimiter.ts +141 -0
- package/test/test.reputationmonitor.ts +262 -0
- package/test/test.smartmail.ts +248 -0
- package/test/test.smtp.client.compatibility.ts +154 -0
- package/test/test.smtp.client.ts +191 -0
- package/test/test.smtp.server.ts +180 -0
- package/test/test.socket-handler-integration.ts +240 -0
- package/test/test.socket-handler-unit.ts +198 -0
- package/test/test.storagemanager.ts +289 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/classes.dcrouter.ts +1310 -0
- package/ts/config/index.ts +2 -0
- package/ts/config/validator.ts +266 -0
- package/ts/deliverability/classes.ipwarmupmanager.ts +896 -0
- package/ts/deliverability/classes.senderreputationmonitor.ts +1244 -0
- package/ts/deliverability/index.ts +13 -0
- package/ts/errors/base.errors.ts +525 -0
- package/ts/errors/email.errors.ts +383 -0
- package/ts/errors/error-handler.ts +412 -0
- package/ts/errors/error.codes.ts +165 -0
- package/ts/errors/index.ts +195 -0
- package/ts/errors/mta.errors.ts +681 -0
- package/ts/errors/reputation.errors.ts +422 -0
- package/ts/index.ts +7 -0
- package/ts/logger.ts +91 -0
- package/ts/mail/core/classes.bouncemanager.ts +965 -0
- package/ts/mail/core/classes.email.ts +941 -0
- package/ts/mail/core/classes.emailvalidator.ts +239 -0
- package/ts/mail/core/classes.templatemanager.ts +320 -0
- package/ts/mail/core/index.ts +5 -0
- package/ts/mail/delivery/classes.delivery.queue.ts +645 -0
- package/ts/mail/delivery/classes.delivery.system.ts +1089 -0
- package/ts/mail/delivery/classes.emailsendjob.ts +447 -0
- package/ts/mail/delivery/classes.emailsendjob.ts.backup +691 -0
- package/ts/mail/delivery/classes.emailsignjob.ts +67 -0
- package/ts/mail/delivery/classes.mta.config.ts +73 -0
- package/ts/mail/delivery/classes.ratelimiter.ts +281 -0
- package/ts/mail/delivery/classes.smtp.client.legacy.ts +1422 -0
- package/ts/mail/delivery/classes.unified.rate.limiter.ts +1053 -0
- package/ts/mail/delivery/index.ts +24 -0
- package/ts/mail/delivery/interfaces.ts +291 -0
- package/ts/mail/delivery/smtpclient/auth-handler.ts +232 -0
- package/ts/mail/delivery/smtpclient/command-handler.ts +343 -0
- package/ts/mail/delivery/smtpclient/connection-manager.ts +289 -0
- package/ts/mail/delivery/smtpclient/constants.ts +145 -0
- package/ts/mail/delivery/smtpclient/create-client.ts +94 -0
- package/ts/mail/delivery/smtpclient/error-handler.ts +141 -0
- package/ts/mail/delivery/smtpclient/index.ts +24 -0
- package/ts/mail/delivery/smtpclient/interfaces.ts +242 -0
- package/ts/mail/delivery/smtpclient/smtp-client.ts +357 -0
- package/ts/mail/delivery/smtpclient/tls-handler.ts +254 -0
- package/ts/mail/delivery/smtpclient/utils/helpers.ts +224 -0
- package/ts/mail/delivery/smtpclient/utils/logging.ts +212 -0
- package/ts/mail/delivery/smtpclient/utils/validation.ts +170 -0
- package/ts/mail/delivery/smtpserver/certificate-utils.ts +398 -0
- package/ts/mail/delivery/smtpserver/command-handler.ts +1340 -0
- package/ts/mail/delivery/smtpserver/connection-manager.ts +1045 -0
- package/ts/mail/delivery/smtpserver/constants.ts +181 -0
- package/ts/mail/delivery/smtpserver/create-server.ts +31 -0
- package/ts/mail/delivery/smtpserver/data-handler.ts +1283 -0
- package/ts/mail/delivery/smtpserver/index.ts +32 -0
- package/ts/mail/delivery/smtpserver/interfaces.ts +655 -0
- package/ts/mail/delivery/smtpserver/secure-server.ts +97 -0
- package/ts/mail/delivery/smtpserver/security-handler.ts +345 -0
- package/ts/mail/delivery/smtpserver/session-manager.ts +557 -0
- package/ts/mail/delivery/smtpserver/smtp-server.ts +804 -0
- package/ts/mail/delivery/smtpserver/starttls-handler.ts +262 -0
- package/ts/mail/delivery/smtpserver/tls-handler.ts +346 -0
- package/ts/mail/delivery/smtpserver/utils/adaptive-logging.ts +514 -0
- package/ts/mail/delivery/smtpserver/utils/helpers.ts +246 -0
- package/ts/mail/delivery/smtpserver/utils/logging.ts +246 -0
- package/ts/mail/delivery/smtpserver/utils/validation.ts +436 -0
- package/ts/mail/index.ts +19 -0
- package/ts/mail/routing/classes.dns.manager.ts +563 -0
- package/ts/mail/routing/classes.dnsmanager.ts +559 -0
- package/ts/mail/routing/classes.domain.registry.ts +139 -0
- package/ts/mail/routing/classes.email.config.ts +82 -0
- package/ts/mail/routing/classes.email.router.ts +575 -0
- package/ts/mail/routing/classes.unified.email.server.ts +1873 -0
- package/ts/mail/routing/index.ts +6 -0
- package/ts/mail/routing/interfaces.ts +202 -0
- package/ts/mail/security/classes.dkimcreator.ts +431 -0
- package/ts/mail/security/classes.dkimverifier.ts +382 -0
- package/ts/mail/security/classes.dmarcverifier.ts +478 -0
- package/ts/mail/security/classes.spfverifier.ts +606 -0
- package/ts/mail/security/index.ts +5 -0
- package/ts/opsserver/classes.opsserver.ts +65 -0
- package/ts/opsserver/handlers/admin.handler.ts +240 -0
- package/ts/opsserver/handlers/config.handler.ts +150 -0
- package/ts/opsserver/handlers/index.ts +5 -0
- package/ts/opsserver/handlers/logs.handler.ts +195 -0
- package/ts/opsserver/handlers/security.handler.ts +208 -0
- package/ts/opsserver/handlers/stats.handler.ts +344 -0
- package/ts/opsserver/helpers/guards.ts +56 -0
- package/ts/opsserver/index.ts +1 -0
- package/ts/paths.ts +48 -0
- package/ts/plugins.ts +94 -0
- package/ts/security/classes.contentscanner.ts +739 -0
- package/ts/security/classes.ipreputationchecker.ts +592 -0
- package/ts/security/classes.securitylogger.ts +299 -0
- package/ts/security/index.ts +21 -0
- package/ts/sms/classes.smsservice.ts +98 -0
- package/ts/sms/config/sms.config.ts +109 -0
- package/ts/sms/config/sms.schema.ts +122 -0
- package/ts/sms/index.ts +1 -0
- package/ts/storage/classes.storagemanager.ts +400 -0
- package/ts/storage/index.ts +2 -0
- package/ts/tspublish.json +3 -0
- package/ts_interfaces/data/auth.ts +8 -0
- package/ts_interfaces/data/index.ts +2 -0
- package/ts_interfaces/data/stats.ts +101 -0
- package/ts_interfaces/index.ts +9 -0
- package/ts_interfaces/plugins.ts +6 -0
- package/ts_interfaces/requests/admin.ts +46 -0
- package/ts_interfaces/requests/config.ts +35 -0
- package/ts_interfaces/requests/index.ts +4 -0
- package/ts_interfaces/requests/logs.ts +44 -0
- package/ts_interfaces/requests/stats.ts +162 -0
- package/ts_interfaces/tspublish.json +3 -0
- package/ts_web/00_commitinfo_data.ts +8 -0
- package/ts_web/appstate.ts +361 -0
- package/ts_web/elements/index.ts +7 -0
- package/ts_web/elements/ops-dashboard.ts +165 -0
- package/ts_web/elements/ops-view-config.ts +268 -0
- package/ts_web/elements/ops-view-logs.ts +207 -0
- package/ts_web/elements/ops-view-overview.ts +222 -0
- package/ts_web/elements/ops-view-security.ts +471 -0
- package/ts_web/elements/ops-view-stats.ts +299 -0
- package/ts_web/elements/shared/css.ts +10 -0
- package/ts_web/elements/shared/index.ts +2 -0
- package/ts_web/elements/shared/ops-sectionheading.ts +42 -0
- package/ts_web/index.ts +9 -0
- package/ts_web/plugins.ts +11 -0
- package/ts_web/tspublish.json +3 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
|
2
|
+
import * as plugins from '../ts/plugins.js';
|
|
3
|
+
import * as paths from '../ts/paths.js';
|
|
4
|
+
import { SenderReputationMonitor } from '../ts/deliverability/classes.senderreputationmonitor.js';
|
|
5
|
+
|
|
6
|
+
// Set NODE_ENV to test to prevent loading persisted data
|
|
7
|
+
process.env.NODE_ENV = 'test';
|
|
8
|
+
|
|
9
|
+
// Cleanup any temporary test data
|
|
10
|
+
const cleanupTestData = () => {
|
|
11
|
+
const reputationDataPath = plugins.path.join(paths.dataDir, 'reputation');
|
|
12
|
+
if (plugins.fs.existsSync(reputationDataPath)) {
|
|
13
|
+
// Remove the directory recursively using fs instead of smartfile
|
|
14
|
+
plugins.fs.rmSync(reputationDataPath, { recursive: true, force: true });
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Helper to reset the singleton instance between tests
|
|
19
|
+
const resetSingleton = () => {
|
|
20
|
+
// @ts-ignore - accessing private static field for testing
|
|
21
|
+
SenderReputationMonitor.instance = null;
|
|
22
|
+
|
|
23
|
+
// Clean up any timeout to prevent race conditions
|
|
24
|
+
const activeSendReputationMonitors = Array.from(Object.values(global))
|
|
25
|
+
.filter((item: any) => item && typeof item === 'object' && item._idleTimeout)
|
|
26
|
+
.filter((item: any) =>
|
|
27
|
+
item._onTimeout &&
|
|
28
|
+
item._onTimeout.toString &&
|
|
29
|
+
item._onTimeout.toString().includes('updateAllDomainMetrics'));
|
|
30
|
+
|
|
31
|
+
// Clear any active timeouts to prevent race conditions
|
|
32
|
+
activeSendReputationMonitors.forEach((timer: any) => {
|
|
33
|
+
clearTimeout(timer);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Before running any tests
|
|
38
|
+
tap.test('setup', async () => {
|
|
39
|
+
resetSingleton();
|
|
40
|
+
cleanupTestData();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Test initialization of SenderReputationMonitor
|
|
44
|
+
tap.test('should initialize SenderReputationMonitor with default settings', async () => {
|
|
45
|
+
resetSingleton();
|
|
46
|
+
const reputationMonitor = SenderReputationMonitor.getInstance();
|
|
47
|
+
|
|
48
|
+
expect(reputationMonitor).toBeTruthy();
|
|
49
|
+
// Check if the object has the expected methods
|
|
50
|
+
expect(typeof reputationMonitor.recordSendEvent).toEqual('function');
|
|
51
|
+
expect(typeof reputationMonitor.getReputationData).toEqual('function');
|
|
52
|
+
expect(typeof reputationMonitor.getReputationSummary).toEqual('function');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Test initialization with custom settings
|
|
56
|
+
tap.test('should initialize SenderReputationMonitor with custom settings', async () => {
|
|
57
|
+
resetSingleton();
|
|
58
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
59
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
60
|
+
domains: ['example.com', 'test.com'],
|
|
61
|
+
updateFrequency: 12 * 60 * 60 * 1000, // 12 hours
|
|
62
|
+
alertThresholds: {
|
|
63
|
+
minReputationScore: 80,
|
|
64
|
+
maxComplaintRate: 0.05
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Test adding domains
|
|
69
|
+
reputationMonitor.addDomain('newdomain.com');
|
|
70
|
+
|
|
71
|
+
// Test retrieving reputation data
|
|
72
|
+
const data = reputationMonitor.getReputationData('example.com');
|
|
73
|
+
expect(data).toBeTruthy();
|
|
74
|
+
expect(data.domain).toEqual('example.com');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Test recording and tracking send events
|
|
78
|
+
tap.test('should record send events and update metrics', async () => {
|
|
79
|
+
resetSingleton();
|
|
80
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
81
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
82
|
+
domains: ['example.com']
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
// Record a series of events
|
|
86
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'sent', count: 100 });
|
|
87
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'delivered', count: 95 });
|
|
88
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'bounce', hardBounce: true, count: 3 });
|
|
89
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'bounce', hardBounce: false, count: 2 });
|
|
90
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'complaint', count: 1 });
|
|
91
|
+
|
|
92
|
+
// Check metrics
|
|
93
|
+
const metrics = reputationMonitor.getReputationData('example.com');
|
|
94
|
+
|
|
95
|
+
expect(metrics).toBeTruthy();
|
|
96
|
+
expect(metrics.volume.sent).toEqual(100);
|
|
97
|
+
expect(metrics.volume.delivered).toEqual(95);
|
|
98
|
+
expect(metrics.volume.hardBounces).toEqual(3);
|
|
99
|
+
expect(metrics.volume.softBounces).toEqual(2);
|
|
100
|
+
expect(metrics.complaints.total).toEqual(1);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Test reputation score calculation
|
|
104
|
+
tap.test('should calculate reputation scores correctly', async () => {
|
|
105
|
+
resetSingleton();
|
|
106
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
107
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
108
|
+
domains: ['high.com', 'medium.com', 'low.com']
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// Record events for different domains
|
|
112
|
+
reputationMonitor.recordSendEvent('high.com', { type: 'sent', count: 1000 });
|
|
113
|
+
reputationMonitor.recordSendEvent('high.com', { type: 'delivered', count: 990 });
|
|
114
|
+
reputationMonitor.recordSendEvent('high.com', { type: 'open', count: 500 });
|
|
115
|
+
|
|
116
|
+
reputationMonitor.recordSendEvent('medium.com', { type: 'sent', count: 1000 });
|
|
117
|
+
reputationMonitor.recordSendEvent('medium.com', { type: 'delivered', count: 950 });
|
|
118
|
+
reputationMonitor.recordSendEvent('medium.com', { type: 'open', count: 300 });
|
|
119
|
+
|
|
120
|
+
reputationMonitor.recordSendEvent('low.com', { type: 'sent', count: 1000 });
|
|
121
|
+
reputationMonitor.recordSendEvent('low.com', { type: 'delivered', count: 850 });
|
|
122
|
+
reputationMonitor.recordSendEvent('low.com', { type: 'open', count: 100 });
|
|
123
|
+
|
|
124
|
+
// Get reputation summary
|
|
125
|
+
const summary = reputationMonitor.getReputationSummary();
|
|
126
|
+
expect(Array.isArray(summary)).toEqual(true);
|
|
127
|
+
expect(summary.length >= 3).toEqual(true);
|
|
128
|
+
|
|
129
|
+
// Check that domains are included in the summary
|
|
130
|
+
const domains = summary.map(item => item.domain);
|
|
131
|
+
expect(domains.includes('high.com')).toEqual(true);
|
|
132
|
+
expect(domains.includes('medium.com')).toEqual(true);
|
|
133
|
+
expect(domains.includes('low.com')).toEqual(true);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Test adding and removing domains
|
|
137
|
+
tap.test('should add and remove domains for monitoring', async () => {
|
|
138
|
+
resetSingleton();
|
|
139
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
140
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
141
|
+
domains: ['example.com']
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// Add a new domain
|
|
145
|
+
reputationMonitor.addDomain('newdomain.com');
|
|
146
|
+
|
|
147
|
+
// Record data for the new domain
|
|
148
|
+
reputationMonitor.recordSendEvent('newdomain.com', { type: 'sent', count: 50 });
|
|
149
|
+
|
|
150
|
+
// Check that data was recorded for the new domain
|
|
151
|
+
const metrics = reputationMonitor.getReputationData('newdomain.com');
|
|
152
|
+
expect(metrics).toBeTruthy();
|
|
153
|
+
expect(metrics.volume.sent).toEqual(50);
|
|
154
|
+
|
|
155
|
+
// Remove a domain
|
|
156
|
+
reputationMonitor.removeDomain('newdomain.com');
|
|
157
|
+
|
|
158
|
+
// Check that data is no longer available
|
|
159
|
+
const removedMetrics = reputationMonitor.getReputationData('newdomain.com');
|
|
160
|
+
expect(removedMetrics === null).toEqual(true);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Test handling open and click events
|
|
164
|
+
tap.test('should track engagement metrics correctly', async () => {
|
|
165
|
+
resetSingleton();
|
|
166
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
167
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
168
|
+
domains: ['example.com']
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// Record basic sending metrics
|
|
172
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'sent', count: 1000 });
|
|
173
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'delivered', count: 950 });
|
|
174
|
+
|
|
175
|
+
// Record engagement events
|
|
176
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'open', count: 500 });
|
|
177
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'click', count: 250 });
|
|
178
|
+
|
|
179
|
+
// Check engagement metrics
|
|
180
|
+
const metrics = reputationMonitor.getReputationData('example.com');
|
|
181
|
+
expect(metrics).toBeTruthy();
|
|
182
|
+
expect(metrics.engagement.opens).toEqual(500);
|
|
183
|
+
expect(metrics.engagement.clicks).toEqual(250);
|
|
184
|
+
expect(typeof metrics.engagement.openRate).toEqual('number');
|
|
185
|
+
expect(typeof metrics.engagement.clickRate).toEqual('number');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Test historical data tracking
|
|
189
|
+
tap.test('should store historical reputation data', async () => {
|
|
190
|
+
resetSingleton();
|
|
191
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
192
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
193
|
+
domains: ['example.com']
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Record events over multiple days
|
|
197
|
+
const today = new Date();
|
|
198
|
+
const todayStr = today.toISOString().split('T')[0];
|
|
199
|
+
|
|
200
|
+
// Record data
|
|
201
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'sent', count: 1000 });
|
|
202
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'delivered', count: 950 });
|
|
203
|
+
|
|
204
|
+
// Get metrics data
|
|
205
|
+
const metrics = reputationMonitor.getReputationData('example.com');
|
|
206
|
+
|
|
207
|
+
// Check that historical data exists
|
|
208
|
+
expect(metrics.historical).toBeTruthy();
|
|
209
|
+
expect(metrics.historical.reputationScores).toBeTruthy();
|
|
210
|
+
|
|
211
|
+
// Check that daily send volume is tracked
|
|
212
|
+
expect(metrics.volume.dailySendVolume).toBeTruthy();
|
|
213
|
+
expect(metrics.volume.dailySendVolume[todayStr]).toEqual(1000);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Test event recording for different event types
|
|
217
|
+
tap.test('should correctly handle different event types', async () => {
|
|
218
|
+
resetSingleton();
|
|
219
|
+
const reputationMonitor = SenderReputationMonitor.getInstance({
|
|
220
|
+
enabled: false, // Disable automatic updates to prevent race conditions
|
|
221
|
+
domains: ['example.com']
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Record different types of events
|
|
225
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'sent', count: 100 });
|
|
226
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'delivered', count: 95 });
|
|
227
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'bounce', hardBounce: true, count: 3 });
|
|
228
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'bounce', hardBounce: false, count: 2 });
|
|
229
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'complaint', receivingDomain: 'gmail.com', count: 1 });
|
|
230
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'open', count: 50 });
|
|
231
|
+
reputationMonitor.recordSendEvent('example.com', { type: 'click', count: 25 });
|
|
232
|
+
|
|
233
|
+
// Check metrics for different event types
|
|
234
|
+
const metrics = reputationMonitor.getReputationData('example.com');
|
|
235
|
+
|
|
236
|
+
// Check volume metrics
|
|
237
|
+
expect(metrics.volume.sent).toEqual(100);
|
|
238
|
+
expect(metrics.volume.delivered).toEqual(95);
|
|
239
|
+
expect(metrics.volume.hardBounces).toEqual(3);
|
|
240
|
+
expect(metrics.volume.softBounces).toEqual(2);
|
|
241
|
+
|
|
242
|
+
// Check complaint metrics
|
|
243
|
+
expect(metrics.complaints.total).toEqual(1);
|
|
244
|
+
expect(metrics.complaints.topDomains[0].domain).toEqual('gmail.com');
|
|
245
|
+
|
|
246
|
+
// Check engagement metrics
|
|
247
|
+
expect(metrics.engagement.opens).toEqual(50);
|
|
248
|
+
expect(metrics.engagement.clicks).toEqual(25);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// After all tests, clean up
|
|
252
|
+
tap.test('cleanup', async () => {
|
|
253
|
+
resetSingleton();
|
|
254
|
+
cleanupTestData();
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
tap.test('stop', async () => {
|
|
258
|
+
await tap.stopForcefully();
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
export default tap.start();
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
|
2
|
+
import * as plugins from '../ts/plugins.js';
|
|
3
|
+
import * as paths from '../ts/paths.js';
|
|
4
|
+
|
|
5
|
+
// Import the components we want to test
|
|
6
|
+
import { EmailValidator } from '../ts/mail/core/classes.emailvalidator.js';
|
|
7
|
+
import { TemplateManager } from '../ts/mail/core/classes.templatemanager.js';
|
|
8
|
+
import { Email } from '../ts/mail/core/classes.email.js';
|
|
9
|
+
|
|
10
|
+
// Ensure test directories exist
|
|
11
|
+
paths.ensureDirectories();
|
|
12
|
+
|
|
13
|
+
tap.test('EmailValidator - should validate email formats correctly', async (tools) => {
|
|
14
|
+
const validator = new EmailValidator();
|
|
15
|
+
|
|
16
|
+
// Test valid email formats
|
|
17
|
+
expect(validator.isValidFormat('user@example.com')).toEqual(true);
|
|
18
|
+
expect(validator.isValidFormat('firstname.lastname@example.com')).toEqual(true);
|
|
19
|
+
expect(validator.isValidFormat('user+tag@example.com')).toEqual(true);
|
|
20
|
+
|
|
21
|
+
// Test invalid email formats
|
|
22
|
+
expect(validator.isValidFormat('user@')).toEqual(false);
|
|
23
|
+
expect(validator.isValidFormat('@example.com')).toEqual(false);
|
|
24
|
+
expect(validator.isValidFormat('user@example')).toEqual(false);
|
|
25
|
+
expect(validator.isValidFormat('user.example.com')).toEqual(false);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
tap.test('EmailValidator - should perform comprehensive validation', async (tools) => {
|
|
29
|
+
const validator = new EmailValidator();
|
|
30
|
+
|
|
31
|
+
// Test basic validation (syntax-only)
|
|
32
|
+
const basicResult = await validator.validate('user@example.com', { checkSyntaxOnly: true });
|
|
33
|
+
expect(basicResult.isValid).toEqual(true);
|
|
34
|
+
expect(basicResult.details.formatValid).toEqual(true);
|
|
35
|
+
|
|
36
|
+
// We can't reliably test MX validation in all environments, but the function should run
|
|
37
|
+
const mxResult = await validator.validate('user@example.com', { checkMx: true });
|
|
38
|
+
expect(typeof mxResult.isValid).toEqual('boolean');
|
|
39
|
+
expect(typeof mxResult.hasMx).toEqual('boolean');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
tap.test('EmailValidator - should detect invalid emails', async (tools) => {
|
|
43
|
+
const validator = new EmailValidator();
|
|
44
|
+
|
|
45
|
+
const invalidResult = await validator.validate('invalid@@example.com', { checkSyntaxOnly: true });
|
|
46
|
+
expect(invalidResult.isValid).toEqual(false);
|
|
47
|
+
expect(invalidResult.details.formatValid).toEqual(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
tap.test('TemplateManager - should register and retrieve templates', async (tools) => {
|
|
51
|
+
const templateManager = new TemplateManager({
|
|
52
|
+
from: 'test@example.com'
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Register a custom template
|
|
56
|
+
templateManager.registerTemplate({
|
|
57
|
+
id: 'test-template',
|
|
58
|
+
name: 'Test Template',
|
|
59
|
+
description: 'A test template',
|
|
60
|
+
from: 'test@example.com',
|
|
61
|
+
subject: 'Test Subject: {{name}}',
|
|
62
|
+
bodyHtml: '<p>Hello, {{name}}!</p>',
|
|
63
|
+
bodyText: 'Hello, {{name}}!',
|
|
64
|
+
category: 'test'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// Get the template back
|
|
68
|
+
const template = templateManager.getTemplate('test-template');
|
|
69
|
+
expect(template).toBeTruthy();
|
|
70
|
+
expect(template.id).toEqual('test-template');
|
|
71
|
+
expect(template.subject).toEqual('Test Subject: {{name}}');
|
|
72
|
+
|
|
73
|
+
// List templates
|
|
74
|
+
const templates = templateManager.listTemplates();
|
|
75
|
+
expect(templates.length > 0).toEqual(true);
|
|
76
|
+
expect(templates.some(t => t.id === 'test-template')).toEqual(true);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
tap.test('TemplateManager - should create email from template', async (tools) => {
|
|
80
|
+
const templateManager = new TemplateManager({
|
|
81
|
+
from: 'test@example.com'
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Register a template
|
|
85
|
+
templateManager.registerTemplate({
|
|
86
|
+
id: 'welcome-test',
|
|
87
|
+
name: 'Welcome Test',
|
|
88
|
+
description: 'A welcome test template',
|
|
89
|
+
from: 'welcome@example.com',
|
|
90
|
+
subject: 'Welcome, {{name}}!',
|
|
91
|
+
bodyHtml: '<p>Hello, {{name}}! Welcome to our service.</p>',
|
|
92
|
+
bodyText: 'Hello, {{name}}! Welcome to our service.',
|
|
93
|
+
category: 'test'
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Create email from template
|
|
97
|
+
const email = await templateManager.createEmail('welcome-test', {
|
|
98
|
+
name: 'John Doe'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
expect(email).toBeTruthy();
|
|
102
|
+
expect(email.from).toEqual('welcome@example.com');
|
|
103
|
+
expect(email.getSubjectWithVariables()).toEqual('Welcome, John Doe!');
|
|
104
|
+
expect(email.getHtmlWithVariables()?.indexOf('Hello, John Doe!') > -1).toEqual(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
tap.test('Email - should handle template variables', async (tools) => {
|
|
108
|
+
// Create email with variables
|
|
109
|
+
const email = new Email({
|
|
110
|
+
from: 'sender@example.com',
|
|
111
|
+
to: 'recipient@example.com',
|
|
112
|
+
subject: 'Hello {{name}}!',
|
|
113
|
+
text: 'Welcome, {{name}}! Your order #{{orderId}} has been processed.',
|
|
114
|
+
html: '<p>Welcome, <strong>{{name}}</strong>! Your order #{{orderId}} has been processed.</p>',
|
|
115
|
+
variables: {
|
|
116
|
+
name: 'John Doe',
|
|
117
|
+
orderId: '12345'
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Test variable substitution
|
|
122
|
+
expect(email.getSubjectWithVariables()).toEqual('Hello John Doe!');
|
|
123
|
+
expect(email.getTextWithVariables()).toEqual('Welcome, John Doe! Your order #12345 has been processed.');
|
|
124
|
+
expect(email.getHtmlWithVariables().indexOf('<strong>John Doe</strong>') > -1).toEqual(true);
|
|
125
|
+
|
|
126
|
+
// Test with additional variables
|
|
127
|
+
const additionalVars = {
|
|
128
|
+
name: 'Jane Smith', // Override existing variable
|
|
129
|
+
status: 'shipped' // Add new variable
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
expect(email.getSubjectWithVariables(additionalVars)).toEqual('Hello Jane Smith!');
|
|
133
|
+
|
|
134
|
+
// Add a new variable
|
|
135
|
+
email.setVariable('trackingNumber', 'TRK123456');
|
|
136
|
+
expect(email.getTextWithVariables().indexOf('12345') > -1).toEqual(true);
|
|
137
|
+
|
|
138
|
+
// Update multiple variables at once
|
|
139
|
+
email.setVariables({
|
|
140
|
+
orderId: '67890',
|
|
141
|
+
status: 'delivered'
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
expect(email.getTextWithVariables().indexOf('67890') > -1).toEqual(true);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
tap.test('Email and Smartmail compatibility - should convert between formats', async (tools) => {
|
|
148
|
+
// Create a Smartmail instance
|
|
149
|
+
const smartmail = new plugins.smartmail.Smartmail({
|
|
150
|
+
from: 'smartmail@example.com',
|
|
151
|
+
subject: 'Test Subject',
|
|
152
|
+
body: '<p>This is a test email.</p>',
|
|
153
|
+
creationObjectRef: {
|
|
154
|
+
orderId: '12345'
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Add recipient and attachment
|
|
159
|
+
smartmail.addRecipient('recipient@example.com');
|
|
160
|
+
|
|
161
|
+
const attachment = await plugins.smartfile.SmartFile.fromString(
|
|
162
|
+
'test.txt',
|
|
163
|
+
'This is a test attachment',
|
|
164
|
+
'utf8',
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
smartmail.addAttachment(attachment);
|
|
168
|
+
|
|
169
|
+
// Convert to Email
|
|
170
|
+
const resolvedSmartmail = await smartmail;
|
|
171
|
+
const email = Email.fromSmartmail(resolvedSmartmail);
|
|
172
|
+
|
|
173
|
+
// Verify first conversion (Smartmail to Email)
|
|
174
|
+
expect(email.from).toEqual('smartmail@example.com');
|
|
175
|
+
expect(email.to.indexOf('recipient@example.com') > -1).toEqual(true);
|
|
176
|
+
expect(email.subject).toEqual('Test Subject');
|
|
177
|
+
expect(email.html?.indexOf('This is a test email') > -1).toEqual(true);
|
|
178
|
+
expect(email.attachments.length).toEqual(1);
|
|
179
|
+
|
|
180
|
+
// Convert back to Smartmail
|
|
181
|
+
const convertedSmartmail = await email.toSmartmail();
|
|
182
|
+
|
|
183
|
+
// Verify second conversion (Email back to Smartmail) with simplified assertions
|
|
184
|
+
expect(convertedSmartmail.options.from).toEqual('smartmail@example.com');
|
|
185
|
+
expect(Array.isArray(convertedSmartmail.options.to)).toEqual(true);
|
|
186
|
+
expect(convertedSmartmail.options.to.length).toEqual(1);
|
|
187
|
+
expect(convertedSmartmail.getSubject()).toEqual('Test Subject');
|
|
188
|
+
expect(convertedSmartmail.getBody(true).indexOf('This is a test email') > -1).toEqual(true);
|
|
189
|
+
expect(convertedSmartmail.attachments.length).toEqual(1);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
tap.test('Email - should validate email addresses', async (tools) => {
|
|
193
|
+
// Attempt to create an email with invalid addresses
|
|
194
|
+
let errorThrown = false;
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
const email = new Email({
|
|
198
|
+
from: 'invalid-email',
|
|
199
|
+
to: 'recipient@example.com',
|
|
200
|
+
subject: 'Test',
|
|
201
|
+
text: 'Test'
|
|
202
|
+
});
|
|
203
|
+
} catch (error) {
|
|
204
|
+
errorThrown = true;
|
|
205
|
+
expect(error.message.indexOf('Invalid sender email address') > -1).toEqual(true);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
expect(errorThrown).toEqual(true);
|
|
209
|
+
|
|
210
|
+
// Attempt with invalid recipient
|
|
211
|
+
errorThrown = false;
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
const email = new Email({
|
|
215
|
+
from: 'sender@example.com',
|
|
216
|
+
to: 'invalid-recipient',
|
|
217
|
+
subject: 'Test',
|
|
218
|
+
text: 'Test'
|
|
219
|
+
});
|
|
220
|
+
} catch (error) {
|
|
221
|
+
errorThrown = true;
|
|
222
|
+
expect(error.message.indexOf('Invalid recipient email address') > -1).toEqual(true);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
expect(errorThrown).toEqual(true);
|
|
226
|
+
|
|
227
|
+
// Valid email should not throw
|
|
228
|
+
let validEmail: Email;
|
|
229
|
+
try {
|
|
230
|
+
validEmail = new Email({
|
|
231
|
+
from: 'sender@example.com',
|
|
232
|
+
to: 'recipient@example.com',
|
|
233
|
+
subject: 'Test',
|
|
234
|
+
text: 'Test'
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
expect(validEmail).toBeTruthy();
|
|
238
|
+
expect(validEmail.from).toEqual('sender@example.com');
|
|
239
|
+
} catch (error) {
|
|
240
|
+
expect(error === undefined).toEqual(true); // This should not happen
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
tap.test('stop', async () => {
|
|
245
|
+
tap.stopForcefully();
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
export default tap.start();
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
|
2
|
+
import { smtpClientMod } from '../ts/mail/delivery/index.js';
|
|
3
|
+
import type { ISmtpClientOptions, SmtpClient } from '../ts/mail/delivery/smtpclient/index.js';
|
|
4
|
+
import { Email } from '../ts/mail/core/classes.email.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Compatibility tests for the legacy SMTP client facade
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
tap.test('verify backward compatibility - client creation', async () => {
|
|
11
|
+
// Create test configuration
|
|
12
|
+
const options: ISmtpClientOptions = {
|
|
13
|
+
host: 'smtp.example.com',
|
|
14
|
+
port: 587,
|
|
15
|
+
secure: false,
|
|
16
|
+
connectionTimeout: 10000,
|
|
17
|
+
domain: 'test.example.com'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Create SMTP client instance using legacy constructor
|
|
21
|
+
const smtpClient = smtpClientMod.createSmtpClient(options);
|
|
22
|
+
|
|
23
|
+
// Verify instance was created correctly
|
|
24
|
+
expect(smtpClient).toBeTruthy();
|
|
25
|
+
expect(smtpClient.isConnected()).toBeFalsy(); // Should start disconnected
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
tap.test('verify backward compatibility - methods exist', async () => {
|
|
29
|
+
const options: ISmtpClientOptions = {
|
|
30
|
+
host: 'smtp.example.com',
|
|
31
|
+
port: 587,
|
|
32
|
+
secure: false
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const smtpClient = smtpClientMod.createSmtpClient(options);
|
|
36
|
+
|
|
37
|
+
// Verify all expected methods exist
|
|
38
|
+
expect(typeof smtpClient.sendMail === 'function').toBeTruthy();
|
|
39
|
+
expect(typeof smtpClient.verify === 'function').toBeTruthy();
|
|
40
|
+
expect(typeof smtpClient.isConnected === 'function').toBeTruthy();
|
|
41
|
+
expect(typeof smtpClient.getPoolStatus === 'function').toBeTruthy();
|
|
42
|
+
expect(typeof smtpClient.updateOptions === 'function').toBeTruthy();
|
|
43
|
+
expect(typeof smtpClient.close === 'function').toBeTruthy();
|
|
44
|
+
expect(typeof smtpClient.on === 'function').toBeTruthy();
|
|
45
|
+
expect(typeof smtpClient.off === 'function').toBeTruthy();
|
|
46
|
+
expect(typeof smtpClient.emit === 'function').toBeTruthy();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
tap.test('verify backward compatibility - options update', async () => {
|
|
50
|
+
const options: ISmtpClientOptions = {
|
|
51
|
+
host: 'smtp.example.com',
|
|
52
|
+
port: 587,
|
|
53
|
+
secure: false
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const smtpClient = smtpClientMod.createSmtpClient(options);
|
|
57
|
+
|
|
58
|
+
// Test option updates don't throw
|
|
59
|
+
expect(() => smtpClient.updateOptions({
|
|
60
|
+
host: 'new-smtp.example.com',
|
|
61
|
+
port: 465,
|
|
62
|
+
secure: true
|
|
63
|
+
})).not.toThrow();
|
|
64
|
+
|
|
65
|
+
expect(() => smtpClient.updateOptions({
|
|
66
|
+
debug: true,
|
|
67
|
+
connectionTimeout: 5000
|
|
68
|
+
})).not.toThrow();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
tap.test('verify backward compatibility - connection failure handling', async () => {
|
|
72
|
+
const options: ISmtpClientOptions = {
|
|
73
|
+
host: 'nonexistent.invalid.domain',
|
|
74
|
+
port: 587,
|
|
75
|
+
secure: false,
|
|
76
|
+
connectionTimeout: 1000 // Short timeout for faster test
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const smtpClient = smtpClientMod.createSmtpClient(options);
|
|
80
|
+
|
|
81
|
+
// verify() should return false for invalid hosts
|
|
82
|
+
const isValid = await smtpClient.verify();
|
|
83
|
+
expect(isValid).toBeFalsy();
|
|
84
|
+
|
|
85
|
+
// sendMail should fail gracefully for invalid hosts
|
|
86
|
+
const email = new Email({
|
|
87
|
+
from: 'test@example.com',
|
|
88
|
+
to: 'recipient@example.com',
|
|
89
|
+
subject: 'Test Email',
|
|
90
|
+
text: 'This is a test email'
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
const result = await smtpClient.sendMail(email);
|
|
95
|
+
expect(result.success).toBeFalsy();
|
|
96
|
+
expect(result.error).toBeTruthy();
|
|
97
|
+
} catch (error) {
|
|
98
|
+
// Connection errors are expected for invalid domains
|
|
99
|
+
expect(error).toBeTruthy();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
tap.test('verify backward compatibility - pool status', async () => {
|
|
104
|
+
const options: ISmtpClientOptions = {
|
|
105
|
+
host: 'smtp.example.com',
|
|
106
|
+
port: 587,
|
|
107
|
+
secure: false,
|
|
108
|
+
pool: true,
|
|
109
|
+
maxConnections: 5
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const smtpClient = smtpClientMod.createSmtpClient(options);
|
|
113
|
+
|
|
114
|
+
// Get pool status
|
|
115
|
+
const status = smtpClient.getPoolStatus();
|
|
116
|
+
expect(status).toBeTruthy();
|
|
117
|
+
expect(typeof status.total === 'number').toBeTruthy();
|
|
118
|
+
expect(typeof status.active === 'number').toBeTruthy();
|
|
119
|
+
expect(typeof status.idle === 'number').toBeTruthy();
|
|
120
|
+
expect(typeof status.pending === 'number').toBeTruthy();
|
|
121
|
+
|
|
122
|
+
// Initially should have no connections
|
|
123
|
+
expect(status.total).toEqual(0);
|
|
124
|
+
expect(status.active).toEqual(0);
|
|
125
|
+
expect(status.idle).toEqual(0);
|
|
126
|
+
expect(status.pending).toEqual(0);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
tap.test('verify backward compatibility - event handling', async () => {
|
|
130
|
+
const options: ISmtpClientOptions = {
|
|
131
|
+
host: 'smtp.example.com',
|
|
132
|
+
port: 587,
|
|
133
|
+
secure: false
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const smtpClient = smtpClientMod.createSmtpClient(options);
|
|
137
|
+
|
|
138
|
+
// Test event listener methods don't throw
|
|
139
|
+
const testListener = () => {};
|
|
140
|
+
|
|
141
|
+
expect(() => smtpClient.on('test', testListener)).not.toThrow();
|
|
142
|
+
expect(() => smtpClient.off('test', testListener)).not.toThrow();
|
|
143
|
+
expect(() => smtpClient.emit('test')).not.toThrow();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
tap.test('clean up after compatibility tests', async () => {
|
|
147
|
+
// No-op - just to make sure everything is cleaned up properly
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
tap.test('stop', async () => {
|
|
151
|
+
await tap.stopForcefully();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
export default tap.start();
|