<commit_before>import nodeMailer, { SentMessageInfo } from 'nodemailer';
import { messaging as firebaseMessaging } from 'firebase-admin';
import Mail from '@/interfaces/Mail';
import PlatformMailTransporter from '@/interfaces/PlatformMailTransporter';
import PlatformPushTransporter from '@/interfaces/PlatformPushTransporter';
import Utils from '../utils';

export default abstract class BaseService {
  // region public static methods
  // endregion

  // region private static methods
  // endregion

  // region public members
  // endregion

  // region private members

  private readonly transporters: any[] = [];

  // endregion

  // region constructor
  // endregion

  // region public methods

  public async send(platformId: string, message: Mail | firebaseMessaging.Message): Promise<SentMessageInfo | string> {
    try {
      const transporter = this.getTransporter(platformId);
      return this._send(transporter, message);
    } catch (e) {
      return Promise.reject(new Error('Invalid platformId. Platform config not found.'));
    }
  }

  // endregion

  // region private methods

  protected abstract _send(transporter: nodeMailer.Transporter | firebaseMessaging.Messaging, message: Mail | firebaseMessaging.Message): Promise<SentMessageInfo | string>;

  protected abstract _createTransporter(config: any): nodeMailer.Transporter | firebaseMessaging.Messaging;

  private createTransporter(platformId: string): nodeMailer.Transporter | firebaseMessaging.Messaging {
    const config = Utils.getPlatformConfig(platformId);
    const transporter = this._createTransporter(config);
    const platformPushTransporter = {
      platformId,
      transporter,
    };
    this.transporters.push(platformPushTransporter);<commit_msg>Fix lint issue<commit_after>import nodeMailer, { SentMessageInfo } from 'nodemailer';
import { messaging as firebaseMessaging } from 'firebase-admin';
import Mail from '@/interfaces/Mail';
import PlatformMailTransporter from '@/interfaces/PlatformMailTransporter';
import PlatformPushTransporter from '@/interfaces/PlatformPushTransporter';
import Utils from '../utils';

export default abstract class BaseService {
  // region public static methods
  // endregion

  // region private static methods
  // endregion

  // region public members
  // endregion

  // region private members

  private readonly transporters: any[] = [];

  // endregion

  // region constructor
  // endregion

  // region public methods

  public async send(platformId: string, message: Mail | firebaseMessaging.Message): Promise<SentMessageInfo | string> {
    try {
      const transporter = this.getTransporter(platformId);
      return this._send(transporter, message);
    } catch (e) {
      return Promise.reject(new Error('Invalid platformId. Platform config not found.'));
    }
  }

  // endregion

  // region private methods

  protected abstract _send(transporter: nodeMailer.Transporter | firebaseMessaging.Messaging,
                           message: Mail | firebaseMessaging.Message): Promise<SentMessageInfo | string>;

  protected abstract _createTransporter(config: any): nodeMailer.Transporter | firebaseMessaging.Messaging;

  private createTransporter(platformId: string): nodeMailer.Transporter | firebaseMessaging.Messaging {
    const config = Utils.getPlatformConfig(platformId);
    const transporter = this._createTransporter(config);
    const platformPushTransporter = {
      platformId,
      transporter,
    };
    this.transporters.push(platformPushTransporter);
{'fraction_non_alphanumeric': 0.0928652321630804, 'fraction_numerical': 0.0, 'mean_word_length': 4.150145772594752, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3367837', 'n_tokens_mistral': 953, 'n_tokens_neox': 894, 'n_words': 245}