From e34ac3c48553b4e742a0454b981aa27f52f904cb Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Sun, 9 Oct 2022 15:08:19 +0200 Subject: [PATCH] chore: remove unused smtp app --- .../backend/src/apps/smtp/assets/favicon.svg | 6 - .../backend/src/apps/smtp/authentication.ts | 44 ---- packages/backend/src/apps/smtp/index.d.ts | 0 packages/backend/src/apps/smtp/index.ts | 15 -- packages/backend/src/apps/smtp/info.json | 201 ------------------ 5 files changed, 266 deletions(-) delete mode 100644 packages/backend/src/apps/smtp/assets/favicon.svg delete mode 100644 packages/backend/src/apps/smtp/authentication.ts delete mode 100644 packages/backend/src/apps/smtp/index.d.ts delete mode 100644 packages/backend/src/apps/smtp/index.ts delete mode 100644 packages/backend/src/apps/smtp/info.json diff --git a/packages/backend/src/apps/smtp/assets/favicon.svg b/packages/backend/src/apps/smtp/assets/favicon.svg deleted file mode 100644 index 44b0edb4..00000000 --- a/packages/backend/src/apps/smtp/assets/favicon.svg +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/packages/backend/src/apps/smtp/authentication.ts b/packages/backend/src/apps/smtp/authentication.ts deleted file mode 100644 index 65dfd609..00000000 --- a/packages/backend/src/apps/smtp/authentication.ts +++ /dev/null @@ -1,44 +0,0 @@ -import nodemailer, { Transporter, TransportOptions } from 'nodemailer'; -import type { - IAuthentication, - IApp, - IJSONObject, -} from '@automatisch/types'; - -export default class Authentication implements IAuthentication { - appData: IApp; - connectionData: IJSONObject; - client: Transporter; - - constructor(appData: IApp, connectionData: IJSONObject) { - this.client = nodemailer.createTransport({ - host: connectionData.host, - port: connectionData.port, - secure: connectionData.useTls, - auth: { - user: connectionData.username, - pass: connectionData.password, - }, - } as TransportOptions); - - this.connectionData = connectionData; - this.appData = appData; - } - - async verifyCredentials() { - await this.client.verify(); - - return { - screenName: this.connectionData.username, - }; - } - - async isStillVerified() { - try { - await this.client.verify(); - return true; - } catch (error) { - return false; - } - } -} diff --git a/packages/backend/src/apps/smtp/index.d.ts b/packages/backend/src/apps/smtp/index.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/backend/src/apps/smtp/index.ts b/packages/backend/src/apps/smtp/index.ts deleted file mode 100644 index 8698d03b..00000000 --- a/packages/backend/src/apps/smtp/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import Authentication from './authentication'; -import { - IService, - IAuthentication, - IApp, - IJSONObject, -} from '@automatisch/types'; - -export default class SMTP implements IService { - authenticationClient: IAuthentication; - - constructor(appData: IApp, connectionData: IJSONObject) { - this.authenticationClient = new Authentication(appData, connectionData); - } -} diff --git a/packages/backend/src/apps/smtp/info.json b/packages/backend/src/apps/smtp/info.json deleted file mode 100644 index e0317d17..00000000 --- a/packages/backend/src/apps/smtp/info.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "name": "SMTP", - "key": "smtp", - "iconUrl": "{BASE_URL}/apps/smtp/assets/favicon.svg", - "docUrl": "https://automatisch.io/docs/smtp", - "primaryColor": "2DAAE1", - "supportsConnections": true, - "fields": [ - { - "key": "host", - "label": "Host", - "type": "string", - "required": true, - "readOnly": false, - "value": null, - "placeholder": null, - "description": "The host information Automatisch will connect to.", - "docUrl": "https://automatisch.io/docs/smtp#host", - "clickToCopy": false - }, - { - "key": "username", - "label": "Email/Username", - "type": "string", - "required": true, - "readOnly": false, - "value": null, - "placeholder": null, - "description": "Your SMTP login credentials.", - "docUrl": "https://automatisch.io/docs/smtp#username", - "clickToCopy": false - }, - { - "key": "password", - "label": "Password", - "type": "string", - "required": true, - "readOnly": false, - "value": null, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/smtp#password", - "clickToCopy": false - }, - { - "key": "useTls", - "label": "Use TLS?", - "type": "boolean", - "required": false, - "readOnly": false, - "value": false, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/smtp#use-tls", - "clickToCopy": false - }, - { - "key": "port", - "label": "Port", - "type": "integer", - "required": false, - "readOnly": false, - "value": 25, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/smtp#port", - "clickToCopy": false - }, - { - "key": "fromEmail", - "label": "From Email", - "type": "string", - "required": false, - "readOnly": false, - "value": null, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/smtp#from-email", - "clickToCopy": false - } - ], - "authenticationSteps": [ - { - "step": 1, - "type": "mutation", - "name": "createConnection", - "arguments": [ - { - "name": "key", - "value": "{key}" - }, - { - "name": "formattedData", - "value": null, - "properties": [ - { - "name": "host", - "value": "{fields.host}" - }, - { - "name": "username", - "value": "{fields.username}" - }, - { - "name": "password", - "value": "{fields.password}" - }, - { - "name": "useTLS", - "value": "{fields.useTls}" - }, - { - "name": "port", - "value": "{fields.port}" - }, - { - "name": "fromEmail", - "value": "{fields.fromEmail}" - } - ] - } - ] - }, - { - "step": 2, - "type": "mutation", - "name": "verifyConnection", - "arguments": [ - { - "name": "id", - "value": "{createConnection.id}" - } - ] - } - ], - "reconnectionSteps": [ - { - "step": 1, - "type": "mutation", - "name": "resetConnection", - "arguments": [ - { - "name": "id", - "value": "{connection.id}" - } - ] - }, - { - "step": 2, - "type": "mutation", - "name": "updateConnection", - "arguments": [ - { - "name": "id", - "value": "{connection.id}" - }, - { - "name": "formattedData", - "value": null, - "properties": [ - { - "name": "host", - "value": "{fields.host}" - }, - { - "name": "username", - "value": "{fields.username}" - }, - { - "name": "password", - "value": "{fields.password}" - }, - { - "name": "useTLS", - "value": "{fields.useTls}" - }, - { - "name": "port", - "value": "{fields.port}" - }, - { - "name": "fromEmail", - "value": "{fields.fromEmail}" - } - ] - } - ] - }, - { - "step": 3, - "type": "mutation", - "name": "verifyConnection", - "arguments": [ - { - "name": "id", - "value": "{connection.id}" - } - ] - } - ] -}