@amadeus-it-group/kassette
Version:
Development server, used mainly for testing, which proxies requests and is able to easily manage local mocks.
34 lines (33 loc) • 1.03 kB
TypeScript
export type InputOrigin = 'none' | 'default' | 'user';
export interface ProcessorArg<Input> {
input: Input | undefined;
inputOrigin: InputOrigin;
}
export interface UserPropertySpec<Input, Output> {
getDefaultInput?(): Input;
transform?(arg: ProcessorArg<Input>): Output;
}
export interface PropertyCache<Type> {
value: Type | undefined;
invalid: boolean;
}
export declare class UserProperty<Input, Output = Input> {
private _spec;
private _userInputIsSet;
private _userInput;
private _inputCache;
private _outputCache;
constructor(_spec?: UserPropertySpec<Input, Output>);
set(value: Input): void;
unset(): void;
get inputAndOrigin(): ProcessorArg<Input>;
get userInputIsSet(): boolean;
get userInput(): Input | undefined;
get hasDefaultInput(): boolean;
get defaultInput(): Input | undefined;
get input(): Input | undefined;
get inputOrigin(): InputOrigin;
resetInputCache(): void;
get output(): Output;
resetOutputCache(): void;
}