import { Q_DateValue, 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, IState } from "./Action"; import { String } from "oak-domain/lib/types/DataType"; import * as ModiEntity from "../ModiEntity/Schema"; export type OpSchema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; action: String<24>; data: Object; filter?: Object | null; extra?: Object | null; iState?: IState | null; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { targetEntity: String<32>; entity: String<32>; entityId: String<64>; action: String<24>; data: Object; filter?: Object | null; extra?: Object | null; iState?: IState | null; modiEntity$modi?: Array; modiEntity$modi$$aggr?: AggregationResult; } & { [A in ExpressionKey]?: any; }; type AttrFilter = { id: Q_StringValue; $$createAt$$: Q_DateValue; $$seq$$: Q_NumberValue; $$updateAt$$: Q_DateValue; targetEntity: Q_StringValue; entity: Q_StringValue; entityId: Q_StringValue; action: Q_StringValue; data: Object; filter: Object; extra: Object; iState: Q_EnumValue; modiEntity$modi: ModiEntity.Filter & SubQueryPredicateMetadata; }; export type Filter = MakeFilter>; export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; $$createAt$$?: number; $$updateAt$$?: number; $$seq$$?: number; targetEntity?: number; entity?: number; entityId?: number; action?: number; data?: number | Object; filter?: number | Object; extra?: number | Object; iState?: number; modiEntity$modi?: ModiEntity.Selection & { $entity: "modiEntity"; }; modiEntity$modi$$aggr?: ModiEntity.Aggregation & { $entity: "modiEntity"; }; } & Partial>; type ModiIdProjection = OneOf<{ id: number; }>; export type SortAttr = { id: number; } | { $$createAt$$: number; } | { $$seq$$: number; } | { $$updateAt$$: number; } | { targetEntity: number; } | { entity: number; } | { entityId: number; } | { action: number; } | { iState: number; } | { [k: string]: any; } | OneOf>; export type SortNode = { $attr: SortAttr; $direction?: "asc" | "desc"; }; export type Sorter = SortNode[]; export type SelectOperation

= OakSelection<"select", P, Filter, Sorter>; export type Selection

= SelectOperation

; export type Aggregation = DeduceAggregation; export type CreateOperationData = FormCreateData> & ({ entity?: string; entityId?: string; [K: string]: any; }) & { modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; export type UpdateOperationData = FormUpdateData & { [k: string]: any; modiEntity$modi?: OakOperation<"create", Omit[]> | Array>>; }; export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; export type RemoveOperationData = {}; export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; export type Operation = CreateOperation | UpdateOperation | RemoveOperation; export type ModiIdSubQuery = Selection; export type EntityDef = { Schema: Schema; OpSchema: OpSchema; Action: OakMakeAction | string; Selection: Selection; Aggregation: Aggregation; Operation: Operation; Create: CreateOperation; Update: UpdateOperation; Remove: RemoveOperation; CreateSingle: CreateSingleOperation; CreateMulti: CreateMultipleOperation; ParticularAction: ParticularAction; }; export {};