oak-general-business/lib/general-app-domain/Subscription/Schema.d.ts

122 lines
4.0 KiB
TypeScript

import { String, Int, Text } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { OneOf } from "oak-domain/lib/types/Polyfill";
import * as SubQuery from "../_SubQuery";
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { GenericAction } from "oak-domain/lib/actions/action";
export declare type WechatPublicConfig = {
type: 'wechatPublic';
appId: string;
appSecret: string;
};
export declare type OpSchema = EntityShape & {
entity: String<32>;
entityId: String<64>;
name: String<32>;
description: Text;
config: WechatPublicConfig;
offset: Int<4>;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
entity: String<32>;
entityId: String<64>;
name: String<32>;
description: Text;
config: WechatPublicConfig;
offset: Int<4>;
} & {
[A in ExpressionKey]?: any;
};
declare type AttrFilter = {
id: Q_StringValue | SubQuery.SubscriptionIdSubQuery;
$$createAt$$: Q_DateValue;
$$seq$$: Q_StringValue;
$$updateAt$$: Q_DateValue;
entity: Q_StringValue;
entityId: Q_StringValue;
name: Q_StringValue;
description: Q_StringValue;
config: Q_EnumValue<WechatPublicConfig>;
offset: Q_NumberValue;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
"#id"?: NodeId;
[k: string]: any;
id?: number;
$$createAt$$?: number;
$$updateAt$$?: number;
$$seq$$?: number;
entity?: number;
entityId?: number;
name?: number;
description?: number;
config?: number;
offset?: number;
} & Partial<ExprOp<OpAttr | string>>;
declare type SubscriptionIdProjection = OneOf<{
id: number;
}>;
export declare type SortAttr = {
id: number;
} | {
$$createAt$$: number;
} | {
$$seq$$: number;
} | {
$$updateAt$$: number;
} | {
entity: number;
} | {
entityId: number;
} | {
name: number;
} | {
description: number;
} | {
config: number;
} | {
offset: number;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;
export declare type SortNode = {
$attr: SortAttr;
$direction?: "asc" | "desc";
};
export declare type Sorter = SortNode[];
export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
export declare type Aggregation = Omit<DeduceAggregation<Projection, Filter, Sorter>, "id">;
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
entity?: string;
entityId?: string;
[K: string]: any;
});
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
};
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
export declare type RemoveOperationData = {};
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export declare type SubscriptionIdSubQuery = Selection<SubscriptionIdProjection>;
export declare type EntityDef = {
Schema: Schema;
OpSchema: OpSchema;
Action: OakMakeAction<GenericAction> | string;
Selection: Selection;
Aggregation: Aggregation;
Operation: Operation;
Create: CreateOperation;
Update: UpdateOperation;
Remove: RemoveOperation;
CreateSingle: CreateSingleOperation;
CreateMulti: CreateMultipleOperation;
};
export {};