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

174 lines
12 KiB
TypeScript

import { JsonProjection } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, JsonFilter, 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 { GenericAction, RelationAction } from "oak-domain/lib/actions/action";
import { String, Text } from "oak-domain/lib/types/DataType";
import { Config } from "../../types/Config";
import { Style } from "../../types/Style";
import * as Message from "../Message/Schema";
import * as System from "../System/Schema";
import * as Relation from "../Relation/Schema";
import * as UserRelation from "../UserRelation/Schema";
export type OpSchema = EntityShape & {
name: String<32>;
description?: Text | null;
config: Config;
style?: Style | null;
entity?: String<32> | null;
entityId?: String<64> | null;
};
export type OpAttr = keyof OpSchema;
type Message$platformAggr = "message$platform$$aggr" | "message$platform$$0$$aggr" | "message$platform$$1$$aggr" | "message$platform$$2$$aggr" | "message$platform$$3$$aggr" | "message$platform$$4$$aggr" | "message$platform$$5$$aggr" | "message$platform$$6$$aggr" | "message$platform$$7$$aggr" | "message$platform$$8$$aggr" | "message$platform$$9$$aggr";
type System$platformAggr = "system$platform$$aggr" | "system$platform$$0$$aggr" | "system$platform$$1$$aggr" | "system$platform$$2$$aggr" | "system$platform$$3$$aggr" | "system$platform$$4$$aggr" | "system$platform$$5$$aggr" | "system$platform$$6$$aggr" | "system$platform$$7$$aggr" | "system$platform$$8$$aggr" | "system$platform$$9$$aggr";
type Relation$entityAggr = "relation$entity$$aggr" | "relation$entity$$0$$aggr" | "relation$entity$$1$$aggr" | "relation$entity$$2$$aggr" | "relation$entity$$3$$aggr" | "relation$entity$$4$$aggr" | "relation$entity$$5$$aggr" | "relation$entity$$6$$aggr" | "relation$entity$$7$$aggr" | "relation$entity$$8$$aggr" | "relation$entity$$9$$aggr";
type UserRelation$entityAggr = "userRelation$entity$$aggr" | "userRelation$entity$$0$$aggr" | "userRelation$entity$$1$$aggr" | "userRelation$entity$$2$$aggr" | "userRelation$entity$$3$$aggr" | "userRelation$entity$$4$$aggr" | "userRelation$entity$$5$$aggr" | "userRelation$entity$$6$$aggr" | "userRelation$entity$$7$$aggr" | "userRelation$entity$$8$$aggr" | "userRelation$entity$$9$$aggr";
export type Schema = OpSchema & {
message$platform?: Array<Message.Schema>;
system$platform?: Array<System.Schema>;
relation$entity?: Array<Relation.Schema>;
userRelation$entity?: Array<UserRelation.Schema>;
} & {
[A in ExpressionKey]?: any;
} & {
[A in Message$platformAggr]?: AggregationResult<Message.Schema>;
} & {
[A in System$platformAggr]?: AggregationResult<System.Schema>;
} & {
[A in Relation$entityAggr]?: AggregationResult<Relation.Schema>;
} & {
[A in UserRelation$entityAggr]?: AggregationResult<UserRelation.Schema>;
};
type AttrFilter = {
id: Q_StringValue;
$$createAt$$: Q_DateValue;
$$seq$$: Q_NumberValue;
$$updateAt$$: Q_DateValue;
name: Q_StringValue;
description: Q_StringValue;
config: JsonFilter<Config>;
style: JsonFilter<Style>;
entity: Q_StringValue;
entityId: Q_StringValue;
message$platform: Message.Filter & SubQueryPredicateMetadata;
system$platform: System.Filter & SubQueryPredicateMetadata;
relation$entity: Relation.Filter & SubQueryPredicateMetadata;
userRelation$entity: UserRelation.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;
name?: number;
description?: number;
config?: number | JsonProjection<Config>;
style?: number | JsonProjection<Style>;
entity?: number;
entityId?: number;
message$platform?: Message.Selection & {
$entity: "message";
};
system$platform?: System.Selection & {
$entity: "system";
};
relation$entity?: Relation.Selection & {
$entity: "relation";
};
userRelation$entity?: UserRelation.Selection & {
$entity: "userRelation";
};
} & Partial<ExprOp<OpAttr | string>> & {
[A in Message$platformAggr]?: Message.Aggregation & {
$entity: "message";
};
} & {
[A in System$platformAggr]?: System.Aggregation & {
$entity: "system";
};
} & {
[A in Relation$entityAggr]?: Relation.Aggregation & {
$entity: "relation";
};
} & {
[A in UserRelation$entityAggr]?: UserRelation.Aggregation & {
$entity: "userRelation";
};
};
type PlatformIdProjection = OneOf<{
id: number;
}>;
export type SortAttr = {
id: number;
} | {
$$createAt$$: number;
} | {
$$seq$$: number;
} | {
$$updateAt$$: number;
} | {
name: number;
} | {
description: number;
} | {
config: number;
} | {
style: number;
} | {
entity: number;
} | {
entityId: number;
} | {
[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">> & ({
entity?: string;
entityId?: string;
[K: string]: any;
}) & {
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
relation$entity?: OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">> | OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">>>;
userRelation$entity?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">>>;
};
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
message$platform?: OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<Message.CreateOperationData, "platform" | "platformId">> | OakOperation<Message.UpdateOperation["action"], Omit<Message.UpdateOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">> | OakOperation<Message.RemoveOperation["action"], Omit<Message.RemoveOperationData, "platform" | "platformId">, Omit<Message.Filter, "platform" | "platformId">>>;
system$platform?: OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">[]> | Array<OakOperation<"create", Omit<System.CreateOperationData, "platform" | "platformId">> | OakOperation<System.UpdateOperation["action"], Omit<System.UpdateOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">> | OakOperation<System.RemoveOperation["action"], Omit<System.RemoveOperationData, "platform" | "platformId">, Omit<System.Filter, "platform" | "platformId">>>;
relation$entity?: OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<Relation.RemoveOperation["action"], Omit<Relation.RemoveOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Relation.CreateOperationData, "entity" | "entityId">> | OakOperation<Relation.UpdateOperation["action"], Omit<Relation.UpdateOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">> | OakOperation<Relation.RemoveOperation["action"], Omit<Relation.RemoveOperationData, "entity" | "entityId">, Omit<Relation.Filter, "entity" | "entityId">>>;
userRelation$entity?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "entity" | "entityId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "entity" | "entityId">, Omit<UserRelation.Filter, "entity" | "entityId">>>;
};
export type UpdateOperation = OakOperation<"update" | RelationAction | string, UpdateOperationData, Filter, Sorter>;
export type RemoveOperationData = {};
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
export type EntityDef = {
Schema: Schema;
OpSchema: OpSchema;
Action: OakMakeAction<GenericAction | RelationAction> | string;
Selection: Selection;
Aggregation: Aggregation;
Operation: Operation;
Create: CreateOperation;
Update: UpdateOperation;
Remove: RemoveOperation;
CreateSingle: CreateSingleOperation;
CreateMulti: CreateMultipleOperation;
};
export {};