From b0dc0adf0e47e823ea94f245597246512a4272c9 Mon Sep 17 00:00:00 2001 From: Faruk AYDIN Date: Sat, 22 Oct 2022 21:09:38 +0200 Subject: [PATCH] chore: Remove postgresql app with the old architecture --- .../src/apps/postgresql/assets/favicon.svg | 10 - .../src/apps/postgresql/authentication.ts | 39 ---- .../backend/src/apps/postgresql/index.d.ts | 0 packages/backend/src/apps/postgresql/index.ts | 15 -- .../backend/src/apps/postgresql/info.json | 201 ------------------ 5 files changed, 265 deletions(-) delete mode 100644 packages/backend/src/apps/postgresql/assets/favicon.svg delete mode 100644 packages/backend/src/apps/postgresql/authentication.ts delete mode 100644 packages/backend/src/apps/postgresql/index.d.ts delete mode 100644 packages/backend/src/apps/postgresql/index.ts delete mode 100644 packages/backend/src/apps/postgresql/info.json diff --git a/packages/backend/src/apps/postgresql/assets/favicon.svg b/packages/backend/src/apps/postgresql/assets/favicon.svg deleted file mode 100644 index 0bdb3e3e..00000000 --- a/packages/backend/src/apps/postgresql/assets/favicon.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/backend/src/apps/postgresql/authentication.ts b/packages/backend/src/apps/postgresql/authentication.ts deleted file mode 100644 index 5f3db4a9..00000000 --- a/packages/backend/src/apps/postgresql/authentication.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { IAuthentication, IApp, IJSONObject } from '@automatisch/types'; -import { Client } from 'pg'; - -export default class Authentication implements IAuthentication { - appData: IApp; - connectionData: IJSONObject; - client: Client; - - constructor(appData: IApp, connectionData: IJSONObject) { - this.client = new Client({ - host: connectionData.host as string, - port: connectionData.port as number, - database: connectionData.database as string, - user: connectionData.username as string, - password: connectionData.password as string, - ssl: connectionData.ssl as boolean, - }); - - this.connectionData = connectionData; - this.appData = appData; - } - - async verifyCredentials() { - await this.client.connect(); - - return { - screenName: this.connectionData.database, - }; - } - - async isStillVerified() { - try { - await this.client.connect(); - return true; - } catch (error) { - return false; - } - } -} diff --git a/packages/backend/src/apps/postgresql/index.d.ts b/packages/backend/src/apps/postgresql/index.d.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/backend/src/apps/postgresql/index.ts b/packages/backend/src/apps/postgresql/index.ts deleted file mode 100644 index 24a44bec..00000000 --- a/packages/backend/src/apps/postgresql/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import Authentication from './authentication'; -import { - IService, - IAuthentication, - IApp, - IJSONObject, -} from '@automatisch/types'; - -export default class PostgreSQL implements IService { - authenticationClient: IAuthentication; - - constructor(appData: IApp, connectionData: IJSONObject) { - this.authenticationClient = new Authentication(appData, connectionData); - } -} diff --git a/packages/backend/src/apps/postgresql/info.json b/packages/backend/src/apps/postgresql/info.json deleted file mode 100644 index 535b9394..00000000 --- a/packages/backend/src/apps/postgresql/info.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "name": "PostgreSQL", - "key": "postgresql", - "iconUrl": "{BASE_URL}/apps/postgresql/assets/favicon.svg", - "docUrl": "https://automatisch.io/docs/postgresql", - "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/postgresql#host", - "clickToCopy": false - }, - { - "key": "port", - "label": "Port", - "type": "integer", - "required": true, - "readOnly": false, - "value": 5432, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/postgresql#port", - "clickToCopy": false - }, - { - "key": "database", - "label": "Database", - "type": "string", - "required": true, - "readOnly": false, - "value": null, - "placeholder": null, - "description": "The name of the database.", - "docUrl": "https://automatisch.io/docs/postgresql#password", - "clickToCopy": false - }, - { - "key": "username", - "label": "Username", - "type": "string", - "required": true, - "readOnly": false, - "value": null, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/postgresql#username", - "clickToCopy": false - }, - { - "key": "password", - "label": "Password", - "type": "string", - "required": false, - "readOnly": false, - "value": null, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/postgresql#password", - "clickToCopy": false - }, - { - "key": "ssl", - "label": "Use SSL?", - "type": "boolean", - "required": true, - "readOnly": false, - "value": false, - "placeholder": null, - "description": null, - "docUrl": "https://automatisch.io/docs/postgresql#ssl", - "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": "port", - "value": "{fields.port}" - }, - { - "name": "database", - "value": "{fields.database}" - }, - { - "name": "username", - "value": "{fields.username}" - }, - { - "name": "password", - "value": "{fields.password}" - }, - { - "name": "ssl", - "value": "{fields.ssl}" - } - ] - } - ] - }, - { - "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": "port", - "value": "{fields.port}" - }, - { - "name": "database", - "value": "{fields.database}" - }, - { - "name": "username", - "value": "{fields.username}" - }, - { - "name": "password", - "value": "{fields.password}" - }, - { - "name": "ssl", - "value": "{fields.ssl}" - } - ] - } - ] - }, - { - "step": 3, - "type": "mutation", - "name": "verifyConnection", - "arguments": [ - { - "name": "id", - "value": "{connection.id}" - } - ] - } - ] -}