import { ForeignKey } from "oak-domain/lib/types/DataType"; 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 } from "oak-domain/lib/types/Entity"; import { Action, ParticularAction } from "./Action"; import { String } from "oak-domain/lib/types/DataType"; import { EntityShape } from "oak-domain/lib/types/Entity"; import { AbleState } from "oak-domain/lib/actions/action"; import * as User from "../User/Schema"; import * as Token from "../Token/Schema"; export type OpSchema = EntityShape & { mobile: String<16>; userId?: ForeignKey<"user"> | null; ableState?: AbleState | null; }; export type OpAttr = keyof OpSchema; export type Schema = EntityShape & { mobile: String<16>; userId?: ForeignKey<"user"> | null; ableState?: AbleState | null; user?: User.Schema | null; token$entity?: Array; token$entity$$aggr?: AggregationResult; } & { [A in ExpressionKey]?: any; }; type AttrFilter = { id: Q_StringValue; $$createAt$$: Q_DateValue; $$seq$$: Q_NumberValue; $$updateAt$$: Q_DateValue; mobile: Q_StringValue; userId: Q_StringValue; user: User.Filter; ableState: Q_EnumValue; token$entity: Token.Filter & SubQueryPredicateMetadata; }; export type Filter = MakeFilter>; export type Projection = { "#id"?: NodeId; [k: string]: any; id?: number; $$createAt$$?: number; $$updateAt$$?: number; $$seq$$?: number; mobile?: number; userId?: number; user?: User.Projection; ableState?: number; token$entity?: Token.Selection & { $entity: "token"; }; token$entity$$aggr?: Token.Aggregation & { $entity: "token"; }; } & Partial>; type MobileIdProjection = OneOf<{ id: number; }>; type UserIdProjection = OneOf<{ userId: number; }>; export type SortAttr = { id: number; } | { $$createAt$$: number; } | { $$seq$$: number; } | { $$updateAt$$: number; } | { mobile: number; } | { userId: number; } | { user: User.SortAttr; } | { ableState: 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> & (({ userId?: never; user?: User.CreateSingleOperation; } | { userId: ForeignKey<"user">; user?: User.UpdateOperation; } | { user?: never; userId?: ForeignKey<"user">; })) & { token$entity?: OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit>>; }; export type CreateSingleOperation = OakOperation<"create", CreateOperationData>; export type CreateMultipleOperation = OakOperation<"create", Array>; export type CreateOperation = CreateSingleOperation | CreateMultipleOperation; export type UpdateOperationData = FormUpdateData> & (({ user?: User.CreateSingleOperation; userId?: never; } | { user?: User.UpdateOperation; userId?: never; } | { user?: User.RemoveOperation; userId?: never; } | { user?: never; userId?: ForeignKey<"user"> | null; })) & { [k: string]: any; token$entity?: OakOperation, Omit> | OakOperation, Omit> | OakOperation<"create", Omit[]> | Array> | OakOperation, Omit> | OakOperation, Omit>>; }; export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>; export type RemoveOperationData = {} & (({ user?: User.UpdateOperation | User.RemoveOperation; })); export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>; export type Operation = CreateOperation | UpdateOperation | RemoveOperation; export type UserIdSubQuery = Selection; export type MobileIdSubQuery = 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 {};