oak-domain 5.0.19 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/base-app-domain/ActionDefDict.d.ts +6 -0
- package/lib/base-app-domain/ActionDefDict.js +8 -4
- package/lib/base-app-domain/EntityDict.d.ts +2 -0
- package/lib/base-app-domain/Log/Action.d.ts +12 -0
- package/lib/base-app-domain/Log/Action.js +14 -0
- package/lib/base-app-domain/Log/Schema.d.ts +135 -0
- package/lib/base-app-domain/Log/Schema.js +2 -0
- package/lib/base-app-domain/Log/Storage.d.ts +3 -0
- package/lib/base-app-domain/Log/Storage.js +28 -0
- package/lib/base-app-domain/Log/Style.d.ts +3 -0
- package/lib/base-app-domain/Log/Style.js +15 -0
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +34 -5
- package/lib/base-app-domain/ModiEntity/Storage.js +1 -1
- package/lib/base-app-domain/Oper/Action.d.ts +12 -0
- package/lib/base-app-domain/Oper/Action.js +14 -0
- package/lib/base-app-domain/Oper/Schema.d.ts +56 -6
- package/lib/base-app-domain/Oper/Storage.js +14 -3
- package/lib/base-app-domain/Oper/Style.d.ts +3 -0
- package/lib/base-app-domain/Oper/Style.js +15 -0
- package/lib/base-app-domain/OperEntity/Schema.d.ts +46 -6
- package/lib/base-app-domain/OperEntity/Storage.js +1 -1
- package/lib/base-app-domain/Storage.js +24 -22
- package/lib/base-app-domain/StyleDict.js +8 -4
- package/lib/base-app-domain/User/Schema.d.ts +2 -2
- package/lib/base-app-domain/_SubQuery.d.ts +12 -0
- package/lib/compiler/routerBuilder.js +1 -1
- package/lib/compiler/schemalBuilder.js +22 -1
- package/lib/entities/Log.d.ts +16 -0
- package/lib/entities/Log.js +45 -0
- package/lib/entities/Oper.d.ts +9 -0
- package/lib/entities/Oper.js +33 -3
- package/lib/store/AsyncRowStore.d.ts +3 -2
- package/lib/store/CascadeStore.js +51 -9
- package/lib/store/IntrinsicCheckers.js +7 -2
- package/lib/store/IntrinsicLogics.js +2 -2
- package/lib/store/SyncRowStore.d.ts +3 -2
- package/lib/store/triggers.d.ts +6 -0
- package/lib/store/triggers.js +351 -0
- package/lib/types/AppLoader.d.ts +2 -1
- package/lib/types/Aspect.d.ts +3 -2
- package/lib/types/Auth.d.ts +8 -7
- package/lib/types/Endpoint.d.ts +3 -2
- package/lib/types/Entity.d.ts +1 -0
- package/lib/types/EntityDesc.d.ts +1 -1
- package/lib/types/Exception.d.ts +2 -0
- package/lib/types/Exception.js +5 -1
- package/lib/types/Port.d.ts +3 -2
- package/lib/types/RowStore.d.ts +4 -3
- package/lib/types/Storage.d.ts +1 -0
- package/lib/types/Timer.d.ts +6 -5
- package/lib/types/Trigger.d.ts +21 -20
- package/lib/types/Watcher.d.ts +5 -4
- package/lib/utils/validator.js +4 -2
- package/package.json +1 -1
- package/src/entities/Log.ts +59 -0
- package/src/entities/Oper.ts +45 -4
- package/lib/store/actionAuth.d.ts +0 -4
- package/lib/store/actionAuth.js +0 -25
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export declare const actionDefDict: {
|
|
2
|
+
log: {
|
|
3
|
+
iState: import("../types").ActionDef<string, string>;
|
|
4
|
+
};
|
|
2
5
|
modi: {
|
|
3
6
|
iState: import("../types").ActionDef<string, string>;
|
|
4
7
|
};
|
|
8
|
+
oper: {
|
|
9
|
+
iState: import("../types").ActionDef<string, string>;
|
|
10
|
+
};
|
|
5
11
|
user: {
|
|
6
12
|
userState: import("../types").ActionDef<string, string>;
|
|
7
13
|
};
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.actionDefDict = void 0;
|
|
4
|
-
const Action_1 = require("./
|
|
5
|
-
const Action_2 = require("./
|
|
4
|
+
const Action_1 = require("./Log/Action");
|
|
5
|
+
const Action_2 = require("./Modi/Action");
|
|
6
|
+
const Action_3 = require("./Oper/Action");
|
|
7
|
+
const Action_4 = require("./User/Action");
|
|
6
8
|
exports.actionDefDict = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
+
log: Action_1.actionDefDict,
|
|
10
|
+
modi: Action_2.actionDefDict,
|
|
11
|
+
oper: Action_3.actionDefDict,
|
|
12
|
+
user: Action_4.actionDefDict
|
|
9
13
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityDef as ActionAuth } from "./ActionAuth/Schema";
|
|
2
2
|
import { EntityDef as I18n } from "./I18n/Schema";
|
|
3
|
+
import { EntityDef as Log } from "./Log/Schema";
|
|
3
4
|
import { EntityDef as Modi } from "./Modi/Schema";
|
|
4
5
|
import { EntityDef as ModiEntity } from "./ModiEntity/Schema";
|
|
5
6
|
import { EntityDef as Oper } from "./Oper/Schema";
|
|
@@ -14,6 +15,7 @@ import { EntityDef as UserRelation } from "./UserRelation/Schema";
|
|
|
14
15
|
export type EntityDict = {
|
|
15
16
|
actionAuth: ActionAuth;
|
|
16
17
|
i18n: I18n;
|
|
18
|
+
log: Log;
|
|
17
19
|
modi: Modi;
|
|
18
20
|
modiEntity: ModiEntity;
|
|
19
21
|
oper: Oper;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionDef } from "../../types/Action";
|
|
2
|
+
import { GenericAction } from "../../actions/action";
|
|
3
|
+
export type IState = 'normal' | 'rollbacked' | string;
|
|
4
|
+
export type State = IState | string;
|
|
5
|
+
export type IAction = 'undo' | 'redo' | string;
|
|
6
|
+
export type ParticularAction = IAction;
|
|
7
|
+
export declare const actions: string[];
|
|
8
|
+
export declare const IActionDef: ActionDef<IAction, IState>;
|
|
9
|
+
export type Action = GenericAction | ParticularAction | string;
|
|
10
|
+
export declare const actionDefDict: {
|
|
11
|
+
iState: ActionDef<string, string>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.actionDefDict = exports.IActionDef = exports.actions = void 0;
|
|
4
|
+
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "undo", "redo"];
|
|
5
|
+
exports.IActionDef = {
|
|
6
|
+
stm: {
|
|
7
|
+
undo: ['normal', 'rollbacked'],
|
|
8
|
+
redo: ['rollbacked', 'normal'],
|
|
9
|
+
},
|
|
10
|
+
is: 'normal',
|
|
11
|
+
};
|
|
12
|
+
exports.actionDefDict = {
|
|
13
|
+
iState: exports.IActionDef
|
|
14
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
|
|
2
|
+
import { OneOf } from "../../types/Polyfill";
|
|
3
|
+
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "../../types/Entity";
|
|
4
|
+
import { Action, ParticularAction, IState } from "./Action";
|
|
5
|
+
import { String } from "../../types/DataType";
|
|
6
|
+
import * as Oper from "../Oper/Schema";
|
|
7
|
+
import * as ModiEntity from "../ModiEntity/Schema";
|
|
8
|
+
import * as OperEntity from "../OperEntity/Schema";
|
|
9
|
+
export type OpSchema = EntityShape & {
|
|
10
|
+
entity: String<32>;
|
|
11
|
+
entityId: String<64>;
|
|
12
|
+
iState?: IState | null;
|
|
13
|
+
};
|
|
14
|
+
export type OpAttr = keyof OpSchema;
|
|
15
|
+
export type Schema = EntityShape & {
|
|
16
|
+
entity: String<32>;
|
|
17
|
+
entityId: String<64>;
|
|
18
|
+
iState?: IState | null;
|
|
19
|
+
oper$log?: Array<Oper.Schema>;
|
|
20
|
+
oper$log$$aggr?: AggregationResult<Oper.Schema>;
|
|
21
|
+
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
22
|
+
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
|
23
|
+
operEntity$entity?: Array<OperEntity.Schema>;
|
|
24
|
+
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
|
|
25
|
+
} & {
|
|
26
|
+
[A in ExpressionKey]?: any;
|
|
27
|
+
};
|
|
28
|
+
type AttrFilter = {
|
|
29
|
+
id: Q_StringValue;
|
|
30
|
+
$$createAt$$: Q_DateValue;
|
|
31
|
+
$$seq$$: Q_NumberValue;
|
|
32
|
+
$$updateAt$$: Q_DateValue;
|
|
33
|
+
entity: Q_StringValue;
|
|
34
|
+
entityId: Q_StringValue;
|
|
35
|
+
iState: Q_EnumValue<IState>;
|
|
36
|
+
oper$log: Oper.Filter & SubQueryPredicateMetadata;
|
|
37
|
+
modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
|
|
38
|
+
operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
|
|
39
|
+
};
|
|
40
|
+
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
41
|
+
export type Projection = {
|
|
42
|
+
"#id"?: NodeId;
|
|
43
|
+
[k: string]: any;
|
|
44
|
+
id?: number;
|
|
45
|
+
$$createAt$$?: number;
|
|
46
|
+
$$updateAt$$?: number;
|
|
47
|
+
$$seq$$?: number;
|
|
48
|
+
entity?: number;
|
|
49
|
+
entityId?: number;
|
|
50
|
+
iState?: number;
|
|
51
|
+
oper$log?: Oper.Selection & {
|
|
52
|
+
$entity: "oper";
|
|
53
|
+
};
|
|
54
|
+
oper$log$$aggr?: Oper.Aggregation & {
|
|
55
|
+
$entity: "oper";
|
|
56
|
+
};
|
|
57
|
+
modiEntity$entity?: ModiEntity.Selection & {
|
|
58
|
+
$entity: "modiEntity";
|
|
59
|
+
};
|
|
60
|
+
modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
|
|
61
|
+
$entity: "modiEntity";
|
|
62
|
+
};
|
|
63
|
+
operEntity$entity?: OperEntity.Selection & {
|
|
64
|
+
$entity: "operEntity";
|
|
65
|
+
};
|
|
66
|
+
operEntity$entity$$aggr?: OperEntity.Aggregation & {
|
|
67
|
+
$entity: "operEntity";
|
|
68
|
+
};
|
|
69
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
70
|
+
type LogIdProjection = OneOf<{
|
|
71
|
+
id: number;
|
|
72
|
+
}>;
|
|
73
|
+
export type SortAttr = {
|
|
74
|
+
id: number;
|
|
75
|
+
} | {
|
|
76
|
+
$$createAt$$: number;
|
|
77
|
+
} | {
|
|
78
|
+
$$seq$$: number;
|
|
79
|
+
} | {
|
|
80
|
+
$$updateAt$$: number;
|
|
81
|
+
} | {
|
|
82
|
+
entity: number;
|
|
83
|
+
} | {
|
|
84
|
+
entityId: number;
|
|
85
|
+
} | {
|
|
86
|
+
iState: number;
|
|
87
|
+
} | {
|
|
88
|
+
[k: string]: any;
|
|
89
|
+
} | OneOf<ExprOp<OpAttr | string>>;
|
|
90
|
+
export type SortNode = {
|
|
91
|
+
$attr: SortAttr;
|
|
92
|
+
$direction?: "asc" | "desc";
|
|
93
|
+
};
|
|
94
|
+
export type Sorter = SortNode[];
|
|
95
|
+
export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
|
96
|
+
export type Selection<P extends Object = Projection> = SelectOperation<P>;
|
|
97
|
+
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
|
98
|
+
export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
|
99
|
+
entity?: string;
|
|
100
|
+
entityId?: string;
|
|
101
|
+
[K: string]: any;
|
|
102
|
+
}) & {
|
|
103
|
+
oper$log?: OakOperation<Oper.UpdateOperation["action"], Omit<Oper.UpdateOperationData, "log" | "logId">, Omit<Oper.Filter, "log" | "logId">> | OakOperation<"create", Omit<Oper.CreateOperationData, "log" | "logId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "log" | "logId">> | OakOperation<Oper.UpdateOperation["action"], Omit<Oper.UpdateOperationData, "log" | "logId">, Omit<Oper.Filter, "log" | "logId">>>;
|
|
104
|
+
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
105
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
106
|
+
};
|
|
107
|
+
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
108
|
+
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
109
|
+
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
110
|
+
export type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
111
|
+
[k: string]: any;
|
|
112
|
+
oper$log?: OakOperation<Oper.UpdateOperation["action"], Omit<Oper.UpdateOperationData, "log" | "logId">, Omit<Oper.Filter, "log" | "logId">> | OakOperation<Oper.RemoveOperation["action"], Omit<Oper.RemoveOperationData, "log" | "logId">, Omit<Oper.Filter, "log" | "logId">> | OakOperation<"create", Omit<Oper.CreateOperationData, "log" | "logId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "log" | "logId">> | OakOperation<Oper.UpdateOperation["action"], Omit<Oper.UpdateOperationData, "log" | "logId">, Omit<Oper.Filter, "log" | "logId">> | OakOperation<Oper.RemoveOperation["action"], Omit<Oper.RemoveOperationData, "log" | "logId">, Omit<Oper.Filter, "log" | "logId">>>;
|
|
113
|
+
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
114
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
115
|
+
};
|
|
116
|
+
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
117
|
+
export type RemoveOperationData = {};
|
|
118
|
+
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
119
|
+
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
120
|
+
export type LogIdSubQuery = Selection<LogIdProjection>;
|
|
121
|
+
export type EntityDef = {
|
|
122
|
+
Schema: Schema;
|
|
123
|
+
OpSchema: OpSchema;
|
|
124
|
+
Action: OakMakeAction<Action> | string;
|
|
125
|
+
Selection: Selection;
|
|
126
|
+
Aggregation: Aggregation;
|
|
127
|
+
Operation: Operation;
|
|
128
|
+
Create: CreateOperation;
|
|
129
|
+
Update: UpdateOperation;
|
|
130
|
+
Remove: RemoveOperation;
|
|
131
|
+
CreateSingle: CreateSingleOperation;
|
|
132
|
+
CreateMulti: CreateMultipleOperation;
|
|
133
|
+
ParticularAction: ParticularAction;
|
|
134
|
+
};
|
|
135
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.desc = void 0;
|
|
4
|
+
const Action_1 = require("./Action");
|
|
5
|
+
exports.desc = {
|
|
6
|
+
attributes: {
|
|
7
|
+
entity: {
|
|
8
|
+
notNull: true,
|
|
9
|
+
type: "varchar",
|
|
10
|
+
params: {
|
|
11
|
+
length: 32
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
entityId: {
|
|
15
|
+
notNull: true,
|
|
16
|
+
type: "varchar",
|
|
17
|
+
params: {
|
|
18
|
+
length: 64
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
iState: {
|
|
22
|
+
type: "enum",
|
|
23
|
+
enumeration: ["normal", "rollbacked"]
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
actionType: "crud",
|
|
27
|
+
actions: Action_1.actions
|
|
28
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.style = void 0;
|
|
4
|
+
exports.style = {
|
|
5
|
+
icon: {
|
|
6
|
+
undo: '',
|
|
7
|
+
redo: '',
|
|
8
|
+
},
|
|
9
|
+
color: {
|
|
10
|
+
iState: {
|
|
11
|
+
normal: '#229954',
|
|
12
|
+
rollbacked: '#2C3E50',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -7,6 +7,7 @@ import { String } from "../../types/DataType";
|
|
|
7
7
|
import * as Modi from "../Modi/Schema";
|
|
8
8
|
import * as ActionAuth from "../ActionAuth/Schema";
|
|
9
9
|
import * as I18n from "../I18n/Schema";
|
|
10
|
+
import * as Log from "../Log/Schema";
|
|
10
11
|
import * as Path from "../Path/Schema";
|
|
11
12
|
import * as Relation from "../Relation/Schema";
|
|
12
13
|
import * as RelationAuth from "../RelationAuth/Schema";
|
|
@@ -16,17 +17,18 @@ import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
|
|
16
17
|
import * as UserRelation from "../UserRelation/Schema";
|
|
17
18
|
export type OpSchema = EntityShape & {
|
|
18
19
|
modiId: ForeignKey<"modi">;
|
|
19
|
-
entity: "actionAuth" | "i18n" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string;
|
|
20
|
+
entity: "actionAuth" | "i18n" | "log" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string;
|
|
20
21
|
entityId: String<64>;
|
|
21
22
|
};
|
|
22
23
|
export type OpAttr = keyof OpSchema;
|
|
23
24
|
export type Schema = EntityShape & {
|
|
24
25
|
modiId: ForeignKey<"modi">;
|
|
25
|
-
entity: "actionAuth" | "i18n" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string;
|
|
26
|
+
entity: "actionAuth" | "i18n" | "log" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string;
|
|
26
27
|
entityId: String<64>;
|
|
27
28
|
modi: Modi.Schema;
|
|
28
29
|
actionAuth?: ActionAuth.Schema;
|
|
29
30
|
i18n?: I18n.Schema;
|
|
31
|
+
log?: Log.Schema;
|
|
30
32
|
path?: Path.Schema;
|
|
31
33
|
relation?: Relation.Schema;
|
|
32
34
|
relationAuth?: RelationAuth.Schema;
|
|
@@ -44,10 +46,11 @@ type AttrFilter = {
|
|
|
44
46
|
$$updateAt$$: Q_DateValue;
|
|
45
47
|
modiId: Q_StringValue;
|
|
46
48
|
modi: Modi.Filter;
|
|
47
|
-
entity: Q_EnumValue<"actionAuth" | "i18n" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string>;
|
|
49
|
+
entity: Q_EnumValue<"actionAuth" | "i18n" | "log" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string>;
|
|
48
50
|
entityId: Q_StringValue;
|
|
49
51
|
actionAuth: ActionAuth.Filter;
|
|
50
52
|
i18n: I18n.Filter;
|
|
53
|
+
log: Log.Filter;
|
|
51
54
|
path: Path.Filter;
|
|
52
55
|
relation: Relation.Filter;
|
|
53
56
|
relationAuth: RelationAuth.Filter;
|
|
@@ -70,6 +73,7 @@ export type Projection = {
|
|
|
70
73
|
entityId?: number;
|
|
71
74
|
actionAuth?: ActionAuth.Projection;
|
|
72
75
|
i18n?: I18n.Projection;
|
|
76
|
+
log?: Log.Projection;
|
|
73
77
|
path?: Path.Projection;
|
|
74
78
|
relation?: Relation.Projection;
|
|
75
79
|
relationAuth?: RelationAuth.Projection;
|
|
@@ -90,6 +94,9 @@ type ActionAuthIdProjection = OneOf<{
|
|
|
90
94
|
type I18nIdProjection = OneOf<{
|
|
91
95
|
entityId: number;
|
|
92
96
|
}>;
|
|
97
|
+
type LogIdProjection = OneOf<{
|
|
98
|
+
entityId: number;
|
|
99
|
+
}>;
|
|
93
100
|
type PathIdProjection = OneOf<{
|
|
94
101
|
entityId: number;
|
|
95
102
|
}>;
|
|
@@ -131,6 +138,8 @@ export type SortAttr = {
|
|
|
131
138
|
actionAuth: ActionAuth.SortAttr;
|
|
132
139
|
} | {
|
|
133
140
|
i18n: I18n.SortAttr;
|
|
141
|
+
} | {
|
|
142
|
+
log: Log.SortAttr;
|
|
134
143
|
} | {
|
|
135
144
|
path: Path.SortAttr;
|
|
136
145
|
} | {
|
|
@@ -173,6 +182,18 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "enti
|
|
|
173
182
|
entity: "i18n";
|
|
174
183
|
entityId: ForeignKey<"I18n">;
|
|
175
184
|
i18n?: never;
|
|
185
|
+
} | {
|
|
186
|
+
entity?: never;
|
|
187
|
+
entityId?: never;
|
|
188
|
+
log: Log.CreateSingleOperation;
|
|
189
|
+
} | {
|
|
190
|
+
entity: "log";
|
|
191
|
+
entityId: ForeignKey<"Log">;
|
|
192
|
+
log?: Log.UpdateOperation;
|
|
193
|
+
} | {
|
|
194
|
+
entity: "log";
|
|
195
|
+
entityId: ForeignKey<"Log">;
|
|
196
|
+
log?: never;
|
|
176
197
|
} | {
|
|
177
198
|
entity: "path";
|
|
178
199
|
entityId: ForeignKey<"Path">;
|
|
@@ -262,6 +283,10 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|
|
262
283
|
modi?: never;
|
|
263
284
|
modiId?: ForeignKey<"modi">;
|
|
264
285
|
})) & ({
|
|
286
|
+
log?: Log.CreateSingleOperation | Log.UpdateOperation | Log.RemoveOperation;
|
|
287
|
+
entityId?: never;
|
|
288
|
+
entity?: never;
|
|
289
|
+
} | {
|
|
265
290
|
relation?: Relation.CreateSingleOperation | Relation.UpdateOperation | Relation.RemoveOperation;
|
|
266
291
|
entityId?: never;
|
|
267
292
|
entity?: never;
|
|
@@ -282,10 +307,11 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
|
|
|
282
307
|
entityId?: never;
|
|
283
308
|
entity?: never;
|
|
284
309
|
} | {
|
|
285
|
-
entity?: ("actionAuth" | "i18n" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string) | null;
|
|
286
|
-
entityId?: ForeignKey<"ActionAuth" | "I18n" | "Path" | "Relation" | "RelationAuth" | "User" | "UserEntityClaim" | "UserEntityGrant" | "UserRelation"> | null;
|
|
310
|
+
entity?: ("actionAuth" | "i18n" | "log" | "path" | "relation" | "relationAuth" | "user" | "userEntityClaim" | "userEntityGrant" | "userRelation" | string) | null;
|
|
311
|
+
entityId?: ForeignKey<"ActionAuth" | "I18n" | "Log" | "Path" | "Relation" | "RelationAuth" | "User" | "UserEntityClaim" | "UserEntityGrant" | "UserRelation"> | null;
|
|
287
312
|
actionAuth?: never;
|
|
288
313
|
i18n?: never;
|
|
314
|
+
log?: never;
|
|
289
315
|
path?: never;
|
|
290
316
|
relation?: never;
|
|
291
317
|
relationAuth?: never;
|
|
@@ -300,6 +326,8 @@ export type UpdateOperation = OakOperation<"update" | string, UpdateOperationDat
|
|
|
300
326
|
export type RemoveOperationData = {} & (({
|
|
301
327
|
modi?: Modi.UpdateOperation | Modi.RemoveOperation;
|
|
302
328
|
})) & ({
|
|
329
|
+
log?: Log.UpdateOperation | Log.RemoveOperation;
|
|
330
|
+
} | {
|
|
303
331
|
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
304
332
|
} | {
|
|
305
333
|
user?: User.UpdateOperation | User.RemoveOperation;
|
|
@@ -317,6 +345,7 @@ export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
|
317
345
|
export type ModiIdSubQuery = Selection<ModiIdProjection>;
|
|
318
346
|
export type ActionAuthIdSubQuery = Selection<ActionAuthIdProjection>;
|
|
319
347
|
export type I18nIdSubQuery = Selection<I18nIdProjection>;
|
|
348
|
+
export type LogIdSubQuery = Selection<LogIdProjection>;
|
|
320
349
|
export type PathIdSubQuery = Selection<PathIdProjection>;
|
|
321
350
|
export type RelationIdSubQuery = Selection<RelationIdProjection>;
|
|
322
351
|
export type RelationAuthIdSubQuery = Selection<RelationAuthIdProjection>;
|
|
@@ -15,7 +15,7 @@ exports.desc = {
|
|
|
15
15
|
params: {
|
|
16
16
|
length: 32
|
|
17
17
|
},
|
|
18
|
-
ref: ["actionAuth", "i18n", "path", "relation", "relationAuth", "user", "userEntityClaim", "userEntityGrant", "userRelation"]
|
|
18
|
+
ref: ["actionAuth", "i18n", "log", "path", "relation", "relationAuth", "user", "userEntityClaim", "userEntityGrant", "userRelation"]
|
|
19
19
|
},
|
|
20
20
|
entityId: {
|
|
21
21
|
notNull: true,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ActionDef } from "../../types/Action";
|
|
2
|
+
import { GenericAction } from "../../actions/action";
|
|
3
|
+
export type IState = 'normal' | 'rollbacked' | string;
|
|
4
|
+
export type State = IState | string;
|
|
5
|
+
export type IAction = 'undo' | 'redo' | string;
|
|
6
|
+
export type ParticularAction = IAction;
|
|
7
|
+
export declare const actions: string[];
|
|
8
|
+
export declare const IActionDef: ActionDef<IAction, IState>;
|
|
9
|
+
export type Action = GenericAction | ParticularAction | string;
|
|
10
|
+
export declare const actionDefDict: {
|
|
11
|
+
iState: ActionDef<string, string>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.actionDefDict = exports.IActionDef = exports.actions = void 0;
|
|
4
|
+
exports.actions = ["count", "stat", "download", "select", "aggregate", "create", "remove", "update", "undo", "redo"];
|
|
5
|
+
exports.IActionDef = {
|
|
6
|
+
stm: {
|
|
7
|
+
undo: ['normal', 'rollbacked'],
|
|
8
|
+
redo: ['rollbacked', 'normal'],
|
|
9
|
+
},
|
|
10
|
+
is: 'normal',
|
|
11
|
+
};
|
|
12
|
+
exports.actionDefDict = {
|
|
13
|
+
iState: exports.IActionDef
|
|
14
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ForeignKey } from "../../types/DataType";
|
|
2
|
-
import { Q_DateValue, Q_NumberValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
|
|
2
|
+
import { Q_DateValue, Q_NumberValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
|
|
3
3
|
import { OneOf } from "../../types/Polyfill";
|
|
4
4
|
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult, EntityShape } from "../../types/Entity";
|
|
5
|
-
import {
|
|
5
|
+
import { Action, ParticularAction, IState } from "./Action";
|
|
6
6
|
import { String, Datetime } from "../../types/DataType";
|
|
7
7
|
import * as User from "../User/Schema";
|
|
8
|
+
import * as Log from "../Log/Schema";
|
|
8
9
|
import * as OperEntity from "../OperEntity/Schema";
|
|
9
10
|
export type OpSchema = EntityShape & {
|
|
10
11
|
action: String<24>;
|
|
@@ -14,6 +15,9 @@ export type OpSchema = EntityShape & {
|
|
|
14
15
|
operatorId?: ForeignKey<"user"> | null;
|
|
15
16
|
targetEntity: String<32>;
|
|
16
17
|
bornAt?: Datetime | null;
|
|
18
|
+
logId?: ForeignKey<"log"> | null;
|
|
19
|
+
undoData?: Object | null;
|
|
20
|
+
iState?: IState | null;
|
|
17
21
|
};
|
|
18
22
|
export type OpAttr = keyof OpSchema;
|
|
19
23
|
export type Schema = EntityShape & {
|
|
@@ -24,7 +28,11 @@ export type Schema = EntityShape & {
|
|
|
24
28
|
operatorId?: ForeignKey<"user"> | null;
|
|
25
29
|
targetEntity: String<32>;
|
|
26
30
|
bornAt?: Datetime | null;
|
|
31
|
+
logId?: ForeignKey<"log"> | null;
|
|
32
|
+
undoData?: Object | null;
|
|
33
|
+
iState?: IState | null;
|
|
27
34
|
operator?: User.Schema | null;
|
|
35
|
+
log?: Log.Schema | null;
|
|
28
36
|
operEntity$oper?: Array<OperEntity.Schema>;
|
|
29
37
|
operEntity$oper$$aggr?: AggregationResult<OperEntity.Schema>;
|
|
30
38
|
} & {
|
|
@@ -43,6 +51,10 @@ type AttrFilter = {
|
|
|
43
51
|
operator: User.Filter;
|
|
44
52
|
targetEntity: Q_StringValue;
|
|
45
53
|
bornAt: Q_DateValue;
|
|
54
|
+
logId: Q_StringValue;
|
|
55
|
+
log: Log.Filter;
|
|
56
|
+
undoData: Object;
|
|
57
|
+
iState: Q_EnumValue<IState>;
|
|
46
58
|
operEntity$oper: OperEntity.Filter & SubQueryPredicateMetadata;
|
|
47
59
|
};
|
|
48
60
|
export type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
@@ -61,6 +73,10 @@ export type Projection = {
|
|
|
61
73
|
operator?: User.Projection;
|
|
62
74
|
targetEntity?: number;
|
|
63
75
|
bornAt?: number;
|
|
76
|
+
logId?: number;
|
|
77
|
+
log?: Log.Projection;
|
|
78
|
+
undoData?: number | Object;
|
|
79
|
+
iState?: number;
|
|
64
80
|
operEntity$oper?: OperEntity.Selection & {
|
|
65
81
|
$entity: "operEntity";
|
|
66
82
|
};
|
|
@@ -74,6 +90,9 @@ type OperIdProjection = OneOf<{
|
|
|
74
90
|
type UserIdProjection = OneOf<{
|
|
75
91
|
operatorId: number;
|
|
76
92
|
}>;
|
|
93
|
+
type LogIdProjection = OneOf<{
|
|
94
|
+
logId: number;
|
|
95
|
+
}>;
|
|
77
96
|
export type SortAttr = {
|
|
78
97
|
id: number;
|
|
79
98
|
} | {
|
|
@@ -92,6 +111,12 @@ export type SortAttr = {
|
|
|
92
111
|
targetEntity: number;
|
|
93
112
|
} | {
|
|
94
113
|
bornAt: number;
|
|
114
|
+
} | {
|
|
115
|
+
logId: number;
|
|
116
|
+
} | {
|
|
117
|
+
log: Log.SortAttr;
|
|
118
|
+
} | {
|
|
119
|
+
iState: number;
|
|
95
120
|
} | {
|
|
96
121
|
[k: string]: any;
|
|
97
122
|
} | OneOf<ExprOp<OpAttr | string>>;
|
|
@@ -103,7 +128,7 @@ export type Sorter = SortNode[];
|
|
|
103
128
|
export type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
|
104
129
|
export type Selection<P extends Object = Projection> = SelectOperation<P>;
|
|
105
130
|
export type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
|
106
|
-
export type CreateOperationData = FormCreateData<Omit<OpSchema, "operatorId">> & (({
|
|
131
|
+
export type CreateOperationData = FormCreateData<Omit<OpSchema, "operatorId" | "logId">> & (({
|
|
107
132
|
operatorId?: never;
|
|
108
133
|
operator?: User.CreateSingleOperation;
|
|
109
134
|
} | {
|
|
@@ -112,13 +137,22 @@ export type CreateOperationData = FormCreateData<Omit<OpSchema, "operatorId">> &
|
|
|
112
137
|
} | {
|
|
113
138
|
operator?: never;
|
|
114
139
|
operatorId?: ForeignKey<"operator">;
|
|
140
|
+
}) & ({
|
|
141
|
+
logId?: never;
|
|
142
|
+
log?: Log.CreateSingleOperation;
|
|
143
|
+
} | {
|
|
144
|
+
logId: ForeignKey<"log">;
|
|
145
|
+
log?: Log.UpdateOperation;
|
|
146
|
+
} | {
|
|
147
|
+
log?: never;
|
|
148
|
+
logId?: ForeignKey<"log">;
|
|
115
149
|
})) & {
|
|
116
150
|
operEntity$oper?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">>>;
|
|
117
151
|
};
|
|
118
152
|
export type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
119
153
|
export type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
120
154
|
export type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
121
|
-
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "operatorId">> & (({
|
|
155
|
+
export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "operatorId" | "logId">> & (({
|
|
122
156
|
operator?: User.CreateSingleOperation;
|
|
123
157
|
operatorId?: never;
|
|
124
158
|
} | {
|
|
@@ -130,22 +164,37 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "operatorId">> &
|
|
|
130
164
|
} | {
|
|
131
165
|
operator?: never;
|
|
132
166
|
operatorId?: ForeignKey<"operator"> | null;
|
|
167
|
+
}) & ({
|
|
168
|
+
log?: Log.CreateSingleOperation;
|
|
169
|
+
logId?: never;
|
|
170
|
+
} | {
|
|
171
|
+
log?: Log.UpdateOperation;
|
|
172
|
+
logId?: never;
|
|
173
|
+
} | {
|
|
174
|
+
log?: Log.RemoveOperation;
|
|
175
|
+
logId?: never;
|
|
176
|
+
} | {
|
|
177
|
+
log?: never;
|
|
178
|
+
logId?: ForeignKey<"log"> | null;
|
|
133
179
|
})) & {
|
|
134
180
|
[k: string]: any;
|
|
135
181
|
operEntity$oper?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "oper" | "operId">>>;
|
|
136
182
|
};
|
|
137
|
-
export type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
183
|
+
export type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
|
|
138
184
|
export type RemoveOperationData = {} & (({
|
|
139
185
|
operator?: User.UpdateOperation | User.RemoveOperation;
|
|
186
|
+
}) & ({
|
|
187
|
+
log?: Log.UpdateOperation | Log.RemoveOperation;
|
|
140
188
|
}));
|
|
141
189
|
export type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
142
190
|
export type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
143
191
|
export type UserIdSubQuery = Selection<UserIdProjection>;
|
|
192
|
+
export type LogIdSubQuery = Selection<LogIdProjection>;
|
|
144
193
|
export type OperIdSubQuery = Selection<OperIdProjection>;
|
|
145
194
|
export type EntityDef = {
|
|
146
195
|
Schema: Schema;
|
|
147
196
|
OpSchema: OpSchema;
|
|
148
|
-
Action: OakMakeAction<
|
|
197
|
+
Action: OakMakeAction<Action> | string;
|
|
149
198
|
Selection: Selection;
|
|
150
199
|
Aggregation: Aggregation;
|
|
151
200
|
Operation: Operation;
|
|
@@ -154,5 +203,6 @@ export type EntityDef = {
|
|
|
154
203
|
Remove: RemoveOperation;
|
|
155
204
|
CreateSingle: CreateSingleOperation;
|
|
156
205
|
CreateMulti: CreateMultipleOperation;
|
|
206
|
+
ParticularAction: ParticularAction;
|
|
157
207
|
};
|
|
158
208
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.desc = void 0;
|
|
4
|
-
const
|
|
4
|
+
const Action_1 = require("./Action");
|
|
5
5
|
exports.desc = {
|
|
6
6
|
attributes: {
|
|
7
7
|
action: {
|
|
@@ -34,10 +34,21 @@ exports.desc = {
|
|
|
34
34
|
},
|
|
35
35
|
bornAt: {
|
|
36
36
|
type: "datetime"
|
|
37
|
+
},
|
|
38
|
+
logId: {
|
|
39
|
+
type: "ref",
|
|
40
|
+
ref: "log"
|
|
41
|
+
},
|
|
42
|
+
undoData: {
|
|
43
|
+
type: "object"
|
|
44
|
+
},
|
|
45
|
+
iState: {
|
|
46
|
+
type: "enum",
|
|
47
|
+
enumeration: ["normal", "rollbacked"]
|
|
37
48
|
}
|
|
38
49
|
},
|
|
39
|
-
actionType: "
|
|
40
|
-
actions:
|
|
50
|
+
actionType: "crud",
|
|
51
|
+
actions: Action_1.actions,
|
|
41
52
|
indexes: [
|
|
42
53
|
{
|
|
43
54
|
name: 'index_bornAt_operatorId',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.style = void 0;
|
|
4
|
+
exports.style = {
|
|
5
|
+
icon: {
|
|
6
|
+
undo: '',
|
|
7
|
+
redo: '',
|
|
8
|
+
},
|
|
9
|
+
color: {
|
|
10
|
+
iState: {
|
|
11
|
+
normal: '#229954',
|
|
12
|
+
rollbacked: '#2C3E50',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|