From a8da464d6674f819bc92746f448910b06e723a42 Mon Sep 17 00:00:00 2001 From: Flavien David Date: Tue, 16 Jan 2024 18:32:39 +0100 Subject: [PATCH] :shirt: --- .../20231109_incident_gdrive_non_deleted_files.ts | 11 ++++------- .../src/api/slack_channels_linked_with_agent.ts | 11 ++++------- connectors/src/connectors/google_drive/index.ts | 11 ++++------- connectors/src/connectors/notion/index.ts | 11 ++++------- connectors/src/connectors/notion/lib/cli.ts | 5 +++-- connectors/src/connectors/notion/lib/notion_api.ts | 2 +- .../src/connectors/notion/temporal/activities.ts | 11 ++++------- .../src/connectors/notion/temporal/workflows.ts | 9 +++++---- connectors/src/connectors/slack/index.ts | 11 ++++------- connectors/src/connectors/webcrawler/index.ts | 11 ++++------- connectors/src/lib/temporal_monitoring.ts | 5 +++-- 11 files changed, 40 insertions(+), 58 deletions(-) diff --git a/connectors/migrations/20231109_incident_gdrive_non_deleted_files.ts b/connectors/migrations/20231109_incident_gdrive_non_deleted_files.ts index 8224bd2cf41c..86a169dae852 100644 --- a/connectors/migrations/20231109_incident_gdrive_non_deleted_files.ts +++ b/connectors/migrations/20231109_incident_gdrive_non_deleted_files.ts @@ -34,13 +34,10 @@ async function main() { console.log(`Connector ${c.id}: found ${files.length} files`); - const fileHash = files.reduce( - (acc, f) => { - acc[f.dustFileId] = f.id; - return acc; - }, - {} as { [key: string]: number } - ); + const fileHash = files.reduce((acc, f) => { + acc[f.dustFileId] = f.id; + return acc; + }, {} as { [key: string]: number }); // find dustProjectId from front based on workspaceId and connectorName const dsData = await front_sequelize.query( diff --git a/connectors/src/api/slack_channels_linked_with_agent.ts b/connectors/src/api/slack_channels_linked_with_agent.ts index 58b1231d511b..10023e39ef22 100644 --- a/connectors/src/api/slack_channels_linked_with_agent.ts +++ b/connectors/src/api/slack_channels_linked_with_agent.ts @@ -74,13 +74,10 @@ const _patchSlackChannelsLinkedWithAgentHandler = async ( const remoteChannels = ( await getChannels(parseInt(connectorId), false) ).flatMap((c) => (c.id && c.name ? [{ id: c.id, name: c.name }] : [])); - const remoteChannelsById = remoteChannels.reduce( - (acc, ch) => { - acc[ch.id] = ch; - return acc; - }, - {} as Record - ); + const remoteChannelsById = remoteChannels.reduce((acc, ch) => { + acc[ch.id] = ch; + return acc; + }, {} as Record); const createdChannels = await Promise.all( missingSlackChannelIds.map((slackChannelId) => { const remoteChannel = remoteChannelsById[slackChannelId]; diff --git a/connectors/src/connectors/google_drive/index.ts b/connectors/src/connectors/google_drive/index.ts index 43fd3865225d..6b6adba83e8d 100644 --- a/connectors/src/connectors/google_drive/index.ts +++ b/connectors/src/connectors/google_drive/index.ts @@ -616,13 +616,10 @@ export async function retrieveGoogleDriveObjectsTitles( }, }); - const titles = googleDriveFiles.reduce( - (acc, curr) => { - acc[curr.driveFileId] = curr.name; - return acc; - }, - {} as Record - ); + const titles = googleDriveFiles.reduce((acc, curr) => { + acc[curr.driveFileId] = curr.name; + return acc; + }, {} as Record); return new Ok(titles); } diff --git a/connectors/src/connectors/notion/index.ts b/connectors/src/connectors/notion/index.ts index 9787cc9e902d..3f523550954a 100644 --- a/connectors/src/connectors/notion/index.ts +++ b/connectors/src/connectors/notion/index.ts @@ -480,13 +480,10 @@ export async function retrieveNotionResourcesTitles( .concat( dbs.map((db) => ({ internalId: db.notionDatabaseId, title: db.title })) ) - .reduce( - (acc, { internalId, title }) => { - acc[internalId] = title ?? null; - return acc; - }, - {} as Record - ); + .reduce((acc, { internalId, title }) => { + acc[internalId] = title ?? null; + return acc; + }, {} as Record); return new Ok(titles); } diff --git a/connectors/src/connectors/notion/lib/cli.ts b/connectors/src/connectors/notion/lib/cli.ts index 6a8819d0d339..d4ee166b894f 100644 --- a/connectors/src/connectors/notion/lib/cli.ts +++ b/connectors/src/connectors/notion/lib/cli.ts @@ -38,8 +38,9 @@ export async function searchNotionPagesForQuery({ page_size: 20, }); - const skippedDatabaseIds = - await listSkippedDatabaseIdsForConnectorId(connectorId); + const skippedDatabaseIds = await listSkippedDatabaseIdsForConnectorId( + connectorId + ); return pages.results.map((p) => ({ id: p.id, diff --git a/connectors/src/connectors/notion/lib/notion_api.ts b/connectors/src/connectors/notion/lib/notion_api.ts index af3c063194e3..5bcef7108aee 100644 --- a/connectors/src/connectors/notion/lib/notion_api.ts +++ b/connectors/src/connectors/notion/lib/notion_api.ts @@ -1176,7 +1176,7 @@ export async function* iteratePaginatedAPIWithRetries< Args extends { start_cursor?: string; }, - Item, + Item >( listFn: (args: Args) => Promise>, firstPageArgs: Args, diff --git a/connectors/src/connectors/notion/temporal/activities.ts b/connectors/src/connectors/notion/temporal/activities.ts index f31f882b53cb..fd029a490422 100644 --- a/connectors/src/connectors/notion/temporal/activities.ts +++ b/connectors/src/connectors/notion/temporal/activities.ts @@ -1578,13 +1578,10 @@ export async function renderAndUpsertPageFromCache({ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion b.childDatabaseTitle!, })) - .reduce( - (acc, { id, title }) => { - acc[id] = title; - return acc; - }, - {} as Record - ); + .reduce((acc, { id, title }) => { + acc[id] = title; + return acc; + }, {} as Record); localLogger.info( "notionRenderAndUpsertPageFromCache: Retrieving child database pages from cache." diff --git a/connectors/src/connectors/notion/temporal/workflows.ts b/connectors/src/connectors/notion/temporal/workflows.ts index 9a3d252830df..a218f3912537 100644 --- a/connectors/src/connectors/notion/temporal/workflows.ts +++ b/connectors/src/connectors/notion/temporal/workflows.ts @@ -125,8 +125,8 @@ export async function notionSyncWorkflow({ runType: isGarbageCollectionRun ? "garbageCollection" : isInitialSync - ? "initialSync" - : "incrementalSync", + ? "initialSync" + : "incrementalSync", }, }); cursor = nextCursor; @@ -157,8 +157,9 @@ export async function notionSyncWorkflow({ // these are resources (pages/DBs) that we didn't get from the search API but that are child pages/DBs // of other pages that we did get from the search API. // We upsert those as well. - const discoveredResources = - await getDiscoveredResourcesFromCache(connectorId); + const discoveredResources = await getDiscoveredResourcesFromCache( + connectorId + ); await performUpserts({ connectorId, pageIds: discoveredResources.pageIds, diff --git a/connectors/src/connectors/slack/index.ts b/connectors/src/connectors/slack/index.ts index db7f27632be5..50016b29aa3c 100644 --- a/connectors/src/connectors/slack/index.ts +++ b/connectors/src/connectors/slack/index.ts @@ -445,13 +445,10 @@ export async function retrieveSlackConnectorPermissions({ }, }), ]); - const localChannelsById = localChannels.reduce( - (acc, ch) => { - acc[ch.slackChannelId] = ch; - return acc; - }, - {} as Record - ); + const localChannelsById = localChannels.reduce((acc, ch) => { + acc[ch.slackChannelId] = ch; + return acc; + }, {} as Record); for (const remoteChannel of remoteChannels) { if (!remoteChannel.id || !remoteChannel.name) { diff --git a/connectors/src/connectors/webcrawler/index.ts b/connectors/src/connectors/webcrawler/index.ts index e9f3366c6bd7..a0eb84df5710 100644 --- a/connectors/src/connectors/webcrawler/index.ts +++ b/connectors/src/connectors/webcrawler/index.ts @@ -221,13 +221,10 @@ export async function retrieveWebCrawlerObjectsTitles( }, }); - const titles = googleDriveFiles.reduce( - (acc, curr) => { - acc[curr.url] = curr.url; - return acc; - }, - {} as Record - ); + const titles = googleDriveFiles.reduce((acc, curr) => { + acc[curr.url] = curr.url; + return acc; + }, {} as Record); return new Ok(titles); } diff --git a/connectors/src/lib/temporal_monitoring.ts b/connectors/src/lib/temporal_monitoring.ts index 9ea1a272ff58..e50544fcf0cc 100644 --- a/connectors/src/lib/temporal_monitoring.ts +++ b/connectors/src/lib/temporal_monitoring.ts @@ -114,8 +114,9 @@ export class ActivityInboundLogInterceptor if (connectorId) { await syncFailed(connectorId, "oauth_token_revoked"); - const doNotCancelOnTokenRevoked = - await getDoNotCancelOnTokenRevoked(workflowId); + const doNotCancelOnTokenRevoked = await getDoNotCancelOnTokenRevoked( + workflowId + ); if (doNotCancelOnTokenRevoked) { this.logger.info( "Skipping cancelling workflow because of expired token."