Types
This commit is contained in:
parent
25233c5c9b
commit
b022dcba77
|
@ -121,9 +121,7 @@ export async function getIntegration(integration: SourceName) {
|
|||
throw new Error("No datasource implementation found.")
|
||||
}
|
||||
|
||||
const VALIDATORS: Partial<
|
||||
Record<SourceName, (config: any) => Promise<boolean | { error: string }>>
|
||||
> = {
|
||||
const VALIDATORS = {
|
||||
[SourceName.POSTGRES]: postgres.validateConnection,
|
||||
}
|
||||
|
||||
|
@ -134,5 +132,5 @@ function getValidators(integration: SourceName) {
|
|||
export default {
|
||||
getDefinitions,
|
||||
getIntegration,
|
||||
getValidators,
|
||||
getValidator: VALIDATORS,
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ if (types) {
|
|||
|
||||
const JSON_REGEX = /'{.*}'::json/s
|
||||
|
||||
interface PostgresConfig {
|
||||
export interface PostgresConfig {
|
||||
host: string
|
||||
port: number
|
||||
database: string
|
||||
|
|
|
@ -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"',
|
||||
|
|
Loading…
Reference in New Issue