Use generic types instead of overrides
This commit is contained in:
parent
1a9653a4db
commit
f7a34dedfa
2 changed files with 14 additions and 18 deletions
|
@ -6,6 +6,7 @@ import {
|
||||||
OIDCConfig,
|
OIDCConfig,
|
||||||
OIDCInnerConfig,
|
OIDCInnerConfig,
|
||||||
SCIMConfig,
|
SCIMConfig,
|
||||||
|
SCIMInnerConfig,
|
||||||
SettingsConfig,
|
SettingsConfig,
|
||||||
SettingsInnerConfig,
|
SettingsInnerConfig,
|
||||||
SMTPConfig,
|
SMTPConfig,
|
||||||
|
@ -244,6 +245,7 @@ export async function getSMTPConfig(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getSCIMConfig(): Promise<SCIMConfig | undefined> {
|
export async function getSCIMConfig(): Promise<SCIMInnerConfig | undefined> {
|
||||||
return getConfig<SCIMConfig>(ConfigType.SCIM)
|
const config = await getConfig<SCIMConfig>(ConfigType.SCIM)
|
||||||
|
return config?.config
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Document } from "../document"
|
import { Document } from "../document"
|
||||||
|
|
||||||
export interface Config extends Document {
|
export interface Config<T = any> extends Document {
|
||||||
type: ConfigType
|
type: ConfigType
|
||||||
config: any
|
config: T
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SMTPInnerConfig {
|
export interface SMTPInnerConfig {
|
||||||
|
@ -18,9 +18,7 @@ export interface SMTPInnerConfig {
|
||||||
connectionTimeout?: any
|
connectionTimeout?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SMTPConfig extends Config {
|
export interface SMTPConfig extends Config<SMTPInnerConfig> {}
|
||||||
config: SMTPInnerConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accessible only via pro.
|
* Accessible only via pro.
|
||||||
|
@ -50,9 +48,7 @@ export interface SettingsInnerConfig {
|
||||||
isSSOEnforced?: boolean
|
isSSOEnforced?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SettingsConfig extends Config {
|
export interface SettingsConfig extends Config<SettingsInnerConfig> {}
|
||||||
config: SettingsInnerConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
export type SSOConfigType = ConfigType.GOOGLE | ConfigType.OIDC
|
export type SSOConfigType = ConfigType.GOOGLE | ConfigType.OIDC
|
||||||
export type SSOConfig = GoogleInnerConfig | OIDCInnerConfig
|
export type SSOConfig = GoogleInnerConfig | OIDCInnerConfig
|
||||||
|
@ -67,9 +63,7 @@ export interface GoogleInnerConfig {
|
||||||
callbackURL?: string
|
callbackURL?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GoogleConfig extends Config {
|
export interface GoogleConfig extends Config<GoogleInnerConfig> {}
|
||||||
config: GoogleInnerConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface OIDCStrategyConfiguration {
|
export interface OIDCStrategyConfiguration {
|
||||||
issuer: string
|
issuer: string
|
||||||
|
@ -96,9 +90,7 @@ export interface OIDCInnerConfig {
|
||||||
scopes: string[]
|
scopes: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OIDCConfig extends Config {
|
export interface OIDCConfig extends Config<OIDCConfigs> {}
|
||||||
config: OIDCConfigs
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface OIDCWellKnownConfig {
|
export interface OIDCWellKnownConfig {
|
||||||
issuer: string
|
issuer: string
|
||||||
|
@ -107,10 +99,12 @@ export interface OIDCWellKnownConfig {
|
||||||
userinfo_endpoint: string
|
userinfo_endpoint: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SCIMConfig extends Config {
|
export interface SCIMInnerConfig {
|
||||||
config: { enabled: boolean }
|
enabled: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SCIMConfig extends Config<SCIMInnerConfig> {}
|
||||||
|
|
||||||
export const isSettingsConfig = (config: Config): config is SettingsConfig =>
|
export const isSettingsConfig = (config: Config): config is SettingsConfig =>
|
||||||
config.type === ConfigType.SETTINGS
|
config.type === ConfigType.SETTINGS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue