Skip to content

Commit

Permalink
implement a few methods of the manager
Browse files Browse the repository at this point in the history
  • Loading branch information
aubin-tchoi committed Mar 4, 2025
1 parent 4771a5f commit 2986405
Showing 1 changed file with 56 additions and 5 deletions.
61 changes: 56 additions & 5 deletions connectors/src/connectors/gong/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { ContentNode, Result } from "@dust-tt/types";
import { Ok } from "@dust-tt/types";
import { Err, Ok } from "@dust-tt/types";

import {
launchGongSyncWorkflow,
stopGongSyncWorkflow,
} from "@connectors/connectors/gong/temporal/client";
import type {
ConnectorManagerError,
CreateConnectorErrorCode,
Expand Down Expand Up @@ -31,6 +35,15 @@ export class GongConnectorManager extends BaseConnectorManager<null> {
{}
);

const result = await launchGongSyncWorkflow(connector.id);
if (result.isErr()) {
logger.error(
{ connectorId: connector.id, error: result.error },
"[Gong] Error launching Gong sync workflow"
);
throw result.error;
}

return new Ok(connector.id.toString());
}

Expand All @@ -41,23 +54,61 @@ export class GongConnectorManager extends BaseConnectorManager<null> {
}

async clean(): Promise<Result<undefined, Error>> {
throw new Error("Method not implemented.");
const { connectorId } = this;
const connector = await ConnectorResource.fetchById(connectorId);
if (!connector) {
logger.error({ connectorId }, "Gong connector not found.");
return new Err(new Error("Connector not found"));
}

// TODO(2025-03-04) - Implement the delete in the strategy.
const res = await connector.delete();
if (res.isErr()) {
logger.error(
{ connectorId, error: res.error },
"Error cleaning up Gong connector."
);
return res;
}

return new Ok(undefined);
}

async stop(): Promise<Result<undefined, Error>> {
throw new Error("Method not implemented.");
const result = await stopGongSyncWorkflow(this.connectorId);
if (result.isErr()) {
return result;
}
return new Ok(undefined);
}

async resume(): Promise<Result<undefined, Error>> {
throw new Error("Method not implemented.");
const result = await launchGongSyncWorkflow(this.connectorId);
if (result.isErr()) {
logger.error(
{ connectorId: this.connectorId, error: result.error },
"[Gong] Error launching Gong sync workflow"
);
throw result.error;
}

return new Ok(undefined);
}

async sync({
fromTs,

Check failure on line 99 in connectors/src/connectors/gong/index.ts

View workflow job for this annotation

GitHub Actions / check-eslint

'fromTs' is defined but never used
}: {
fromTs: number | null;
}): Promise<Result<string, Error>> {
throw new Error("Method not implemented.");
const result = await launchGongSyncWorkflow(this.connectorId);
if (result.isErr()) {
logger.error(
{ connectorId: this.connectorId, error: result.error },
"[Gong] Error launching Gong sync workflow"
);
throw result.error;
}
return new Ok(this.connectorId.toString());
}

async retrievePermissions(): Promise<
Expand Down

0 comments on commit 2986405

Please sign in to comment.