244 lines
11 KiB
TypeScript
244 lines
11 KiB
TypeScript
import { ForeignKey } from "oak-domain/lib/types/DataType";
|
|
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } 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, AggregationResult, EntityShape } from "oak-domain/lib/types/Entity";
|
|
import { Action, ParticularAction } from "./Action";
|
|
import { String, Boolean } from "oak-domain/lib/types/DataType";
|
|
import * as System from "../System/Schema";
|
|
import * as OfflineAccount from "../OfflineAccount/Schema";
|
|
import * as WpAccount from "../WpAccount/Schema";
|
|
import * as WithdrawAccount from "../WithdrawAccount/Schema";
|
|
import * as ModiEntity from "../ModiEntity/Schema";
|
|
import * as OperEntity from "../OperEntity/Schema";
|
|
export type OpSchema = EntityShape & {
|
|
entity: "offlineAccount" | "wpAccount" | string;
|
|
entityId: String<64>;
|
|
enabled: Boolean;
|
|
systemId: ForeignKey<"system">;
|
|
};
|
|
export type OpAttr = keyof OpSchema;
|
|
type WithdrawAccount$channelAggr = "withdrawAccount$channel$$aggr" | "withdrawAccount$channel$$0$$aggr" | "withdrawAccount$channel$$1$$aggr" | "withdrawAccount$channel$$2$$aggr" | "withdrawAccount$channel$$3$$aggr" | "withdrawAccount$channel$$4$$aggr" | "withdrawAccount$channel$$5$$aggr" | "withdrawAccount$channel$$6$$aggr" | "withdrawAccount$channel$$7$$aggr" | "withdrawAccount$channel$$8$$aggr" | "withdrawAccount$channel$$9$$aggr";
|
|
type ModiEntity$entityAggr = "modiEntity$entity$$aggr" | "modiEntity$entity$$0$$aggr" | "modiEntity$entity$$1$$aggr" | "modiEntity$entity$$2$$aggr" | "modiEntity$entity$$3$$aggr" | "modiEntity$entity$$4$$aggr" | "modiEntity$entity$$5$$aggr" | "modiEntity$entity$$6$$aggr" | "modiEntity$entity$$7$$aggr" | "modiEntity$entity$$8$$aggr" | "modiEntity$entity$$9$$aggr";
|
|
type OperEntity$entityAggr = "operEntity$entity$$aggr" | "operEntity$entity$$0$$aggr" | "operEntity$entity$$1$$aggr" | "operEntity$entity$$2$$aggr" | "operEntity$entity$$3$$aggr" | "operEntity$entity$$4$$aggr" | "operEntity$entity$$5$$aggr" | "operEntity$entity$$6$$aggr" | "operEntity$entity$$7$$aggr" | "operEntity$entity$$8$$aggr" | "operEntity$entity$$9$$aggr";
|
|
export type Schema = OpSchema & {
|
|
system: System.Schema;
|
|
offlineAccount?: OfflineAccount.Schema;
|
|
wpAccount?: WpAccount.Schema;
|
|
withdrawAccount$channel?: Array<WithdrawAccount.Schema>;
|
|
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
operEntity$entity?: Array<OperEntity.Schema>;
|
|
} & {
|
|
[A in ExpressionKey]?: any;
|
|
} & {
|
|
[A in WithdrawAccount$channelAggr]?: AggregationResult<WithdrawAccount.Schema>;
|
|
} & {
|
|
[A in ModiEntity$entityAggr]?: AggregationResult<ModiEntity.Schema>;
|
|
} & {
|
|
[A in OperEntity$entityAggr]?: AggregationResult<OperEntity.Schema>;
|
|
};
|
|
type AttrFilter = {
|
|
id: Q_StringValue;
|
|
$$createAt$$: Q_DateValue;
|
|
$$seq$$: Q_NumberValue;
|
|
$$updateAt$$: Q_DateValue;
|
|
entity: Q_EnumValue<"offlineAccount" | "wpAccount" | string>;
|
|
entityId: Q_StringValue;
|
|
enabled: Q_BooleanValue;
|
|
systemId: Q_StringValue;
|
|
system: System.Filter;
|
|
offlineAccount: OfflineAccount.Filter;
|
|
wpAccount: WpAccount.Filter;
|
|
withdrawAccount$channel: WithdrawAccount.Filter & SubQueryPredicateMetadata;
|
|
modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
|
|
operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
|
|
};
|
|
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
export type Projection = {
|
|
"#id"?: NodeId;
|
|
[k: string]: any;
|
|
id?: number;
|
|
$$createAt$$?: number;
|
|
$$updateAt$$?: number;
|
|
$$seq$$?: number;
|
|
entity?: number;
|
|
entityId?: number;
|
|
enabled?: number;
|
|
systemId?: number;
|
|
system?: System.Projection;
|
|
offlineAccount?: OfflineAccount.Projection;
|
|
wpAccount?: WpAccount.Projection;
|
|
withdrawAccount$channel?: WithdrawAccount.Selection & {
|
|
$entity: "withdrawAccount";
|
|
};
|
|
modiEntity$entity?: ModiEntity.Selection & {
|
|
$entity: "modiEntity";
|
|
};
|
|
operEntity$entity?: OperEntity.Selection & {
|
|
$entity: "operEntity";
|
|
};
|
|
} & Partial<ExprOp<OpAttr | string>> & {
|
|
[A in WithdrawAccount$channelAggr]?: WithdrawAccount.Aggregation & {
|
|
$entity: "withdrawAccount";
|
|
};
|
|
} & {
|
|
[A in ModiEntity$entityAggr]?: ModiEntity.Aggregation & {
|
|
$entity: "modiEntity";
|
|
};
|
|
} & {
|
|
[A in OperEntity$entityAggr]?: OperEntity.Aggregation & {
|
|
$entity: "operEntity";
|
|
};
|
|
};
|
|
type WithdrawChannelIdProjection = OneOf<{
|
|
id: number;
|
|
}>;
|
|
type SystemIdProjection = OneOf<{
|
|
systemId: number;
|
|
}>;
|
|
type OfflineAccountIdProjection = OneOf<{
|
|
entityId: number;
|
|
}>;
|
|
type WpAccountIdProjection = OneOf<{
|
|
entityId: number;
|
|
}>;
|
|
export type SortAttr = {
|
|
id: number;
|
|
} | {
|
|
$$createAt$$: number;
|
|
} | {
|
|
$$seq$$: number;
|
|
} | {
|
|
$$updateAt$$: number;
|
|
} | {
|
|
entity: number;
|
|
} | {
|
|
entityId: number;
|
|
} | {
|
|
enabled: number;
|
|
} | {
|
|
systemId: number;
|
|
} | {
|
|
system: System.SortAttr;
|
|
} | {
|
|
offlineAccount: OfflineAccount.SortAttr;
|
|
} | {
|
|
wpAccount: WpAccount.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" | "systemId">> & (({
|
|
systemId?: never;
|
|
system: System.CreateSingleOperation;
|
|
} | {
|
|
systemId: ForeignKey<"system">;
|
|
system?: System.UpdateOperation;
|
|
} | {
|
|
system?: never;
|
|
systemId: ForeignKey<"system">;
|
|
})) & ({
|
|
entity?: never;
|
|
entityId?: never;
|
|
offlineAccount: OfflineAccount.CreateSingleOperation;
|
|
} | {
|
|
entity: "offlineAccount";
|
|
entityId: ForeignKey<"OfflineAccount">;
|
|
offlineAccount?: OfflineAccount.UpdateOperation;
|
|
} | {
|
|
entity: "offlineAccount";
|
|
entityId: ForeignKey<"OfflineAccount">;
|
|
offlineAccount?: never;
|
|
} | {
|
|
entity?: never;
|
|
entityId?: never;
|
|
wpAccount: WpAccount.CreateSingleOperation;
|
|
} | {
|
|
entity: "wpAccount";
|
|
entityId: ForeignKey<"WpAccount">;
|
|
wpAccount?: WpAccount.UpdateOperation;
|
|
} | {
|
|
entity: "wpAccount";
|
|
entityId: ForeignKey<"WpAccount">;
|
|
wpAccount?: never;
|
|
} | {
|
|
entity?: string;
|
|
entityId?: string;
|
|
[K: string]: any;
|
|
}) & {
|
|
withdrawAccount$channel?: OakOperation<WithdrawAccount.UpdateOperation["action"], Omit<WithdrawAccount.UpdateOperationData, "channel" | "channelId">, Omit<WithdrawAccount.Filter, "channel" | "channelId">> | OakOperation<"create", Omit<WithdrawAccount.CreateOperationData, "channel" | "channelId">[]> | Array<OakOperation<"create", Omit<WithdrawAccount.CreateOperationData, "channel" | "channelId">> | OakOperation<WithdrawAccount.UpdateOperation["action"], Omit<WithdrawAccount.UpdateOperationData, "channel" | "channelId">, Omit<WithdrawAccount.Filter, "channel" | "channelId">>>;
|
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
};
|
|
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" | "systemId">> & (({
|
|
system?: System.CreateSingleOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: System.UpdateOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: System.RemoveOperation;
|
|
systemId?: never;
|
|
} | {
|
|
system?: never;
|
|
systemId?: ForeignKey<"system">;
|
|
})) & ({
|
|
offlineAccount?: OfflineAccount.CreateSingleOperation | OfflineAccount.UpdateOperation | OfflineAccount.RemoveOperation;
|
|
entityId?: never;
|
|
entity?: never;
|
|
} | {
|
|
wpAccount?: WpAccount.CreateSingleOperation | WpAccount.UpdateOperation | WpAccount.RemoveOperation;
|
|
entityId?: never;
|
|
entity?: never;
|
|
} | {
|
|
entity?: ("offlineAccount" | "wpAccount" | string) | null;
|
|
entityId?: ForeignKey<"OfflineAccount" | "WpAccount"> | null;
|
|
offlineAccount?: never;
|
|
wpAccount?: never;
|
|
}) & {
|
|
[k: string]: any;
|
|
withdrawAccount$channel?: OakOperation<WithdrawAccount.UpdateOperation["action"], Omit<WithdrawAccount.UpdateOperationData, "channel" | "channelId">, Omit<WithdrawAccount.Filter, "channel" | "channelId">> | OakOperation<WithdrawAccount.RemoveOperation["action"], Omit<WithdrawAccount.RemoveOperationData, "channel" | "channelId">, Omit<WithdrawAccount.Filter, "channel" | "channelId">> | OakOperation<"create", Omit<WithdrawAccount.CreateOperationData, "channel" | "channelId">[]> | Array<OakOperation<"create", Omit<WithdrawAccount.CreateOperationData, "channel" | "channelId">> | OakOperation<WithdrawAccount.UpdateOperation["action"], Omit<WithdrawAccount.UpdateOperationData, "channel" | "channelId">, Omit<WithdrawAccount.Filter, "channel" | "channelId">> | OakOperation<WithdrawAccount.RemoveOperation["action"], Omit<WithdrawAccount.RemoveOperationData, "channel" | "channelId">, Omit<WithdrawAccount.Filter, "channel" | "channelId">>>;
|
|
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
};
|
|
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
export type RemoveOperationData = {} & (({
|
|
system?: System.UpdateOperation | System.RemoveOperation;
|
|
})) & ({
|
|
offlineAccount?: OfflineAccount.UpdateOperation | OfflineAccount.RemoveOperation;
|
|
} | {
|
|
wpAccount?: WpAccount.UpdateOperation | WpAccount.RemoveOperation;
|
|
} | {
|
|
[k: string]: any;
|
|
});
|
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
|
export type OfflineAccountIdSubQuery = Selection<OfflineAccountIdProjection>;
|
|
export type WpAccountIdSubQuery = Selection<WpAccountIdProjection>;
|
|
export type WithdrawChannelIdSubQuery = Selection<WithdrawChannelIdProjection>;
|
|
export type EntityDef = {
|
|
Schema: Schema;
|
|
OpSchema: OpSchema;
|
|
Action: OakMakeAction<Action> | string;
|
|
Selection: Selection;
|
|
Aggregation: Aggregation;
|
|
Operation: Operation;
|
|
Create: CreateOperation;
|
|
Update: UpdateOperation;
|
|
Remove: RemoveOperation;
|
|
CreateSingle: CreateSingleOperation;
|
|
CreateMulti: CreateMultipleOperation;
|
|
ParticularAction: ParticularAction;
|
|
};
|
|
export {};
|