Skip to content

Commit

Permalink
Add CLI for Gdrive incremental sync (#2434)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasryaric authored Nov 8, 2023
1 parent 26b1cc3 commit 75dbe91
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion connectors/src/admin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import {
SYNC_CONNECTOR_BY_TYPE,
} from "@connectors/connectors";
import { getDocumentId } from "@connectors/connectors/google_drive/temporal/activities";
import { launchGoogleDriveRenewWebhooksWorkflow } from "@connectors/connectors/google_drive/temporal/client";
import {
launchGoogleDriveIncrementalSyncWorkflow,
launchGoogleDriveRenewWebhooksWorkflow,
} from "@connectors/connectors/google_drive/temporal/client";
import { toggleSlackbot } from "@connectors/connectors/slack/bot";
import { launchSlackSyncOneThreadWorkflow } from "@connectors/connectors/slack/temporal/client";
import {
Expand Down Expand Up @@ -261,6 +264,31 @@ const google = async (command: string, args: parseArgs.ParsedArgs) => {
await throwOnError(launchGoogleDriveRenewWebhooksWorkflow());
return;
}
case "start-incremental-sync": {
if (!args.wId) {
throw new Error("Missing --wId argument");
}
if (!args.dataSourceName) {
throw new Error("Missing --dataSourceName argument");
}

const connector = await Connector.findOne({
where: {
workspaceId: args.wId,
dataSourceName: args.dataSourceName,
type: "google_drive",
},
});
if (!connector) {
throw new Error(
`Could not find connector for workspace ${args.wId} and data source ${args.dataSourceName}`
);
}
await throwOnError(
launchGoogleDriveIncrementalSyncWorkflow(connector.id.toString())
);
return;
}
case "skip-file": {
if (!args.wId) {
throw new Error("Missing --wId argument");
Expand Down

0 comments on commit 75dbe91

Please sign in to comment.