From 8f2853991ce184de999e172a387567e500bee9c4 Mon Sep 17 00:00:00 2001 From: Uros Marolt Date: Thu, 2 Feb 2023 15:11:29 +0100 Subject: [PATCH] Bugfix/typescript errors (#480) --- .github/workflows/CI-node.yaml | 3 +++ backend/src/api/index.ts | 2 +- backend/src/api/report/reportDestroy.ts | 2 +- backend/src/api/widget/widgetDestroy.ts | 2 +- backend/src/serverless/integrations/types/iteratorTypes.ts | 5 ++--- .../serverless/integrations/usecases/chat/getChannels.ts | 7 +++---- .../serverless/integrations/usecases/chat/getThreads.ts | 3 +-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI-node.yaml b/.github/workflows/CI-node.yaml index d99f7f0544..ae6ec6c240 100644 --- a/.github/workflows/CI-node.yaml +++ b/.github/workflows/CI-node.yaml @@ -37,6 +37,9 @@ jobs: - name: Check formatting run: npx prettier --check . + - name: Check typescript + run: npx tsc + tests-main: needs: lint-format runs-on: ubuntu-latest diff --git a/backend/src/api/index.ts b/backend/src/api/index.ts index 79fb63df77..de5e1c9e78 100644 --- a/backend/src/api/index.ts +++ b/backend/src/api/index.ts @@ -174,4 +174,4 @@ setImmediate(async () => { app.use(io.expressErrorHandler()) }) -export default server \ No newline at end of file +export default server diff --git a/backend/src/api/report/reportDestroy.ts b/backend/src/api/report/reportDestroy.ts index c9ca31b1da..c79c53c562 100644 --- a/backend/src/api/report/reportDestroy.ts +++ b/backend/src/api/report/reportDestroy.ts @@ -8,7 +8,7 @@ export default async (req, res) => { await new ReportService(req).destroyAll(req.query.ids) - track('Report Deleted') + track('Report Deleted', { ids: req.query.ids }, { ...req }) const payload = true diff --git a/backend/src/api/widget/widgetDestroy.ts b/backend/src/api/widget/widgetDestroy.ts index a5a6c50f69..162a26ac6e 100644 --- a/backend/src/api/widget/widgetDestroy.ts +++ b/backend/src/api/widget/widgetDestroy.ts @@ -10,7 +10,7 @@ export default async (req, res) => { const payload = true - track('Widget Deleted') + track('Widget Deleted', { ids: req.query.ids }, { ...req }) await req.responseHandler.success(req, res, payload) } diff --git a/backend/src/serverless/integrations/types/iteratorTypes.ts b/backend/src/serverless/integrations/types/iteratorTypes.ts index 07d7ec6eb0..2d95340029 100644 --- a/backend/src/serverless/integrations/types/iteratorTypes.ts +++ b/backend/src/serverless/integrations/types/iteratorTypes.ts @@ -1,5 +1,4 @@ import { AddActivitiesSingle } from './messageTypes' -import { Channels } from './regularTypes' export type IntegrationResponse = { records: Array @@ -24,11 +23,11 @@ export interface TwitterOutput extends BaseOutput { export interface TwitterReachOutput extends BaseOutput {} export interface DiscordOutput extends BaseOutput { - channels: Channels + channels: any[] } export interface SlackOutput extends BaseOutput { - channels: Channels + channels: any[] users: Object } diff --git a/backend/src/serverless/integrations/usecases/chat/getChannels.ts b/backend/src/serverless/integrations/usecases/chat/getChannels.ts index 419ba6e5be..83da8151c1 100644 --- a/backend/src/serverless/integrations/usecases/chat/getChannels.ts +++ b/backend/src/serverless/integrations/usecases/chat/getChannels.ts @@ -1,7 +1,6 @@ import { SuperfaceClient } from '@superfaceai/one-sdk' import { cleanSuperfaceError } from '../cleanError' import { createServiceChildLogger } from '../../../../utils/logging' -import { Channel, Channels } from '../../types/regularTypes' import isInvalid from '../isInvalid' import { timeout } from '../../../../utils/timing' @@ -17,7 +16,7 @@ async function tryChannel( client: SuperfaceClient, source: string, accessToken: string, - channel: Channel, + channel: any, ): Promise { try { const input = { @@ -61,11 +60,11 @@ async function getChannels( log.warn({ input, result }, 'Invalid request in getChannels') } if (tryChannels) { - const out: Channels = [] + const out: any[] = [] for (const channel of result.value.channels) { const limit = await tryChannel(client, source, accessToken, channel) if (limit) { - const toOut: Channel = { + const toOut: any = { name: channel.name, id: channel.id, } diff --git a/backend/src/serverless/integrations/usecases/chat/getThreads.ts b/backend/src/serverless/integrations/usecases/chat/getThreads.ts index 95c2c49b0b..3a60d029cb 100644 --- a/backend/src/serverless/integrations/usecases/chat/getThreads.ts +++ b/backend/src/serverless/integrations/usecases/chat/getThreads.ts @@ -1,5 +1,4 @@ import { SuperfaceClient } from '@superfaceai/one-sdk' -import { Channels } from '../../types/regularTypes' import isInvalid from '../isInvalid' import { PlatformType } from '../../../../types/integrationEnums' import { createServiceChildLogger } from '../../../../utils/logging' @@ -11,7 +10,7 @@ async function getChannels( client: SuperfaceClient, serverId: string, accessToken: string, -): Promise { +): Promise { try { const input = { server: serverId.toString() } const profile = await client.getProfile('chat/threads')