Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MS connector] Use provider configuration from connector #6151

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions connectors/src/connectors/microsoft/temporal/activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import type { MicrosoftNodeModel } from "@connectors/lib/models/microsoft";
import logger from "@connectors/logger/logger";
import type { WithCreationAttributes } from "@connectors/resources/connector/strategy";
import { ConnectorResource } from "@connectors/resources/connector_resource";
import type { MicrosoftConfigurationResource } from "@connectors/resources/microsoft_resource";
import {
MicrosoftConfigurationResource,
MicrosoftNodeResource,
MicrosoftRootResource,
} from "@connectors/resources/microsoft_resource";
Expand Down Expand Up @@ -170,7 +170,7 @@ export async function syncFiles({
}

const providerConfig =
await MicrosoftConfigurationResource.fetchByConnectorId(connectorId);
connector.providerConfiguration as MicrosoftConfigurationResource;

if (!providerConfig) {
throw new Error(`Configuration for connector ${connectorId} not found`);
Expand Down
4 changes: 4 additions & 0 deletions connectors/src/resources/connector_resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,10 @@ export class ConnectorResource extends BaseResource<ConnectorModel> {
return this.errorType === "third_party_internal_error";
}

get providerConfiguration(): ConnectorProviderConfigurationResource | null {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to type with the mapping in the strategy file. We def don't want this generic type here since this is meant to be used in each separate connectors 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had looked into that before submitting. I don't think it can be done easily.

At some point, we get a connector by id, and that's runtime, so the connector object can't be typed as a XXXConnectorResource itself. Thus, at the time i'm not sure how its provider configuration can be typed as well

Going to have a second look

return this.configuration;
}

toJSON(): ConnectorType {
return {
id: this.id.toString(),
Expand Down
Loading