diff --git a/packages/server/src/integrations/index.ts b/packages/server/src/integrations/index.ts index 5a2271de25..076c9fdcb5 100644 --- a/packages/server/src/integrations/index.ts +++ b/packages/server/src/integrations/index.ts @@ -121,9 +121,7 @@ export async function getIntegration(integration: SourceName) { throw new Error("No datasource implementation found.") } -const VALIDATORS: Partial< - Record Promise> -> = { +const VALIDATORS = { [SourceName.POSTGRES]: postgres.validateConnection, } @@ -134,5 +132,5 @@ function getValidators(integration: SourceName) { export default { getDefinitions, getIntegration, - getValidators, + getValidator: VALIDATORS, } diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index c452b8afc7..da678854b4 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -31,7 +31,7 @@ if (types) { const JSON_REGEX = /'{.*}'::json/s -interface PostgresConfig { +export interface PostgresConfig { host: string port: number database: string diff --git a/packages/server/src/sdk/tests/datasources/validators.spec.ts b/packages/server/src/sdk/tests/datasources/validators.spec.ts index 677ff8b59c..9664c6c8fc 100644 --- a/packages/server/src/sdk/tests/datasources/validators.spec.ts +++ b/packages/server/src/sdk/tests/datasources/validators.spec.ts @@ -6,7 +6,7 @@ jest.unmock("pg") describe("datasource validators", () => { describe("postgres", () => { - const validator = integrations.getValidators(SourceName.POSTGRES)! + const validator = integrations.getValidator[SourceName.POSTGRES]! let host: string let port: number @@ -31,7 +31,6 @@ describe("datasource validators", () => { schema: "public", ssl: false, rejectUnauthorized: false, - ca: false, }) expect(result).toBeTruthy() }) @@ -46,7 +45,6 @@ describe("datasource validators", () => { schema: "public", ssl: false, rejectUnauthorized: false, - ca: false, }) expect(result).toEqual({ error: 'password authentication failed for user "wrong"',