@msom/http
Version:
@msom/http
52 lines • 2.06 kB
TypeScript
import { QueryCondition, CompCondition, CompConditionType, AndCondition, OrCondition, CompPropValue } from "./interfaces";
export declare enum ModelType {
RELATE = "relate",
MODEL = "model"
}
export interface ModelHandler {
condition(condition: QueryCondition): this;
relate(relateName: string, callback?: ((relateModel: RelateModelHandler) => void) | undefined): this;
}
export interface RelateModelHandler extends ModelHandler {
recursive(count: number): this;
}
export declare abstract class Model implements ModelHandler {
type: ModelType;
conditions: QueryCondition | undefined;
relates: {
[K in string]: Model;
};
children?: RelateModel;
condition(condition: QueryCondition): this;
relate(relateName: string, callback?: ((relateModel: RelateModel) => void) | undefined): this;
}
export declare class QueryModel extends Model {
type: ModelType.MODEL;
modelName: string;
constructor(modelName: string);
static is(model: Model): model is QueryModel;
}
export declare class RelateModel extends Model implements RelateModelHandler {
type: ModelType.RELATE;
relateName: string;
constructor(relateName: string);
recursive(count: number): this;
static is(model: Model): model is RelateModel;
}
export interface QueryProtocol {
start: string;
option: QueryModel;
}
export declare class QueryProtocolBuilder {
private startModel;
private rootModel;
private currentModel;
constructor(startModel: string);
model(modelName: string, callback?: (model: ModelHandler) => void): this;
relate(relateName: string, callback?: (model: RelateModelHandler) => void): this;
protocol(): QueryProtocol;
}
export declare function comp(compType: CompConditionType, propKey: string, value: CompPropValue | ReadonlyArray<CompPropValue>): CompCondition;
export declare function and(...conditions: QueryCondition[]): AndCondition;
export declare function or(...conditions: QueryCondition[]): OrCondition;
//# sourceMappingURL=QueryProtocolBuilder.d.ts.map