oak-app-domain加进git
This commit is contained in:
parent
4a2783eb81
commit
a6671278d6
|
|
@ -64,6 +64,5 @@ jspm_packages/
|
|||
|
||||
build
|
||||
package-lock.json
|
||||
src/oak-app-domain
|
||||
scripts/local
|
||||
*tsbuildinfo
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
import { AbleAction, AbleState, makeAbleActionDef } from 'oak-domain/lib/actions/action';
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type PayAction = 'charge' | 'withdraw' | 'cost' | 'refund' | 'loan' | 'repay' | string;
|
||||
export type ParticularAction = AbleAction | PayAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "enable", "disable", "charge", "withdraw", "cost", "refund", "loan", "repay"];
|
||||
const AbleActionDef: ActionDef<AbleAction, AbleState> = makeAbleActionDef('enabled');
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
ableState: AbleActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Price, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { AbleAction, AbleState, makeAbleActionDef } from "oak-domain/lib/actions/action";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Relation from "../Relation/Schema";
|
||||
import * as UserRelation from "../UserRelation/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
total: Price;
|
||||
avail: Price;
|
||||
entity?: ("user" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
ableState?: AbleState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
total: Price;
|
||||
avail: Price;
|
||||
entity?: ("user" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
ableState?: AbleState | null;
|
||||
user?: User.Schema;
|
||||
relation$entity?: Array<Relation.Schema>;
|
||||
relation$entity$$aggr?: AggregationResult<Relation.Schema>;
|
||||
userRelation$entity?: Array<UserRelation.Schema>;
|
||||
userRelation$entity$$aggr?: AggregationResult<UserRelation.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
total: Q_NumberValue;
|
||||
avail: Q_NumberValue;
|
||||
entity: Q_EnumValue<"user" | string>;
|
||||
entityId: Q_StringValue;
|
||||
ableState: Q_EnumValue<AbleState>;
|
||||
user: User.Filter;
|
||||
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;
|
||||
total?: number;
|
||||
avail?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
ableState?: number;
|
||||
user?: User.Projection;
|
||||
relation$entity?: Relation.Selection & {
|
||||
$entity: "relation";
|
||||
};
|
||||
relation$entity$$aggr?: Relation.Aggregation & {
|
||||
$entity: "relation";
|
||||
};
|
||||
userRelation$entity?: UserRelation.Selection & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
userRelation$entity$$aggr?: UserRelation.Aggregation & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type AccountIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
total: number;
|
||||
} | {
|
||||
avail: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
ableState: number;
|
||||
} | {
|
||||
user: User.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">> & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
user?: User.CreateSingleOperation;
|
||||
} | {
|
||||
entity?: "user";
|
||||
entityId?: ForeignKey<"User">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
entity?: "user";
|
||||
entityId?: ForeignKey<"User">;
|
||||
user?: never;
|
||||
} | {
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
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<Omit<OpSchema, "entity" | "entityId">> & ({
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: "user" | string;
|
||||
entityId?: ForeignKey<"User">;
|
||||
user?: never;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
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" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type AccountIdSubQuery = Selection<AccountIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<Action | RelationAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
ParticularAction: ParticularAction;
|
||||
};
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
import { relationActions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
total: {
|
||||
notNull: true,
|
||||
type: "money"
|
||||
},
|
||||
avail: {
|
||||
notNull: true,
|
||||
type: "money"
|
||||
},
|
||||
entity: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user"]
|
||||
},
|
||||
entityId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
ableState: {
|
||||
type: "enum",
|
||||
enumeration: ["enabled", "disabled"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
relation: ["owner", "audit"]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"地址","attr":{"ableState":"状态","total":"余额","avail":"可用余额","entity":"对象实体","entityId":"对象实体Id"},"action":{"charge":"充值","withdraw":"提现","cost":"支付","refund":"退款","loan":"抵押","repay":"归还","enable":"启用","disable":"禁用"},"r":{"owner":"所有者","audit":"审核者"},"v":{"ableState":{"enabled":"正常","disabled":"冻结"}}}
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Relation from "../Relation/Schema";
|
||||
import * as Path from "../Path/Schema";
|
||||
type Actions = string[];
|
||||
export type OpSchema = EntityShape & {
|
||||
relationId?: ForeignKey<"relation"> | null;
|
||||
pathId: ForeignKey<"path">;
|
||||
deActions: Actions;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
relationId?: ForeignKey<"relation"> | null;
|
||||
pathId: ForeignKey<"path">;
|
||||
deActions: Actions;
|
||||
relation?: Relation.Schema | null;
|
||||
path: Path.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
relationId: Q_StringValue;
|
||||
relation: Relation.Filter;
|
||||
pathId: Q_StringValue;
|
||||
path: Path.Filter;
|
||||
deActions: JsonFilter<Actions>;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
relationId?: number;
|
||||
relation?: Relation.Projection;
|
||||
pathId?: number;
|
||||
path?: Path.Projection;
|
||||
deActions?: number | JsonProjection<Actions>;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ActionAuthIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type RelationIdProjection = OneOf<{
|
||||
relationId: number;
|
||||
}>;
|
||||
type PathIdProjection = OneOf<{
|
||||
pathId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
relationId: number;
|
||||
} | {
|
||||
relation: Relation.SortAttr;
|
||||
} | {
|
||||
pathId: number;
|
||||
} | {
|
||||
path: Path.SortAttr;
|
||||
} | {
|
||||
deActions: 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, "relationId" | "pathId">> & (({
|
||||
relationId?: never;
|
||||
relation?: Relation.CreateSingleOperation;
|
||||
} | {
|
||||
relationId: ForeignKey<"relation">;
|
||||
relation?: Relation.UpdateOperation;
|
||||
} | {
|
||||
relation?: never;
|
||||
relationId?: ForeignKey<"relation">;
|
||||
}) & ({
|
||||
pathId?: never;
|
||||
path: Path.CreateSingleOperation;
|
||||
} | {
|
||||
pathId: ForeignKey<"path">;
|
||||
path?: Path.UpdateOperation;
|
||||
} | {
|
||||
path?: never;
|
||||
pathId: ForeignKey<"path">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId" | "pathId">> & (({
|
||||
relation?: Relation.CreateSingleOperation;
|
||||
relationId?: never;
|
||||
} | {
|
||||
relation?: Relation.UpdateOperation;
|
||||
relationId?: never;
|
||||
} | {
|
||||
relation?: Relation.RemoveOperation;
|
||||
relationId?: never;
|
||||
} | {
|
||||
relation?: never;
|
||||
relationId?: ForeignKey<"relation"> | null;
|
||||
}) & ({
|
||||
path?: Path.CreateSingleOperation;
|
||||
pathId?: never;
|
||||
} | {
|
||||
path?: Path.UpdateOperation;
|
||||
pathId?: never;
|
||||
} | {
|
||||
path?: Path.RemoveOperation;
|
||||
pathId?: never;
|
||||
} | {
|
||||
path?: never;
|
||||
pathId?: ForeignKey<"path">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
}) & ({
|
||||
path?: Path.UpdateOperation | Path.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
||||
export type PathIdSubQuery = Selection<PathIdProjection>;
|
||||
export type ActionAuthIdSubQuery = Selection<ActionAuthIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
relationId: {
|
||||
type: "ref",
|
||||
ref: "relation"
|
||||
},
|
||||
pathId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "path"
|
||||
},
|
||||
deActions: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_relation_path',
|
||||
attributes: [
|
||||
{
|
||||
name: "relationId",
|
||||
},
|
||||
{
|
||||
name: "pathId",
|
||||
}
|
||||
],
|
||||
config: {
|
||||
unique: true,
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"用户授权","attr":{"relation":"关系","path":"路径","deActions":"目标对象动作"}}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import { ActionDefDict as Modi } from "./Modi/Action";
|
||||
import { ActionDefDict as Account } from "./Account/Action";
|
||||
import { ActionDefDict as Captcha } from "./Captcha/Action";
|
||||
import { ActionDefDict as Email } from "./Email/Action";
|
||||
import { ActionDefDict as Message } from "./Message/Action";
|
||||
import { ActionDefDict as Mobile } from "./Mobile/Action";
|
||||
import { ActionDefDict as Notification } from "./Notification/Action";
|
||||
import { ActionDefDict as Parasite } from "./Parasite/Action";
|
||||
import { ActionDefDict as ToDo } from "./ToDo/Action";
|
||||
import { ActionDefDict as Token } from "./Token/Action";
|
||||
import { ActionDefDict as User } from "./User/Action";
|
||||
import { ActionDefDict as UserEntityGrant } from "./UserEntityGrant/Action";
|
||||
import { ActionDefDict as UserWechatPublicTag } from "./UserWechatPublicTag/Action";
|
||||
import { ActionDefDict as WechatLogin } from "./WechatLogin/Action";
|
||||
import { ActionDefDict as WechatMenu } from "./WechatMenu/Action";
|
||||
import { ActionDefDict as WechatPublicTag } from "./WechatPublicTag/Action";
|
||||
export const ActionDefDict = {
|
||||
modi: Modi,
|
||||
account: Account,
|
||||
captcha: Captcha,
|
||||
email: Email,
|
||||
message: Message,
|
||||
mobile: Mobile,
|
||||
notification: Notification,
|
||||
parasite: Parasite,
|
||||
toDo: ToDo,
|
||||
token: Token,
|
||||
user: User,
|
||||
userEntityGrant: UserEntityGrant,
|
||||
userWechatPublicTag: UserWechatPublicTag,
|
||||
wechatLogin: WechatLogin,
|
||||
wechatMenu: WechatMenu,
|
||||
wechatPublicTag: WechatPublicTag
|
||||
};
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Image, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Area from "../Area/Schema";
|
||||
import * as User from "../User/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
detail: String<32>;
|
||||
areaId: ForeignKey<"area">;
|
||||
phone: String<12>;
|
||||
name: String<32>;
|
||||
default: Boolean;
|
||||
remark?: Text | null;
|
||||
entity?: ("user" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
detail: String<32>;
|
||||
areaId: ForeignKey<"area">;
|
||||
phone: String<12>;
|
||||
name: String<32>;
|
||||
default: Boolean;
|
||||
remark?: Text | null;
|
||||
entity?: ("user" | string) | null;
|
||||
entityId?: String<64> | null;
|
||||
area: Area.Schema;
|
||||
user?: User.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
detail: Q_StringValue;
|
||||
areaId: Q_StringValue;
|
||||
area: Area.Filter;
|
||||
phone: Q_StringValue;
|
||||
name: Q_StringValue;
|
||||
default: Q_BooleanValue;
|
||||
remark: Q_StringValue;
|
||||
entity: Q_EnumValue<"user" | string>;
|
||||
entityId: Q_StringValue;
|
||||
user: User.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;
|
||||
detail?: number;
|
||||
areaId?: number;
|
||||
area?: Area.Projection;
|
||||
phone?: number;
|
||||
name?: number;
|
||||
default?: number;
|
||||
remark?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
user?: User.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type AddressIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type AreaIdProjection = OneOf<{
|
||||
areaId: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
detail: number;
|
||||
} | {
|
||||
areaId: number;
|
||||
} | {
|
||||
area: Area.SortAttr;
|
||||
} | {
|
||||
phone: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
default: number;
|
||||
} | {
|
||||
remark: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
user: User.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" | "areaId">> & ({
|
||||
area?: never;
|
||||
areaId: ForeignKey<"area">;
|
||||
}) & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
user?: User.CreateSingleOperation;
|
||||
} | {
|
||||
entity?: "user";
|
||||
entityId?: ForeignKey<"User">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
entity?: "user";
|
||||
entityId?: ForeignKey<"User">;
|
||||
user?: 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" | "areaId">> & ({
|
||||
area?: never;
|
||||
areaId?: ForeignKey<"area">;
|
||||
}) & ({
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: "user" | string;
|
||||
entityId?: ForeignKey<"User">;
|
||||
user?: never;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type AreaIdSubQuery = Selection<AreaIdProjection>;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type AddressIdSubQuery = Selection<AddressIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
detail: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
areaId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "area"
|
||||
},
|
||||
phone: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 12
|
||||
}
|
||||
},
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
default: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
remark: {
|
||||
type: "text"
|
||||
},
|
||||
entity: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user"]
|
||||
},
|
||||
entityId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"地址","attr":{"detail":"详细地址","area":"所在地区","phone":"联系电话","name":"姓名","default":"是否默认","remark":"备注","entity":"对象实体","entityId":"对象实体Id"}}
|
||||
|
|
@ -0,0 +1,331 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Image, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { Style } from "../../types/Style";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as System from "../System/Schema";
|
||||
import * as ExtraFile from "../ExtraFile/Schema";
|
||||
import * as Notification from "../Notification/Schema";
|
||||
import * as SessionMessage from "../SessionMessage/Schema";
|
||||
import * as Token from "../Token/Schema";
|
||||
import * as WechatMenu from "../WechatMenu/Schema";
|
||||
import * as WechatPublicAutoReply from "../WechatPublicAutoReply/Schema";
|
||||
import * as WechatPublicTag from "../WechatPublicTag/Schema";
|
||||
import * as WechatPublicTemplate from "../WechatPublicTemplate/Schema";
|
||||
import * as WechatQrCode from "../WechatQrCode/Schema";
|
||||
import * as WechatUser from "../WechatUser/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
export type Passport = 'email' | 'mobile' | 'wechat' | 'wechatPublic';
|
||||
export type AppType = 'web' | 'wechatMp' | 'wechatPublic' | 'native';
|
||||
export type WechatMpConfig = {
|
||||
type: 'wechatMp';
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
originalId?: string; //原始id
|
||||
qrCodePrefix?: string; // 扫描二维码跳转的前缀(在小程序后台配置,必须统一跳转到weCharQrCode/scan/index)
|
||||
server?: {
|
||||
url?: string; //服务器地址(URL)
|
||||
token: string; //令牌(Token)
|
||||
encodingAESKey: string; //消息加解密密钥(EncodingAESKey)
|
||||
mode: 'clear' | 'compatible' | 'safe'; //消息加解密方式 明文模式 兼容模式 安全模式
|
||||
dataFormat: 'json' | 'xml';
|
||||
};
|
||||
passport?: Passport[];
|
||||
};
|
||||
export type WebConfig = {
|
||||
type: 'web';
|
||||
wechat?: {
|
||||
appId: string;
|
||||
appSecret: string; //网站 微信扫码登录
|
||||
domain?: string;
|
||||
enable?: boolean; //启用扫码登录
|
||||
};
|
||||
passport?: Passport[];
|
||||
};
|
||||
export type WechatPublicTemplateMsgsConfig = Record<string, string>; // key值代表messageTypeId,value的值代表对应的templateId,data的转换改成message上的函数注入
|
||||
export type WechatPublicConfig = {
|
||||
type: 'wechatPublic';
|
||||
isService: boolean; // 是否服务号
|
||||
appId: string;
|
||||
appSecret: string;
|
||||
originalId?: string; //原始id
|
||||
enable?: boolean;
|
||||
templateMsgs?: WechatPublicTemplateMsgsConfig;
|
||||
server?: {
|
||||
url?: string; //服务器地址(URL)
|
||||
token: string; //令牌(Token)
|
||||
encodingAESKey: string; //消息加解密密钥(EncodingAESKey)
|
||||
mode: 'clear' | 'compatible' | 'safe'; //消息加解密方式 明文模式 兼容模式 安全模式
|
||||
};
|
||||
wechatMp?: {
|
||||
appId: string;
|
||||
//公众号跳小程序配置 originalId
|
||||
originalId: string; //原始id
|
||||
};
|
||||
passport?: Passport[];
|
||||
};
|
||||
export type NativeConfig = {
|
||||
type: 'native';
|
||||
passport?: Passport[];
|
||||
};
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
description: Text;
|
||||
type: AppType;
|
||||
systemId: ForeignKey<"system">;
|
||||
config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
|
||||
style?: Style | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
name: String<32>;
|
||||
description: Text;
|
||||
type: AppType;
|
||||
systemId: ForeignKey<"system">;
|
||||
config: WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig;
|
||||
style?: Style | null;
|
||||
system: System.Schema;
|
||||
extraFile$application?: Array<ExtraFile.Schema>;
|
||||
extraFile$application$$aggr?: AggregationResult<ExtraFile.Schema>;
|
||||
notification$application?: Array<Notification.Schema>;
|
||||
notification$application$$aggr?: AggregationResult<Notification.Schema>;
|
||||
sessionMessage$application?: Array<SessionMessage.Schema>;
|
||||
sessionMessage$application$$aggr?: AggregationResult<SessionMessage.Schema>;
|
||||
token$application?: Array<Token.Schema>;
|
||||
token$application$$aggr?: AggregationResult<Token.Schema>;
|
||||
wechatMenu$application?: Array<WechatMenu.Schema>;
|
||||
wechatMenu$application$$aggr?: AggregationResult<WechatMenu.Schema>;
|
||||
wechatPublicAutoReply$application?: Array<WechatPublicAutoReply.Schema>;
|
||||
wechatPublicAutoReply$application$$aggr?: AggregationResult<WechatPublicAutoReply.Schema>;
|
||||
wechatPublicTag$application?: Array<WechatPublicTag.Schema>;
|
||||
wechatPublicTag$application$$aggr?: AggregationResult<WechatPublicTag.Schema>;
|
||||
wechatPublicTemplate$application?: Array<WechatPublicTemplate.Schema>;
|
||||
wechatPublicTemplate$application$$aggr?: AggregationResult<WechatPublicTemplate.Schema>;
|
||||
wechatQrCode$application?: Array<WechatQrCode.Schema>;
|
||||
wechatQrCode$application$$aggr?: AggregationResult<WechatQrCode.Schema>;
|
||||
wechatUser$application?: Array<WechatUser.Schema>;
|
||||
wechatUser$application$$aggr?: AggregationResult<WechatUser.Schema>;
|
||||
session$entity?: Array<Session.Schema>;
|
||||
session$entity$$aggr?: AggregationResult<Session.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
name: Q_StringValue;
|
||||
description: Q_StringValue;
|
||||
type: Q_EnumValue<AppType>;
|
||||
systemId: Q_StringValue;
|
||||
system: System.Filter;
|
||||
config: JsonFilter<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
|
||||
style: JsonFilter<Style>;
|
||||
extraFile$application: ExtraFile.Filter & SubQueryPredicateMetadata;
|
||||
notification$application: Notification.Filter & SubQueryPredicateMetadata;
|
||||
sessionMessage$application: SessionMessage.Filter & SubQueryPredicateMetadata;
|
||||
token$application: Token.Filter & SubQueryPredicateMetadata;
|
||||
wechatMenu$application: WechatMenu.Filter & SubQueryPredicateMetadata;
|
||||
wechatPublicAutoReply$application: WechatPublicAutoReply.Filter & SubQueryPredicateMetadata;
|
||||
wechatPublicTag$application: WechatPublicTag.Filter & SubQueryPredicateMetadata;
|
||||
wechatPublicTemplate$application: WechatPublicTemplate.Filter & SubQueryPredicateMetadata;
|
||||
wechatQrCode$application: WechatQrCode.Filter & SubQueryPredicateMetadata;
|
||||
wechatUser$application: WechatUser.Filter & SubQueryPredicateMetadata;
|
||||
session$entity: Session.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;
|
||||
type?: number;
|
||||
systemId?: number;
|
||||
system?: System.Projection;
|
||||
config?: number | JsonProjection<WebConfig | WechatMpConfig | WechatPublicConfig | NativeConfig>;
|
||||
style?: number | JsonProjection<Style>;
|
||||
extraFile$application?: ExtraFile.Selection & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
extraFile$application$$aggr?: ExtraFile.Aggregation & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
notification$application?: Notification.Selection & {
|
||||
$entity: "notification";
|
||||
};
|
||||
notification$application$$aggr?: Notification.Aggregation & {
|
||||
$entity: "notification";
|
||||
};
|
||||
sessionMessage$application?: SessionMessage.Selection & {
|
||||
$entity: "sessionMessage";
|
||||
};
|
||||
sessionMessage$application$$aggr?: SessionMessage.Aggregation & {
|
||||
$entity: "sessionMessage";
|
||||
};
|
||||
token$application?: Token.Selection & {
|
||||
$entity: "token";
|
||||
};
|
||||
token$application$$aggr?: Token.Aggregation & {
|
||||
$entity: "token";
|
||||
};
|
||||
wechatMenu$application?: WechatMenu.Selection & {
|
||||
$entity: "wechatMenu";
|
||||
};
|
||||
wechatMenu$application$$aggr?: WechatMenu.Aggregation & {
|
||||
$entity: "wechatMenu";
|
||||
};
|
||||
wechatPublicAutoReply$application?: WechatPublicAutoReply.Selection & {
|
||||
$entity: "wechatPublicAutoReply";
|
||||
};
|
||||
wechatPublicAutoReply$application$$aggr?: WechatPublicAutoReply.Aggregation & {
|
||||
$entity: "wechatPublicAutoReply";
|
||||
};
|
||||
wechatPublicTag$application?: WechatPublicTag.Selection & {
|
||||
$entity: "wechatPublicTag";
|
||||
};
|
||||
wechatPublicTag$application$$aggr?: WechatPublicTag.Aggregation & {
|
||||
$entity: "wechatPublicTag";
|
||||
};
|
||||
wechatPublicTemplate$application?: WechatPublicTemplate.Selection & {
|
||||
$entity: "wechatPublicTemplate";
|
||||
};
|
||||
wechatPublicTemplate$application$$aggr?: WechatPublicTemplate.Aggregation & {
|
||||
$entity: "wechatPublicTemplate";
|
||||
};
|
||||
wechatQrCode$application?: WechatQrCode.Selection & {
|
||||
$entity: "wechatQrCode";
|
||||
};
|
||||
wechatQrCode$application$$aggr?: WechatQrCode.Aggregation & {
|
||||
$entity: "wechatQrCode";
|
||||
};
|
||||
wechatUser$application?: WechatUser.Selection & {
|
||||
$entity: "wechatUser";
|
||||
};
|
||||
wechatUser$application$$aggr?: WechatUser.Aggregation & {
|
||||
$entity: "wechatUser";
|
||||
};
|
||||
session$entity?: Session.Selection & {
|
||||
$entity: "session";
|
||||
};
|
||||
session$entity$$aggr?: Session.Aggregation & {
|
||||
$entity: "session";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ApplicationIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type SystemIdProjection = OneOf<{
|
||||
systemId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
description: number;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
systemId: number;
|
||||
} | {
|
||||
system: System.SortAttr;
|
||||
} | {
|
||||
style: 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, "systemId">> & (({
|
||||
systemId?: never;
|
||||
system: System.CreateSingleOperation;
|
||||
} | {
|
||||
systemId: ForeignKey<"system">;
|
||||
system?: System.UpdateOperation;
|
||||
} | {
|
||||
system?: never;
|
||||
systemId: ForeignKey<"system">;
|
||||
})) & {
|
||||
extraFile$application?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "application" | "applicationId">, Omit<ExtraFile.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "application" | "applicationId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "application" | "applicationId">, Omit<ExtraFile.Filter, "application" | "applicationId">>>;
|
||||
notification$application?: OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "application" | "applicationId">, Omit<Notification.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<Notification.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<Notification.CreateOperationData, "application" | "applicationId">> | OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "application" | "applicationId">, Omit<Notification.Filter, "application" | "applicationId">>>;
|
||||
sessionMessage$application?: OakOperation<SessionMessage.UpdateOperation["action"], Omit<SessionMessage.UpdateOperationData, "application" | "applicationId">, Omit<SessionMessage.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<SessionMessage.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<SessionMessage.CreateOperationData, "application" | "applicationId">> | OakOperation<SessionMessage.UpdateOperation["action"], Omit<SessionMessage.UpdateOperationData, "application" | "applicationId">, Omit<SessionMessage.Filter, "application" | "applicationId">>>;
|
||||
token$application?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "application" | "applicationId">, Omit<Token.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<Token.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "application" | "applicationId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "application" | "applicationId">, Omit<Token.Filter, "application" | "applicationId">>>;
|
||||
wechatMenu$application?: OakOperation<WechatMenu.UpdateOperation["action"], Omit<WechatMenu.UpdateOperationData, "application" | "applicationId">, Omit<WechatMenu.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatMenu.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatMenu.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatMenu.UpdateOperation["action"], Omit<WechatMenu.UpdateOperationData, "application" | "applicationId">, Omit<WechatMenu.Filter, "application" | "applicationId">>>;
|
||||
wechatPublicAutoReply$application?: OakOperation<WechatPublicAutoReply.UpdateOperation["action"], Omit<WechatPublicAutoReply.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicAutoReply.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatPublicAutoReply.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatPublicAutoReply.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatPublicAutoReply.UpdateOperation["action"], Omit<WechatPublicAutoReply.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicAutoReply.Filter, "application" | "applicationId">>>;
|
||||
wechatPublicTag$application?: OakOperation<WechatPublicTag.UpdateOperation["action"], Omit<WechatPublicTag.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTag.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatPublicTag.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatPublicTag.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatPublicTag.UpdateOperation["action"], Omit<WechatPublicTag.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTag.Filter, "application" | "applicationId">>>;
|
||||
wechatPublicTemplate$application?: OakOperation<WechatPublicTemplate.UpdateOperation["action"], Omit<WechatPublicTemplate.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTemplate.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatPublicTemplate.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatPublicTemplate.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatPublicTemplate.UpdateOperation["action"], Omit<WechatPublicTemplate.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTemplate.Filter, "application" | "applicationId">>>;
|
||||
wechatQrCode$application?: OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "application" | "applicationId">, Omit<WechatQrCode.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "application" | "applicationId">, Omit<WechatQrCode.Filter, "application" | "applicationId">>>;
|
||||
wechatUser$application?: OakOperation<WechatUser.UpdateOperation["action"], Omit<WechatUser.UpdateOperationData, "application" | "applicationId">, Omit<WechatUser.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatUser.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatUser.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatUser.UpdateOperation["action"], Omit<WechatUser.UpdateOperationData, "application" | "applicationId">, Omit<WechatUser.Filter, "application" | "applicationId">>>;
|
||||
session$entity?: OakOperation<Session.UpdateOperation["action"], Omit<Session.UpdateOperationData, "entity" | "entityId">, Omit<Session.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Session.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Session.CreateOperationData, "entity" | "entityId">> | OakOperation<Session.UpdateOperation["action"], Omit<Session.UpdateOperationData, "entity" | "entityId">, Omit<Session.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<Omit<OpSchema, "systemId">> & (({
|
||||
system?: System.CreateSingleOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: System.UpdateOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: System.RemoveOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: never;
|
||||
systemId?: ForeignKey<"system">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
extraFile$application?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "application" | "applicationId">, Omit<ExtraFile.Filter, "application" | "applicationId">> | OakOperation<ExtraFile.RemoveOperation["action"], Omit<ExtraFile.RemoveOperationData, "application" | "applicationId">, Omit<ExtraFile.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "application" | "applicationId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "application" | "applicationId">, Omit<ExtraFile.Filter, "application" | "applicationId">> | OakOperation<ExtraFile.RemoveOperation["action"], Omit<ExtraFile.RemoveOperationData, "application" | "applicationId">, Omit<ExtraFile.Filter, "application" | "applicationId">>>;
|
||||
notification$application?: OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "application" | "applicationId">, Omit<Notification.Filter, "application" | "applicationId">> | OakOperation<Notification.RemoveOperation["action"], Omit<Notification.RemoveOperationData, "application" | "applicationId">, Omit<Notification.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<Notification.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<Notification.CreateOperationData, "application" | "applicationId">> | OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "application" | "applicationId">, Omit<Notification.Filter, "application" | "applicationId">> | OakOperation<Notification.RemoveOperation["action"], Omit<Notification.RemoveOperationData, "application" | "applicationId">, Omit<Notification.Filter, "application" | "applicationId">>>;
|
||||
sessionMessage$application?: OakOperation<SessionMessage.UpdateOperation["action"], Omit<SessionMessage.UpdateOperationData, "application" | "applicationId">, Omit<SessionMessage.Filter, "application" | "applicationId">> | OakOperation<SessionMessage.RemoveOperation["action"], Omit<SessionMessage.RemoveOperationData, "application" | "applicationId">, Omit<SessionMessage.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<SessionMessage.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<SessionMessage.CreateOperationData, "application" | "applicationId">> | OakOperation<SessionMessage.UpdateOperation["action"], Omit<SessionMessage.UpdateOperationData, "application" | "applicationId">, Omit<SessionMessage.Filter, "application" | "applicationId">> | OakOperation<SessionMessage.RemoveOperation["action"], Omit<SessionMessage.RemoveOperationData, "application" | "applicationId">, Omit<SessionMessage.Filter, "application" | "applicationId">>>;
|
||||
token$application?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "application" | "applicationId">, Omit<Token.Filter, "application" | "applicationId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "application" | "applicationId">, Omit<Token.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<Token.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "application" | "applicationId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "application" | "applicationId">, Omit<Token.Filter, "application" | "applicationId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "application" | "applicationId">, Omit<Token.Filter, "application" | "applicationId">>>;
|
||||
wechatMenu$application?: OakOperation<WechatMenu.UpdateOperation["action"], Omit<WechatMenu.UpdateOperationData, "application" | "applicationId">, Omit<WechatMenu.Filter, "application" | "applicationId">> | OakOperation<WechatMenu.RemoveOperation["action"], Omit<WechatMenu.RemoveOperationData, "application" | "applicationId">, Omit<WechatMenu.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatMenu.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatMenu.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatMenu.UpdateOperation["action"], Omit<WechatMenu.UpdateOperationData, "application" | "applicationId">, Omit<WechatMenu.Filter, "application" | "applicationId">> | OakOperation<WechatMenu.RemoveOperation["action"], Omit<WechatMenu.RemoveOperationData, "application" | "applicationId">, Omit<WechatMenu.Filter, "application" | "applicationId">>>;
|
||||
wechatPublicAutoReply$application?: OakOperation<WechatPublicAutoReply.UpdateOperation["action"], Omit<WechatPublicAutoReply.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicAutoReply.Filter, "application" | "applicationId">> | OakOperation<WechatPublicAutoReply.RemoveOperation["action"], Omit<WechatPublicAutoReply.RemoveOperationData, "application" | "applicationId">, Omit<WechatPublicAutoReply.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatPublicAutoReply.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatPublicAutoReply.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatPublicAutoReply.UpdateOperation["action"], Omit<WechatPublicAutoReply.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicAutoReply.Filter, "application" | "applicationId">> | OakOperation<WechatPublicAutoReply.RemoveOperation["action"], Omit<WechatPublicAutoReply.RemoveOperationData, "application" | "applicationId">, Omit<WechatPublicAutoReply.Filter, "application" | "applicationId">>>;
|
||||
wechatPublicTag$application?: OakOperation<WechatPublicTag.UpdateOperation["action"], Omit<WechatPublicTag.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTag.Filter, "application" | "applicationId">> | OakOperation<WechatPublicTag.RemoveOperation["action"], Omit<WechatPublicTag.RemoveOperationData, "application" | "applicationId">, Omit<WechatPublicTag.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatPublicTag.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatPublicTag.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatPublicTag.UpdateOperation["action"], Omit<WechatPublicTag.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTag.Filter, "application" | "applicationId">> | OakOperation<WechatPublicTag.RemoveOperation["action"], Omit<WechatPublicTag.RemoveOperationData, "application" | "applicationId">, Omit<WechatPublicTag.Filter, "application" | "applicationId">>>;
|
||||
wechatPublicTemplate$application?: OakOperation<WechatPublicTemplate.UpdateOperation["action"], Omit<WechatPublicTemplate.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTemplate.Filter, "application" | "applicationId">> | OakOperation<WechatPublicTemplate.RemoveOperation["action"], Omit<WechatPublicTemplate.RemoveOperationData, "application" | "applicationId">, Omit<WechatPublicTemplate.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatPublicTemplate.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatPublicTemplate.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatPublicTemplate.UpdateOperation["action"], Omit<WechatPublicTemplate.UpdateOperationData, "application" | "applicationId">, Omit<WechatPublicTemplate.Filter, "application" | "applicationId">> | OakOperation<WechatPublicTemplate.RemoveOperation["action"], Omit<WechatPublicTemplate.RemoveOperationData, "application" | "applicationId">, Omit<WechatPublicTemplate.Filter, "application" | "applicationId">>>;
|
||||
wechatQrCode$application?: OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "application" | "applicationId">, Omit<WechatQrCode.Filter, "application" | "applicationId">> | OakOperation<WechatQrCode.RemoveOperation["action"], Omit<WechatQrCode.RemoveOperationData, "application" | "applicationId">, Omit<WechatQrCode.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatQrCode.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatQrCode.UpdateOperation["action"], Omit<WechatQrCode.UpdateOperationData, "application" | "applicationId">, Omit<WechatQrCode.Filter, "application" | "applicationId">> | OakOperation<WechatQrCode.RemoveOperation["action"], Omit<WechatQrCode.RemoveOperationData, "application" | "applicationId">, Omit<WechatQrCode.Filter, "application" | "applicationId">>>;
|
||||
wechatUser$application?: OakOperation<WechatUser.UpdateOperation["action"], Omit<WechatUser.UpdateOperationData, "application" | "applicationId">, Omit<WechatUser.Filter, "application" | "applicationId">> | OakOperation<WechatUser.RemoveOperation["action"], Omit<WechatUser.RemoveOperationData, "application" | "applicationId">, Omit<WechatUser.Filter, "application" | "applicationId">> | OakOperation<"create", Omit<WechatUser.CreateOperationData, "application" | "applicationId">[]> | Array<OakOperation<"create", Omit<WechatUser.CreateOperationData, "application" | "applicationId">> | OakOperation<WechatUser.UpdateOperation["action"], Omit<WechatUser.UpdateOperationData, "application" | "applicationId">, Omit<WechatUser.Filter, "application" | "applicationId">> | OakOperation<WechatUser.RemoveOperation["action"], Omit<WechatUser.RemoveOperationData, "application" | "applicationId">, Omit<WechatUser.Filter, "application" | "applicationId">>>;
|
||||
session$entity?: OakOperation<Session.UpdateOperation["action"], Omit<Session.UpdateOperationData, "entity" | "entityId">, Omit<Session.Filter, "entity" | "entityId">> | OakOperation<Session.RemoveOperation["action"], Omit<Session.RemoveOperationData, "entity" | "entityId">, Omit<Session.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Session.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Session.CreateOperationData, "entity" | "entityId">> | OakOperation<Session.UpdateOperation["action"], Omit<Session.UpdateOperationData, "entity" | "entityId">, Omit<Session.Filter, "entity" | "entityId">> | OakOperation<Session.RemoveOperation["action"], Omit<Session.RemoveOperationData, "entity" | "entityId">, Omit<Session.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
system?: System.UpdateOperation | System.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
description: {
|
||||
notNull: true,
|
||||
type: "text"
|
||||
},
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["web", "wechatMp", "wechatPublic", "native"]
|
||||
},
|
||||
systemId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "system"
|
||||
},
|
||||
config: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
},
|
||||
style: {
|
||||
type: "object"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"应用","attr":{"description":"描述","type":"类型","system":"系统","name":"名称","config":"设置","style":"样式","sessions":"会话"},"v":{"type":{"web":"网站","wechatPublic":"微信公众号","wechatMp":"微信小程序","native":"App"}}}
|
||||
|
|
@ -0,0 +1,170 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Geo } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape, Configuration } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Address from "../Address/Schema";
|
||||
import * as Station from "../Station/Schema";
|
||||
import * as Subway from "../Subway/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
level: 'province' | 'city' | 'district' | 'street' | 'country';
|
||||
depth: 0 | 1 | 2 | 3 | 4;
|
||||
parentId?: ForeignKey<"area"> | null;
|
||||
code: String<12>;
|
||||
center: Geo;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
name: String<32>;
|
||||
level: 'province' | 'city' | 'district' | 'street' | 'country';
|
||||
depth: 0 | 1 | 2 | 3 | 4;
|
||||
parentId?: ForeignKey<"area"> | null;
|
||||
code: String<12>;
|
||||
center: Geo;
|
||||
parent?: Schema | null;
|
||||
address$area?: Array<Address.Schema>;
|
||||
address$area$$aggr?: AggregationResult<Address.Schema>;
|
||||
area$parent?: Array<Schema>;
|
||||
area$parent$$aggr?: AggregationResult<Schema>;
|
||||
station$area?: Array<Station.Schema>;
|
||||
station$area$$aggr?: AggregationResult<Station.Schema>;
|
||||
subway$area?: Array<Subway.Schema>;
|
||||
subway$area$$aggr?: AggregationResult<Subway.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
name: Q_StringValue;
|
||||
level: Q_EnumValue<'province' | 'city' | 'district' | 'street' | 'country'>;
|
||||
depth: Q_EnumValue<0 | 1 | 2 | 3 | 4>;
|
||||
parentId: Q_StringValue;
|
||||
parent: Filter;
|
||||
code: Q_StringValue;
|
||||
address$area: Address.Filter & SubQueryPredicateMetadata;
|
||||
area$parent: Filter & SubQueryPredicateMetadata;
|
||||
station$area: Station.Filter & SubQueryPredicateMetadata;
|
||||
subway$area: Subway.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;
|
||||
level?: number;
|
||||
depth?: number;
|
||||
parentId?: number;
|
||||
parent?: Projection;
|
||||
code?: number;
|
||||
center?: number;
|
||||
address$area?: Address.Selection & {
|
||||
$entity: "address";
|
||||
};
|
||||
address$area$$aggr?: Address.Aggregation & {
|
||||
$entity: "address";
|
||||
};
|
||||
area$parent?: Selection & {
|
||||
$entity: "area";
|
||||
};
|
||||
area$parent$$aggr?: Aggregation & {
|
||||
$entity: "area";
|
||||
};
|
||||
station$area?: Station.Selection & {
|
||||
$entity: "station";
|
||||
};
|
||||
station$area$$aggr?: Station.Aggregation & {
|
||||
$entity: "station";
|
||||
};
|
||||
subway$area?: Subway.Selection & {
|
||||
$entity: "subway";
|
||||
};
|
||||
subway$area$$aggr?: Subway.Aggregation & {
|
||||
$entity: "subway";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type AreaIdProjection = OneOf<{
|
||||
id: number;
|
||||
parentId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
level: number;
|
||||
} | {
|
||||
depth: number;
|
||||
} | {
|
||||
parentId: number;
|
||||
} | {
|
||||
parent: SortAttr;
|
||||
} | {
|
||||
code: number;
|
||||
} | {
|
||||
center: 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, "parentId">> & ({
|
||||
parent?: never;
|
||||
parentId?: ForeignKey<"parent">;
|
||||
}) & {
|
||||
address$area?: OakOperation<Address.UpdateOperation["action"], Omit<Address.UpdateOperationData, "area" | "areaId">, Omit<Address.Filter, "area" | "areaId">> | OakOperation<"create", Omit<Address.CreateOperationData, "area" | "areaId">[]> | Array<OakOperation<"create", Omit<Address.CreateOperationData, "area" | "areaId">> | OakOperation<Address.UpdateOperation["action"], Omit<Address.UpdateOperationData, "area" | "areaId">, Omit<Address.Filter, "area" | "areaId">>>;
|
||||
station$area?: OakOperation<Station.UpdateOperation["action"], Omit<Station.UpdateOperationData, "area" | "areaId">, Omit<Station.Filter, "area" | "areaId">> | OakOperation<"create", Omit<Station.CreateOperationData, "area" | "areaId">[]> | Array<OakOperation<"create", Omit<Station.CreateOperationData, "area" | "areaId">> | OakOperation<Station.UpdateOperation["action"], Omit<Station.UpdateOperationData, "area" | "areaId">, Omit<Station.Filter, "area" | "areaId">>>;
|
||||
subway$area?: OakOperation<Subway.UpdateOperation["action"], Omit<Subway.UpdateOperationData, "area" | "areaId">, Omit<Subway.Filter, "area" | "areaId">> | OakOperation<"create", Omit<Subway.CreateOperationData, "area" | "areaId">[]> | Array<OakOperation<"create", Omit<Subway.CreateOperationData, "area" | "areaId">> | OakOperation<Subway.UpdateOperation["action"], Omit<Subway.UpdateOperationData, "area" | "areaId">, Omit<Subway.Filter, "area" | "areaId">>>;
|
||||
};
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "parentId">> & ({
|
||||
parent?: never;
|
||||
parentId?: ForeignKey<"parent"> | null;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
address$area?: OakOperation<Address.UpdateOperation["action"], Omit<Address.UpdateOperationData, "area" | "areaId">, Omit<Address.Filter, "area" | "areaId">> | OakOperation<Address.RemoveOperation["action"], Omit<Address.RemoveOperationData, "area" | "areaId">, Omit<Address.Filter, "area" | "areaId">> | OakOperation<"create", Omit<Address.CreateOperationData, "area" | "areaId">[]> | Array<OakOperation<"create", Omit<Address.CreateOperationData, "area" | "areaId">> | OakOperation<Address.UpdateOperation["action"], Omit<Address.UpdateOperationData, "area" | "areaId">, Omit<Address.Filter, "area" | "areaId">> | OakOperation<Address.RemoveOperation["action"], Omit<Address.RemoveOperationData, "area" | "areaId">, Omit<Address.Filter, "area" | "areaId">>>;
|
||||
station$area?: OakOperation<Station.UpdateOperation["action"], Omit<Station.UpdateOperationData, "area" | "areaId">, Omit<Station.Filter, "area" | "areaId">> | OakOperation<Station.RemoveOperation["action"], Omit<Station.RemoveOperationData, "area" | "areaId">, Omit<Station.Filter, "area" | "areaId">> | OakOperation<"create", Omit<Station.CreateOperationData, "area" | "areaId">[]> | Array<OakOperation<"create", Omit<Station.CreateOperationData, "area" | "areaId">> | OakOperation<Station.UpdateOperation["action"], Omit<Station.UpdateOperationData, "area" | "areaId">, Omit<Station.Filter, "area" | "areaId">> | OakOperation<Station.RemoveOperation["action"], Omit<Station.RemoveOperationData, "area" | "areaId">, Omit<Station.Filter, "area" | "areaId">>>;
|
||||
subway$area?: OakOperation<Subway.UpdateOperation["action"], Omit<Subway.UpdateOperationData, "area" | "areaId">, Omit<Subway.Filter, "area" | "areaId">> | OakOperation<Subway.RemoveOperation["action"], Omit<Subway.RemoveOperationData, "area" | "areaId">, Omit<Subway.Filter, "area" | "areaId">> | OakOperation<"create", Omit<Subway.CreateOperationData, "area" | "areaId">[]> | Array<OakOperation<"create", Omit<Subway.CreateOperationData, "area" | "areaId">> | OakOperation<Subway.UpdateOperation["action"], Omit<Subway.UpdateOperationData, "area" | "areaId">, Omit<Subway.Filter, "area" | "areaId">> | OakOperation<Subway.RemoveOperation["action"], Omit<Subway.RemoveOperationData, "area" | "areaId">, Omit<Subway.Filter, "area" | "areaId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type AreaIdSubQuery = Selection<AreaIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<ReadOnlyAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { readOnlyActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
level: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["province", "city", "district", "street", "country"]
|
||||
},
|
||||
depth: {
|
||||
notNull: true,
|
||||
type: "int",
|
||||
params: {
|
||||
width: 4
|
||||
}
|
||||
},
|
||||
parentId: {
|
||||
type: "ref",
|
||||
ref: "area"
|
||||
},
|
||||
code: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 12
|
||||
}
|
||||
},
|
||||
center: {
|
||||
notNull: true,
|
||||
type: "geometry"
|
||||
}
|
||||
},
|
||||
static: true,
|
||||
actionType: "readOnly",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"地区","attr":{"level":"层级","depth":"深度","parent":"上级地区","name":"名称","code":"地区编码","center":"中心坐标"},"v":{"level":{"country":"国家","province":"省","city":"市","district":"区","street":"街道"}}}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Float, Text } from "oak-domain/lib/types/DataType";
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as ArticleMenu from "../ArticleMenu/Schema";
|
||||
import * as ExtraFile from "../ExtraFile/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
content: Text;
|
||||
articleMenuId: ForeignKey<"articleMenu">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
name: String<32>;
|
||||
content: Text;
|
||||
articleMenuId: ForeignKey<"articleMenu">;
|
||||
articleMenu: ArticleMenu.Schema;
|
||||
extraFile$entity?: Array<ExtraFile.Schema>;
|
||||
extraFile$entity$$aggr?: AggregationResult<ExtraFile.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
name: Q_StringValue;
|
||||
content: Q_StringValue;
|
||||
articleMenuId: Q_StringValue;
|
||||
articleMenu: ArticleMenu.Filter;
|
||||
extraFile$entity: ExtraFile.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;
|
||||
content?: number;
|
||||
articleMenuId?: number;
|
||||
articleMenu?: ArticleMenu.Projection;
|
||||
extraFile$entity?: ExtraFile.Selection & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
extraFile$entity$$aggr?: ExtraFile.Aggregation & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ArticleIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type ArticleMenuIdProjection = OneOf<{
|
||||
articleMenuId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
content: number;
|
||||
} | {
|
||||
articleMenuId: number;
|
||||
} | {
|
||||
articleMenu: ArticleMenu.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, "articleMenuId">> & (({
|
||||
articleMenuId?: never;
|
||||
articleMenu: ArticleMenu.CreateSingleOperation;
|
||||
} | {
|
||||
articleMenuId: ForeignKey<"articleMenu">;
|
||||
articleMenu?: ArticleMenu.UpdateOperation;
|
||||
} | {
|
||||
articleMenu?: never;
|
||||
articleMenuId: ForeignKey<"articleMenu">;
|
||||
})) & {
|
||||
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.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<Omit<OpSchema, "articleMenuId">> & (({
|
||||
articleMenu?: ArticleMenu.CreateSingleOperation;
|
||||
articleMenuId?: never;
|
||||
} | {
|
||||
articleMenu?: ArticleMenu.UpdateOperation;
|
||||
articleMenuId?: never;
|
||||
} | {
|
||||
articleMenu?: ArticleMenu.RemoveOperation;
|
||||
articleMenuId?: never;
|
||||
} | {
|
||||
articleMenu?: never;
|
||||
articleMenuId?: ForeignKey<"articleMenu">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<ExtraFile.RemoveOperation["action"], Omit<ExtraFile.RemoveOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<ExtraFile.RemoveOperation["action"], Omit<ExtraFile.RemoveOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
articleMenu?: ArticleMenu.UpdateOperation | ArticleMenu.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type ArticleMenuIdSubQuery = Selection<ArticleMenuIdProjection>;
|
||||
export type ArticleIdSubQuery = Selection<ArticleIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
content: {
|
||||
notNull: true,
|
||||
type: "text"
|
||||
},
|
||||
articleMenuId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "articleMenu"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"文章","attr":{"name":"文章标题","content":"请输入正文内容","articleMenu":"文章菜单","files":"文件"}}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Boolean } from "oak-domain/lib/types/DataType";
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { EntityShape, Configuration } from "oak-domain/lib/types/Entity";
|
||||
import { LocaleDef } from "oak-domain/lib/types/Locale";
|
||||
import { Index } from "oak-domain/lib/types/Storage";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Article from "../Article/Schema";
|
||||
import * as ExtraFile from "../ExtraFile/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
isArticle: Boolean;
|
||||
parentId?: ForeignKey<"articleMenu"> | null;
|
||||
isLeaf: Boolean;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
name: String<32>;
|
||||
isArticle: Boolean;
|
||||
parentId?: ForeignKey<"articleMenu"> | null;
|
||||
isLeaf: Boolean;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
parent?: Schema | null;
|
||||
article$articleMenu?: Array<Article.Schema>;
|
||||
article$articleMenu$$aggr?: AggregationResult<Article.Schema>;
|
||||
articleMenu$parent?: Array<Schema>;
|
||||
articleMenu$parent$$aggr?: AggregationResult<Schema>;
|
||||
extraFile$entity?: Array<ExtraFile.Schema>;
|
||||
extraFile$entity$$aggr?: AggregationResult<ExtraFile.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
name: Q_StringValue;
|
||||
isArticle: Q_BooleanValue;
|
||||
parentId: Q_StringValue;
|
||||
parent: Filter;
|
||||
isLeaf: Q_BooleanValue;
|
||||
entity: Q_StringValue;
|
||||
entityId: Q_StringValue;
|
||||
article$articleMenu: Article.Filter & SubQueryPredicateMetadata;
|
||||
articleMenu$parent: Filter & SubQueryPredicateMetadata;
|
||||
extraFile$entity: ExtraFile.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;
|
||||
isArticle?: number;
|
||||
parentId?: number;
|
||||
parent?: Projection;
|
||||
isLeaf?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
article$articleMenu?: Article.Selection & {
|
||||
$entity: "article";
|
||||
};
|
||||
article$articleMenu$$aggr?: Article.Aggregation & {
|
||||
$entity: "article";
|
||||
};
|
||||
articleMenu$parent?: Selection & {
|
||||
$entity: "articleMenu";
|
||||
};
|
||||
articleMenu$parent$$aggr?: Aggregation & {
|
||||
$entity: "articleMenu";
|
||||
};
|
||||
extraFile$entity?: ExtraFile.Selection & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
extraFile$entity$$aggr?: ExtraFile.Aggregation & {
|
||||
$entity: "extraFile";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ArticleMenuIdProjection = OneOf<{
|
||||
id: number;
|
||||
parentId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
isArticle: number;
|
||||
} | {
|
||||
parentId: number;
|
||||
} | {
|
||||
parent: SortAttr;
|
||||
} | {
|
||||
isLeaf: 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" | "parentId">> & (({
|
||||
parentId?: never;
|
||||
parent?: CreateSingleOperation;
|
||||
} | {
|
||||
parentId: ForeignKey<"parent">;
|
||||
parent?: UpdateOperation;
|
||||
} | {
|
||||
parent?: never;
|
||||
parentId?: ForeignKey<"parent">;
|
||||
})) & ({
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
article$articleMenu?: OakOperation<Article.UpdateOperation["action"], Omit<Article.UpdateOperationData, "articleMenu" | "articleMenuId">, Omit<Article.Filter, "articleMenu" | "articleMenuId">> | OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">[]> | Array<OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">> | OakOperation<Article.UpdateOperation["action"], Omit<Article.UpdateOperationData, "articleMenu" | "articleMenuId">, Omit<Article.Filter, "articleMenu" | "articleMenuId">>>;
|
||||
articleMenu$parent?: OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "parent" | "parentId">, Omit<Filter, "parent" | "parentId">> | OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">> | OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "parent" | "parentId">, Omit<Filter, "parent" | "parentId">>>;
|
||||
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.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<Omit<OpSchema, "parentId">> & (({
|
||||
parent?: CreateSingleOperation;
|
||||
parentId?: never;
|
||||
} | {
|
||||
parent?: UpdateOperation;
|
||||
parentId?: never;
|
||||
} | {
|
||||
parent?: RemoveOperation;
|
||||
parentId?: never;
|
||||
} | {
|
||||
parent?: never;
|
||||
parentId?: ForeignKey<"parent"> | null;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
article$articleMenu?: OakOperation<Article.UpdateOperation["action"], Omit<Article.UpdateOperationData, "articleMenu" | "articleMenuId">, Omit<Article.Filter, "articleMenu" | "articleMenuId">> | OakOperation<Article.RemoveOperation["action"], Omit<Article.RemoveOperationData, "articleMenu" | "articleMenuId">, Omit<Article.Filter, "articleMenu" | "articleMenuId">> | OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">[]> | Array<OakOperation<"create", Omit<Article.CreateOperationData, "articleMenu" | "articleMenuId">> | OakOperation<Article.UpdateOperation["action"], Omit<Article.UpdateOperationData, "articleMenu" | "articleMenuId">, Omit<Article.Filter, "articleMenu" | "articleMenuId">> | OakOperation<Article.RemoveOperation["action"], Omit<Article.RemoveOperationData, "articleMenu" | "articleMenuId">, Omit<Article.Filter, "articleMenu" | "articleMenuId">>>;
|
||||
articleMenu$parent?: OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "parent" | "parentId">, Omit<Filter, "parent" | "parentId">> | OakOperation<RemoveOperation["action"], Omit<RemoveOperationData, "parent" | "parentId">, Omit<Filter, "parent" | "parentId">> | OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "parent" | "parentId">> | OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "parent" | "parentId">, Omit<Filter, "parent" | "parentId">> | OakOperation<RemoveOperation["action"], Omit<RemoveOperationData, "parent" | "parentId">, Omit<Filter, "parent" | "parentId">>>;
|
||||
extraFile$entity?: OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<ExtraFile.RemoveOperation["action"], Omit<ExtraFile.RemoveOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ExtraFile.CreateOperationData, "entity" | "entityId">> | OakOperation<ExtraFile.UpdateOperation["action"], Omit<ExtraFile.UpdateOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">> | OakOperation<ExtraFile.RemoveOperation["action"], Omit<ExtraFile.RemoveOperationData, "entity" | "entityId">, Omit<ExtraFile.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
parent?: UpdateOperation | RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type ArticleMenuIdSubQuery = Selection<ArticleMenuIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
isArticle: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
parentId: {
|
||||
type: "ref",
|
||||
ref: "articleMenu"
|
||||
},
|
||||
isLeaf: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"文章分类","attr":{"name":"分类标题","isArticle":"是否存在文章","parent":"所属分类","entity":"对象","entityId":"对象Id","isLeaf":"结点下是否存在叶子结点","files":"图片"}}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type IState = 'unsent' | 'sending' | 'sent' | 'failure' | string;
|
||||
export type IAction = 'send' | 'success' | 'fail' | string;
|
||||
const IActionDef: ActionDef<IAction, IState> = {
|
||||
stm: {
|
||||
send: ['unsent', 'sending'],
|
||||
success: ['sending', 'sent'],
|
||||
fail: ['sending', 'failure'],
|
||||
},
|
||||
is: 'unsent',
|
||||
};
|
||||
export type ParticularAction = IAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "send", "success", "fail"];
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
iState: IActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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, IState } from "./Action";
|
||||
import { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { ActionType, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { String, Text, Boolean, Datetime } from "oak-domain/lib/types/DataType";
|
||||
import { ActionDef, Index } from "oak-domain/lib/types";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
export type OpSchema = EntityShape & {
|
||||
mobile: String<11>;
|
||||
code: String<4>;
|
||||
visitorId: Text;
|
||||
reason?: Text | null;
|
||||
env: Object;
|
||||
expired: Boolean;
|
||||
expiresAt: Datetime;
|
||||
type: 'login' | 'changePassword' | 'confirm';
|
||||
iState?: IState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
mobile: String<11>;
|
||||
code: String<4>;
|
||||
visitorId: Text;
|
||||
reason?: Text | null;
|
||||
env: Object;
|
||||
expired: Boolean;
|
||||
expiresAt: Datetime;
|
||||
type: 'login' | 'changePassword' | 'confirm';
|
||||
iState?: IState | null;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
mobile: Q_StringValue;
|
||||
code: Q_StringValue;
|
||||
visitorId: Q_StringValue;
|
||||
reason: Q_StringValue;
|
||||
env: Object;
|
||||
expired: Q_BooleanValue;
|
||||
expiresAt: Q_DateValue;
|
||||
type: Q_EnumValue<'login' | 'changePassword' | 'confirm'>;
|
||||
iState: Q_EnumValue<IState>;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
mobile?: number;
|
||||
code?: number;
|
||||
visitorId?: number;
|
||||
reason?: number;
|
||||
env?: number | Object;
|
||||
expired?: number;
|
||||
expiresAt?: number;
|
||||
type?: number;
|
||||
iState?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type CaptchaIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
mobile: number;
|
||||
} | {
|
||||
code: number;
|
||||
} | {
|
||||
visitorId: number;
|
||||
} | {
|
||||
reason: number;
|
||||
} | {
|
||||
expired: number;
|
||||
} | {
|
||||
expiresAt: number;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
iState: 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<OpSchema>;
|
||||
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;
|
||||
};
|
||||
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 CaptchaIdSubQuery = Selection<CaptchaIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
mobile: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 11
|
||||
}
|
||||
},
|
||||
code: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 4
|
||||
}
|
||||
},
|
||||
visitorId: {
|
||||
notNull: true,
|
||||
type: "text"
|
||||
},
|
||||
reason: {
|
||||
type: "text"
|
||||
},
|
||||
env: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
},
|
||||
expired: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
expiresAt: {
|
||||
notNull: true,
|
||||
type: "datetime"
|
||||
},
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["login", "changePassword", "confirm"]
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["unsent", "sending", "sent", "failure"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_mobile_code',
|
||||
attributes: [
|
||||
{
|
||||
name: 'mobile',
|
||||
direction: 'ASC',
|
||||
},
|
||||
{
|
||||
name: 'code',
|
||||
direction: 'ASC',
|
||||
},
|
||||
{
|
||||
name: '$$createAt$$',
|
||||
direction: 'DESC',
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"验证码","attr":{"mobile":"手机号","code":"验证码","visitorId":"用户标识","reason":"失败原因","env":"用户环境","expired":"是否过期","expiresAt":"过期时间","iState":"状态","type":"类型"},"action":{"send":"发送","fail":"失败","success":"成功"},"v":{"iState":{"unsent":"未发送","sending":"发送中","sent":"已发送","failure":"已失败"},"type":{"login":"登录","changePassword":"修改密码","confirm":"校验"}}}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { ActionType, EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { String, Text, Boolean, Datetime } from "oak-domain/lib/types/DataType";
|
||||
import { LocaleDef } from "oak-domain/lib/types/Locale";
|
||||
import { ActionDef, Index } from "oak-domain/lib/types";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as User from "../User/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
prevPassword?: String<32> | null;
|
||||
newPassword?: String<32> | null;
|
||||
result: 'success' | 'fail';
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
prevPassword?: String<32> | null;
|
||||
newPassword?: String<32> | null;
|
||||
result: 'success' | 'fail';
|
||||
user: User.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
userId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
prevPassword: Q_StringValue;
|
||||
newPassword: Q_StringValue;
|
||||
result: Q_EnumValue<'success' | 'fail'>;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
prevPassword?: number;
|
||||
newPassword?: number;
|
||||
result?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ChangePasswordTempIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
userId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
userId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
prevPassword: number;
|
||||
} | {
|
||||
newPassword: number;
|
||||
} | {
|
||||
result: 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, "userId">> & (({
|
||||
userId?: never;
|
||||
user: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: ForeignKey<"user">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
user?: never;
|
||||
userId: ForeignKey<"user">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId">> & (({
|
||||
user?: User.CreateSingleOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.UpdateOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.RemoveOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: ForeignKey<"user">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | 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<UserIdProjection>;
|
||||
export type ChangePasswordTempIdSubQuery = Selection<ChangePasswordTempIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
userId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
prevPassword: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
newPassword: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
result: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["success", "fail"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"密码修改记录","attr":{"user":"用户","prevPassword":"原密码","newPassword":"新密码","result":"修改结果"},"v":{"result":{"success":"成功","fail":"失败"}}}
|
||||
|
|
@ -0,0 +1,140 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as System from "../System/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
url: String<64>;
|
||||
apiPath?: String<32> | null;
|
||||
protocol: 'http' | 'https';
|
||||
port: Int<2>;
|
||||
systemId: ForeignKey<"system">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
url: String<64>;
|
||||
apiPath?: String<32> | null;
|
||||
protocol: 'http' | 'https';
|
||||
port: Int<2>;
|
||||
systemId: ForeignKey<"system">;
|
||||
system: System.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
url: Q_StringValue;
|
||||
apiPath: Q_StringValue;
|
||||
protocol: Q_EnumValue<'http' | 'https'>;
|
||||
port: Q_NumberValue;
|
||||
systemId: Q_StringValue;
|
||||
system: System.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;
|
||||
url?: number;
|
||||
apiPath?: number;
|
||||
protocol?: number;
|
||||
port?: number;
|
||||
systemId?: number;
|
||||
system?: System.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type DomainIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type SystemIdProjection = OneOf<{
|
||||
systemId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
url: number;
|
||||
} | {
|
||||
apiPath: number;
|
||||
} | {
|
||||
protocol: number;
|
||||
} | {
|
||||
port: number;
|
||||
} | {
|
||||
systemId: number;
|
||||
} | {
|
||||
system: System.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, "systemId">> & (({
|
||||
systemId?: never;
|
||||
system: System.CreateSingleOperation;
|
||||
} | {
|
||||
systemId: ForeignKey<"system">;
|
||||
system?: System.UpdateOperation;
|
||||
} | {
|
||||
system?: never;
|
||||
systemId: ForeignKey<"system">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "systemId">> & (({
|
||||
system?: System.CreateSingleOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: System.UpdateOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: System.RemoveOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: never;
|
||||
systemId?: ForeignKey<"system">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
system?: System.UpdateOperation | System.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
||||
export type DomainIdSubQuery = Selection<DomainIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
url: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
apiPath: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
protocol: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["http", "https"]
|
||||
},
|
||||
port: {
|
||||
notNull: true,
|
||||
type: "int",
|
||||
params: {
|
||||
width: 2,
|
||||
signed: true
|
||||
}
|
||||
},
|
||||
systemId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "system"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"域名","attr":{"url":"域名","apiPath":"api路径","protocol":"协议","port":"端口","system":"系统"},"v":{"protocol":{"http":"http","https":"https"}}}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { AbleAction, AbleState, makeAbleActionDef } from 'oak-domain/lib/actions/action';
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type ParticularAction = AbleAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "enable", "disable"];
|
||||
const AbleActionDef: ActionDef<AbleAction, AbleState> = makeAbleActionDef('enabled');
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
ableState: AbleActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Text, Image } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { AbleAction, AbleState, makeAbleActionDef } from "oak-domain/lib/actions/action";
|
||||
import { ActionDef } from "oak-domain/lib/types";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Token from "../Token/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
email: String<16>;
|
||||
userId: ForeignKey<"user">;
|
||||
ableState?: AbleState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
email: String<16>;
|
||||
userId: ForeignKey<"user">;
|
||||
ableState?: AbleState | null;
|
||||
user: User.Schema;
|
||||
token$entity?: Array<Token.Schema>;
|
||||
token$entity$$aggr?: AggregationResult<Token.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
email: Q_StringValue;
|
||||
userId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
ableState: Q_EnumValue<AbleState>;
|
||||
token$entity: Token.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;
|
||||
email?: number;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
ableState?: number;
|
||||
token$entity?: Token.Selection & {
|
||||
$entity: "token";
|
||||
};
|
||||
token$entity$$aggr?: Token.Aggregation & {
|
||||
$entity: "token";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type EmailIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
userId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
email: number;
|
||||
} | {
|
||||
userId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
ableState: 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, "userId">> & (({
|
||||
userId?: never;
|
||||
user: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: ForeignKey<"user">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
user?: never;
|
||||
userId: ForeignKey<"user">;
|
||||
})) & {
|
||||
token$entity?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.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<Omit<OpSchema, "userId">> & (({
|
||||
user?: User.CreateSingleOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.UpdateOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.RemoveOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: ForeignKey<"user">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
token$entity?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
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<UserIdProjection>;
|
||||
export type EmailIdSubQuery = Selection<EmailIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
email: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 16
|
||||
}
|
||||
},
|
||||
userId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
ableState: {
|
||||
type: "enum",
|
||||
enumeration: ["enabled", "disabled"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_email_ableState',
|
||||
attributes: [
|
||||
{
|
||||
name: 'email',
|
||||
direction: 'ASC',
|
||||
},
|
||||
{
|
||||
name: 'ableState',
|
||||
direction: 'ASC',
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"邮箱","attr":{"ableState":"是否可用","email":"邮箱","user":"关联用户","tokens":"相关令牌"},"action":{"enable":"启用","disable":"禁用"},"v":{"ableState":{"enabled":"可用的","disabled":"禁用的"}}}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
import { EntityDef as ActionAuth } from "./ActionAuth/Schema";
|
||||
import { EntityDef as I18n } from "./I18n/Schema";
|
||||
import { EntityDef as Modi } from "./Modi/Schema";
|
||||
import { EntityDef as ModiEntity } from "./ModiEntity/Schema";
|
||||
import { EntityDef as Oper } from "./Oper/Schema";
|
||||
import { EntityDef as OperEntity } from "./OperEntity/Schema";
|
||||
import { EntityDef as Path } from "./Path/Schema";
|
||||
import { EntityDef as Relation } from "./Relation/Schema";
|
||||
import { EntityDef as RelationAuth } from "./RelationAuth/Schema";
|
||||
import { EntityDef as User } from "./User/Schema";
|
||||
import { EntityDef as UserEntityClaim } from "./UserEntityClaim/Schema";
|
||||
import { EntityDef as UserEntityGrant } from "./UserEntityGrant/Schema";
|
||||
import { EntityDef as UserRelation } from "./UserRelation/Schema";
|
||||
import { EntityDef as Account } from "./Account/Schema";
|
||||
import { EntityDef as Address } from "./Address/Schema";
|
||||
import { EntityDef as Application } from "./Application/Schema";
|
||||
import { EntityDef as Area } from "./Area/Schema";
|
||||
import { EntityDef as Article } from "./Article/Schema";
|
||||
import { EntityDef as ArticleMenu } from "./ArticleMenu/Schema";
|
||||
import { EntityDef as Captcha } from "./Captcha/Schema";
|
||||
import { EntityDef as ChangePasswordTemp } from "./ChangePasswordTemp/Schema";
|
||||
import { EntityDef as Domain } from "./Domain/Schema";
|
||||
import { EntityDef as Email } from "./Email/Schema";
|
||||
import { EntityDef as ExtraFile } from "./ExtraFile/Schema";
|
||||
import { EntityDef as Livestream } from "./Livestream/Schema";
|
||||
import { EntityDef as Message } from "./Message/Schema";
|
||||
import { EntityDef as MessageSystem } from "./MessageSystem/Schema";
|
||||
import { EntityDef as MessageType } from "./MessageType/Schema";
|
||||
import { EntityDef as MessageTypeSmsTemplate } from "./MessageTypeSmsTemplate/Schema";
|
||||
import { EntityDef as MessageTypeTemplate } from "./MessageTypeTemplate/Schema";
|
||||
import { EntityDef as Mobile } from "./Mobile/Schema";
|
||||
import { EntityDef as Notification } from "./Notification/Schema";
|
||||
import { EntityDef as Parasite } from "./Parasite/Schema";
|
||||
import { EntityDef as Platform } from "./Platform/Schema";
|
||||
import { EntityDef as ReadRemark } from "./ReadRemark/Schema";
|
||||
import { EntityDef as Session } from "./Session/Schema";
|
||||
import { EntityDef as SessionMessage } from "./SessionMessage/Schema";
|
||||
import { EntityDef as SmsTemplate } from "./SmsTemplate/Schema";
|
||||
import { EntityDef as Station } from "./Station/Schema";
|
||||
import { EntityDef as Subscription } from "./Subscription/Schema";
|
||||
import { EntityDef as Subway } from "./Subway/Schema";
|
||||
import { EntityDef as SubwayStation } from "./SubwayStation/Schema";
|
||||
import { EntityDef as System } from "./System/Schema";
|
||||
import { EntityDef as ToDo } from "./ToDo/Schema";
|
||||
import { EntityDef as Token } from "./Token/Schema";
|
||||
import { EntityDef as UserSystem } from "./UserSystem/Schema";
|
||||
import { EntityDef as UserWechatPublicTag } from "./UserWechatPublicTag/Schema";
|
||||
import { EntityDef as WechatLogin } from "./WechatLogin/Schema";
|
||||
import { EntityDef as WechatMenu } from "./WechatMenu/Schema";
|
||||
import { EntityDef as WechatMpJump } from "./WechatMpJump/Schema";
|
||||
import { EntityDef as WechatPublicAutoReply } from "./WechatPublicAutoReply/Schema";
|
||||
import { EntityDef as WechatPublicTag } from "./WechatPublicTag/Schema";
|
||||
import { EntityDef as WechatPublicTemplate } from "./WechatPublicTemplate/Schema";
|
||||
import { EntityDef as WechatQrCode } from "./WechatQrCode/Schema";
|
||||
import { EntityDef as WechatUser } from "./WechatUser/Schema";
|
||||
export type EntityDict = {
|
||||
actionAuth: ActionAuth;
|
||||
i18n: I18n;
|
||||
modi: Modi;
|
||||
modiEntity: ModiEntity;
|
||||
oper: Oper;
|
||||
operEntity: OperEntity;
|
||||
path: Path;
|
||||
relation: Relation;
|
||||
relationAuth: RelationAuth;
|
||||
user: User;
|
||||
userEntityClaim: UserEntityClaim;
|
||||
userEntityGrant: UserEntityGrant;
|
||||
userRelation: UserRelation;
|
||||
account: Account;
|
||||
address: Address;
|
||||
application: Application;
|
||||
area: Area;
|
||||
article: Article;
|
||||
articleMenu: ArticleMenu;
|
||||
captcha: Captcha;
|
||||
changePasswordTemp: ChangePasswordTemp;
|
||||
domain: Domain;
|
||||
email: Email;
|
||||
extraFile: ExtraFile;
|
||||
livestream: Livestream;
|
||||
message: Message;
|
||||
messageSystem: MessageSystem;
|
||||
messageType: MessageType;
|
||||
messageTypeSmsTemplate: MessageTypeSmsTemplate;
|
||||
messageTypeTemplate: MessageTypeTemplate;
|
||||
mobile: Mobile;
|
||||
notification: Notification;
|
||||
parasite: Parasite;
|
||||
platform: Platform;
|
||||
readRemark: ReadRemark;
|
||||
session: Session;
|
||||
sessionMessage: SessionMessage;
|
||||
smsTemplate: SmsTemplate;
|
||||
station: Station;
|
||||
subscription: Subscription;
|
||||
subway: Subway;
|
||||
subwayStation: SubwayStation;
|
||||
system: System;
|
||||
toDo: ToDo;
|
||||
token: Token;
|
||||
userSystem: UserSystem;
|
||||
userWechatPublicTag: UserWechatPublicTag;
|
||||
wechatLogin: WechatLogin;
|
||||
wechatMenu: WechatMenu;
|
||||
wechatMpJump: WechatMpJump;
|
||||
wechatPublicAutoReply: WechatPublicAutoReply;
|
||||
wechatPublicTag: WechatPublicTag;
|
||||
wechatPublicTemplate: WechatPublicTemplate;
|
||||
wechatQrCode: WechatQrCode;
|
||||
wechatUser: WechatUser;
|
||||
};
|
||||
|
|
@ -0,0 +1,351 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Text, Image, Float, Boolean } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Application from "../Application/Schema";
|
||||
import * as Article from "../Article/Schema";
|
||||
import * as ArticleMenu from "../ArticleMenu/Schema";
|
||||
import * as SessionMessage from "../SessionMessage/Schema";
|
||||
import * as User from "../User/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
origin: 'qiniu' | 'wechat' | 'unknown' | 'ctyun';
|
||||
type: 'image' | 'video' | 'audio' | 'file';
|
||||
bucket?: String<32> | null;
|
||||
objectId?: String<64> | null;
|
||||
tag1?: String<32> | null;
|
||||
tag2?: String<32> | null;
|
||||
filename: String<256>;
|
||||
md5?: Text | null;
|
||||
entity: "article" | "articleMenu" | "sessionMessage" | "user" | string;
|
||||
entityId: String<64>;
|
||||
extra1?: Text | null;
|
||||
extra2?: Object | null;
|
||||
extension?: String<16> | null;
|
||||
size?: Int<4> | null;
|
||||
sort?: Float<22, 10> | null;
|
||||
fileType?: String<128> | null;
|
||||
isBridge?: Boolean | null;
|
||||
uploadState: 'success' | 'failed' | 'uploading';
|
||||
uploadMeta?: Object | null;
|
||||
applicationId: ForeignKey<"application">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
origin: 'qiniu' | 'wechat' | 'unknown' | 'ctyun';
|
||||
type: 'image' | 'video' | 'audio' | 'file';
|
||||
bucket?: String<32> | null;
|
||||
objectId?: String<64> | null;
|
||||
tag1?: String<32> | null;
|
||||
tag2?: String<32> | null;
|
||||
filename: String<256>;
|
||||
md5?: Text | null;
|
||||
entity: "article" | "articleMenu" | "sessionMessage" | "user" | string;
|
||||
entityId: String<64>;
|
||||
extra1?: Text | null;
|
||||
extra2?: Object | null;
|
||||
extension?: String<16> | null;
|
||||
size?: Int<4> | null;
|
||||
sort?: Float<22, 10> | null;
|
||||
fileType?: String<128> | null;
|
||||
isBridge?: Boolean | null;
|
||||
uploadState: 'success' | 'failed' | 'uploading';
|
||||
uploadMeta?: Object | null;
|
||||
applicationId: ForeignKey<"application">;
|
||||
application: Application.Schema;
|
||||
article?: Article.Schema;
|
||||
articleMenu?: ArticleMenu.Schema;
|
||||
sessionMessage?: SessionMessage.Schema;
|
||||
user?: User.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
origin: Q_EnumValue<'qiniu' | 'wechat' | 'unknown' | 'ctyun'>;
|
||||
type: Q_EnumValue<'image' | 'video' | 'audio' | 'file'>;
|
||||
bucket: Q_StringValue;
|
||||
objectId: Q_StringValue;
|
||||
tag1: Q_StringValue;
|
||||
tag2: Q_StringValue;
|
||||
filename: Q_StringValue;
|
||||
md5: Q_StringValue;
|
||||
entity: Q_EnumValue<"article" | "articleMenu" | "sessionMessage" | "user" | string>;
|
||||
entityId: Q_StringValue;
|
||||
extra1: Q_StringValue;
|
||||
extra2: Object;
|
||||
extension: Q_StringValue;
|
||||
size: Q_NumberValue;
|
||||
sort: Q_NumberValue;
|
||||
fileType: Q_StringValue;
|
||||
isBridge: Q_BooleanValue;
|
||||
uploadState: Q_EnumValue<'success' | 'failed' | 'uploading'>;
|
||||
uploadMeta: Object;
|
||||
applicationId: Q_StringValue;
|
||||
application: Application.Filter;
|
||||
article: Article.Filter;
|
||||
articleMenu: ArticleMenu.Filter;
|
||||
sessionMessage: SessionMessage.Filter;
|
||||
user: User.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;
|
||||
origin?: number;
|
||||
type?: number;
|
||||
bucket?: number;
|
||||
objectId?: number;
|
||||
tag1?: number;
|
||||
tag2?: number;
|
||||
filename?: number;
|
||||
md5?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
extra1?: number;
|
||||
extra2?: number | Object;
|
||||
extension?: number;
|
||||
size?: number;
|
||||
sort?: number;
|
||||
fileType?: number;
|
||||
isBridge?: number;
|
||||
uploadState?: number;
|
||||
uploadMeta?: number | Object;
|
||||
applicationId?: number;
|
||||
application?: Application.Projection;
|
||||
article?: Article.Projection;
|
||||
articleMenu?: ArticleMenu.Projection;
|
||||
sessionMessage?: SessionMessage.Projection;
|
||||
user?: User.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ExtraFileIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type ApplicationIdProjection = OneOf<{
|
||||
applicationId: number;
|
||||
}>;
|
||||
type ArticleIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type ArticleMenuIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type SessionMessageIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
origin: number;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
bucket: number;
|
||||
} | {
|
||||
objectId: number;
|
||||
} | {
|
||||
tag1: number;
|
||||
} | {
|
||||
tag2: number;
|
||||
} | {
|
||||
filename: number;
|
||||
} | {
|
||||
md5: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
extra1: number;
|
||||
} | {
|
||||
extension: number;
|
||||
} | {
|
||||
size: number;
|
||||
} | {
|
||||
sort: number;
|
||||
} | {
|
||||
fileType: number;
|
||||
} | {
|
||||
isBridge: number;
|
||||
} | {
|
||||
uploadState: number;
|
||||
} | {
|
||||
applicationId: number;
|
||||
} | {
|
||||
application: Application.SortAttr;
|
||||
} | {
|
||||
article: Article.SortAttr;
|
||||
} | {
|
||||
articleMenu: ArticleMenu.SortAttr;
|
||||
} | {
|
||||
sessionMessage: SessionMessage.SortAttr;
|
||||
} | {
|
||||
user: User.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" | "applicationId">> & (({
|
||||
applicationId?: never;
|
||||
application: Application.CreateSingleOperation;
|
||||
} | {
|
||||
applicationId: ForeignKey<"application">;
|
||||
application?: Application.UpdateOperation;
|
||||
} | {
|
||||
application?: never;
|
||||
applicationId: ForeignKey<"application">;
|
||||
})) & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
article: Article.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "article";
|
||||
entityId: ForeignKey<"Article">;
|
||||
article?: Article.UpdateOperation;
|
||||
} | {
|
||||
entity: "article";
|
||||
entityId: ForeignKey<"Article">;
|
||||
article?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
articleMenu: ArticleMenu.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "articleMenu";
|
||||
entityId: ForeignKey<"ArticleMenu">;
|
||||
articleMenu?: ArticleMenu.UpdateOperation;
|
||||
} | {
|
||||
entity: "articleMenu";
|
||||
entityId: ForeignKey<"ArticleMenu">;
|
||||
articleMenu?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
sessionMessage: SessionMessage.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "sessionMessage";
|
||||
entityId: ForeignKey<"SessionMessage">;
|
||||
sessionMessage?: SessionMessage.UpdateOperation;
|
||||
} | {
|
||||
entity: "sessionMessage";
|
||||
entityId: ForeignKey<"SessionMessage">;
|
||||
sessionMessage?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
user: User.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "user";
|
||||
entityId: ForeignKey<"User">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
entity: "user";
|
||||
entityId: ForeignKey<"User">;
|
||||
user?: 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" | "applicationId">> & (({
|
||||
application?: Application.CreateSingleOperation;
|
||||
applicationId?: never;
|
||||
} | {
|
||||
application?: Application.UpdateOperation;
|
||||
applicationId?: never;
|
||||
} | {
|
||||
application?: Application.RemoveOperation;
|
||||
applicationId?: never;
|
||||
} | {
|
||||
application?: never;
|
||||
applicationId?: ForeignKey<"application">;
|
||||
})) & ({
|
||||
article?: Article.CreateSingleOperation | Article.UpdateOperation | Article.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
articleMenu?: ArticleMenu.CreateSingleOperation | ArticleMenu.UpdateOperation | ArticleMenu.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
sessionMessage?: SessionMessage.CreateSingleOperation | SessionMessage.UpdateOperation | SessionMessage.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("article" | "articleMenu" | "sessionMessage" | "user" | string) | null;
|
||||
entityId?: ForeignKey<"Article" | "ArticleMenu" | "SessionMessage" | "User"> | null;
|
||||
article?: never;
|
||||
articleMenu?: never;
|
||||
sessionMessage?: never;
|
||||
user?: never;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
application?: Application.UpdateOperation | Application.RemoveOperation;
|
||||
})) & ({
|
||||
article?: Article.UpdateOperation | Article.RemoveOperation;
|
||||
} | {
|
||||
articleMenu?: ArticleMenu.UpdateOperation | ArticleMenu.RemoveOperation;
|
||||
} | {
|
||||
sessionMessage?: SessionMessage.UpdateOperation | SessionMessage.RemoveOperation;
|
||||
} | {
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
||||
export type ArticleIdSubQuery = Selection<ArticleIdProjection>;
|
||||
export type ArticleMenuIdSubQuery = Selection<ArticleMenuIdProjection>;
|
||||
export type SessionMessageIdSubQuery = Selection<SessionMessageIdProjection>;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type ExtraFileIdSubQuery = Selection<ExtraFileIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
origin: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["qiniu", "wechat", "unknown", "ctyun"]
|
||||
},
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["image", "video", "audio", "file"]
|
||||
},
|
||||
bucket: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
objectId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
tag1: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
tag2: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
filename: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 256
|
||||
}
|
||||
},
|
||||
md5: {
|
||||
type: "text"
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["article", "articleMenu", "sessionMessage", "user"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
extra1: {
|
||||
type: "text"
|
||||
},
|
||||
extra2: {
|
||||
type: "object"
|
||||
},
|
||||
extension: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 16
|
||||
}
|
||||
},
|
||||
size: {
|
||||
type: "int",
|
||||
params: {
|
||||
width: 4,
|
||||
signed: true
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
type: "decimal",
|
||||
params: {
|
||||
precision: 22,
|
||||
scale: 10
|
||||
}
|
||||
},
|
||||
fileType: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
isBridge: {
|
||||
type: "boolean"
|
||||
},
|
||||
uploadState: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["success", "failed", "uploading"]
|
||||
},
|
||||
uploadMeta: {
|
||||
type: "object"
|
||||
},
|
||||
applicationId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "application"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'objectId_deleteAt',
|
||||
attributes: [
|
||||
{
|
||||
name: 'objectId',
|
||||
},
|
||||
{
|
||||
name: '$$deleteAt$$',
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"文件","attr":{"origin":"源","type":"类型","bucket":"桶","objectId":"对象编号","tag1":"标签一","tag2":"标签二","filename":"文件名","md5":"md5","entity":"关联对象","entityId":"关联对象id","extra1":"额外信息","extra2":"非结构化额外信息","extension":"后缀名","size":"文件大小","sort":"排序","fileType":"文件类型","isBridge":"是否桥接访问","uploadState":"上传状态","uploadMeta":"上传需要的metadata","application":"来源应用"},"v":{"origin":{"qiniu":"七牛云","ctyun":"天翼云","wechat":"微信","unknown":"未知"},"type":{"image":"图像","video":"视频","audio":"音频","file":"文件"},"uploadState":{"success":"上传成功","failed":"上传失败","uploading":"上传中"}}}
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
export type OpSchema = EntityShape & {
|
||||
module: String<64>;
|
||||
position: String<188>;
|
||||
namespace: String<256>;
|
||||
language: String<32>;
|
||||
data: Object;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
module: String<64>;
|
||||
position: String<188>;
|
||||
namespace: String<256>;
|
||||
language: String<32>;
|
||||
data: Object;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
module: Q_StringValue;
|
||||
position: Q_StringValue;
|
||||
namespace: Q_StringValue;
|
||||
language: Q_StringValue;
|
||||
data: Object;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
module?: number;
|
||||
position?: number;
|
||||
namespace?: number;
|
||||
language?: number;
|
||||
data?: number | Object;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type I18nIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
module: number;
|
||||
} | {
|
||||
position: number;
|
||||
} | {
|
||||
namespace: number;
|
||||
} | {
|
||||
language: 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<OpSchema>;
|
||||
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;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type I18nIdSubQuery = Selection<I18nIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
module: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
position: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 188
|
||||
}
|
||||
},
|
||||
namespace: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 256
|
||||
}
|
||||
},
|
||||
language: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
data: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
}
|
||||
},
|
||||
static: true,
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'namespace_language',
|
||||
attributes: [
|
||||
{
|
||||
name: 'namespace',
|
||||
},
|
||||
{
|
||||
name: 'language',
|
||||
}
|
||||
],
|
||||
config: {
|
||||
unique: true,
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"用户授权","attr":{"module":"模块","position":"文件位置","namespace":"命名空间","language":"语言","data":"数据"}}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Float, Int, Boolean, Datetime, } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
export type OpSchema = EntityShape & {
|
||||
title: String<32>;
|
||||
streamTitle: String<32>;
|
||||
liveonly: 'online' | 'offline';
|
||||
hub: String<32>;
|
||||
streamKey: String<64>;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
rtmpPushUrl: String<64>;
|
||||
rtmpPlayUrl: String<64>;
|
||||
pcPushUrl: String<64>;
|
||||
expireAt: Datetime;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
title: String<32>;
|
||||
streamTitle: String<32>;
|
||||
liveonly: 'online' | 'offline';
|
||||
hub: String<32>;
|
||||
streamKey: String<64>;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
rtmpPushUrl: String<64>;
|
||||
rtmpPlayUrl: String<64>;
|
||||
pcPushUrl: String<64>;
|
||||
expireAt: Datetime;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
title: Q_StringValue;
|
||||
streamTitle: Q_StringValue;
|
||||
liveonly: Q_EnumValue<'online' | 'offline'>;
|
||||
hub: Q_StringValue;
|
||||
streamKey: Q_StringValue;
|
||||
entity: Q_StringValue;
|
||||
entityId: Q_StringValue;
|
||||
rtmpPushUrl: Q_StringValue;
|
||||
rtmpPlayUrl: Q_StringValue;
|
||||
pcPushUrl: Q_StringValue;
|
||||
expireAt: Q_DateValue;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
title?: number;
|
||||
streamTitle?: number;
|
||||
liveonly?: number;
|
||||
hub?: number;
|
||||
streamKey?: number;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
rtmpPushUrl?: number;
|
||||
rtmpPlayUrl?: number;
|
||||
pcPushUrl?: number;
|
||||
expireAt?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type LivestreamIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
title: number;
|
||||
} | {
|
||||
streamTitle: number;
|
||||
} | {
|
||||
liveonly: number;
|
||||
} | {
|
||||
hub: number;
|
||||
} | {
|
||||
streamKey: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
rtmpPushUrl: number;
|
||||
} | {
|
||||
rtmpPlayUrl: number;
|
||||
} | {
|
||||
pcPushUrl: number;
|
||||
} | {
|
||||
expireAt: 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;
|
||||
});
|
||||
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;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type LivestreamIdSubQuery = Selection<LivestreamIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
title: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
streamTitle: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
liveonly: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["online", "offline"]
|
||||
},
|
||||
hub: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
streamKey: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
rtmpPushUrl: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
rtmpPlayUrl: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
pcPushUrl: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
expireAt: {
|
||||
notNull: true,
|
||||
type: "datetime"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"直播流","attr":{"title":"名称","streamTitle":"直播流名称","liveonly":"活跃状态","hub":"直播空间名称","entity":"所属实体","entityId":"所属实体id","rtmpPushUrl":"推流地址","rtmpPlayUrl":"播放地址","expireAt":"推流过期时间","pcPushUrl":"OBS推流地址","streamKey":"OBS串流密钥"},"v":{"liveonly":{"online":"在线","offline":"下线"}}}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type IAction = 'succeed' | 'fail' | string;
|
||||
export type IState = 'sending' | 'success' | 'failure' | string;
|
||||
export type VisitState = 'unvisited' | 'visited' | string;
|
||||
export type VisitAction = 'visit' | string;
|
||||
export type ParticularAction = IAction | VisitAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeed", "fail", "visit"];
|
||||
const IActionDef: ActionDef<IAction, IState> = {
|
||||
stm: {
|
||||
succeed: ['sending', 'success'],
|
||||
fail: ['sending', 'failure'],
|
||||
},
|
||||
};
|
||||
const VisitActionDef: ActionDef<VisitAction, VisitState> = {
|
||||
stm: {
|
||||
visit: ['unvisited', 'visited'],
|
||||
},
|
||||
is: 'unvisited',
|
||||
};
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
iState: IActionDef,
|
||||
visitState: VisitActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,269 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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, IState, VisitState } from "./Action";
|
||||
import { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Text, Image } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { Index, ActionDef } from "oak-domain/lib/types";
|
||||
import { Channel, Weight } from "../../types/Message";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Platform from "../Platform/Schema";
|
||||
import * as MessageSystem from "../MessageSystem/Schema";
|
||||
import * as WechatMpJump from "../WechatMpJump/Schema";
|
||||
type Router = {
|
||||
pathname: string;
|
||||
props?: Record<string, any>;
|
||||
state?: Record<string, any>;
|
||||
isTabBar?: boolean; //小程序独有 小程序跳回tabBar的话 必须使用 wx.switchTab
|
||||
};
|
||||
type MessageRestriction = {
|
||||
systemIds?: string[]; // 允许发送的system
|
||||
channels?: Array<Channel>; // 允许推送的渠道
|
||||
};
|
||||
type Chaanels = Channel[];
|
||||
export type OpSchema = EntityShape & {
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
userId: ForeignKey<"user">;
|
||||
type: String<64>;
|
||||
weight: Weight;
|
||||
restriction?: MessageRestriction | null;
|
||||
title: String<256>;
|
||||
content: Text;
|
||||
data?: Object | null;
|
||||
router?: Router | null;
|
||||
platformId?: ForeignKey<"platform"> | null;
|
||||
channels?: Chaanels | null;
|
||||
iState?: IState | null;
|
||||
visitState?: VisitState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
userId: ForeignKey<"user">;
|
||||
type: String<64>;
|
||||
weight: Weight;
|
||||
restriction?: MessageRestriction | null;
|
||||
title: String<256>;
|
||||
content: Text;
|
||||
data?: Object | null;
|
||||
router?: Router | null;
|
||||
platformId?: ForeignKey<"platform"> | null;
|
||||
channels?: Chaanels | null;
|
||||
iState?: IState | null;
|
||||
visitState?: VisitState | null;
|
||||
user: User.Schema;
|
||||
platform?: Platform.Schema | null;
|
||||
messageSystem$message?: Array<MessageSystem.Schema>;
|
||||
messageSystem$message$$aggr?: AggregationResult<MessageSystem.Schema>;
|
||||
wechatMpJump$message?: Array<WechatMpJump.Schema>;
|
||||
wechatMpJump$message$$aggr?: AggregationResult<WechatMpJump.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
entity: Q_StringValue;
|
||||
entityId: Q_StringValue;
|
||||
userId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
type: Q_StringValue;
|
||||
weight: Q_EnumValue<Weight>;
|
||||
restriction: JsonFilter<MessageRestriction>;
|
||||
title: Q_StringValue;
|
||||
content: Q_StringValue;
|
||||
data: Object;
|
||||
router: JsonFilter<Router>;
|
||||
platformId: Q_StringValue;
|
||||
platform: Platform.Filter;
|
||||
channels: JsonFilter<Chaanels>;
|
||||
iState: Q_EnumValue<IState>;
|
||||
visitState: Q_EnumValue<VisitState>;
|
||||
messageSystem$message: MessageSystem.Filter & SubQueryPredicateMetadata;
|
||||
wechatMpJump$message: WechatMpJump.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;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
type?: number;
|
||||
weight?: number;
|
||||
restriction?: number | JsonProjection<MessageRestriction>;
|
||||
title?: number;
|
||||
content?: number;
|
||||
data?: number | Object;
|
||||
router?: number | JsonProjection<Router>;
|
||||
platformId?: number;
|
||||
platform?: Platform.Projection;
|
||||
channels?: number | JsonProjection<Chaanels>;
|
||||
iState?: number;
|
||||
visitState?: number;
|
||||
messageSystem$message?: MessageSystem.Selection & {
|
||||
$entity: "messageSystem";
|
||||
};
|
||||
messageSystem$message$$aggr?: MessageSystem.Aggregation & {
|
||||
$entity: "messageSystem";
|
||||
};
|
||||
wechatMpJump$message?: WechatMpJump.Selection & {
|
||||
$entity: "wechatMpJump";
|
||||
};
|
||||
wechatMpJump$message$$aggr?: WechatMpJump.Aggregation & {
|
||||
$entity: "wechatMpJump";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type MessageIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
userId: number;
|
||||
}>;
|
||||
type PlatformIdProjection = OneOf<{
|
||||
platformId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
userId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
weight: number;
|
||||
} | {
|
||||
restriction: number;
|
||||
} | {
|
||||
title: number;
|
||||
} | {
|
||||
content: number;
|
||||
} | {
|
||||
router: number;
|
||||
} | {
|
||||
platformId: number;
|
||||
} | {
|
||||
platform: Platform.SortAttr;
|
||||
} | {
|
||||
channels: number;
|
||||
} | {
|
||||
iState: number;
|
||||
} | {
|
||||
visitState: 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" | "userId" | "platformId">> & (({
|
||||
userId?: never;
|
||||
user: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: ForeignKey<"user">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
user?: never;
|
||||
userId: ForeignKey<"user">;
|
||||
}) & ({
|
||||
platformId?: never;
|
||||
platform?: Platform.CreateSingleOperation;
|
||||
} | {
|
||||
platformId: ForeignKey<"platform">;
|
||||
platform?: Platform.UpdateOperation;
|
||||
} | {
|
||||
platform?: never;
|
||||
platformId?: ForeignKey<"platform">;
|
||||
})) & ({
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
messageSystem$message?: OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">> | OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">>>;
|
||||
wechatMpJump$message?: OakOperation<WechatMpJump.UpdateOperation["action"], Omit<WechatMpJump.UpdateOperationData, "message" | "messageId">, Omit<WechatMpJump.Filter, "message" | "messageId">> | OakOperation<"create", Omit<WechatMpJump.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<WechatMpJump.CreateOperationData, "message" | "messageId">> | OakOperation<WechatMpJump.UpdateOperation["action"], Omit<WechatMpJump.UpdateOperationData, "message" | "messageId">, Omit<WechatMpJump.Filter, "message" | "messageId">>>;
|
||||
};
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "platformId">> & (({
|
||||
user?: User.CreateSingleOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.UpdateOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.RemoveOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: ForeignKey<"user">;
|
||||
}) & ({
|
||||
platform?: Platform.CreateSingleOperation;
|
||||
platformId?: never;
|
||||
} | {
|
||||
platform?: Platform.UpdateOperation;
|
||||
platformId?: never;
|
||||
} | {
|
||||
platform?: Platform.RemoveOperation;
|
||||
platformId?: never;
|
||||
} | {
|
||||
platform?: never;
|
||||
platformId?: ForeignKey<"platform"> | null;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
messageSystem$message?: OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<MessageSystem.CreateOperationData, "message" | "messageId">> | OakOperation<MessageSystem.UpdateOperation["action"], Omit<MessageSystem.UpdateOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">> | OakOperation<MessageSystem.RemoveOperation["action"], Omit<MessageSystem.RemoveOperationData, "message" | "messageId">, Omit<MessageSystem.Filter, "message" | "messageId">>>;
|
||||
wechatMpJump$message?: OakOperation<WechatMpJump.UpdateOperation["action"], Omit<WechatMpJump.UpdateOperationData, "message" | "messageId">, Omit<WechatMpJump.Filter, "message" | "messageId">> | OakOperation<WechatMpJump.RemoveOperation["action"], Omit<WechatMpJump.RemoveOperationData, "message" | "messageId">, Omit<WechatMpJump.Filter, "message" | "messageId">> | OakOperation<"create", Omit<WechatMpJump.CreateOperationData, "message" | "messageId">[]> | Array<OakOperation<"create", Omit<WechatMpJump.CreateOperationData, "message" | "messageId">> | OakOperation<WechatMpJump.UpdateOperation["action"], Omit<WechatMpJump.UpdateOperationData, "message" | "messageId">, Omit<WechatMpJump.Filter, "message" | "messageId">> | OakOperation<WechatMpJump.RemoveOperation["action"], Omit<WechatMpJump.RemoveOperationData, "message" | "messageId">, Omit<WechatMpJump.Filter, "message" | "messageId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
}) & ({
|
||||
platform?: Platform.UpdateOperation | Platform.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type PlatformIdSubQuery = Selection<PlatformIdProjection>;
|
||||
export type MessageIdSubQuery = Selection<MessageIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
userId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
weight: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["high", "medium", "low"]
|
||||
},
|
||||
restriction: {
|
||||
type: "object"
|
||||
},
|
||||
title: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 256
|
||||
}
|
||||
},
|
||||
content: {
|
||||
notNull: true,
|
||||
type: "text"
|
||||
},
|
||||
data: {
|
||||
type: "object"
|
||||
},
|
||||
router: {
|
||||
type: "object"
|
||||
},
|
||||
platformId: {
|
||||
type: "ref",
|
||||
ref: "platform"
|
||||
},
|
||||
channels: {
|
||||
type: "object"
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["sending", "success", "failure"]
|
||||
},
|
||||
visitState: {
|
||||
type: "enum",
|
||||
enumeration: ["unvisited", "visited"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"消息","attr":{"entity":"关联对象","entityId":"关联对象ID","restriction":"限制","title":"标题","content":"内容","user":"关联用户","type":"消息类型","weight":"优先级","iState":"发送状态","visitState":"访问状态","router":"目标路由","data":"透传数据","platform":"平台","channels":"渠道"},"action":{"succeed":"成功","fail":"失败","visit":"阅读"},"v":{"iState":{"sending":"发送中","success":"发送成功","failure":"发送失败"},"visitState":{"unvisited":"未读","visited":"已读"},"weight":{"high":"高","medium":"中","low":"低"}}}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Message from "../Message/Schema";
|
||||
import * as System from "../System/Schema";
|
||||
import * as Notification from "../Notification/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
messageId: ForeignKey<"message">;
|
||||
systemId: ForeignKey<"system">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
messageId: ForeignKey<"message">;
|
||||
systemId: ForeignKey<"system">;
|
||||
message: Message.Schema;
|
||||
system: System.Schema;
|
||||
notification$messageSystem?: Array<Notification.Schema>;
|
||||
notification$messageSystem$$aggr?: AggregationResult<Notification.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
messageId: Q_StringValue;
|
||||
message: Message.Filter;
|
||||
systemId: Q_StringValue;
|
||||
system: System.Filter;
|
||||
notification$messageSystem: Notification.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;
|
||||
messageId?: number;
|
||||
message?: Message.Projection;
|
||||
systemId?: number;
|
||||
system?: System.Projection;
|
||||
notification$messageSystem?: Notification.Selection & {
|
||||
$entity: "notification";
|
||||
};
|
||||
notification$messageSystem$$aggr?: Notification.Aggregation & {
|
||||
$entity: "notification";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type MessageSystemIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type MessageIdProjection = OneOf<{
|
||||
messageId: number;
|
||||
}>;
|
||||
type SystemIdProjection = OneOf<{
|
||||
systemId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
messageId: number;
|
||||
} | {
|
||||
message: Message.SortAttr;
|
||||
} | {
|
||||
systemId: number;
|
||||
} | {
|
||||
system: System.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, "messageId" | "systemId">> & (({
|
||||
messageId?: never;
|
||||
message: Message.CreateSingleOperation;
|
||||
} | {
|
||||
messageId: ForeignKey<"message">;
|
||||
message?: Message.UpdateOperation;
|
||||
} | {
|
||||
message?: never;
|
||||
messageId: ForeignKey<"message">;
|
||||
}) & ({
|
||||
systemId?: never;
|
||||
system: System.CreateSingleOperation;
|
||||
} | {
|
||||
systemId: ForeignKey<"system">;
|
||||
system?: System.UpdateOperation;
|
||||
} | {
|
||||
system?: never;
|
||||
systemId: ForeignKey<"system">;
|
||||
})) & {
|
||||
notification$messageSystem?: OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "messageSystem" | "messageSystemId">, Omit<Notification.Filter, "messageSystem" | "messageSystemId">> | OakOperation<"create", Omit<Notification.CreateOperationData, "messageSystem" | "messageSystemId">[]> | Array<OakOperation<"create", Omit<Notification.CreateOperationData, "messageSystem" | "messageSystemId">> | OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "messageSystem" | "messageSystemId">, Omit<Notification.Filter, "messageSystem" | "messageSystemId">>>;
|
||||
};
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "messageId" | "systemId">> & (({
|
||||
message?: Message.CreateSingleOperation;
|
||||
messageId?: never;
|
||||
} | {
|
||||
message?: Message.UpdateOperation;
|
||||
messageId?: never;
|
||||
} | {
|
||||
message?: Message.RemoveOperation;
|
||||
messageId?: never;
|
||||
} | {
|
||||
message?: never;
|
||||
messageId?: ForeignKey<"message">;
|
||||
}) & ({
|
||||
system?: System.CreateSingleOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: System.UpdateOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: System.RemoveOperation;
|
||||
systemId?: never;
|
||||
} | {
|
||||
system?: never;
|
||||
systemId?: ForeignKey<"system">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
notification$messageSystem?: OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "messageSystem" | "messageSystemId">, Omit<Notification.Filter, "messageSystem" | "messageSystemId">> | OakOperation<Notification.RemoveOperation["action"], Omit<Notification.RemoveOperationData, "messageSystem" | "messageSystemId">, Omit<Notification.Filter, "messageSystem" | "messageSystemId">> | OakOperation<"create", Omit<Notification.CreateOperationData, "messageSystem" | "messageSystemId">[]> | Array<OakOperation<"create", Omit<Notification.CreateOperationData, "messageSystem" | "messageSystemId">> | OakOperation<Notification.UpdateOperation["action"], Omit<Notification.UpdateOperationData, "messageSystem" | "messageSystemId">, Omit<Notification.Filter, "messageSystem" | "messageSystemId">> | OakOperation<Notification.RemoveOperation["action"], Omit<Notification.RemoveOperationData, "messageSystem" | "messageSystemId">, Omit<Notification.Filter, "messageSystem" | "messageSystemId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
message?: Message.UpdateOperation | Message.RemoveOperation;
|
||||
}) & ({
|
||||
system?: System.UpdateOperation | System.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type MessageIdSubQuery = Selection<MessageIdProjection>;
|
||||
export type SystemIdSubQuery = Selection<SystemIdProjection>;
|
||||
export type MessageSystemIdSubQuery = Selection<MessageSystemIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
messageId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "message"
|
||||
},
|
||||
systemId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "system"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"消息系统连接","attr":{"message":"消息","system":"系统"}}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
export type OpSchema = EntityShape & {
|
||||
type: String<64>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
type: String<64>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
type: Q_StringValue;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
type?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type MessageTypeIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
type: 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<OpSchema>;
|
||||
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;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type MessageTypeIdSubQuery = Selection<MessageTypeIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"消息类型","attr":{"type":"类型"}}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Float, Int, Boolean, Datetime, } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as SmsTemplate from "../SmsTemplate/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
type: String<64>;
|
||||
templateId: ForeignKey<"smsTemplate">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
type: String<64>;
|
||||
templateId: ForeignKey<"smsTemplate">;
|
||||
template: SmsTemplate.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
type: Q_StringValue;
|
||||
templateId: Q_StringValue;
|
||||
template: SmsTemplate.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;
|
||||
type?: number;
|
||||
templateId?: number;
|
||||
template?: SmsTemplate.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type MessageTypeSmsTemplateIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type SmsTemplateIdProjection = OneOf<{
|
||||
templateId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
templateId: number;
|
||||
} | {
|
||||
template: SmsTemplate.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, "templateId">> & (({
|
||||
templateId?: never;
|
||||
template: SmsTemplate.CreateSingleOperation;
|
||||
} | {
|
||||
templateId: ForeignKey<"template">;
|
||||
template?: SmsTemplate.UpdateOperation;
|
||||
} | {
|
||||
template?: never;
|
||||
templateId: ForeignKey<"template">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "templateId">> & (({
|
||||
template?: SmsTemplate.CreateSingleOperation;
|
||||
templateId?: never;
|
||||
} | {
|
||||
template?: SmsTemplate.UpdateOperation;
|
||||
templateId?: never;
|
||||
} | {
|
||||
template?: SmsTemplate.RemoveOperation;
|
||||
templateId?: never;
|
||||
} | {
|
||||
template?: never;
|
||||
templateId?: ForeignKey<"template">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
template?: SmsTemplate.UpdateOperation | SmsTemplate.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type SmsTemplateIdSubQuery = Selection<SmsTemplateIdProjection>;
|
||||
export type MessageTypeSmsTemplateIdSubQuery = Selection<MessageTypeSmsTemplateIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
templateId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "smsTemplate"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"消息类型模板关联","attr":{"type":"消息类型","template":"短信消息模板"}}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Float, Int, Boolean, Datetime, } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as WechatPublicTemplate from "../WechatPublicTemplate/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
type: String<64>;
|
||||
templateId: ForeignKey<"wechatPublicTemplate">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
type: String<64>;
|
||||
templateId: ForeignKey<"wechatPublicTemplate">;
|
||||
template: WechatPublicTemplate.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
type: Q_StringValue;
|
||||
templateId: Q_StringValue;
|
||||
template: WechatPublicTemplate.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;
|
||||
type?: number;
|
||||
templateId?: number;
|
||||
template?: WechatPublicTemplate.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type MessageTypeTemplateIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type WechatPublicTemplateIdProjection = OneOf<{
|
||||
templateId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
type: number;
|
||||
} | {
|
||||
templateId: number;
|
||||
} | {
|
||||
template: WechatPublicTemplate.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, "templateId">> & (({
|
||||
templateId?: never;
|
||||
template: WechatPublicTemplate.CreateSingleOperation;
|
||||
} | {
|
||||
templateId: ForeignKey<"template">;
|
||||
template?: WechatPublicTemplate.UpdateOperation;
|
||||
} | {
|
||||
template?: never;
|
||||
templateId: ForeignKey<"template">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "templateId">> & (({
|
||||
template?: WechatPublicTemplate.CreateSingleOperation;
|
||||
templateId?: never;
|
||||
} | {
|
||||
template?: WechatPublicTemplate.UpdateOperation;
|
||||
templateId?: never;
|
||||
} | {
|
||||
template?: WechatPublicTemplate.RemoveOperation;
|
||||
templateId?: never;
|
||||
} | {
|
||||
template?: never;
|
||||
templateId?: ForeignKey<"template">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
template?: WechatPublicTemplate.UpdateOperation | WechatPublicTemplate.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type WechatPublicTemplateIdSubQuery = Selection<WechatPublicTemplateIdProjection>;
|
||||
export type MessageTypeTemplateIdSubQuery = Selection<MessageTypeTemplateIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
type: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
templateId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "wechatPublicTemplate"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"消息类型模板关联","attr":{"type":"消息类型","template":"公众号消息模板"}}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import { AbleAction, AbleState, makeAbleActionDef } from 'oak-domain/lib/actions/action';
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type ParticularAction = AbleAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "enable", "disable"];
|
||||
const AbleActionDef: ActionDef<AbleAction, AbleState> = makeAbleActionDef('enabled');
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
ableState: AbleActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Text, Image } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { AbleAction, AbleState, makeAbleActionDef } from "oak-domain/lib/actions/action";
|
||||
import { ActionDef, Index } from "oak-domain/lib/types";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
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.Schema>;
|
||||
token$entity$$aggr?: AggregationResult<Token.Schema>;
|
||||
} & {
|
||||
[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<AbleState>;
|
||||
token$entity: Token.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;
|
||||
mobile?: number;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
ableState?: number;
|
||||
token$entity?: Token.Selection & {
|
||||
$entity: "token";
|
||||
};
|
||||
token$entity$$aggr?: Token.Aggregation & {
|
||||
$entity: "token";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
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<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, "userId">> & (({
|
||||
userId?: never;
|
||||
user?: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: ForeignKey<"user">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: ForeignKey<"user">;
|
||||
})) & {
|
||||
token$entity?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.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<Omit<OpSchema, "userId">> & (({
|
||||
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<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
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<UserIdProjection>;
|
||||
export type MobileIdSubQuery = Selection<MobileIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
mobile: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 16
|
||||
}
|
||||
},
|
||||
userId: {
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
ableState: {
|
||||
type: "enum",
|
||||
enumeration: ["enabled", "disabled"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_mobile_ableState',
|
||||
attributes: [
|
||||
{
|
||||
name: 'mobile',
|
||||
direction: 'ASC',
|
||||
},
|
||||
{
|
||||
name: 'ableState',
|
||||
direction: 'ASC',
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"手机","attr":{"ableState":"是否可用","mobile":"手机号","user":"关联用户","tokens":"相关令牌"},"action":{"enable":"启用","disable":"禁用"},"v":{"ableState":{"enabled":"可用的","disabled":"禁用的"}}}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type IState = 'active' | 'applied' | 'abandoned' | string;
|
||||
export type IAction = 'apply' | 'abandon' | string;
|
||||
const IActionDef: ActionDef<IAction, IState> = {
|
||||
stm: {
|
||||
apply: ['active', 'applied'],
|
||||
abandon: ['active', 'abandoned'],
|
||||
},
|
||||
is: 'active',
|
||||
};
|
||||
export type ParticularAction = IAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "apply", "abandon"];
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
iState: IActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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, IState } from "./Action";
|
||||
import { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as ModiEntity from "../ModiEntity/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
targetEntity: String<32>;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
action: String<16>;
|
||||
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<16>;
|
||||
data: Object;
|
||||
filter?: Object | null;
|
||||
extra?: Object | null;
|
||||
iState?: IState | null;
|
||||
modiEntity$modi?: Array<ModiEntity.Schema>;
|
||||
modiEntity$modi$$aggr?: AggregationResult<ModiEntity.Schema>;
|
||||
} & {
|
||||
[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<IState>;
|
||||
modiEntity$modi: ModiEntity.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;
|
||||
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<ExprOp<OpAttr | string>>;
|
||||
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<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;
|
||||
}) & {
|
||||
modiEntity$modi?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">>>;
|
||||
};
|
||||
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;
|
||||
modiEntity$modi?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">>>;
|
||||
};
|
||||
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<ModiIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
targetEntity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
action: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 16
|
||||
}
|
||||
},
|
||||
data: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
},
|
||||
filter: {
|
||||
type: "object"
|
||||
},
|
||||
extra: {
|
||||
type: "object"
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["active", "applied", "abandoned"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_state',
|
||||
attributes: [
|
||||
{
|
||||
name: 'iState',
|
||||
direction: 'ASC',
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"更新","attr":{"targetEntity":"目标对象","entity":"关联对象","entityId":"关联对象Id","action":"动作","data":"数据","filter":"条件","extra":"其它","iState":"状态"},"action":{"abandon":"放弃","apply":"应用"},"v":{"iState":{"active":"活跃的","abandoned":"放弃的","applied":"应用的"}}}
|
||||
|
|
@ -0,0 +1,485 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Modi from "../Modi/Schema";
|
||||
import * as User from "../User/Schema";
|
||||
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
||||
import * as UserSystem from "../UserSystem/Schema";
|
||||
import * as UserWechatPublicTag from "../UserWechatPublicTag/Schema";
|
||||
import * as WechatLogin from "../WechatLogin/Schema";
|
||||
import * as WechatMenu from "../WechatMenu/Schema";
|
||||
import * as WechatMpJump from "../WechatMpJump/Schema";
|
||||
import * as WechatPublicAutoReply from "../WechatPublicAutoReply/Schema";
|
||||
import * as WechatPublicTag from "../WechatPublicTag/Schema";
|
||||
import * as WechatPublicTemplate from "../WechatPublicTemplate/Schema";
|
||||
import * as WechatQrCode from "../WechatQrCode/Schema";
|
||||
import * as WechatUser from "../WechatUser/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
modiId: ForeignKey<"modi">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
modiId: ForeignKey<"modi">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
modi: Modi.Schema;
|
||||
user?: User.Schema;
|
||||
userEntityGrant?: UserEntityGrant.Schema;
|
||||
userSystem?: UserSystem.Schema;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Schema;
|
||||
wechatLogin?: WechatLogin.Schema;
|
||||
wechatMenu?: WechatMenu.Schema;
|
||||
wechatMpJump?: WechatMpJump.Schema;
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.Schema;
|
||||
wechatPublicTag?: WechatPublicTag.Schema;
|
||||
wechatPublicTemplate?: WechatPublicTemplate.Schema;
|
||||
wechatQrCode?: WechatQrCode.Schema;
|
||||
wechatUser?: WechatUser.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
modiId: Q_StringValue;
|
||||
modi: Modi.Filter;
|
||||
entity: Q_EnumValue<"user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string>;
|
||||
entityId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
userEntityGrant: UserEntityGrant.Filter;
|
||||
userSystem: UserSystem.Filter;
|
||||
userWechatPublicTag: UserWechatPublicTag.Filter;
|
||||
wechatLogin: WechatLogin.Filter;
|
||||
wechatMenu: WechatMenu.Filter;
|
||||
wechatMpJump: WechatMpJump.Filter;
|
||||
wechatPublicAutoReply: WechatPublicAutoReply.Filter;
|
||||
wechatPublicTag: WechatPublicTag.Filter;
|
||||
wechatPublicTemplate: WechatPublicTemplate.Filter;
|
||||
wechatQrCode: WechatQrCode.Filter;
|
||||
wechatUser: WechatUser.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;
|
||||
modiId?: number;
|
||||
modi?: Modi.Projection;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
user?: User.Projection;
|
||||
userEntityGrant?: UserEntityGrant.Projection;
|
||||
userSystem?: UserSystem.Projection;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Projection;
|
||||
wechatLogin?: WechatLogin.Projection;
|
||||
wechatMenu?: WechatMenu.Projection;
|
||||
wechatMpJump?: WechatMpJump.Projection;
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.Projection;
|
||||
wechatPublicTag?: WechatPublicTag.Projection;
|
||||
wechatPublicTemplate?: WechatPublicTemplate.Projection;
|
||||
wechatQrCode?: WechatQrCode.Projection;
|
||||
wechatUser?: WechatUser.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ModiEntityIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type ModiIdProjection = OneOf<{
|
||||
modiId: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserEntityGrantIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserSystemIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserWechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatLoginIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatMenuIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatMpJumpIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatPublicAutoReplyIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatPublicTemplateIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatQrCodeIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatUserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
modiId: number;
|
||||
} | {
|
||||
modi: Modi.SortAttr;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
userEntityGrant: UserEntityGrant.SortAttr;
|
||||
} | {
|
||||
userSystem: UserSystem.SortAttr;
|
||||
} | {
|
||||
userWechatPublicTag: UserWechatPublicTag.SortAttr;
|
||||
} | {
|
||||
wechatLogin: WechatLogin.SortAttr;
|
||||
} | {
|
||||
wechatMenu: WechatMenu.SortAttr;
|
||||
} | {
|
||||
wechatMpJump: WechatMpJump.SortAttr;
|
||||
} | {
|
||||
wechatPublicAutoReply: WechatPublicAutoReply.SortAttr;
|
||||
} | {
|
||||
wechatPublicTag: WechatPublicTag.SortAttr;
|
||||
} | {
|
||||
wechatPublicTemplate: WechatPublicTemplate.SortAttr;
|
||||
} | {
|
||||
wechatQrCode: WechatQrCode.SortAttr;
|
||||
} | {
|
||||
wechatUser: WechatUser.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" | "modiId">> & (({
|
||||
modiId?: never;
|
||||
modi: Modi.CreateSingleOperation;
|
||||
} | {
|
||||
modiId: ForeignKey<"modi">;
|
||||
modi?: Modi.UpdateOperation;
|
||||
} | {
|
||||
modi?: never;
|
||||
modiId: ForeignKey<"modi">;
|
||||
})) & ({
|
||||
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;
|
||||
userEntityGrant: UserEntityGrant.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "userEntityGrant";
|
||||
entityId: ForeignKey<"UserEntityGrant">;
|
||||
userEntityGrant?: UserEntityGrant.UpdateOperation;
|
||||
} | {
|
||||
entity: "userEntityGrant";
|
||||
entityId: ForeignKey<"UserEntityGrant">;
|
||||
userEntityGrant?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
userSystem: UserSystem.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "userSystem";
|
||||
entityId: ForeignKey<"UserSystem">;
|
||||
userSystem?: UserSystem.UpdateOperation;
|
||||
} | {
|
||||
entity: "userSystem";
|
||||
entityId: ForeignKey<"UserSystem">;
|
||||
userSystem?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
userWechatPublicTag: UserWechatPublicTag.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "userWechatPublicTag";
|
||||
entityId: ForeignKey<"UserWechatPublicTag">;
|
||||
userWechatPublicTag?: UserWechatPublicTag.UpdateOperation;
|
||||
} | {
|
||||
entity: "userWechatPublicTag";
|
||||
entityId: ForeignKey<"UserWechatPublicTag">;
|
||||
userWechatPublicTag?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatLogin: WechatLogin.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: ForeignKey<"WechatLogin">;
|
||||
wechatLogin?: WechatLogin.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: ForeignKey<"WechatLogin">;
|
||||
wechatLogin?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatMenu: WechatMenu.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatMenu";
|
||||
entityId: ForeignKey<"WechatMenu">;
|
||||
wechatMenu?: WechatMenu.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatMenu";
|
||||
entityId: ForeignKey<"WechatMenu">;
|
||||
wechatMenu?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatMpJump: WechatMpJump.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatMpJump";
|
||||
entityId: ForeignKey<"WechatMpJump">;
|
||||
wechatMpJump?: WechatMpJump.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatMpJump";
|
||||
entityId: ForeignKey<"WechatMpJump">;
|
||||
wechatMpJump?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatPublicAutoReply: WechatPublicAutoReply.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatPublicAutoReply";
|
||||
entityId: ForeignKey<"WechatPublicAutoReply">;
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatPublicAutoReply";
|
||||
entityId: ForeignKey<"WechatPublicAutoReply">;
|
||||
wechatPublicAutoReply?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatPublicTag: WechatPublicTag.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTag";
|
||||
entityId: ForeignKey<"WechatPublicTag">;
|
||||
wechatPublicTag?: WechatPublicTag.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTag";
|
||||
entityId: ForeignKey<"WechatPublicTag">;
|
||||
wechatPublicTag?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatPublicTemplate: WechatPublicTemplate.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTemplate";
|
||||
entityId: ForeignKey<"WechatPublicTemplate">;
|
||||
wechatPublicTemplate?: WechatPublicTemplate.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTemplate";
|
||||
entityId: ForeignKey<"WechatPublicTemplate">;
|
||||
wechatPublicTemplate?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatQrCode: WechatQrCode.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatQrCode";
|
||||
entityId: ForeignKey<"WechatQrCode">;
|
||||
wechatQrCode?: WechatQrCode.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatQrCode";
|
||||
entityId: ForeignKey<"WechatQrCode">;
|
||||
wechatQrCode?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatUser: WechatUser.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatUser";
|
||||
entityId: ForeignKey<"WechatUser">;
|
||||
wechatUser?: WechatUser.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatUser";
|
||||
entityId: ForeignKey<"WechatUser">;
|
||||
wechatUser?: 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" | "modiId">> & (({
|
||||
modi?: Modi.CreateSingleOperation;
|
||||
modiId?: never;
|
||||
} | {
|
||||
modi?: Modi.UpdateOperation;
|
||||
modiId?: never;
|
||||
} | {
|
||||
modi?: Modi.RemoveOperation;
|
||||
modiId?: never;
|
||||
} | {
|
||||
modi?: never;
|
||||
modiId?: ForeignKey<"modi">;
|
||||
})) & ({
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
userEntityGrant?: UserEntityGrant.CreateSingleOperation | UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
userSystem?: UserSystem.CreateSingleOperation | UserSystem.UpdateOperation | UserSystem.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
userWechatPublicTag?: UserWechatPublicTag.CreateSingleOperation | UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.CreateSingleOperation | WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatMenu?: WechatMenu.CreateSingleOperation | WechatMenu.UpdateOperation | WechatMenu.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatMpJump?: WechatMpJump.CreateSingleOperation | WechatMpJump.UpdateOperation | WechatMpJump.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.CreateSingleOperation | WechatPublicAutoReply.UpdateOperation | WechatPublicAutoReply.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.CreateSingleOperation | WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicTemplate?: WechatPublicTemplate.CreateSingleOperation | WechatPublicTemplate.UpdateOperation | WechatPublicTemplate.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatQrCode?: WechatQrCode.CreateSingleOperation | WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatUser?: WechatUser.CreateSingleOperation | WechatUser.UpdateOperation | WechatUser.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "WechatMpJump" | "WechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
|
||||
user?: never;
|
||||
userEntityGrant?: never;
|
||||
userSystem?: never;
|
||||
userWechatPublicTag?: never;
|
||||
wechatLogin?: never;
|
||||
wechatMenu?: never;
|
||||
wechatMpJump?: never;
|
||||
wechatPublicAutoReply?: never;
|
||||
wechatPublicTag?: never;
|
||||
wechatPublicTemplate?: never;
|
||||
wechatQrCode?: never;
|
||||
wechatUser?: never;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
modi?: Modi.UpdateOperation | Modi.RemoveOperation;
|
||||
})) & ({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
|
||||
} | {
|
||||
userSystem?: UserSystem.UpdateOperation | UserSystem.RemoveOperation;
|
||||
} | {
|
||||
userWechatPublicTag?: UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
} | {
|
||||
wechatMenu?: WechatMenu.UpdateOperation | WechatMenu.RemoveOperation;
|
||||
} | {
|
||||
wechatMpJump?: WechatMpJump.UpdateOperation | WechatMpJump.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.UpdateOperation | WechatPublicAutoReply.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicTemplate?: WechatPublicTemplate.UpdateOperation | WechatPublicTemplate.RemoveOperation;
|
||||
} | {
|
||||
wechatQrCode?: WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation;
|
||||
} | {
|
||||
wechatUser?: WechatUser.UpdateOperation | WechatUser.RemoveOperation;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type ModiIdSubQuery = Selection<ModiIdProjection>;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
|
||||
export type UserSystemIdSubQuery = Selection<UserSystemIdProjection>;
|
||||
export type UserWechatPublicTagIdSubQuery = Selection<UserWechatPublicTagIdProjection>;
|
||||
export type WechatLoginIdSubQuery = Selection<WechatLoginIdProjection>;
|
||||
export type WechatMenuIdSubQuery = Selection<WechatMenuIdProjection>;
|
||||
export type WechatMpJumpIdSubQuery = Selection<WechatMpJumpIdProjection>;
|
||||
export type WechatPublicAutoReplyIdSubQuery = Selection<WechatPublicAutoReplyIdProjection>;
|
||||
export type WechatPublicTagIdSubQuery = Selection<WechatPublicTagIdProjection>;
|
||||
export type WechatPublicTemplateIdSubQuery = Selection<WechatPublicTemplateIdProjection>;
|
||||
export type WechatQrCodeIdSubQuery = Selection<WechatQrCodeIdProjection>;
|
||||
export type WechatUserIdSubQuery = Selection<WechatUserIdProjection>;
|
||||
export type ModiEntityIdSubQuery = Selection<ModiEntityIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { appendOnlyActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
modiId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "modi"
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatLogin", "wechatMenu", "wechatMpJump", "wechatPublicAutoReply", "wechatPublicTag", "wechatPublicTemplate", "wechatQrCode", "wechatUser"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "appendOnly",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"更新对象连接","attr":{"modi":"更新","entity":"关联对象","entityId":"关联对象id"}}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type IAction = 'succeed' | 'fail' | string;
|
||||
export type IState = 'sending' | 'success' | 'failure' | string;
|
||||
export type ParticularAction = IAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "succeed", "fail"];
|
||||
const IActionDef: ActionDef<IAction, IState> = {
|
||||
stm: {
|
||||
succeed: ['sending', 'success'],
|
||||
fail: ['sending', 'failure'],
|
||||
},
|
||||
is: 'sending',
|
||||
};
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {
|
||||
iState: IActionDef
|
||||
};
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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, IState } from "./Action";
|
||||
import { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { Index, ActionDef } from "oak-domain/lib/types";
|
||||
import { Channel } from "../../types/Message";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Application from "../Application/Schema";
|
||||
import * as MessageSystem from "../MessageSystem/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
channel: Channel;
|
||||
applicationId?: ForeignKey<"application"> | null;
|
||||
data?: Object | null;
|
||||
messageSystemId: ForeignKey<"messageSystem">;
|
||||
data1?: Object | null;
|
||||
data2?: Object | null;
|
||||
templateId?: String<128> | null;
|
||||
iState?: IState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
channel: Channel;
|
||||
applicationId?: ForeignKey<"application"> | null;
|
||||
data?: Object | null;
|
||||
messageSystemId: ForeignKey<"messageSystem">;
|
||||
data1?: Object | null;
|
||||
data2?: Object | null;
|
||||
templateId?: String<128> | null;
|
||||
iState?: IState | null;
|
||||
application?: Application.Schema | null;
|
||||
messageSystem: MessageSystem.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
channel: Q_EnumValue<Channel>;
|
||||
applicationId: Q_StringValue;
|
||||
application: Application.Filter;
|
||||
data: Object;
|
||||
messageSystemId: Q_StringValue;
|
||||
messageSystem: MessageSystem.Filter;
|
||||
data1: Object;
|
||||
data2: Object;
|
||||
templateId: Q_StringValue;
|
||||
iState: Q_EnumValue<IState>;
|
||||
};
|
||||
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
||||
export type Projection = {
|
||||
"#id"?: NodeId;
|
||||
[k: string]: any;
|
||||
id?: number;
|
||||
$$createAt$$?: number;
|
||||
$$updateAt$$?: number;
|
||||
$$seq$$?: number;
|
||||
channel?: number;
|
||||
applicationId?: number;
|
||||
application?: Application.Projection;
|
||||
data?: number | Object;
|
||||
messageSystemId?: number;
|
||||
messageSystem?: MessageSystem.Projection;
|
||||
data1?: number | Object;
|
||||
data2?: number | Object;
|
||||
templateId?: number;
|
||||
iState?: number;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type NotificationIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type ApplicationIdProjection = OneOf<{
|
||||
applicationId: number;
|
||||
}>;
|
||||
type MessageSystemIdProjection = OneOf<{
|
||||
messageSystemId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
channel: number;
|
||||
} | {
|
||||
applicationId: number;
|
||||
} | {
|
||||
application: Application.SortAttr;
|
||||
} | {
|
||||
messageSystemId: number;
|
||||
} | {
|
||||
messageSystem: MessageSystem.SortAttr;
|
||||
} | {
|
||||
templateId: number;
|
||||
} | {
|
||||
iState: 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, "applicationId" | "messageSystemId">> & (({
|
||||
applicationId?: never;
|
||||
application?: Application.CreateSingleOperation;
|
||||
} | {
|
||||
applicationId: ForeignKey<"application">;
|
||||
application?: Application.UpdateOperation;
|
||||
} | {
|
||||
application?: never;
|
||||
applicationId?: ForeignKey<"application">;
|
||||
}) & ({
|
||||
messageSystemId?: never;
|
||||
messageSystem: MessageSystem.CreateSingleOperation;
|
||||
} | {
|
||||
messageSystemId: ForeignKey<"messageSystem">;
|
||||
messageSystem?: MessageSystem.UpdateOperation;
|
||||
} | {
|
||||
messageSystem?: never;
|
||||
messageSystemId: ForeignKey<"messageSystem">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "applicationId" | "messageSystemId">> & (({
|
||||
application?: Application.CreateSingleOperation;
|
||||
applicationId?: never;
|
||||
} | {
|
||||
application?: Application.UpdateOperation;
|
||||
applicationId?: never;
|
||||
} | {
|
||||
application?: Application.RemoveOperation;
|
||||
applicationId?: never;
|
||||
} | {
|
||||
application?: never;
|
||||
applicationId?: ForeignKey<"application"> | null;
|
||||
}) & ({
|
||||
messageSystem?: MessageSystem.CreateSingleOperation;
|
||||
messageSystemId?: never;
|
||||
} | {
|
||||
messageSystem?: MessageSystem.UpdateOperation;
|
||||
messageSystemId?: never;
|
||||
} | {
|
||||
messageSystem?: MessageSystem.RemoveOperation;
|
||||
messageSystemId?: never;
|
||||
} | {
|
||||
messageSystem?: never;
|
||||
messageSystemId?: ForeignKey<"messageSystem">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
application?: Application.UpdateOperation | Application.RemoveOperation;
|
||||
}) & ({
|
||||
messageSystem?: MessageSystem.UpdateOperation | MessageSystem.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type ApplicationIdSubQuery = Selection<ApplicationIdProjection>;
|
||||
export type MessageSystemIdSubQuery = Selection<MessageSystemIdProjection>;
|
||||
export type NotificationIdSubQuery = Selection<NotificationIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
channel: {
|
||||
notNull: true,
|
||||
type: "enum",
|
||||
enumeration: ["wechatPublic", "jPush", "jim", "wechatMp", "sms"]
|
||||
},
|
||||
applicationId: {
|
||||
type: "ref",
|
||||
ref: "application"
|
||||
},
|
||||
data: {
|
||||
type: "object"
|
||||
},
|
||||
messageSystemId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "messageSystem"
|
||||
},
|
||||
data1: {
|
||||
type: "object"
|
||||
},
|
||||
data2: {
|
||||
type: "object"
|
||||
},
|
||||
templateId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 128
|
||||
}
|
||||
},
|
||||
iState: {
|
||||
type: "enum",
|
||||
enumeration: ["sending", "success", "failure"]
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"通知","attr":{"channel":"消息渠道","data":"消息数据","messageSystem":"消息系统连接","data1":"数据1","data2":"数据2","iState":"状态","application":"关联应用","templateId":"模板id"},"action":{"succeed":"成功","fail":"失败"},"v":{"iState":{"sending":"发送中","success":"发送成功","failure":"发送失败"},"channel":{"wechatPublic":"公众号","jPush":"极光推送","jim":"极光消息","wechatMp":"小程序","sms":"短信"}}}
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Image, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as User from "../User/Schema";
|
||||
import * as OperEntity from "../OperEntity/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
action: String<16>;
|
||||
data: Object;
|
||||
filter?: Object | null;
|
||||
extra?: Object | null;
|
||||
operatorId?: ForeignKey<"user"> | null;
|
||||
targetEntity: String<32>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
action: String<16>;
|
||||
data: Object;
|
||||
filter?: Object | null;
|
||||
extra?: Object | null;
|
||||
operatorId?: ForeignKey<"user"> | null;
|
||||
targetEntity: String<32>;
|
||||
operator?: User.Schema | null;
|
||||
operEntity$oper?: Array<OperEntity.Schema>;
|
||||
operEntity$oper$$aggr?: AggregationResult<OperEntity.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
action: Q_StringValue;
|
||||
data: Object;
|
||||
filter: Object;
|
||||
extra: Object;
|
||||
operatorId: Q_StringValue;
|
||||
operator: User.Filter;
|
||||
targetEntity: Q_StringValue;
|
||||
operEntity$oper: 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;
|
||||
action?: number;
|
||||
data?: number | Object;
|
||||
filter?: number | Object;
|
||||
extra?: number | Object;
|
||||
operatorId?: number;
|
||||
operator?: User.Projection;
|
||||
targetEntity?: number;
|
||||
operEntity$oper?: OperEntity.Selection & {
|
||||
$entity: "operEntity";
|
||||
};
|
||||
operEntity$oper$$aggr?: OperEntity.Aggregation & {
|
||||
$entity: "operEntity";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type OperIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
operatorId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
action: number;
|
||||
} | {
|
||||
operatorId: number;
|
||||
} | {
|
||||
operator: User.SortAttr;
|
||||
} | {
|
||||
targetEntity: 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, "operatorId">> & (({
|
||||
operatorId?: never;
|
||||
operator?: User.CreateSingleOperation;
|
||||
} | {
|
||||
operatorId: ForeignKey<"operator">;
|
||||
operator?: User.UpdateOperation;
|
||||
} | {
|
||||
operator?: never;
|
||||
operatorId?: ForeignKey<"operator">;
|
||||
})) & {
|
||||
operEntity$oper?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">>>;
|
||||
};
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "operatorId">> & (({
|
||||
operator?: User.CreateSingleOperation;
|
||||
operatorId?: never;
|
||||
} | {
|
||||
operator?: User.UpdateOperation;
|
||||
operatorId?: never;
|
||||
} | {
|
||||
operator?: User.RemoveOperation;
|
||||
operatorId?: never;
|
||||
} | {
|
||||
operator?: never;
|
||||
operatorId?: ForeignKey<"operator"> | null;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
operEntity$oper?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
operator?: User.UpdateOperation | User.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type OperIdSubQuery = Selection<OperIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { appendOnlyActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
action: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 16
|
||||
}
|
||||
},
|
||||
data: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
},
|
||||
filter: {
|
||||
type: "object"
|
||||
},
|
||||
extra: {
|
||||
type: "object"
|
||||
},
|
||||
operatorId: {
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
targetEntity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "appendOnly",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"操作","attr":{"action":"动作","data":"数据","filter":"选择条件","extra":"其它","operator":"操作者","targetEntity":"关联对象"}}
|
||||
|
|
@ -0,0 +1,475 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape, Configuration } from "oak-domain/lib/types/Entity";
|
||||
import { LocaleDef } from "oak-domain/lib/types/Locale";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Oper from "../Oper/Schema";
|
||||
import * as User from "../User/Schema";
|
||||
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
||||
import * as UserSystem from "../UserSystem/Schema";
|
||||
import * as UserWechatPublicTag from "../UserWechatPublicTag/Schema";
|
||||
import * as WechatLogin from "../WechatLogin/Schema";
|
||||
import * as WechatMenu from "../WechatMenu/Schema";
|
||||
import * as WechatMpJump from "../WechatMpJump/Schema";
|
||||
import * as WechatPublicAutoReply from "../WechatPublicAutoReply/Schema";
|
||||
import * as WechatPublicTag from "../WechatPublicTag/Schema";
|
||||
import * as WechatPublicTemplate from "../WechatPublicTemplate/Schema";
|
||||
import * as WechatQrCode from "../WechatQrCode/Schema";
|
||||
import * as WechatUser from "../WechatUser/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
operId: ForeignKey<"oper">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
operId: ForeignKey<"oper">;
|
||||
entity: "user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string;
|
||||
entityId: String<64>;
|
||||
oper: Oper.Schema;
|
||||
user?: User.Schema;
|
||||
userEntityGrant?: UserEntityGrant.Schema;
|
||||
userSystem?: UserSystem.Schema;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Schema;
|
||||
wechatLogin?: WechatLogin.Schema;
|
||||
wechatMenu?: WechatMenu.Schema;
|
||||
wechatMpJump?: WechatMpJump.Schema;
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.Schema;
|
||||
wechatPublicTag?: WechatPublicTag.Schema;
|
||||
wechatPublicTemplate?: WechatPublicTemplate.Schema;
|
||||
wechatQrCode?: WechatQrCode.Schema;
|
||||
wechatUser?: WechatUser.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" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string>;
|
||||
entityId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
userEntityGrant: UserEntityGrant.Filter;
|
||||
userSystem: UserSystem.Filter;
|
||||
userWechatPublicTag: UserWechatPublicTag.Filter;
|
||||
wechatLogin: WechatLogin.Filter;
|
||||
wechatMenu: WechatMenu.Filter;
|
||||
wechatMpJump: WechatMpJump.Filter;
|
||||
wechatPublicAutoReply: WechatPublicAutoReply.Filter;
|
||||
wechatPublicTag: WechatPublicTag.Filter;
|
||||
wechatPublicTemplate: WechatPublicTemplate.Filter;
|
||||
wechatQrCode: WechatQrCode.Filter;
|
||||
wechatUser: WechatUser.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;
|
||||
userEntityGrant?: UserEntityGrant.Projection;
|
||||
userSystem?: UserSystem.Projection;
|
||||
userWechatPublicTag?: UserWechatPublicTag.Projection;
|
||||
wechatLogin?: WechatLogin.Projection;
|
||||
wechatMenu?: WechatMenu.Projection;
|
||||
wechatMpJump?: WechatMpJump.Projection;
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.Projection;
|
||||
wechatPublicTag?: WechatPublicTag.Projection;
|
||||
wechatPublicTemplate?: WechatPublicTemplate.Projection;
|
||||
wechatQrCode?: WechatQrCode.Projection;
|
||||
wechatUser?: WechatUser.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type OperEntityIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type OperIdProjection = OneOf<{
|
||||
operId: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserEntityGrantIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserSystemIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type UserWechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatLoginIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatMenuIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatMpJumpIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatPublicAutoReplyIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatPublicTagIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatPublicTemplateIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatQrCodeIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type WechatUserIdProjection = 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;
|
||||
} | {
|
||||
userEntityGrant: UserEntityGrant.SortAttr;
|
||||
} | {
|
||||
userSystem: UserSystem.SortAttr;
|
||||
} | {
|
||||
userWechatPublicTag: UserWechatPublicTag.SortAttr;
|
||||
} | {
|
||||
wechatLogin: WechatLogin.SortAttr;
|
||||
} | {
|
||||
wechatMenu: WechatMenu.SortAttr;
|
||||
} | {
|
||||
wechatMpJump: WechatMpJump.SortAttr;
|
||||
} | {
|
||||
wechatPublicAutoReply: WechatPublicAutoReply.SortAttr;
|
||||
} | {
|
||||
wechatPublicTag: WechatPublicTag.SortAttr;
|
||||
} | {
|
||||
wechatPublicTemplate: WechatPublicTemplate.SortAttr;
|
||||
} | {
|
||||
wechatQrCode: WechatQrCode.SortAttr;
|
||||
} | {
|
||||
wechatUser: WechatUser.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;
|
||||
} | {
|
||||
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;
|
||||
userEntityGrant: UserEntityGrant.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "userEntityGrant";
|
||||
entityId: ForeignKey<"UserEntityGrant">;
|
||||
userEntityGrant?: UserEntityGrant.UpdateOperation;
|
||||
} | {
|
||||
entity: "userEntityGrant";
|
||||
entityId: ForeignKey<"UserEntityGrant">;
|
||||
userEntityGrant?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
userSystem: UserSystem.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "userSystem";
|
||||
entityId: ForeignKey<"UserSystem">;
|
||||
userSystem?: UserSystem.UpdateOperation;
|
||||
} | {
|
||||
entity: "userSystem";
|
||||
entityId: ForeignKey<"UserSystem">;
|
||||
userSystem?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
userWechatPublicTag: UserWechatPublicTag.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "userWechatPublicTag";
|
||||
entityId: ForeignKey<"UserWechatPublicTag">;
|
||||
userWechatPublicTag?: UserWechatPublicTag.UpdateOperation;
|
||||
} | {
|
||||
entity: "userWechatPublicTag";
|
||||
entityId: ForeignKey<"UserWechatPublicTag">;
|
||||
userWechatPublicTag?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatLogin: WechatLogin.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: ForeignKey<"WechatLogin">;
|
||||
wechatLogin?: WechatLogin.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatLogin";
|
||||
entityId: ForeignKey<"WechatLogin">;
|
||||
wechatLogin?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatMenu: WechatMenu.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatMenu";
|
||||
entityId: ForeignKey<"WechatMenu">;
|
||||
wechatMenu?: WechatMenu.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatMenu";
|
||||
entityId: ForeignKey<"WechatMenu">;
|
||||
wechatMenu?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatMpJump: WechatMpJump.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatMpJump";
|
||||
entityId: ForeignKey<"WechatMpJump">;
|
||||
wechatMpJump?: WechatMpJump.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatMpJump";
|
||||
entityId: ForeignKey<"WechatMpJump">;
|
||||
wechatMpJump?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatPublicAutoReply: WechatPublicAutoReply.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatPublicAutoReply";
|
||||
entityId: ForeignKey<"WechatPublicAutoReply">;
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatPublicAutoReply";
|
||||
entityId: ForeignKey<"WechatPublicAutoReply">;
|
||||
wechatPublicAutoReply?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatPublicTag: WechatPublicTag.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTag";
|
||||
entityId: ForeignKey<"WechatPublicTag">;
|
||||
wechatPublicTag?: WechatPublicTag.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTag";
|
||||
entityId: ForeignKey<"WechatPublicTag">;
|
||||
wechatPublicTag?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatPublicTemplate: WechatPublicTemplate.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTemplate";
|
||||
entityId: ForeignKey<"WechatPublicTemplate">;
|
||||
wechatPublicTemplate?: WechatPublicTemplate.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatPublicTemplate";
|
||||
entityId: ForeignKey<"WechatPublicTemplate">;
|
||||
wechatPublicTemplate?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatQrCode: WechatQrCode.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatQrCode";
|
||||
entityId: ForeignKey<"WechatQrCode">;
|
||||
wechatQrCode?: WechatQrCode.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatQrCode";
|
||||
entityId: ForeignKey<"WechatQrCode">;
|
||||
wechatQrCode?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
wechatUser: WechatUser.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "wechatUser";
|
||||
entityId: ForeignKey<"WechatUser">;
|
||||
wechatUser?: WechatUser.UpdateOperation;
|
||||
} | {
|
||||
entity: "wechatUser";
|
||||
entityId: ForeignKey<"WechatUser">;
|
||||
wechatUser?: 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?: never;
|
||||
operId?: ForeignKey<"oper">;
|
||||
})) & ({
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
userEntityGrant?: UserEntityGrant.CreateSingleOperation | UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
userSystem?: UserSystem.CreateSingleOperation | UserSystem.UpdateOperation | UserSystem.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
userWechatPublicTag?: UserWechatPublicTag.CreateSingleOperation | UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.CreateSingleOperation | WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatMenu?: WechatMenu.CreateSingleOperation | WechatMenu.UpdateOperation | WechatMenu.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatMpJump?: WechatMpJump.CreateSingleOperation | WechatMpJump.UpdateOperation | WechatMpJump.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.CreateSingleOperation | WechatPublicAutoReply.UpdateOperation | WechatPublicAutoReply.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.CreateSingleOperation | WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatPublicTemplate?: WechatPublicTemplate.CreateSingleOperation | WechatPublicTemplate.UpdateOperation | WechatPublicTemplate.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatQrCode?: WechatQrCode.CreateSingleOperation | WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
wechatUser?: WechatUser.CreateSingleOperation | WechatUser.UpdateOperation | WechatUser.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatMpJump" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
|
||||
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "WechatMpJump" | "WechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
|
||||
user?: never;
|
||||
userEntityGrant?: never;
|
||||
userSystem?: never;
|
||||
userWechatPublicTag?: never;
|
||||
wechatLogin?: never;
|
||||
wechatMenu?: never;
|
||||
wechatMpJump?: never;
|
||||
wechatPublicAutoReply?: never;
|
||||
wechatPublicTag?: never;
|
||||
wechatPublicTemplate?: never;
|
||||
wechatQrCode?: never;
|
||||
wechatUser?: never;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
|
||||
} | {
|
||||
userSystem?: UserSystem.UpdateOperation | UserSystem.RemoveOperation;
|
||||
} | {
|
||||
userWechatPublicTag?: UserWechatPublicTag.UpdateOperation | UserWechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
wechatLogin?: WechatLogin.UpdateOperation | WechatLogin.RemoveOperation;
|
||||
} | {
|
||||
wechatMenu?: WechatMenu.UpdateOperation | WechatMenu.RemoveOperation;
|
||||
} | {
|
||||
wechatMpJump?: WechatMpJump.UpdateOperation | WechatMpJump.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicAutoReply?: WechatPublicAutoReply.UpdateOperation | WechatPublicAutoReply.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicTag?: WechatPublicTag.UpdateOperation | WechatPublicTag.RemoveOperation;
|
||||
} | {
|
||||
wechatPublicTemplate?: WechatPublicTemplate.UpdateOperation | WechatPublicTemplate.RemoveOperation;
|
||||
} | {
|
||||
wechatQrCode?: WechatQrCode.UpdateOperation | WechatQrCode.RemoveOperation;
|
||||
} | {
|
||||
wechatUser?: WechatUser.UpdateOperation | WechatUser.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 UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
|
||||
export type UserSystemIdSubQuery = Selection<UserSystemIdProjection>;
|
||||
export type UserWechatPublicTagIdSubQuery = Selection<UserWechatPublicTagIdProjection>;
|
||||
export type WechatLoginIdSubQuery = Selection<WechatLoginIdProjection>;
|
||||
export type WechatMenuIdSubQuery = Selection<WechatMenuIdProjection>;
|
||||
export type WechatMpJumpIdSubQuery = Selection<WechatMpJumpIdProjection>;
|
||||
export type WechatPublicAutoReplyIdSubQuery = Selection<WechatPublicAutoReplyIdProjection>;
|
||||
export type WechatPublicTagIdSubQuery = Selection<WechatPublicTagIdProjection>;
|
||||
export type WechatPublicTemplateIdSubQuery = Selection<WechatPublicTemplateIdProjection>;
|
||||
export type WechatQrCodeIdSubQuery = Selection<WechatQrCodeIdProjection>;
|
||||
export type WechatUserIdSubQuery = Selection<WechatUserIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { appendOnlyActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
operId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "oper"
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
},
|
||||
ref: ["user", "userEntityGrant", "userSystem", "userWechatPublicTag", "wechatLogin", "wechatMenu", "wechatMpJump", "wechatPublicAutoReply", "wechatPublicTag", "wechatPublicTemplate", "wechatQrCode", "wechatUser"]
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "appendOnly",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"操作对象连接","attr":{"oper":"操作","entity":"关联对象","entityId":"关联对象id"}}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { ActionDef } from "oak-domain/lib/types/Action";
|
||||
import { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
export type IAction = 'wakeup' | 'cancel' | 'qrcode' | string;
|
||||
export type ParticularAction = IAction;
|
||||
export const actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "wakeup", "cancel", "qrcode"];
|
||||
export type Action = GenericAction | ParticularAction | string;
|
||||
export const ActionDefDict = {};
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Image, Boolean, Text, } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { LocaleDef } from "oak-domain/lib/types/Locale";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Token from "../Token/Schema";
|
||||
type RedirectTo = {
|
||||
pathname: string;
|
||||
props?: Record<string, any>;
|
||||
state?: Record<string, any>;
|
||||
};
|
||||
export type OpSchema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
showTip?: Boolean | null;
|
||||
expiresAt: Datetime;
|
||||
expired: Boolean;
|
||||
redirectTo: RedirectTo;
|
||||
multiple?: Boolean | null;
|
||||
tokenLifeLength?: Int<4> | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
entity: String<32>;
|
||||
entityId: String<64>;
|
||||
showTip?: Boolean | null;
|
||||
expiresAt: Datetime;
|
||||
expired: Boolean;
|
||||
redirectTo: RedirectTo;
|
||||
multiple?: Boolean | null;
|
||||
tokenLifeLength?: Int<4> | null;
|
||||
user: User.Schema;
|
||||
token$entity?: Array<Token.Schema>;
|
||||
token$entity$$aggr?: AggregationResult<Token.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
userId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
entity: Q_StringValue;
|
||||
entityId: Q_StringValue;
|
||||
showTip: Q_BooleanValue;
|
||||
expiresAt: Q_DateValue;
|
||||
expired: Q_BooleanValue;
|
||||
redirectTo: JsonFilter<RedirectTo>;
|
||||
multiple: Q_BooleanValue;
|
||||
tokenLifeLength: Q_NumberValue;
|
||||
token$entity: Token.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;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
showTip?: number;
|
||||
expiresAt?: number;
|
||||
expired?: number;
|
||||
redirectTo?: number | JsonProjection<RedirectTo>;
|
||||
multiple?: number;
|
||||
tokenLifeLength?: number;
|
||||
token$entity?: Token.Selection & {
|
||||
$entity: "token";
|
||||
};
|
||||
token$entity$$aggr?: Token.Aggregation & {
|
||||
$entity: "token";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ParasiteIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
userId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
userId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
showTip: number;
|
||||
} | {
|
||||
expiresAt: number;
|
||||
} | {
|
||||
expired: number;
|
||||
} | {
|
||||
redirectTo: number;
|
||||
} | {
|
||||
multiple: number;
|
||||
} | {
|
||||
tokenLifeLength: 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" | "userId">> & (({
|
||||
userId?: never;
|
||||
user: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: ForeignKey<"user">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
user?: never;
|
||||
userId: ForeignKey<"user">;
|
||||
})) & ({
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
token$entity?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.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<Omit<OpSchema, "userId">> & (({
|
||||
user?: User.CreateSingleOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.UpdateOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.RemoveOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: ForeignKey<"user">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
token$entity?: OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<Token.CreateOperationData, "entity" | "entityId">> | OakOperation<Token.UpdateOperation["action"], Omit<Token.UpdateOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">> | OakOperation<Token.RemoveOperation["action"], Omit<Token.RemoveOperationData, "entity" | "entityId">, Omit<Token.Filter, "entity" | "entityId">>>;
|
||||
};
|
||||
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<UserIdProjection>;
|
||||
export type ParasiteIdSubQuery = Selection<ParasiteIdProjection>;
|
||||
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;
|
||||
};
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { actions } from "./Action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
userId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
entity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
showTip: {
|
||||
type: "boolean"
|
||||
},
|
||||
expiresAt: {
|
||||
notNull: true,
|
||||
type: "datetime"
|
||||
},
|
||||
expired: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
redirectTo: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
},
|
||||
multiple: {
|
||||
type: "boolean"
|
||||
},
|
||||
tokenLifeLength: {
|
||||
type: "int",
|
||||
params: {
|
||||
width: 4,
|
||||
signed: true
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"寄生","attr":{"user":"用户","showTip":"提示","expired":"已过期","expiresAt":"过期时间","redirectTo":"重定向页面","multiple":"允许反复使用","tokens":"令牌","entity":"关联对象","entityId":"关联对象Id","tokenLifeLength":"令牌生命长度"},"action":{"wakeup":"激活","cancel":"作废","qrcode":"采集码"}}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as ActionAuth from "../ActionAuth/Schema";
|
||||
import * as RelationAuth from "../RelationAuth/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
destEntity: String<32>;
|
||||
value: String<256>;
|
||||
recursive: Boolean;
|
||||
sourceEntity: String<32>;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
destEntity: String<32>;
|
||||
value: String<256>;
|
||||
recursive: Boolean;
|
||||
sourceEntity: String<32>;
|
||||
actionAuth$path?: Array<ActionAuth.Schema>;
|
||||
actionAuth$path$$aggr?: AggregationResult<ActionAuth.Schema>;
|
||||
relationAuth$path?: Array<RelationAuth.Schema>;
|
||||
relationAuth$path$$aggr?: AggregationResult<RelationAuth.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
destEntity: Q_StringValue;
|
||||
value: Q_StringValue;
|
||||
recursive: Q_BooleanValue;
|
||||
sourceEntity: Q_StringValue;
|
||||
actionAuth$path: ActionAuth.Filter & SubQueryPredicateMetadata;
|
||||
relationAuth$path: RelationAuth.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;
|
||||
destEntity?: number;
|
||||
value?: number;
|
||||
recursive?: number;
|
||||
sourceEntity?: number;
|
||||
actionAuth$path?: ActionAuth.Selection & {
|
||||
$entity: "actionAuth";
|
||||
};
|
||||
actionAuth$path$$aggr?: ActionAuth.Aggregation & {
|
||||
$entity: "actionAuth";
|
||||
};
|
||||
relationAuth$path?: RelationAuth.Selection & {
|
||||
$entity: "relationAuth";
|
||||
};
|
||||
relationAuth$path$$aggr?: RelationAuth.Aggregation & {
|
||||
$entity: "relationAuth";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type PathIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
destEntity: number;
|
||||
} | {
|
||||
value: number;
|
||||
} | {
|
||||
recursive: number;
|
||||
} | {
|
||||
sourceEntity: 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<OpSchema> & {
|
||||
actionAuth$path?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">>>;
|
||||
relationAuth$path?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">>>;
|
||||
};
|
||||
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;
|
||||
actionAuth$path?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "path" | "pathId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "path" | "pathId">, Omit<ActionAuth.Filter, "path" | "pathId">>>;
|
||||
relationAuth$path?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "path" | "pathId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "path" | "pathId">, Omit<RelationAuth.Filter, "path" | "pathId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {};
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type PathIdSubQuery = Selection<PathIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
destEntity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
value: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 256
|
||||
}
|
||||
},
|
||||
recursive: {
|
||||
notNull: true,
|
||||
type: "boolean"
|
||||
},
|
||||
sourceEntity: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions,
|
||||
indexes: [
|
||||
{
|
||||
name: 'index_source_dest_path',
|
||||
attributes: [
|
||||
{
|
||||
name: 'sourceEntity',
|
||||
},
|
||||
{
|
||||
name: 'value',
|
||||
},
|
||||
{
|
||||
name: 'destEntity',
|
||||
},
|
||||
],
|
||||
config: {
|
||||
unique: true,
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"关系路径","attr":{"sourceEntity":"源对象","value":"路径(从dest到source)","destEntity":"目标对象","recursive":"是否递归(目标对象)"}}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Image, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { Config } from "../../types/Config";
|
||||
import { Style } from "../../types/Style";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Message from "../Message/Schema";
|
||||
import * as System from "../System/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
name: String<32>;
|
||||
description: Text;
|
||||
config: Config;
|
||||
style?: Style | null;
|
||||
entity?: String<32> | null;
|
||||
entityId?: String<64> | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
name: String<32>;
|
||||
description: Text;
|
||||
config: Config;
|
||||
style?: Style | null;
|
||||
entity?: String<32> | null;
|
||||
entityId?: String<64> | null;
|
||||
message$platform?: Array<Message.Schema>;
|
||||
message$platform$$aggr?: AggregationResult<Message.Schema>;
|
||||
system$platform?: Array<System.Schema>;
|
||||
system$platform$$aggr?: AggregationResult<System.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
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;
|
||||
};
|
||||
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";
|
||||
};
|
||||
message$platform$$aggr?: Message.Aggregation & {
|
||||
$entity: "message";
|
||||
};
|
||||
system$platform?: System.Selection & {
|
||||
$entity: "system";
|
||||
};
|
||||
system$platform$$aggr?: System.Aggregation & {
|
||||
$entity: "system";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
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">>>;
|
||||
};
|
||||
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">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | 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> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
name: {
|
||||
notNull: true,
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
description: {
|
||||
notNull: true,
|
||||
type: "text"
|
||||
},
|
||||
config: {
|
||||
notNull: true,
|
||||
type: "object"
|
||||
},
|
||||
style: {
|
||||
type: "object"
|
||||
},
|
||||
entity: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 32
|
||||
}
|
||||
},
|
||||
entityId: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"平台","attr":{"name":"名称","description":"描述","config":"设置","style":"样式","entity":"关联对象","entityId":"关联对象id"}}
|
||||
|
|
@ -0,0 +1,155 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String, Int, Datetime, Image, Boolean, Text } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as User from "../User/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
sessionId: ForeignKey<"session">;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
userId: ForeignKey<"user">;
|
||||
sessionId: ForeignKey<"session">;
|
||||
user: User.Schema;
|
||||
session: Session.Schema;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
userId: Q_StringValue;
|
||||
user: User.Filter;
|
||||
sessionId: Q_StringValue;
|
||||
session: Session.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;
|
||||
userId?: number;
|
||||
user?: User.Projection;
|
||||
sessionId?: number;
|
||||
session?: Session.Projection;
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type ReadRemarkIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type UserIdProjection = OneOf<{
|
||||
userId: number;
|
||||
}>;
|
||||
type SessionIdProjection = OneOf<{
|
||||
sessionId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
userId: number;
|
||||
} | {
|
||||
user: User.SortAttr;
|
||||
} | {
|
||||
sessionId: number;
|
||||
} | {
|
||||
session: Session.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, "userId" | "sessionId">> & (({
|
||||
userId?: never;
|
||||
user: User.CreateSingleOperation;
|
||||
} | {
|
||||
userId: ForeignKey<"user">;
|
||||
user?: User.UpdateOperation;
|
||||
} | {
|
||||
user?: never;
|
||||
userId: ForeignKey<"user">;
|
||||
}) & ({
|
||||
sessionId?: never;
|
||||
session: Session.CreateSingleOperation;
|
||||
} | {
|
||||
sessionId: ForeignKey<"session">;
|
||||
session?: Session.UpdateOperation;
|
||||
} | {
|
||||
session?: never;
|
||||
sessionId: ForeignKey<"session">;
|
||||
}));
|
||||
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
||||
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
||||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId" | "sessionId">> & (({
|
||||
user?: User.CreateSingleOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.UpdateOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: User.RemoveOperation;
|
||||
userId?: never;
|
||||
} | {
|
||||
user?: never;
|
||||
userId?: ForeignKey<"user">;
|
||||
}) & ({
|
||||
session?: Session.CreateSingleOperation;
|
||||
sessionId?: never;
|
||||
} | {
|
||||
session?: Session.UpdateOperation;
|
||||
sessionId?: never;
|
||||
} | {
|
||||
session?: Session.RemoveOperation;
|
||||
sessionId?: never;
|
||||
} | {
|
||||
session?: never;
|
||||
sessionId?: ForeignKey<"session">;
|
||||
})) & {
|
||||
[k: string]: any;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
}) & ({
|
||||
session?: Session.UpdateOperation | Session.RemoveOperation;
|
||||
}));
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type UserIdSubQuery = Selection<UserIdProjection>;
|
||||
export type SessionIdSubQuery = Selection<SessionIdProjection>;
|
||||
export type ReadRemarkIdSubQuery = Selection<ReadRemarkIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import { StorageDesc } from "oak-domain/lib/types/Storage";
|
||||
import { OpSchema } from "./Schema";
|
||||
import { genericActions as actions } from "oak-domain/lib/actions/action";
|
||||
export const desc: StorageDesc<OpSchema> = {
|
||||
attributes: {
|
||||
userId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "user"
|
||||
},
|
||||
sessionId: {
|
||||
notNull: true,
|
||||
type: "ref",
|
||||
ref: "session"
|
||||
}
|
||||
},
|
||||
actionType: "crud",
|
||||
actions
|
||||
};
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"name":"会话","attr":{"user":"当前用户","session":"会话"}}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
import { EntityDict } from "./EntityDict";
|
||||
import { CreateOperationData as Relation } from "./Relation/Schema";
|
||||
export const relations: Relation[] = [
|
||||
{
|
||||
id: "account-owner",
|
||||
entity: "account",
|
||||
name: "owner"
|
||||
},
|
||||
{
|
||||
id: "account-audit",
|
||||
entity: "account",
|
||||
name: "audit"
|
||||
},
|
||||
{
|
||||
id: "session-partner",
|
||||
entity: "session",
|
||||
name: "partner"
|
||||
},
|
||||
{
|
||||
id: "toDo-collaborator",
|
||||
entity: "toDo",
|
||||
name: "collaborator"
|
||||
}
|
||||
];
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
import { PrimaryKey, ForeignKey, JsonProjection } from "oak-domain/lib/types/DataType";
|
||||
import { Q_DateValue, Q_BooleanValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, FulltextFilter, ExprOp, ExpressionKey, JsonFilter, SubQueryPredicateMetadata } from "oak-domain/lib/types/Demand";
|
||||
import { OneOf, ValueOf } 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 { GenericAction, AppendOnlyAction, ReadOnlyAction, ExcludeUpdateAction, ExcludeRemoveAction, RelationAction } from "oak-domain/lib/actions/action";
|
||||
import { String } from "oak-domain/lib/types/DataType";
|
||||
import { EntityShape } from "oak-domain/lib/types/Entity";
|
||||
import { EntityDesc } from "oak-domain/lib/types/EntityDesc";
|
||||
import * as Account from "../Account/Schema";
|
||||
import * as Session from "../Session/Schema";
|
||||
import * as ToDo from "../ToDo/Schema";
|
||||
import * as ActionAuth from "../ActionAuth/Schema";
|
||||
import * as RelationAuth from "../RelationAuth/Schema";
|
||||
import * as UserEntityClaim from "../UserEntityClaim/Schema";
|
||||
import * as UserRelation from "../UserRelation/Schema";
|
||||
export type OpSchema = EntityShape & {
|
||||
entity: "account" | "session" | "toDo" | string;
|
||||
entityId?: String<64> | null;
|
||||
name?: String<32> | null;
|
||||
display?: String<32> | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
export type Schema = EntityShape & {
|
||||
entity: "account" | "session" | "toDo" | string;
|
||||
entityId?: String<64> | null;
|
||||
name?: String<32> | null;
|
||||
display?: String<32> | null;
|
||||
account?: Account.Schema;
|
||||
session?: Session.Schema;
|
||||
toDo?: ToDo.Schema;
|
||||
actionAuth$relation?: Array<ActionAuth.Schema>;
|
||||
actionAuth$relation$$aggr?: AggregationResult<ActionAuth.Schema>;
|
||||
relationAuth$sourceRelation?: Array<RelationAuth.Schema>;
|
||||
relationAuth$sourceRelation$$aggr?: AggregationResult<RelationAuth.Schema>;
|
||||
relationAuth$destRelation?: Array<RelationAuth.Schema>;
|
||||
relationAuth$destRelation$$aggr?: AggregationResult<RelationAuth.Schema>;
|
||||
userEntityClaim$relation?: Array<UserEntityClaim.Schema>;
|
||||
userEntityClaim$relation$$aggr?: AggregationResult<UserEntityClaim.Schema>;
|
||||
userRelation$relation?: Array<UserRelation.Schema>;
|
||||
userRelation$relation$$aggr?: AggregationResult<UserRelation.Schema>;
|
||||
} & {
|
||||
[A in ExpressionKey]?: any;
|
||||
};
|
||||
type AttrFilter = {
|
||||
id: Q_StringValue;
|
||||
$$createAt$$: Q_DateValue;
|
||||
$$seq$$: Q_NumberValue;
|
||||
$$updateAt$$: Q_DateValue;
|
||||
entity: Q_EnumValue<"account" | "session" | "toDo" | string>;
|
||||
entityId: Q_StringValue;
|
||||
name: Q_StringValue;
|
||||
display: Q_StringValue;
|
||||
account: Account.Filter;
|
||||
session: Session.Filter;
|
||||
toDo: ToDo.Filter;
|
||||
actionAuth$relation: ActionAuth.Filter & SubQueryPredicateMetadata;
|
||||
relationAuth$sourceRelation: RelationAuth.Filter & SubQueryPredicateMetadata;
|
||||
relationAuth$destRelation: RelationAuth.Filter & SubQueryPredicateMetadata;
|
||||
userEntityClaim$relation: UserEntityClaim.Filter & SubQueryPredicateMetadata;
|
||||
userRelation$relation: 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;
|
||||
entity?: number;
|
||||
entityId?: number;
|
||||
name?: number;
|
||||
display?: number;
|
||||
account?: Account.Projection;
|
||||
session?: Session.Projection;
|
||||
toDo?: ToDo.Projection;
|
||||
actionAuth$relation?: ActionAuth.Selection & {
|
||||
$entity: "actionAuth";
|
||||
};
|
||||
actionAuth$relation$$aggr?: ActionAuth.Aggregation & {
|
||||
$entity: "actionAuth";
|
||||
};
|
||||
relationAuth$sourceRelation?: RelationAuth.Selection & {
|
||||
$entity: "relationAuth";
|
||||
};
|
||||
relationAuth$sourceRelation$$aggr?: RelationAuth.Aggregation & {
|
||||
$entity: "relationAuth";
|
||||
};
|
||||
relationAuth$destRelation?: RelationAuth.Selection & {
|
||||
$entity: "relationAuth";
|
||||
};
|
||||
relationAuth$destRelation$$aggr?: RelationAuth.Aggregation & {
|
||||
$entity: "relationAuth";
|
||||
};
|
||||
userEntityClaim$relation?: UserEntityClaim.Selection & {
|
||||
$entity: "userEntityClaim";
|
||||
};
|
||||
userEntityClaim$relation$$aggr?: UserEntityClaim.Aggregation & {
|
||||
$entity: "userEntityClaim";
|
||||
};
|
||||
userRelation$relation?: UserRelation.Selection & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
userRelation$relation$$aggr?: UserRelation.Aggregation & {
|
||||
$entity: "userRelation";
|
||||
};
|
||||
} & Partial<ExprOp<OpAttr | string>>;
|
||||
type RelationIdProjection = OneOf<{
|
||||
id: number;
|
||||
}>;
|
||||
type AccountIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type SessionIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
type ToDoIdProjection = OneOf<{
|
||||
entityId: number;
|
||||
}>;
|
||||
export type SortAttr = {
|
||||
id: number;
|
||||
} | {
|
||||
$$createAt$$: number;
|
||||
} | {
|
||||
$$seq$$: number;
|
||||
} | {
|
||||
$$updateAt$$: number;
|
||||
} | {
|
||||
entity: number;
|
||||
} | {
|
||||
entityId: number;
|
||||
} | {
|
||||
name: number;
|
||||
} | {
|
||||
display: number;
|
||||
} | {
|
||||
account: Account.SortAttr;
|
||||
} | {
|
||||
session: Session.SortAttr;
|
||||
} | {
|
||||
toDo: ToDo.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">> & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
account?: Account.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "account";
|
||||
entityId?: ForeignKey<"Account">;
|
||||
account?: Account.UpdateOperation;
|
||||
} | {
|
||||
entity: "account";
|
||||
entityId?: ForeignKey<"Account">;
|
||||
account?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
session?: Session.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "session";
|
||||
entityId?: ForeignKey<"Session">;
|
||||
session?: Session.UpdateOperation;
|
||||
} | {
|
||||
entity: "session";
|
||||
entityId?: ForeignKey<"Session">;
|
||||
session?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
toDo?: ToDo.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "toDo";
|
||||
entityId?: ForeignKey<"ToDo">;
|
||||
toDo?: ToDo.UpdateOperation;
|
||||
} | {
|
||||
entity: "toDo";
|
||||
entityId?: ForeignKey<"ToDo">;
|
||||
toDo?: never;
|
||||
} | {
|
||||
entity?: string;
|
||||
entityId?: string;
|
||||
[K: string]: any;
|
||||
}) & {
|
||||
actionAuth$relation?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">>>;
|
||||
relationAuth$sourceRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">>>;
|
||||
relationAuth$destRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">>>;
|
||||
userEntityClaim$relation?: OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">> | OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">>>;
|
||||
userRelation$relation?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">>>;
|
||||
};
|
||||
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">> & ({
|
||||
account?: Account.CreateSingleOperation | Account.UpdateOperation | Account.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
session?: Session.CreateSingleOperation | Session.UpdateOperation | Session.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
toDo?: ToDo.CreateSingleOperation | ToDo.UpdateOperation | ToDo.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
entity?: ("account" | "session" | "toDo" | string) | null;
|
||||
entityId?: ForeignKey<"Account" | "Session" | "ToDo">;
|
||||
account?: never;
|
||||
session?: never;
|
||||
toDo?: never;
|
||||
}) & {
|
||||
[k: string]: any;
|
||||
actionAuth$relation?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">> | OakOperation<ActionAuth.RemoveOperation["action"], Omit<ActionAuth.RemoveOperationData, "relation" | "relationId">, Omit<ActionAuth.Filter, "relation" | "relationId">>>;
|
||||
relationAuth$sourceRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "sourceRelation" | "sourceRelationId">, Omit<RelationAuth.Filter, "sourceRelation" | "sourceRelationId">>>;
|
||||
relationAuth$destRelation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">> | OakOperation<RelationAuth.RemoveOperation["action"], Omit<RelationAuth.RemoveOperationData, "destRelation" | "destRelationId">, Omit<RelationAuth.Filter, "destRelation" | "destRelationId">>>;
|
||||
userEntityClaim$relation?: OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<UserEntityClaim.RemoveOperation["action"], Omit<UserEntityClaim.RemoveOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserEntityClaim.CreateOperationData, "relation" | "relationId">> | OakOperation<UserEntityClaim.UpdateOperation["action"], Omit<UserEntityClaim.UpdateOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">> | OakOperation<UserEntityClaim.RemoveOperation["action"], Omit<UserEntityClaim.RemoveOperationData, "relation" | "relationId">, Omit<UserEntityClaim.Filter, "relation" | "relationId">>>;
|
||||
userRelation$relation?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">> | OakOperation<UserRelation.RemoveOperation["action"], Omit<UserRelation.RemoveOperationData, "relation" | "relationId">, Omit<UserRelation.Filter, "relation" | "relationId">>>;
|
||||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
account?: Account.UpdateOperation | Account.RemoveOperation;
|
||||
} | {
|
||||
session?: Session.UpdateOperation | Session.RemoveOperation;
|
||||
} | {
|
||||
toDo?: ToDo.UpdateOperation | ToDo.RemoveOperation;
|
||||
} | {
|
||||
[k: string]: any;
|
||||
});
|
||||
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
||||
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
||||
export type AccountIdSubQuery = Selection<AccountIdProjection>;
|
||||
export type SessionIdSubQuery = Selection<SessionIdProjection>;
|
||||
export type ToDoIdSubQuery = Selection<ToDoIdProjection>;
|
||||
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
||||
export type EntityDef = {
|
||||
Schema: Schema;
|
||||
OpSchema: OpSchema;
|
||||
Action: OakMakeAction<GenericAction> | string;
|
||||
Selection: Selection;
|
||||
Aggregation: Aggregation;
|
||||
Operation: Operation;
|
||||
Create: CreateOperation;
|
||||
Update: UpdateOperation;
|
||||
Remove: RemoveOperation;
|
||||
CreateSingle: CreateSingleOperation;
|
||||
CreateMulti: CreateMultipleOperation;
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue