oak-pay-business/es/oak-app-domain/OperEntity/Schema.d.ts

366 lines
12 KiB
TypeScript

import { ForeignKey } 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 { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { AppendOnlyAction } from "oak-domain/lib/actions/action";
import { String } from "oak-domain/lib/types/DataType";
import * as Oper from "../Oper/Schema";
import * as User from "../User/Schema";
import * as WechatPay from "../WechatPay/Schema";
import * as Withdraw from "../Withdraw/Schema";
import * as WithdrawAccount from "../WithdrawAccount/Schema";
import * as WithdrawChannel from "../WithdrawChannel/Schema";
import * as WithdrawTransfer from "../WithdrawTransfer/Schema";
import * as WpAccount from "../WpAccount/Schema";
import * as WpProduct from "../WpProduct/Schema";
export type OpSchema = EntityShape & {
operId: ForeignKey<"oper">;
entity: "user" | "wechatPay" | "withdraw" | "withdrawAccount" | "withdrawChannel" | "withdrawTransfer" | "wpAccount" | "wpProduct" | string;
entityId: String<64>;
};
export type OpAttr = keyof OpSchema;
export type Schema = OpSchema & {
oper: Oper.Schema;
user?: User.Schema;
wechatPay?: WechatPay.Schema;
withdraw?: Withdraw.Schema;
withdrawAccount?: WithdrawAccount.Schema;
withdrawChannel?: WithdrawChannel.Schema;
withdrawTransfer?: WithdrawTransfer.Schema;
wpAccount?: WpAccount.Schema;
wpProduct?: WpProduct.Schema;
} & {
[A in ExpressionKey]?: any;
};
type AttrFilter = {
id: Q_StringValue;
$$createAt$$: Q_DateValue;
$$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue;
operId: Q_StringValue;
oper: Oper.Filter;
entity: Q_EnumValue<"user" | "wechatPay" | "withdraw" | "withdrawAccount" | "withdrawChannel" | "withdrawTransfer" | "wpAccount" | "wpProduct" | string>;
entityId: Q_StringValue;
user: User.Filter;
wechatPay: WechatPay.Filter;
withdraw: Withdraw.Filter;
withdrawAccount: WithdrawAccount.Filter;
withdrawChannel: WithdrawChannel.Filter;
withdrawTransfer: WithdrawTransfer.Filter;
wpAccount: WpAccount.Filter;
wpProduct: WpProduct.Filter;
};
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export type Projection = {
"#id"?: NodeId;
[k: string]: any;
id?: number;
$$createAt$$?: number;
$$updateAt$$?: number;
$$seq$$?: number;
operId?: number;
oper?: Oper.Projection;
entity?: number;
entityId?: number;
user?: User.Projection;
wechatPay?: WechatPay.Projection;
withdraw?: Withdraw.Projection;
withdrawAccount?: WithdrawAccount.Projection;
withdrawChannel?: WithdrawChannel.Projection;
withdrawTransfer?: WithdrawTransfer.Projection;
wpAccount?: WpAccount.Projection;
wpProduct?: WpProduct.Projection;
} & Partial<ExprOp<OpAttr | string>>;
type OperEntityIdProjection = OneOf<{
id: number;
}>;
type OperIdProjection = OneOf<{
operId: number;
}>;
type UserIdProjection = OneOf<{
entityId: number;
}>;
type WechatPayIdProjection = OneOf<{
entityId: number;
}>;
type WithdrawIdProjection = OneOf<{
entityId: number;
}>;
type WithdrawAccountIdProjection = OneOf<{
entityId: number;
}>;
type WithdrawChannelIdProjection = OneOf<{
entityId: number;
}>;
type WithdrawTransferIdProjection = OneOf<{
entityId: number;
}>;
type WpAccountIdProjection = OneOf<{
entityId: number;
}>;
type WpProductIdProjection = OneOf<{
entityId: number;
}>;
export type SortAttr = {
id: number;
} | {
$$createAt$$: number;
} | {
$$seq$$: number;
} | {
$$updateAt$$: number;
} | {
operId: number;
} | {
oper: Oper.SortAttr;
} | {
entity: number;
} | {
entityId: number;
} | {
user: User.SortAttr;
} | {
wechatPay: WechatPay.SortAttr;
} | {
withdraw: Withdraw.SortAttr;
} | {
withdrawAccount: WithdrawAccount.SortAttr;
} | {
withdrawChannel: WithdrawChannel.SortAttr;
} | {
withdrawTransfer: WithdrawTransfer.SortAttr;
} | {
wpAccount: WpAccount.SortAttr;
} | {
wpProduct: WpProduct.SortAttr;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;
export type SortNode = {
$attr: SortAttr;
$direction?: "asc" | "desc";
};
export type Sorter = SortNode[];
export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
export type Selection<P extends Object = Projection> = SelectOperation<P>;
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "operId">> & (({
operId?: never;
oper: Oper.CreateSingleOperation;
} | {
operId: ForeignKey<"oper">;
oper?: Oper.UpdateOperation;
} | {
oper?: never;
operId: ForeignKey<"oper">;
})) & ({
entity?: never;
entityId?: never;
user: User.CreateSingleOperation;
} | {
entity: "user";
entityId: ForeignKey<"User">;
user?: User.UpdateOperation;
} | {
entity: "user";
entityId: ForeignKey<"User">;
user?: never;
} | {
entity?: never;
entityId?: never;
wechatPay: WechatPay.CreateSingleOperation;
} | {
entity: "wechatPay";
entityId: ForeignKey<"WechatPay">;
wechatPay?: WechatPay.UpdateOperation;
} | {
entity: "wechatPay";
entityId: ForeignKey<"WechatPay">;
wechatPay?: never;
} | {
entity?: never;
entityId?: never;
withdraw: Withdraw.CreateSingleOperation;
} | {
entity: "withdraw";
entityId: ForeignKey<"Withdraw">;
withdraw?: Withdraw.UpdateOperation;
} | {
entity: "withdraw";
entityId: ForeignKey<"Withdraw">;
withdraw?: never;
} | {
entity?: never;
entityId?: never;
withdrawAccount: WithdrawAccount.CreateSingleOperation;
} | {
entity: "withdrawAccount";
entityId: ForeignKey<"WithdrawAccount">;
withdrawAccount?: WithdrawAccount.UpdateOperation;
} | {
entity: "withdrawAccount";
entityId: ForeignKey<"WithdrawAccount">;
withdrawAccount?: never;
} | {
entity?: never;
entityId?: never;
withdrawChannel: WithdrawChannel.CreateSingleOperation;
} | {
entity: "withdrawChannel";
entityId: ForeignKey<"WithdrawChannel">;
withdrawChannel?: WithdrawChannel.UpdateOperation;
} | {
entity: "withdrawChannel";
entityId: ForeignKey<"WithdrawChannel">;
withdrawChannel?: never;
} | {
entity?: never;
entityId?: never;
withdrawTransfer: WithdrawTransfer.CreateSingleOperation;
} | {
entity: "withdrawTransfer";
entityId: ForeignKey<"WithdrawTransfer">;
withdrawTransfer?: WithdrawTransfer.UpdateOperation;
} | {
entity: "withdrawTransfer";
entityId: ForeignKey<"WithdrawTransfer">;
withdrawTransfer?: never;
} | {
entity?: never;
entityId?: never;
wpAccount: WpAccount.CreateSingleOperation;
} | {
entity: "wpAccount";
entityId: ForeignKey<"WpAccount">;
wpAccount?: WpAccount.UpdateOperation;
} | {
entity: "wpAccount";
entityId: ForeignKey<"WpAccount">;
wpAccount?: never;
} | {
entity?: never;
entityId?: never;
wpProduct: WpProduct.CreateSingleOperation;
} | {
entity: "wpProduct";
entityId: ForeignKey<"WpProduct">;
wpProduct?: WpProduct.UpdateOperation;
} | {
entity: "wpProduct";
entityId: ForeignKey<"WpProduct">;
wpProduct?: never;
} | {
entity?: string;
entityId?: string;
[K: string]: any;
});
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "entityId" | "operId">> & (({
oper?: Oper.CreateSingleOperation;
operId?: never;
} | {
oper?: Oper.UpdateOperation;
operId?: never;
} | {
oper?: Oper.RemoveOperation;
operId?: never;
} | {
oper?: never;
operId?: ForeignKey<"oper">;
})) & ({
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
entityId?: never;
entity?: never;
} | {
wechatPay?: WechatPay.CreateSingleOperation | WechatPay.UpdateOperation | WechatPay.RemoveOperation;
entityId?: never;
entity?: never;
} | {
withdraw?: Withdraw.CreateSingleOperation | Withdraw.UpdateOperation | Withdraw.RemoveOperation;
entityId?: never;
entity?: never;
} | {
withdrawAccount?: WithdrawAccount.CreateSingleOperation | WithdrawAccount.UpdateOperation | WithdrawAccount.RemoveOperation;
entityId?: never;
entity?: never;
} | {
withdrawChannel?: WithdrawChannel.CreateSingleOperation | WithdrawChannel.UpdateOperation | WithdrawChannel.RemoveOperation;
entityId?: never;
entity?: never;
} | {
withdrawTransfer?: WithdrawTransfer.CreateSingleOperation | WithdrawTransfer.UpdateOperation | WithdrawTransfer.RemoveOperation;
entityId?: never;
entity?: never;
} | {
wpAccount?: WpAccount.CreateSingleOperation | WpAccount.UpdateOperation | WpAccount.RemoveOperation;
entityId?: never;
entity?: never;
} | {
wpProduct?: WpProduct.CreateSingleOperation | WpProduct.UpdateOperation | WpProduct.RemoveOperation;
entityId?: never;
entity?: never;
} | {
entity?: ("user" | "wechatPay" | "withdraw" | "withdrawAccount" | "withdrawChannel" | "withdrawTransfer" | "wpAccount" | "wpProduct" | string) | null;
entityId?: ForeignKey<"User" | "WechatPay" | "Withdraw" | "WithdrawAccount" | "WithdrawChannel" | "WithdrawTransfer" | "WpAccount" | "WpProduct"> | null;
user?: never;
wechatPay?: never;
withdraw?: never;
withdrawAccount?: never;
withdrawChannel?: never;
withdrawTransfer?: never;
wpAccount?: never;
wpProduct?: never;
}) & {
[k: string]: any;
};
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
export type RemoveOperationData = {} & (({
oper?: Oper.UpdateOperation | Oper.RemoveOperation;
})) & ({
user?: User.UpdateOperation | User.RemoveOperation;
} | {
wechatPay?: WechatPay.UpdateOperation | WechatPay.RemoveOperation;
} | {
withdraw?: Withdraw.UpdateOperation | Withdraw.RemoveOperation;
} | {
withdrawAccount?: WithdrawAccount.UpdateOperation | WithdrawAccount.RemoveOperation;
} | {
withdrawChannel?: WithdrawChannel.UpdateOperation | WithdrawChannel.RemoveOperation;
} | {
withdrawTransfer?: WithdrawTransfer.UpdateOperation | WithdrawTransfer.RemoveOperation;
} | {
wpAccount?: WpAccount.UpdateOperation | WpAccount.RemoveOperation;
} | {
wpProduct?: WpProduct.UpdateOperation | WpProduct.RemoveOperation;
} | {
[k: string]: any;
});
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export type OperIdSubQuery = Selection<OperIdProjection>;
export type UserIdSubQuery = Selection<UserIdProjection>;
export type WechatPayIdSubQuery = Selection<WechatPayIdProjection>;
export type WithdrawIdSubQuery = Selection<WithdrawIdProjection>;
export type WithdrawAccountIdSubQuery = Selection<WithdrawAccountIdProjection>;
export type WithdrawChannelIdSubQuery = Selection<WithdrawChannelIdProjection>;
export type WithdrawTransferIdSubQuery = Selection<WithdrawTransferIdProjection>;
export type WpAccountIdSubQuery = Selection<WpAccountIdProjection>;
export type WpProductIdSubQuery = Selection<WpProductIdProjection>;
export type OperEntityIdSubQuery = Selection<OperEntityIdProjection>;
export type EntityDef = {
Schema: Schema;
OpSchema: OpSchema;
Action: OakMakeAction<AppendOnlyAction> | string;
Selection: Selection;
Aggregation: Aggregation;
Operation: Operation;
Create: CreateOperation;
Update: UpdateOperation;
Remove: RemoveOperation;
CreateSingle: CreateSingleOperation;
CreateMulti: CreateMultipleOperation;
};
export {};