Merge branch 'release'
This commit is contained in:
commit
3275df56e3
|
|
@ -113,16 +113,10 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "relationId" | "
|
|||
} | {
|
||||
relation?: never;
|
||||
relationId?: ForeignKey<"relation">;
|
||||
}) & ({
|
||||
pathId?: never;
|
||||
path: Path.CreateSingleOperation;
|
||||
} | {
|
||||
pathId: ForeignKey<"path">;
|
||||
path?: Path.UpdateOperation;
|
||||
} | {
|
||||
}) & {
|
||||
path?: never;
|
||||
pathId: ForeignKey<"path">;
|
||||
})) & {
|
||||
}) & {
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
};
|
||||
|
|
@ -141,19 +135,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId" | "
|
|||
} | {
|
||||
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;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
|
|
@ -161,8 +146,6 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId" | "
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ exports.desc = {
|
|||
type: "object"
|
||||
}
|
||||
},
|
||||
static: true,
|
||||
actionType: "crud",
|
||||
actions: action_1.genericActions,
|
||||
indexes: [
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ exports.desc = {
|
|||
type: "object"
|
||||
}
|
||||
},
|
||||
static: true,
|
||||
actionType: "crud",
|
||||
actions: action_1.genericActions,
|
||||
indexes: [
|
||||
|
|
|
|||
|
|
@ -166,37 +166,13 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
modi?: never;
|
||||
modiId: ForeignKey<"modi">;
|
||||
})) & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
actionAuth: ActionAuth.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "actionAuth";
|
||||
entityId: ForeignKey<"ActionAuth">;
|
||||
actionAuth?: ActionAuth.UpdateOperation;
|
||||
} | {
|
||||
entity: "actionAuth";
|
||||
entityId: ForeignKey<"ActionAuth">;
|
||||
actionAuth?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
i18n: I18n.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "i18n";
|
||||
entityId: ForeignKey<"I18n">;
|
||||
i18n?: I18n.UpdateOperation;
|
||||
} | {
|
||||
entity: "i18n";
|
||||
entityId: ForeignKey<"I18n">;
|
||||
i18n?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
path: Path.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "path";
|
||||
entityId: ForeignKey<"Path">;
|
||||
path?: Path.UpdateOperation;
|
||||
} | {
|
||||
entity: "path";
|
||||
entityId: ForeignKey<"Path">;
|
||||
|
|
@ -213,14 +189,6 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
entity: "relation";
|
||||
entityId: ForeignKey<"Relation">;
|
||||
relation?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
relationAuth: RelationAuth.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "relationAuth";
|
||||
entityId: ForeignKey<"RelationAuth">;
|
||||
relationAuth?: RelationAuth.UpdateOperation;
|
||||
} | {
|
||||
entity: "relationAuth";
|
||||
entityId: ForeignKey<"RelationAuth">;
|
||||
|
|
@ -294,25 +262,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
modi?: never;
|
||||
modiId?: ForeignKey<"modi">;
|
||||
})) & ({
|
||||
actionAuth?: ActionAuth.CreateSingleOperation | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
i18n?: I18n.CreateSingleOperation | I18n.UpdateOperation | I18n.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
path?: Path.CreateSingleOperation | Path.UpdateOperation | Path.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
relation?: Relation.CreateSingleOperation | Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
relationAuth?: RelationAuth.CreateSingleOperation | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
|
|
@ -348,15 +300,7 @@ export type UpdateOperation = OakOperation<"update" | string, UpdateOperationDat
|
|||
export type RemoveOperationData = {} & (({
|
||||
modi?: Modi.UpdateOperation | Modi.RemoveOperation;
|
||||
})) & ({
|
||||
actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
||||
} | {
|
||||
i18n?: I18n.UpdateOperation | I18n.RemoveOperation;
|
||||
} | {
|
||||
path?: Path.UpdateOperation | Path.RemoveOperation;
|
||||
} | {
|
||||
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
} | {
|
||||
relationAuth?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
||||
} | {
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
|
|
|
|||
|
|
@ -163,37 +163,13 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
oper?: never;
|
||||
operId: ForeignKey<"oper">;
|
||||
})) & ({
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
actionAuth: ActionAuth.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "actionAuth";
|
||||
entityId: ForeignKey<"ActionAuth">;
|
||||
actionAuth?: ActionAuth.UpdateOperation;
|
||||
} | {
|
||||
entity: "actionAuth";
|
||||
entityId: ForeignKey<"ActionAuth">;
|
||||
actionAuth?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
i18n: I18n.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "i18n";
|
||||
entityId: ForeignKey<"I18n">;
|
||||
i18n?: I18n.UpdateOperation;
|
||||
} | {
|
||||
entity: "i18n";
|
||||
entityId: ForeignKey<"I18n">;
|
||||
i18n?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
path: Path.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "path";
|
||||
entityId: ForeignKey<"Path">;
|
||||
path?: Path.UpdateOperation;
|
||||
} | {
|
||||
entity: "path";
|
||||
entityId: ForeignKey<"Path">;
|
||||
|
|
@ -210,14 +186,6 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
entity: "relation";
|
||||
entityId: ForeignKey<"Relation">;
|
||||
relation?: never;
|
||||
} | {
|
||||
entity?: never;
|
||||
entityId?: never;
|
||||
relationAuth: RelationAuth.CreateSingleOperation;
|
||||
} | {
|
||||
entity: "relationAuth";
|
||||
entityId: ForeignKey<"RelationAuth">;
|
||||
relationAuth?: RelationAuth.UpdateOperation;
|
||||
} | {
|
||||
entity: "relationAuth";
|
||||
entityId: ForeignKey<"RelationAuth">;
|
||||
|
|
@ -285,25 +253,9 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
oper?: never;
|
||||
operId?: ForeignKey<"oper">;
|
||||
})) & ({
|
||||
actionAuth?: ActionAuth.CreateSingleOperation | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
i18n?: I18n.CreateSingleOperation | I18n.UpdateOperation | I18n.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
path?: Path.CreateSingleOperation | Path.UpdateOperation | Path.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
relation?: Relation.CreateSingleOperation | Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
relationAuth?: RelationAuth.CreateSingleOperation | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
||||
entityId?: never;
|
||||
entity?: never;
|
||||
} | {
|
||||
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
||||
entityId?: never;
|
||||
|
|
@ -337,15 +289,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|||
};
|
||||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & ({
|
||||
actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
||||
} | {
|
||||
i18n?: I18n.UpdateOperation | I18n.RemoveOperation;
|
||||
} | {
|
||||
path?: Path.UpdateOperation | Path.RemoveOperation;
|
||||
} | {
|
||||
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
} | {
|
||||
relationAuth?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
||||
} | {
|
||||
user?: User.UpdateOperation | User.RemoveOperation;
|
||||
} | {
|
||||
|
|
|
|||
|
|
@ -112,8 +112,6 @@ export type SelectOperation<P extends Object = Projection> = OakSelection<"selec
|
|||
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">>>;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
};
|
||||
|
|
@ -122,8 +120,6 @@ export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperati
|
|||
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">>>;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ exports.desc = {
|
|||
}
|
||||
}
|
||||
},
|
||||
static: true,
|
||||
actionType: "crud",
|
||||
actions: action_1.genericActions,
|
||||
indexes: [
|
||||
|
|
|
|||
|
|
@ -145,9 +145,6 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|||
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">>>;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
|
|
@ -158,9 +155,6 @@ export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperati
|
|||
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
||||
export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
||||
[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">>>;
|
||||
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
||||
|
|
|
|||
|
|
@ -118,16 +118,10 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "sourceRelationI
|
|||
} | {
|
||||
sourceRelation?: never;
|
||||
sourceRelationId: ForeignKey<"sourceRelation">;
|
||||
}) & ({
|
||||
pathId?: never;
|
||||
path: Path.CreateSingleOperation;
|
||||
} | {
|
||||
pathId: ForeignKey<"path">;
|
||||
path?: Path.UpdateOperation;
|
||||
} | {
|
||||
}) & {
|
||||
path?: never;
|
||||
pathId: ForeignKey<"path">;
|
||||
}) & ({
|
||||
} & ({
|
||||
destRelationId?: never;
|
||||
destRelation: Relation.CreateSingleOperation;
|
||||
} | {
|
||||
|
|
@ -155,19 +149,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "sourceRelationI
|
|||
} | {
|
||||
sourceRelation?: never;
|
||||
sourceRelationId?: ForeignKey<"sourceRelation">;
|
||||
}) & ({
|
||||
path?: Path.CreateSingleOperation;
|
||||
pathId?: never;
|
||||
} | {
|
||||
path?: Path.UpdateOperation;
|
||||
pathId?: never;
|
||||
} | {
|
||||
path?: Path.RemoveOperation;
|
||||
pathId?: never;
|
||||
} | {
|
||||
}) & {
|
||||
path?: never;
|
||||
pathId?: ForeignKey<"path">;
|
||||
}) & ({
|
||||
} & ({
|
||||
destRelation?: Relation.CreateSingleOperation;
|
||||
destRelationId?: never;
|
||||
} | {
|
||||
|
|
@ -187,8 +172,6 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "sourceRelationI
|
|||
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
||||
export type RemoveOperationData = {} & (({
|
||||
sourceRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
}) & ({
|
||||
path?: Path.UpdateOperation | Path.RemoveOperation;
|
||||
}) & ({
|
||||
destRelation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ exports.desc = {
|
|||
ref: "relation"
|
||||
}
|
||||
},
|
||||
static: true,
|
||||
actionType: "crud",
|
||||
actions: action_1.genericActions,
|
||||
indexes: [
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ exports.style = {
|
|||
userState: {
|
||||
normal: '#112233',
|
||||
merged: '#223344',
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
type DepNode = {
|
||||
name: string;
|
||||
parent?: DepNode;
|
||||
};
|
||||
type DepGraph = {
|
||||
nodeDict: Record<string, DepNode>;
|
||||
roots: DepNode[];
|
||||
nodes: Record<string, 1>;
|
||||
dependencies: Record<string, Record<string, 1>>;
|
||||
ascOrder: string[];
|
||||
};
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ const ts = tslib_1.__importStar(require("typescript"));
|
|||
const string_1 = require("../utils/string");
|
||||
const env_1 = require("./env");
|
||||
const fs_extra_1 = require("fs-extra");
|
||||
const lodash_1 = require("lodash");
|
||||
const { factory } = ts;
|
||||
/**
|
||||
* 构建项目依赖关系图
|
||||
|
|
@ -17,19 +18,15 @@ const { factory } = ts;
|
|||
*/
|
||||
function analyzeDepedency(cwd) {
|
||||
const depGraph = {
|
||||
nodeDict: {},
|
||||
roots: [],
|
||||
nodes: {},
|
||||
dependencies: {},
|
||||
ascOrder: [],
|
||||
};
|
||||
function analyzeOne(dir, name, parent) {
|
||||
const node = {
|
||||
name,
|
||||
parent,
|
||||
};
|
||||
function analyzeOne(dir, name) {
|
||||
if (name) {
|
||||
depGraph.nodeDict[name] = node;
|
||||
if (!parent) {
|
||||
depGraph.roots.push(node);
|
||||
if (!depGraph.nodes[name]) {
|
||||
depGraph.nodes[name] = 1;
|
||||
depGraph.dependencies[name] = {};
|
||||
}
|
||||
}
|
||||
let dependencies = [];
|
||||
|
|
@ -42,7 +39,7 @@ function analyzeDepedency(cwd) {
|
|||
else {
|
||||
const depConfigJsFile = join(dir, 'lib', 'configuration', 'dependency.js');
|
||||
if ((0, fs_1.existsSync)(depConfigJsFile)) {
|
||||
dependencies = require(depConfigJsFile);
|
||||
dependencies = require(depConfigJsFile).default;
|
||||
}
|
||||
else {
|
||||
// 没有依赖文件,直接返回
|
||||
|
|
@ -50,11 +47,10 @@ function analyzeDepedency(cwd) {
|
|||
}
|
||||
}
|
||||
dependencies.forEach((dep) => {
|
||||
const n2 = depGraph.nodeDict[dep];
|
||||
if (n2) {
|
||||
(0, assert_1.default)(name);
|
||||
if (name) {
|
||||
depGraph.dependencies[name][dep] = 1;
|
||||
}
|
||||
else {
|
||||
if (!depGraph.nodes[dep]) {
|
||||
let dir2 = join(cwd, 'node_modules', dep);
|
||||
if (!(0, fs_1.existsSync)(dir2)) {
|
||||
dir2 = join(dir, 'node_modules', dep);
|
||||
|
|
@ -62,15 +58,33 @@ function analyzeDepedency(cwd) {
|
|||
throw new Error(`找不到依赖包${dep}的安装位置,当前包是${dir}`);
|
||||
}
|
||||
}
|
||||
analyzeOne(dir2, dep, name ? node : undefined);
|
||||
analyzeOne(dir2, dep);
|
||||
}
|
||||
});
|
||||
}
|
||||
analyzeOne(cwd, '');
|
||||
// 输出一个从底向上的序列,因为当前的项目中最多只有一个依赖,所以暂时不写
|
||||
const deps = Object.keys(depGraph.nodeDict);
|
||||
(0, assert_1.default)(deps.length <= 1);
|
||||
depGraph.ascOrder = deps;
|
||||
// 输出一个依赖关系从底向上的序列,类似于图中的反向遍历算法
|
||||
do {
|
||||
const deps = Object.keys(depGraph.nodes);
|
||||
if (deps.length === 0) {
|
||||
break;
|
||||
}
|
||||
const freeNodes = [];
|
||||
for (const n of deps) {
|
||||
if (Object.keys(depGraph.dependencies[n]).length === 0) {
|
||||
freeNodes.push(n);
|
||||
}
|
||||
}
|
||||
(0, assert_1.default)(freeNodes.length > 0, '依赖关系成环!');
|
||||
freeNodes.forEach((n) => {
|
||||
(0, lodash_1.unset)(depGraph.nodes, n);
|
||||
(0, lodash_1.unset)(depGraph.dependencies, n);
|
||||
for (const n2 in depGraph.dependencies) {
|
||||
(0, lodash_1.unset)(depGraph.dependencies[n2], n);
|
||||
}
|
||||
depGraph.ascOrder.push(n);
|
||||
});
|
||||
} while (true);
|
||||
return depGraph;
|
||||
}
|
||||
exports.analyzeDepedency = analyzeDepedency;
|
||||
|
|
@ -141,8 +155,7 @@ function outputPolyfillDts(dependencies, briefNames, sourceFile, printer, filena
|
|||
factory.createIntersectionTypeNode([
|
||||
featureTypeNode,
|
||||
...briefNames.map((ele) => factory.createTypeReferenceNode(factory.createIdentifier(`${(0, string_1.firstLetterUpperCase)(ele)}FeatureDict`), [
|
||||
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined),
|
||||
factory.createTypeReferenceNode(factory.createIdentifier("BackendRuntimeContext"), undefined)
|
||||
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)
|
||||
]))
|
||||
])
|
||||
]
|
||||
|
|
@ -153,8 +166,7 @@ function outputPolyfillDts(dependencies, briefNames, sourceFile, printer, filena
|
|||
type: factory.createIntersectionTypeNode([
|
||||
featureType,
|
||||
...briefNames.map((ele) => factory.createTypeReferenceNode(factory.createIdentifier(`${(0, string_1.firstLetterUpperCase)(ele)}FeatureDict`), [
|
||||
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined),
|
||||
factory.createTypeReferenceNode(factory.createIdentifier("BackendRuntimeContext"), undefined)
|
||||
factory.createTypeReferenceNode(factory.createIdentifier("EntityDict"), undefined)
|
||||
]))
|
||||
])
|
||||
});
|
||||
|
|
@ -266,8 +278,8 @@ function outputRuntimeCxt(dependencies, briefNames, sourceFile, printer, filenam
|
|||
}
|
||||
function outputDependentContext(depGraph, printer, filename) {
|
||||
// 目前只支持单向依赖,未来可以利用mixin来实现多类的继承
|
||||
(0, assert_1.default)(depGraph.roots.length <= 1);
|
||||
let root = depGraph.roots[0] ? depGraph.roots[0].name : 'oak-frontend-base';
|
||||
// assert(depGraph.roots.length <= 1);
|
||||
let root = depGraph.ascOrder.length > 0 ? depGraph.ascOrder[depGraph.ascOrder.length - 1] : 'oak-frontend-base';
|
||||
const statements = [
|
||||
factory.createExportDeclaration(undefined, false, factory.createNamedExports([
|
||||
factory.createExportSpecifier(false, undefined, factory.createIdentifier("BackendRuntimeContext")),
|
||||
|
|
|
|||
|
|
@ -28,4 +28,7 @@ const entityDesc = {
|
|||
},
|
||||
},
|
||||
],
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,4 +30,7 @@ const entityDesc = {
|
|||
},
|
||||
}
|
||||
],
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,5 +31,8 @@ const entityDesc = {
|
|||
recursive: '是否递归(目标对象)',
|
||||
},
|
||||
},
|
||||
},
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,5 +30,8 @@ const entityDesc = {
|
|||
destRelation: '目标关系',
|
||||
},
|
||||
},
|
||||
},
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ exports.entityDesc = {
|
|||
normal: '正常',
|
||||
merged: '已被合并',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
style: {
|
||||
|
|
@ -37,7 +37,7 @@ exports.entityDesc = {
|
|||
userState: {
|
||||
normal: '#112233',
|
||||
merged: '#223344',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,6 +14,5 @@ export declare abstract class RowStore<ED extends EntityDict> {
|
|||
abstract registerOperationRewriter(rewriter: OperationRewriter<ED, AsyncContext<ED> | SyncContext<ED>, SelectOption>): void;
|
||||
abstract registerSelectionRewriter(rewriter: SelectionRewriter<ED, AsyncContext<ED> | SyncContext<ED>, OperateOption>): void;
|
||||
getSchema(): StorageSchema<ED>;
|
||||
mergeOperationResult(result: OperationResult<ED>, toBeMerged: OperationResult<ED>): void;
|
||||
mergeMultipleResults(toBeMerged: OperationResult<ED>[]): OperationResult<ED>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RowStore = void 0;
|
||||
const lodash_1 = require("../utils/lodash");
|
||||
const operationResult_1 = require("../utils/operationResult");
|
||||
class RowStore {
|
||||
storageSchema;
|
||||
constructor(storageSchema) {
|
||||
|
|
@ -10,22 +10,9 @@ class RowStore {
|
|||
getSchema() {
|
||||
return this.storageSchema;
|
||||
}
|
||||
mergeOperationResult(result, toBeMerged) {
|
||||
for (const entity in toBeMerged) {
|
||||
for (const action in toBeMerged[entity]) {
|
||||
const value = (0, lodash_1.get)(result, `${entity}.${action}`);
|
||||
if (typeof value === 'number') {
|
||||
(0, lodash_1.set)(result, `${entity}.${action}`, value + toBeMerged[entity][action]);
|
||||
}
|
||||
else {
|
||||
(0, lodash_1.set)(result, `${entity}.${action}`, toBeMerged[entity][action]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mergeMultipleResults(toBeMerged) {
|
||||
const result = {};
|
||||
toBeMerged.forEach(ele => this.mergeOperationResult(result, ele));
|
||||
toBeMerged.forEach(ele => (0, operationResult_1.mergeOperationResult)(result, ele));
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
declare const ToCent: (float: number) => number;
|
||||
declare const ToYuan: (int: number) => number;
|
||||
declare const StringToCent: (value: string, allowNegative?: true) => number | undefined;
|
||||
declare const CentToString: (value: number) => string | undefined;
|
||||
declare const CentToString: (value: number, fixed?: number) => string | undefined;
|
||||
declare const ThousandCont: (value: number, decimalPlaces?: number) => string | undefined;
|
||||
export { ToCent, ToYuan, StringToCent, CentToString, ThousandCont };
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ const StringToCent = (value, allowNegative) => {
|
|||
}
|
||||
};
|
||||
exports.StringToCent = StringToCent;
|
||||
const CentToString = (value) => {
|
||||
const CentToString = (value, fixed) => {
|
||||
if (typeof value === 'number') {
|
||||
return `${ToYuan(value)}`;
|
||||
return ToYuan(value).toFixed(fixed);
|
||||
}
|
||||
};
|
||||
exports.CentToString = CentToString;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
import { OperationResult, EntityDict } from "../types/Entity";
|
||||
export declare function mergeOperationResult<ED extends EntityDict>(result: OperationResult<ED>, toBeMerged: OperationResult<ED>): OperationResult<ED>;
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mergeOperationResult = void 0;
|
||||
const lodash_1 = require("../utils/lodash");
|
||||
function mergeOperationResult(result, toBeMerged) {
|
||||
for (const entity in toBeMerged) {
|
||||
for (const action in toBeMerged[entity]) {
|
||||
const value = (0, lodash_1.get)(result, `${entity}.${action}`);
|
||||
if (typeof value === 'number') {
|
||||
(0, lodash_1.set)(result, `${entity}.${action}`, value + toBeMerged[entity][action]);
|
||||
}
|
||||
else {
|
||||
(0, lodash_1.set)(result, `${entity}.${action}`, toBeMerged[entity][action]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.mergeOperationResult = mergeOperationResult;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "oak-domain",
|
||||
"version": "5.0.1",
|
||||
"version": "5.0.2",
|
||||
"author": {
|
||||
"name": "XuChang"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import * as ts from 'typescript';
|
|||
import { firstLetterLowerCase, firstLetterUpperCase } from '../utils/string';
|
||||
import { OAK_CLI_MODULE_NAME } from './env';
|
||||
import { copySync, mkdirSync } from 'fs-extra';
|
||||
import { unset } from 'lodash';
|
||||
const { factory } = ts;
|
||||
|
||||
type DepNode = {
|
||||
|
|
@ -13,8 +14,8 @@ type DepNode = {
|
|||
};
|
||||
|
||||
type DepGraph = {
|
||||
nodeDict: Record<string, DepNode>;
|
||||
roots: DepNode[];
|
||||
nodes: Record<string, 1>;
|
||||
dependencies: Record<string, Record<string, 1>>;
|
||||
ascOrder: string[];
|
||||
};
|
||||
|
||||
|
|
@ -25,20 +26,16 @@ type DepGraph = {
|
|||
*/
|
||||
export function analyzeDepedency(cwd: string) {
|
||||
const depGraph: DepGraph = {
|
||||
nodeDict: {},
|
||||
roots: [],
|
||||
nodes: {},
|
||||
dependencies: {},
|
||||
ascOrder: [],
|
||||
};
|
||||
|
||||
function analyzeOne(dir: string, name: string, parent?: DepNode) {
|
||||
const node: DepNode = {
|
||||
name,
|
||||
parent,
|
||||
};
|
||||
function analyzeOne(dir: string, name: string) {
|
||||
if (name) {
|
||||
depGraph.nodeDict[name] = node;
|
||||
if (!parent) {
|
||||
depGraph.roots.push(node);
|
||||
if (!depGraph.nodes[name]) {
|
||||
depGraph.nodes[name] = 1;
|
||||
depGraph.dependencies[name] = {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +50,7 @@ export function analyzeDepedency(cwd: string) {
|
|||
else {
|
||||
const depConfigJsFile = join(dir, 'lib', 'configuration', 'dependency.js');
|
||||
if (existsSync(depConfigJsFile)) {
|
||||
dependencies = require(depConfigJsFile);
|
||||
dependencies = require(depConfigJsFile).default;
|
||||
}
|
||||
else {
|
||||
// 没有依赖文件,直接返回
|
||||
|
|
@ -63,11 +60,10 @@ export function analyzeDepedency(cwd: string) {
|
|||
|
||||
dependencies.forEach(
|
||||
(dep) => {
|
||||
const n2 = depGraph.nodeDict[dep];
|
||||
if (n2) {
|
||||
assert(name);
|
||||
if (name) {
|
||||
depGraph.dependencies[name][dep] = 1;
|
||||
}
|
||||
else {
|
||||
if (!depGraph.nodes[dep]) {
|
||||
let dir2 = join(cwd, 'node_modules', dep);
|
||||
if (!existsSync(dir2)) {
|
||||
dir2 = join(dir, 'node_modules', dep);
|
||||
|
|
@ -75,7 +71,7 @@ export function analyzeDepedency(cwd: string) {
|
|||
throw new Error(`找不到依赖包${dep}的安装位置,当前包是${dir}`);
|
||||
}
|
||||
}
|
||||
analyzeOne(dir2, dep, name ? node : undefined);
|
||||
analyzeOne(dir2, dep);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
@ -83,10 +79,32 @@ export function analyzeDepedency(cwd: string) {
|
|||
|
||||
analyzeOne(cwd, '');
|
||||
|
||||
// 输出一个从底向上的序列,因为当前的项目中最多只有一个依赖,所以暂时不写
|
||||
const deps = Object.keys(depGraph.nodeDict);
|
||||
assert(deps.length <= 1);
|
||||
depGraph.ascOrder = deps;
|
||||
// 输出一个依赖关系从底向上的序列,类似于图中的反向遍历算法
|
||||
do {
|
||||
const deps = Object.keys(depGraph.nodes);
|
||||
if (deps.length === 0) {
|
||||
break;
|
||||
}
|
||||
const freeNodes: string[] = [];
|
||||
for (const n of deps) {
|
||||
if (Object.keys(depGraph.dependencies[n]).length === 0) {
|
||||
freeNodes.push(n);
|
||||
}
|
||||
}
|
||||
assert(freeNodes.length > 0, '依赖关系成环!');
|
||||
freeNodes.forEach(
|
||||
(n) => {
|
||||
unset(depGraph.nodes, n);
|
||||
unset(depGraph.dependencies, n);
|
||||
for (const n2 in depGraph.dependencies) {
|
||||
unset(depGraph.dependencies[n2], n);
|
||||
}
|
||||
|
||||
depGraph.ascOrder.push(n);
|
||||
}
|
||||
);
|
||||
} while(true);
|
||||
|
||||
return depGraph;
|
||||
}
|
||||
|
||||
|
|
@ -218,10 +236,6 @@ function outputPolyfillDts(
|
|||
factory.createTypeReferenceNode(
|
||||
factory.createIdentifier("EntityDict"),
|
||||
undefined
|
||||
),
|
||||
factory.createTypeReferenceNode(
|
||||
factory.createIdentifier("BackendRuntimeContext"),
|
||||
undefined
|
||||
)
|
||||
]
|
||||
)
|
||||
|
|
@ -244,10 +258,6 @@ function outputPolyfillDts(
|
|||
factory.createTypeReferenceNode(
|
||||
factory.createIdentifier("EntityDict"),
|
||||
undefined
|
||||
),
|
||||
factory.createTypeReferenceNode(
|
||||
factory.createIdentifier("BackendRuntimeContext"),
|
||||
undefined
|
||||
)
|
||||
]
|
||||
)
|
||||
|
|
@ -471,8 +481,8 @@ function outputRuntimeCxt(
|
|||
|
||||
function outputDependentContext(depGraph: DepGraph, printer: ts.Printer, filename: string) {
|
||||
// 目前只支持单向依赖,未来可以利用mixin来实现多类的继承
|
||||
assert(depGraph.roots.length <= 1);
|
||||
let root = depGraph.roots[0] ? depGraph.roots[0].name : 'oak-frontend-base';
|
||||
// assert(depGraph.roots.length <= 1);
|
||||
let root = depGraph.ascOrder.length > 0 ? depGraph.ascOrder[depGraph.ascOrder.length - 1] : 'oak-frontend-base';
|
||||
|
||||
const statements = [
|
||||
factory.createExportDeclaration(
|
||||
|
|
|
|||
|
|
@ -38,4 +38,7 @@ const entityDesc: EntityDesc<Schema> = {
|
|||
},
|
||||
},
|
||||
],
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,4 +39,7 @@ const entityDesc: EntityDesc<Schema> = {
|
|||
},
|
||||
}
|
||||
],
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -39,5 +39,8 @@ const entityDesc: EntityDesc<Schema> = {
|
|||
recursive: '是否递归(目标对象)',
|
||||
},
|
||||
},
|
||||
},
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -40,5 +40,8 @@ const entityDesc: EntityDesc<Schema> = {
|
|||
destRelation: '目标关系',
|
||||
},
|
||||
},
|
||||
},
|
||||
configuration: {
|
||||
static: true,
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { String, Int, Text, Image, Datetime } from '../types/DataType';
|
||||
import { String, Text } from '../types/DataType';
|
||||
import { EntityShape } from '../types/Entity';
|
||||
import { ActionDef } from '../types/Action';
|
||||
import { EntityDesc } from '../types/EntityDesc';
|
||||
|
|
@ -22,9 +22,14 @@ export const UserActionDef: ActionDef<UserAction, UserState> = {
|
|||
},
|
||||
};
|
||||
|
||||
export const entityDesc: EntityDesc<Schema, Action, '', {
|
||||
userState: UserState,
|
||||
}> = {
|
||||
export const entityDesc: EntityDesc<
|
||||
Schema,
|
||||
Action,
|
||||
'',
|
||||
{
|
||||
userState: UserState;
|
||||
}
|
||||
> = {
|
||||
locales: {
|
||||
zh_CN: {
|
||||
name: '用户',
|
||||
|
|
@ -43,7 +48,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
normal: '正常',
|
||||
merged: '已被合并',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
style: {
|
||||
|
|
@ -54,7 +59,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
userState: {
|
||||
normal: '#112233',
|
||||
merged: '#223344',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
@ -4,6 +4,7 @@ import { get, set } from '../utils/lodash';
|
|||
import { AsyncContext } from '../store/AsyncRowStore';
|
||||
import { SyncContext } from '../store/SyncRowStore';
|
||||
import { OperateOption, SelectOption } from '.';
|
||||
import { mergeOperationResult } from '../utils/operationResult';
|
||||
|
||||
export type TxnOption = {
|
||||
isolationLevel: 'repeatable read' | 'serializable';
|
||||
|
|
@ -41,24 +42,10 @@ export abstract class RowStore<ED extends EntityDict> {
|
|||
return this.storageSchema;
|
||||
}
|
||||
|
||||
mergeOperationResult(result: OperationResult<ED>, toBeMerged: OperationResult<ED>) {
|
||||
for (const entity in toBeMerged) {
|
||||
for (const action in toBeMerged[entity]) {
|
||||
const value = get(result, `${entity}.${action}`);
|
||||
if (typeof value === 'number') {
|
||||
set(result, `${entity}.${action}`, value + toBeMerged[entity]![action]!);
|
||||
}
|
||||
else {
|
||||
set(result, `${entity}.${action}`, toBeMerged[entity]![action]!);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mergeMultipleResults(toBeMerged: OperationResult<ED>[]) {
|
||||
const result: OperationResult<ED> = {};
|
||||
toBeMerged.forEach(
|
||||
ele => this.mergeOperationResult(result, ele)
|
||||
ele => mergeOperationResult(result, ele)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ const StringToCent: (
|
|||
}
|
||||
};
|
||||
|
||||
const CentToString: (value: number) => string | undefined = (value) => {
|
||||
const CentToString: (value: number, fixed?: number) => string | undefined = (value, fixed) => {
|
||||
if (typeof value === 'number') {
|
||||
return `${ToYuan(value)}`;
|
||||
return ToYuan(value).toFixed(fixed);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
import { OperationResult, EntityDict } from "../types/Entity";
|
||||
import { get, set } from '../utils/lodash';
|
||||
|
||||
export function mergeOperationResult<ED extends EntityDict>(result: OperationResult<ED>, toBeMerged: OperationResult<ED>) {
|
||||
for (const entity in toBeMerged) {
|
||||
for (const action in toBeMerged[entity]) {
|
||||
const value = get(result, `${entity}.${action}`);
|
||||
if (typeof value === 'number') {
|
||||
set(result, `${entity}.${action}`, value + toBeMerged[entity]![action]!);
|
||||
}
|
||||
else {
|
||||
set(result, `${entity}.${action}`, toBeMerged[entity]![action]!);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Loading…
Reference in New Issue