Skip to content

Commit

Permalink
merge connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tdraier committed Jun 21, 2024
1 parent 9e30c54 commit 72b942f
Show file tree
Hide file tree
Showing 33 changed files with 127 additions and 456 deletions.
4 changes: 2 additions & 2 deletions connectors/src/admin/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
IntercomWorkspace,
} from "@connectors/lib/models/intercom";
import {
MicrosoftSharepointConfiguration,
MicrosoftConfiguration,
MicrosoftTeamsConfiguration,
} from "@connectors/lib/models/microsoft";
import {
Expand Down Expand Up @@ -85,7 +85,7 @@ async function main(): Promise<void> {
await GoogleDriveFiles.sync({ alter: true });
await GoogleDriveSheet.sync({ alter: true });
await GoogleDriveSyncToken.sync({ alter: true });
await MicrosoftSharepointConfiguration.sync({ alter: true });
await MicrosoftConfiguration.sync({ alter: true });
await MicrosoftTeamsConfiguration.sync({ alter: true });
await NotionConnectorBlockCacheEntry.sync({ alter: true });
await NotionConnectorPageCacheEntry.sync({ alter: true });
Expand Down
3 changes: 1 addition & 2 deletions connectors/src/api/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ const _patchConnectorConfiguration = async (
case "github":
case "google_drive":
case "intercom":
case "microsoft_teams":
case "microsoft_sharepoint":
case "microsoft":
case "slack": {
throw new Error(
`Connector type ${connector.type} does not support configuration patching`
Expand Down
3 changes: 1 addition & 2 deletions connectors/src/api/create_connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ const _createConnectorAPIHandler = async (
case "confluence":
case "google_drive":
case "intercom":
case "microsoft_teams":
case "microsoft_sharepoint":
case "microsoft":
case "slack": {
const connectorCreator =
CREATE_CONNECTOR_BY_TYPE[req.params.connector_provider];
Expand Down
98 changes: 31 additions & 67 deletions connectors/src/connectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,37 +87,21 @@ import type {
SyncConnector,
} from "@connectors/connectors/interface";
import {
cleanupMicrosoftSharepointConnector,
createMicrosoftSharepointConnector,
fullResyncMicrosoftSharepointConnector,
getMicrosoftSharepointConfig,
pauseMicrosoftSharepointConnector,
resumeMicrosoftSharepointConnector,
retrieveMicrosoftSharepointConnectorPermissions,
retrieveMicrosoftSharepointContentNodeParents,
retrieveMicrosoftSharepointContentNodes,
setMicrosoftSharepointConfig,
setMicrosoftSharepointConnectorPermissions,
stopMicrosoftSharepointConnector,
unpauseMicrosoftSharepointConnector,
updateMicrosoftSharepointConnector,
} from "@connectors/connectors/microsoft/sharepoint";
import {
cleanupMicrosoftTeamsConnector,
createMicrosoftTeamsConnector,
fullResyncMicrosoftTeamsConnector,
getMicrosoftTeamsConfig,
pauseMicrosoftTeamsConnector,
resumeMicrosoftTeamsConnector,
retrieveMicrosoftTeamsConnectorPermissions,
retrieveMicrosoftTeamsContentNodeParents,
retrieveMicrosoftTeamsContentNodes,
setMicrosoftTeamsConfig,
setMicrosoftTeamsConnectorPermissions,
stopMicrosoftTeamsConnector,
unpauseMicrosoftTeamsConnector,
updateMicrosoftTeamsConnector,
} from "@connectors/connectors/microsoft/teams";
cleanupMicrosoftConnector,
createMicrosoftConnector,
fullResyncMicrosoftConnector,
getMicrosoftConfig,
pauseMicrosoftConnector,
resumeMicrosoftConnector,
retrieveMicrosoftConnectorPermissions,
retrieveMicrosoftContentNodeParents,
retrieveMicrosoftContentNodes,
setMicrosoftConfig,
setMicrosoftConnectorPermissions,
stopMicrosoftConnector,
unpauseMicrosoftConnector,
updateMicrosoftConnector,
} from "@connectors/connectors/microsoft";
import {
cleanupNotionConnector,
createNotionConnector,
Expand Down Expand Up @@ -166,8 +150,7 @@ export const CREATE_CONNECTOR_BY_TYPE: ConnectorProviderCreateConnectorMapping =
github: createGithubConnector,
google_drive: createGoogleDriveConnector,
intercom: createIntercomConnector,
microsoft_sharepoint: createMicrosoftSharepointConnector,
microsoft_teams: createMicrosoftTeamsConnector,
microsoft: createMicrosoftConnector,
notion: createNotionConnector,
slack: createSlackConnector,
webcrawler: createWebcrawlerConnector,
Expand All @@ -179,8 +162,7 @@ export const UPDATE_CONNECTOR_BY_TYPE: Record<
> = {
confluence: updateConfluenceConnector,
slack: updateSlackConnector,
microsoft_sharepoint: updateMicrosoftSharepointConnector,
microsoft_teams: updateMicrosoftTeamsConnector,
microsoft: updateMicrosoftConnector,
notion: updateNotionConnector,
github: updateGithubConnector,
google_drive: updateGoogleDriveConnector,
Expand All @@ -200,8 +182,7 @@ export const STOP_CONNECTOR_BY_TYPE: Record<
return new Ok(undefined);
},
github: stopGithubConnector,
microsoft_sharepoint: stopMicrosoftSharepointConnector,
microsoft_teams: stopMicrosoftTeamsConnector,
microsoft: stopMicrosoftConnector,
notion: stopNotionConnector,
google_drive: async (connectorId: ModelId) => {
await terminateAllWorkflowsForConnectorId(connectorId);
Expand All @@ -217,8 +198,7 @@ export const DELETE_CONNECTOR_BY_TYPE: Record<
> = {
confluence: cleanupConfluenceConnector,
slack: cleanupSlackConnector,
microsoft_sharepoint: cleanupMicrosoftSharepointConnector,
microsoft_teams: cleanupMicrosoftTeamsConnector,
microsoft: cleanupMicrosoftConnector,
notion: cleanupNotionConnector,
github: cleanupGithubConnector,
google_drive: cleanupGoogleDriveConnector,
Expand All @@ -235,8 +215,7 @@ export const RESUME_CONNECTOR_BY_TYPE: Record<
logger.info({ connectorId }, `Resuming Slack connector is a no-op.`);
return new Ok(undefined);
},
microsoft_sharepoint: resumeMicrosoftSharepointConnector,
microsoft_teams: resumeMicrosoftTeamsConnector,
microsoft: resumeMicrosoftConnector,
notion: resumeNotionConnector,
github: resumeGithubConnector,
google_drive: async (connectorId: ModelId) => {
Expand All @@ -257,8 +236,7 @@ export const SYNC_CONNECTOR_BY_TYPE: Record<ConnectorProvider, SyncConnector> =
{
confluence: launchConfluenceSyncWorkflow,
slack: launchSlackSyncWorkflow,
microsoft_sharepoint: fullResyncMicrosoftSharepointConnector,
microsoft_teams: fullResyncMicrosoftTeamsConnector,
microsoft: fullResyncMicrosoftConnector,
notion: fullResyncNotionConnector,
github: fullResyncGithubConnector,
google_drive: launchGoogleDriveFullSyncWorkflow,
Expand All @@ -273,8 +251,7 @@ export const RETRIEVE_CONNECTOR_PERMISSIONS_BY_TYPE: Record<
confluence: retrieveConfluenceConnectorPermissions,
slack: retrieveSlackConnectorPermissions,
github: retrieveGithubConnectorPermissions,
microsoft_sharepoint: retrieveMicrosoftSharepointConnectorPermissions,
microsoft_teams: retrieveMicrosoftTeamsConnectorPermissions,
microsoft: retrieveMicrosoftConnectorPermissions,
notion: retrieveNotionConnectorPermissions,
google_drive: retrieveGoogleDriveConnectorPermissions,
intercom: retrieveIntercomConnectorPermissions,
Expand All @@ -287,8 +264,7 @@ export const SET_CONNECTOR_PERMISSIONS_BY_TYPE: Record<
> = {
confluence: setConfluenceConnectorPermissions,
slack: setSlackConnectorPermissions,
microsoft_sharepoint: setMicrosoftSharepointConnectorPermissions,
microsoft_teams: setMicrosoftTeamsConnectorPermissions,
microsoft: setMicrosoftConnectorPermissions,
notion: async () => {
return new Err(
new Error(`Setting Notion connector permissions is not implemented yet.`)
Expand All @@ -314,8 +290,7 @@ export const BATCH_RETRIEVE_CONTENT_NODES_BY_TYPE: Record<
> = {
confluence: retrieveConfluenceContentNodes,
slack: retrieveSlackContentNodes,
microsoft_sharepoint: retrieveMicrosoftSharepointContentNodes,
microsoft_teams: retrieveMicrosoftTeamsContentNodes,
microsoft: retrieveMicrosoftContentNodes,
notion: retrieveNotionContentNodes,
github: retrieveGithubReposContentNodes,
google_drive: retrieveGoogleDriveContentNodes,
Expand All @@ -328,8 +303,7 @@ export const RETRIEVE_CONTENT_NODE_PARENTS_BY_TYPE: Record<
ContentNodeParentsRetriever
> = {
confluence: retrieveConfluenceContentNodeParents,
microsoft_sharepoint: retrieveMicrosoftSharepointContentNodeParents,
microsoft_teams: retrieveMicrosoftTeamsContentNodeParents,
microsoft: retrieveMicrosoftContentNodeParents,
notion: retrieveNotionContentNodeParents,
google_drive: retrieveGoogleDriveContentNodeParents,
slack: async () => new Ok([]), // Slack is flat
Expand All @@ -347,8 +321,7 @@ export const SET_CONNECTOR_CONFIG_BY_TYPE: Record<
throw new Error("Not implemented");
},
slack: setSlackConfig,
microsoft_sharepoint: setMicrosoftSharepointConfig,
microsoft_teams: setMicrosoftTeamsConfig,
microsoft: setMicrosoftConfig,
notion: async () => {
throw new Error("Not implemented");
},
Expand All @@ -369,8 +342,7 @@ export const GET_CONNECTOR_CONFIG_BY_TYPE: Record<
throw new Error("Not implemented");
},
slack: getSlackConfig,
microsoft_sharepoint: getMicrosoftSharepointConfig,
microsoft_teams: getMicrosoftTeamsConfig,
microsoft: getMicrosoftConfig,
notion: async () => {
throw new Error("Not implemented");
},
Expand All @@ -394,10 +366,7 @@ export const SET_CONNECTOR_CONFIGURATION_BY_TYPE: ConnectorProviderUpdateConfigu
slack: () => {
throw new Error("Not implemented");
},
microsoft_sharepoint: () => {
throw new Error("Not implemented");
},
microsoft_teams: () => {
microsoft: () => {
throw new Error("Not implemented");
},
notion: () => {
Expand All @@ -424,10 +393,7 @@ export const GARBAGE_COLLECT_BY_TYPE: Record<
slack: () => {
throw new Error("Not implemented");
},
microsoft_sharepoint: async () => {
throw new Error("Not implemented");
},
microsoft_teams: () => {
microsoft: async () => {
throw new Error("Not implemented");
},
notion: async () => {
Expand All @@ -454,8 +420,7 @@ export const PAUSE_CONNECTOR_BY_TYPE: Record<
> = {
confluence: pauseConfluenceConnector,
slack: pauseSlackConnector,
microsoft_sharepoint: pauseMicrosoftSharepointConnector,
microsoft_teams: pauseMicrosoftTeamsConnector,
microsoft: pauseMicrosoftConnector,
notion: pauseNotionConnector,
github: pauseGithubConnector,
google_drive: pauseGoogleDriveConnector,
Expand All @@ -471,8 +436,7 @@ export const UNPAUSE_CONNECTOR_BY_TYPE: Record<
> = {
confluence: unpauseConfluenceConnector,
slack: unpauseSlackConnector,
microsoft_sharepoint: unpauseMicrosoftSharepointConnector,
microsoft_teams: unpauseMicrosoftTeamsConnector,
microsoft: unpauseMicrosoftConnector,
notion: unpauseNotionConnector,
github: unpauseGithubConnector,
google_drive: unpauseGoogleDriveConnector,
Expand Down
Loading

0 comments on commit 72b942f

Please sign in to comment.