fix: Backend eslint warnings
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
ecc9239bfe
commit
775ac7a8b1
@@ -1,17 +1,22 @@
|
||||
import type { IField } from '@automatisch/types';
|
||||
import type {
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IField,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
import { URLSearchParams } from 'url';
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
|
||||
export default class Authentication {
|
||||
appData: any;
|
||||
connectionData: any;
|
||||
export default class Authentication implements IAuthentication {
|
||||
appData: IApp;
|
||||
connectionData: IJSONObject;
|
||||
client: AxiosInstance = axios.create({
|
||||
baseURL: 'https://discord.com/api/',
|
||||
});
|
||||
|
||||
scope: string[] = ['identify', 'email'];
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.appData = appData;
|
||||
this.connectionData = connectionData;
|
||||
}
|
||||
@@ -24,7 +29,7 @@ export default class Authentication {
|
||||
|
||||
async createAuthData() {
|
||||
const searchParams = new URLSearchParams({
|
||||
client_id: this.connectionData.consumerKey,
|
||||
client_id: this.connectionData.consumerKey as string,
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
response_type: 'code',
|
||||
scope: this.scope.join(' '),
|
||||
@@ -37,15 +42,15 @@ export default class Authentication {
|
||||
|
||||
async verifyCredentials() {
|
||||
const params = new URLSearchParams({
|
||||
client_id: this.connectionData.consumerKey,
|
||||
client_id: this.connectionData.consumerKey as string,
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
response_type: 'code',
|
||||
scope: this.scope.join(' '),
|
||||
client_secret: this.connectionData.consumerSecret,
|
||||
code: this.connectionData.oauthVerifier,
|
||||
client_secret: this.connectionData.consumerSecret as string,
|
||||
code: this.connectionData.oauthVerifier as string,
|
||||
grant_type: 'authorization_code',
|
||||
});
|
||||
const { data: verifiedCredentials }: any = await this.client.post(
|
||||
const { data: verifiedCredentials } = await this.client.post(
|
||||
'/oauth2/token',
|
||||
params.toString()
|
||||
);
|
||||
@@ -58,7 +63,7 @@ export default class Authentication {
|
||||
token_type: tokenType,
|
||||
} = verifiedCredentials;
|
||||
|
||||
const { data: user }: any = await this.client.get('/users/@me', {
|
||||
const { data: user } = await this.client.get('/users/@me', {
|
||||
headers: {
|
||||
Authorization: `${tokenType} ${accessToken}`,
|
||||
},
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Discord {
|
||||
authenticationClient: any;
|
||||
export default class Discord implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Firebase {
|
||||
authenticationClient: any;
|
||||
export default class Firebase implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Flickr {
|
||||
authenticationClient: any;
|
||||
export default class Flickr implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Github {
|
||||
authenticationClient: any;
|
||||
export default class Github implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,4 @@
|
||||
import type {
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IField,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
import type { IAuthentication, IApp, IJSONObject } from '@automatisch/types';
|
||||
import { Client } from 'pg';
|
||||
|
||||
export default class Authentication implements IAuthentication {
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class PostgreSQL {
|
||||
authenticationClient: any;
|
||||
export default class PostgreSQL implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class SMTP {
|
||||
authenticationClient: any;
|
||||
export default class SMTP implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Twilio {
|
||||
authenticationClient: any;
|
||||
export default class Twilio implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Twitch {
|
||||
authenticationClient: any;
|
||||
export default class Twitch implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import CreateTweet from './actions/create-tweet';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class Actions {
|
||||
createTweet: any
|
||||
createTweet: CreateTweet;
|
||||
|
||||
constructor(connectionData: any, parameters: any) {
|
||||
this.createTweet = new CreateTweet(connectionData, parameters)
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
this.createTweet = new CreateTweet(connectionData, parameters);
|
||||
}
|
||||
}
|
||||
|
@@ -1,22 +1,23 @@
|
||||
import TwitterApi from 'twitter-api-v2';
|
||||
import TwitterApi, { TwitterApiTokens } from 'twitter-api-v2';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class CreateTweet {
|
||||
client: any;
|
||||
parameters: any;
|
||||
client: TwitterApi;
|
||||
parameters: IJSONObject;
|
||||
|
||||
constructor(connectionData: any, parameters: any) {
|
||||
constructor(connectionData: IJSONObject, parameters: IJSONObject) {
|
||||
this.client = new TwitterApi({
|
||||
appKey: connectionData.consumerKey,
|
||||
appSecret: connectionData.consumerSecret,
|
||||
accessToken: connectionData.accessToken,
|
||||
accessSecret: connectionData.accessSecret,
|
||||
});
|
||||
} as TwitterApiTokens);
|
||||
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
async run() {
|
||||
const tweet = await this.client.v1.tweet(this.parameters.tweet);
|
||||
const tweet = await this.client.v1.tweet(this.parameters.tweet as string);
|
||||
return tweet;
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,23 @@
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
import Authentication from './authentication';
|
||||
import Triggers from './triggers';
|
||||
import Actions from './actions';
|
||||
|
||||
export default class Twitter {
|
||||
authenticationClient: any;
|
||||
triggers: any;
|
||||
actions: any;
|
||||
export default class Twitter implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
triggers: Triggers;
|
||||
actions: Actions;
|
||||
|
||||
constructor(appData: any, connectionData: any, parameters: any) {
|
||||
constructor(
|
||||
appData: IApp,
|
||||
connectionData: IJSONObject,
|
||||
parameters: IJSONObject
|
||||
) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
this.triggers = new Triggers(connectionData);
|
||||
this.actions = new Actions(connectionData, parameters);
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import MyTweet from './triggers/my-tweet';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class Triggers {
|
||||
myTweet: any
|
||||
myTweet: MyTweet;
|
||||
|
||||
constructor(connectionData: any) {
|
||||
this.myTweet = new MyTweet(connectionData)
|
||||
constructor(connectionData: IJSONObject) {
|
||||
this.myTweet = new MyTweet(connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,15 +1,16 @@
|
||||
import TwitterApi from 'twitter-api-v2';
|
||||
import TwitterApi, { TwitterApiTokens } from 'twitter-api-v2';
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
|
||||
export default class MyTweet {
|
||||
client: any
|
||||
client: TwitterApi;
|
||||
|
||||
constructor(connectionData: any) {
|
||||
constructor(connectionData: IJSONObject) {
|
||||
this.client = new TwitterApi({
|
||||
appKey: connectionData.consumerKey,
|
||||
appSecret: connectionData.consumerSecret,
|
||||
accessToken: connectionData.accessToken,
|
||||
accessSecret: connectionData.accessSecret
|
||||
});
|
||||
accessSecret: connectionData.accessSecret,
|
||||
} as TwitterApiTokens);
|
||||
}
|
||||
|
||||
async run() {
|
||||
|
@@ -56,7 +56,7 @@ export default class Authentication implements IAuthentication {
|
||||
redirect_uri: this.oauthRedirectUrl,
|
||||
});
|
||||
|
||||
const { data: verifiedCredentials }: any = await this.client.post(
|
||||
const { data: verifiedCredentials } = await this.client.post(
|
||||
'/oauth/token',
|
||||
params.toString()
|
||||
);
|
||||
@@ -67,7 +67,7 @@ export default class Authentication implements IAuthentication {
|
||||
token_type: tokenType,
|
||||
} = verifiedCredentials;
|
||||
|
||||
const { data: user }: any = await this.client.get('/me', {
|
||||
const { data: user } = await this.client.get('/me', {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
|
@@ -1,9 +1,15 @@
|
||||
import Authentication from './authentication';
|
||||
import {
|
||||
IService,
|
||||
IAuthentication,
|
||||
IApp,
|
||||
IJSONObject,
|
||||
} from '@automatisch/types';
|
||||
|
||||
export default class Typeform {
|
||||
authenticationClient: any;
|
||||
export default class Typeform implements IService {
|
||||
authenticationClient: IAuthentication;
|
||||
|
||||
constructor(appData: any, connectionData: any) {
|
||||
constructor(appData: IApp, connectionData: IJSONObject) {
|
||||
this.authenticationClient = new Authentication(appData, connectionData);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import Context from '../../types/express/context';
|
||||
import Processor from '../../services/processor';
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import processorQueue from '../../queues/processor';
|
||||
|
||||
type Params = {
|
||||
|
@@ -6,8 +6,8 @@ class ExecutionStep extends Base {
|
||||
id!: string;
|
||||
executionId!: string;
|
||||
stepId!: string;
|
||||
dataIn!: any;
|
||||
dataOut!: any;
|
||||
dataIn!: Record<string, unknown>;
|
||||
dataOut!: Record<string, unknown>;
|
||||
status: string;
|
||||
|
||||
static tableName = 'execution_steps';
|
||||
|
6
packages/types/index.d.ts
vendored
6
packages/types/index.d.ts
vendored
@@ -114,11 +114,15 @@ export interface IApp {
|
||||
connections: IConnection[];
|
||||
}
|
||||
|
||||
export interface IService {
|
||||
authenticationClient: IAuthentication;
|
||||
}
|
||||
|
||||
export interface IAuthentication {
|
||||
appData: IApp;
|
||||
connectionData: IJSONObject;
|
||||
client: unknown;
|
||||
verifyCredentials(): Promise<JSONObject>;
|
||||
verifyCredentials(): Promise<IJSONObject>;
|
||||
isStillVerified(): Promise<boolean>;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user