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

104 lines
4.1 KiB
TypeScript

import { String } from "oak-domain/lib/types/DataType";
import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "oak-domain/lib/types/Demand";
import { OneOf } from "oak-domain/lib/types/Polyfill";
import * as SubQuery from "../_SubQuery";
import { FormCreateData, FormUpdateData, Operation as OakOperation, MakeAction as OakMakeAction, EntityShape } from "oak-domain/lib/types/Entity";
import { ReadOnlyAction, RelationAction } from "oak-domain/lib/actions/action";
import * as UserRole from "../UserRole/Schema";
export declare type OpSchema = EntityShape & {
name: String<64>;
};
export declare type OpAttr = keyof OpSchema;
export declare type Schema = EntityShape & {
name: String<64>;
userRole$role?: Array<UserRole.Schema>;
} & {
[A in ExpressionKey]?: any;
};
declare type AttrFilter = {
id: Q_StringValue | SubQuery.RoleIdSubQuery;
$$createAt$$: Q_DateValue;
$$seq$$: Q_StringValue;
$$updateAt$$: Q_DateValue;
name: Q_StringValue;
};
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
export declare type Projection = {
"#id"?: NodeId;
[k: string]: any;
id: 1;
$$createAt$$?: 1;
$$updateAt$$?: 1;
$$seq$$?: 1;
name?: 1;
userRole$role?: UserRole.Selection & {
$entity: "userRole";
};
} & Partial<ExprOp<OpAttr | string>>;
export declare type ExportProjection = {
"#id"?: NodeId;
[k: string]: any;
id?: string;
$$createAt$$?: string;
$$updateAt$$?: string;
$$seq$$?: string;
name?: string;
userRole$role?: UserRole.Exportation & {
$entity: "userRole";
};
} & Partial<ExprOp<OpAttr | string>>;
declare type RoleIdProjection = OneOf<{
id: 1;
}>;
export declare type SortAttr = {
id: 1;
} | {
$$createAt$$: 1;
} | {
$$seq$$: 1;
} | {
$$updateAt$$: 1;
} | {
name: 1;
} | {
[k: string]: any;
} | OneOf<ExprOp<OpAttr | string>>;
export declare type SortNode = {
$attr: SortAttr;
$direction?: "asc" | "desc";
};
export declare type Sorter = SortNode[];
export declare type SelectOperation<P extends Object = Projection> = Omit<OakOperation<"select", P, Filter, Sorter>, "id">;
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
export declare type Exportation = OakOperation<"export", ExportProjection, Filter, Sorter>;
export declare type CreateOperationData = FormCreateData<OpSchema> & {
userRole$role?: OakOperation<"create", Omit<UserRole.CreateOperationData, "role" | "roleId">[]> | Array<OakOperation<"create", Omit<UserRole.CreateOperationData, "role" | "roleId">>>;
};
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
[k: string]: any;
userRoles$role?: UserRole.RemoveOperation | OakOperation<"create", Omit<UserRole.CreateOperationData, "role" | "roleId">[]> | Array<OakOperation<"create", Omit<UserRole.CreateOperationData, "role" | "roleId">> | UserRole.RemoveOperation>;
};
export declare type UpdateOperation = OakOperation<"update" | RelationAction | string, UpdateOperationData, Filter, Sorter>;
export declare type RemoveOperationData = {};
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation | SelectOperation;
export declare type RoleIdSubQuery = Selection<RoleIdProjection>;
export declare type NativeAttr = OpAttr;
export declare type FullAttr = NativeAttr | `userRoles$${number}.${UserRole.NativeAttr}`;
export declare type EntityDef = {
Schema: Schema;
OpSchema: OpSchema;
Action: OakMakeAction<ReadOnlyAction | RelationAction> | string;
Selection: Selection;
Operation: Operation;
Create: CreateOperation;
Update: UpdateOperation;
Remove: RemoveOperation;
CreateSingle: CreateSingleOperation;
CreateMulti: CreateMultipleOperation;
};
export {};