All files / src/lib/types option.ts

100% Statements 7/7
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163                                                                                          94x 94x 94x 94x 94x 94x 94x                                                                                                                                                                                                                              
import EventEmitter from 'events';
import { LogLevel, LogProvider } from '../logger';
import { ILegacyApiTokenCreate } from './models/api-token';
import { IExperimentalOptions } from '../experimental';
import SMTPTransport from 'nodemailer/lib/smtp-transport';
 
export type EventHook = (eventName: string, data: object) => void;
 
export interface ISSLOption {
    rejectUnauthorized: boolean;
    ca?: string;
    key?: string;
    cert?: string;
}
 
export interface IDBOption {
    user: string;
    password: string;
    host: string;
    port: number;
    database: string;
    ssl?: ISSLOption | boolean;
    driver: 'postgres';
    version?: string;
    acquireConnectionTimeout?: number;
    pool?: {
        min?: number;
        max?: number;
        idleTimeoutMillis?: number;
        propagateCreateError?: boolean;
    };
    schema: string;
    disableMigration: boolean;
    applicationName?: string;
}
 
export interface ISessionOption {
    ttlHours: number;
    db: boolean;
}
 
export interface IVersionOption {
    url?: string;
    enable?: boolean;
}
export enum IAuthType {
    OPEN_SOURCE = 'open-source',
    DEMO = 'demo',
    ENTERPRISE = 'enterprise',
    HOSTED = 'hosted',
    CUSTOM = 'custom',
    NONE = 'none',
}
 
export interface IAuthOption {
    enableApiToken: boolean;
    type: IAuthType;
    customAuthHandler?: Function;
    createAdminUser: boolean;
    initApiTokens: ILegacyApiTokenCreate[];
}
 
export interface IImportOption {
    file: string;
    keepExisting: boolean;
    dropBeforeImport: boolean;
}
 
export interface IServerOption {
    port?: number;
    host?: string;
    pipe?: string;
    keepAliveTimeout: number;
    headersTimeout: number;
    baseUriPath: string;
    cdnPrefix?: string;
    unleashUrl: string;
    serverMetrics: boolean;
    enableRequestLogger: boolean;
    gracefulShutdownEnable: boolean;
    gracefulShutdownTimeout: number;
    secret: string;
}
 
export interface IUnleashOptions {
    databaseUrl?: string;
    databaseUrlFile?: string;
    db?: Partial<IDBOption>;
    session?: Partial<ISessionOption>;
    getLogger?: LogProvider;
    logLevel?: LogLevel;
    server?: Partial<IServerOption>;
    versionCheck?: Partial<IVersionOption>;
    authentication?: Partial<IAuthOption>;
    ui?: object;
    import?: Partial<IImportOption>;
    experimental?: IExperimentalOptions;
    email?: Partial<IEmailOption>;
    secureHeaders?: boolean;
    enableOAS?: boolean;
    preHook?: Function;
    preRouterHook?: Function;
    eventHook?: EventHook;
    enterpriseVersion?: string;
    disableLegacyFeaturesApi?: boolean;
}
 
export interface IEmailOption {
    host?: string;
    secure: boolean;
    port: number;
    sender: string;
    smtpuser?: string;
    smtppass?: string;
    transportOptions?: SMTPTransport.Options;
}
 
export interface IListeningPipe {
    path: string;
}
 
export interface IListeningHost {
    host?: string;
    port: number;
}
 
export interface IUIConfig {
    slogan?: string;
    name?: string;
    flags?: { [key: string]: boolean };
    links?: [
        {
            value: string;
            icon?: string;
            href: string;
            title: string;
        },
    ];
}
 
export interface IUnleashConfig {
    db: IDBOption;
    session: ISessionOption;
    getLogger: LogProvider;
    server: IServerOption;
    listen: IListeningHost | IListeningPipe;
    versionCheck: IVersionOption;
    authentication: IAuthOption;
    ui: IUIConfig;
    import: IImportOption;
    experimental?: IExperimentalOptions;
    email: IEmailOption;
    secureHeaders: boolean;
    enableOAS: boolean;
    preHook?: Function;
    preRouterHook?: Function;
    eventHook?: EventHook;
    enterpriseVersion?: string;
    eventBus: EventEmitter;
    disableLegacyFeaturesApi?: boolean;
    environmentEnableOverrides?: string[];
}