import { c as u$1 } from './chunk-QBAGENBN.cjs'; import { a as n, b as o } from './chunk-2SR2TPRO.cjs'; import { Injectable, Global, Module } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { from, tap, catchError, throwError, of } from 'rxjs'; import '@tonysamperi/logger'; import 'winston'; import 'winston-transport'; function b(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var c=o.length-1;c>=0;c--)(s=o[c])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r}n(b,"_ts_decorate");function g(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)}n(g,"_ts_metadata");var m=class m{_configSrv;_loggerSrv;_transporter;constructor(t,e){this._configSrv=t,this._loggerSrv=e,this._init();}sendEmail(t){return from(this._transporter.sendMail(t)).pipe(tap(e=>{this._loggerSrv.info(`${this.constructor.name}: email sent successfully: ${e.messageId}`);}),catchError(e=>(this._loggerSrv.error(`${this.constructor.name}: failed to send email: ${e.message}`,e.stack),throwError(()=>e))))}verifyConnection(){return from(this._transporter.verify()).pipe(tap(()=>this._loggerSrv.info(`${this.constructor.name}: SMTP connection verified successfully`)),catchError(t=>(this._loggerSrv.error(`${this.constructor.name}: SMTP connection verification failed: ${t.message}`,t.stack),of(false))))}_init(){let t=o("nodemailer");this._transporter=t.createTransport({host:this._configSrv.get("smtp.host"),port:this._configSrv.get("smtp.port")||587,secure:this._configSrv.get("smtp.secure")||false,auth:{user:this._configSrv.get("smtp.user"),pass:this._configSrv.get("smtp.password")}});}};n(m,"SmpSmtpService");var p=m;p=b([Injectable(),g("design:type",Function),g("design:paramtypes",[typeof ConfigService>"u"?Object:ConfigService,typeof u$1>"u"?Object:u$1])],p);function O(o,t,e,n){var i=arguments.length,r=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(o,t,e,n);else for(var c=o.length-1;c>=0;c--)(s=o[c])&&(r=(i<3?s(r):i>3?s(t,e,r):s(t,e))||r);return i>3&&r&&Object.defineProperty(t,e,r),r}n(O,"_ts_decorate");var u=class u{};n(u,"SmpSmtpModule");var a=u;a=O([Global(),Module({imports:[],providers:[p],exports:[p]})],a); export { p as a, a as b };