lex-model-validator
Version:
Validate lex-language-models with ease.
86 lines (85 loc) • 2.4 kB
TypeScript
import { LexModelValidator, ValidationFunction, Validator } from '../index';
export interface KeyValuePair<T = {}> {
key: string;
value?: any;
}
export declare type InputModel = Record<string, any>;
export declare type ValidatorConstructor = new ($master: LexModelValidator, $parent?: Validator) => Validator;
export interface ValidatorInterface {
run(data: InputModel): void;
runChildren(data: InputModel): void;
}
export declare type Constraints = Record<string, Constraint>;
export declare type AllowedType = 'object' | 'string' | 'boolean' | 'undefined' | 'function' | 'number' | 'symbol';
export interface Constraint {
required?: boolean;
validate?: ValidationFunction;
minLength?: number;
maxLength?: number;
type?: AllowedType;
isArray?: boolean;
min?: number;
max?: number;
equals?: any;
matches?: string | RegExp | string[];
}
export interface LexModel {
metadata: MetaData;
resource: Resource;
}
export interface MetaData {
schemaVersion: string;
importType: 'LEX';
importFormat: 'JSON';
}
export interface Resource {
name: string;
version: string;
locale: string;
childDirected: boolean;
idleSessionTTLInSeconds: number;
clarificationPrompt: Prompt;
abortStatement: Statement;
intents: Intent[];
slotTypes: SlotType[];
}
export interface Intent {
name: string;
version: string;
fulfillmentActivity: {
type: string;
};
sampleUtterances: string[];
slots: Slot[];
}
export declare type SlotConstraint = 'Required' | 'Optional';
export interface Slot {
name: string;
priority: number;
slotType: string;
slotTypeVersion?: string;
slotConstraint: SlotConstraint;
sampleUtterances: string[];
valueElicitationPrompt: Prompt;
}
export interface SlotType {
name: string;
version: string;
enumerationValues: SlotEnumerationValue[];
valueSelectionStrategy: ValueSelectionStrategy;
}
export declare type ValueSelectionStrategy = string;
export interface SlotEnumerationValue {
value: string;
synonyms: string[];
}
export interface Statement {
messages: Message[];
}
export interface Prompt extends Statement {
maxAttempts: number;
}
export interface Message {
contentType: string;
content: string;
}