UNPKG

622 BTypeScriptView Raw
1import convict from 'convict';
2import SchemaCore, { OpType } from './core/schema-core';
3import { Context, OpConfig, APIConfig } from '../interfaces';
4/**
5 * A base class for supporting convict "Schema" definitions
6 */
7export default abstract class ConvictSchema<T extends Object, S = any> extends SchemaCore<T> {
8 schema: convict.Schema<S>;
9 constructor(context: Context, opType?: OpType);
10 validate(inputConfig: any): APIConfig & T;
11 validate(inputConfig: any): OpConfig & T;
12 validateJob(job: any): void;
13 static type(): string;
14 abstract build<U = any>(context?: Context): convict.Schema<S & U>;
15}