oak-domain 2.6.7 → 2.6.9
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/ActionAuth/Schema.d.ts +156 -0
- package/lib/base-app-domain/ActionAuth/Schema.js +2 -0
- package/lib/base-app-domain/ActionAuth/Storage.d.ts +3 -0
- package/lib/base-app-domain/ActionAuth/Storage.js +49 -0
- package/lib/base-app-domain/EntityDict.d.ts +8 -0
- package/lib/base-app-domain/Modi/Storage.js +5 -0
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +112 -4
- package/lib/base-app-domain/ModiEntity/Storage.js +4 -1
- package/lib/base-app-domain/Oper/Storage.js +3 -0
- package/lib/base-app-domain/OperEntity/Schema.d.ts +112 -4
- package/lib/base-app-domain/OperEntity/Storage.js +4 -1
- package/lib/base-app-domain/Relation/Schema.d.ts +160 -0
- package/lib/base-app-domain/Relation/Schema.js +2 -0
- package/lib/base-app-domain/Relation/Storage.d.ts +3 -0
- package/lib/base-app-domain/Relation/Storage.js +57 -0
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +156 -0
- package/lib/base-app-domain/RelationAuth/Schema.js +2 -0
- package/lib/base-app-domain/RelationAuth/Storage.d.ts +3 -0
- package/lib/base-app-domain/RelationAuth/Storage.js +49 -0
- package/lib/base-app-domain/Storage.js +20 -12
- package/lib/base-app-domain/User/Schema.d.ts +11 -0
- package/lib/base-app-domain/UserEntityGrant/Storage.js +3 -0
- package/lib/base-app-domain/UserRelation/Schema.d.ts +175 -0
- package/lib/base-app-domain/UserRelation/Schema.js +2 -0
- package/lib/base-app-domain/UserRelation/Storage.d.ts +3 -0
- package/lib/base-app-domain/UserRelation/Storage.js +36 -0
- package/lib/base-app-domain/_SubQuery.d.ts +32 -0
- package/lib/checkers/index.js +1 -0
- package/lib/compiler/schemalBuilder.js +4 -1
- package/lib/entities/ActionAuth.d.ts +11 -0
- package/lib/entities/ActionAuth.js +30 -0
- package/lib/entities/Relation.d.ts +8 -0
- package/lib/entities/Relation.js +33 -0
- package/lib/entities/RelationAuth.d.ts +11 -0
- package/lib/entities/RelationAuth.js +30 -0
- package/lib/entities/UserRelation.d.ts +7 -0
- package/lib/entities/UserRelation.js +28 -0
- package/lib/store/CascadeStore.js +5 -4
- package/lib/store/checker.d.ts +1 -0
- package/lib/store/checker.js +200 -19
- package/lib/store/modi.js +2 -2
- package/lib/store/relation.js +1 -0
- package/lib/timers/vaccum.js +4 -4
- package/lib/types/Auth.d.ts +1 -1
- package/lib/types/Connector.d.ts +6 -0
- package/lib/types/Entity.d.ts +2 -1
- package/lib/types/Exception.d.ts +5 -2
- package/lib/types/Exception.js +15 -1
- package/lib/utils/SimpleConnector.d.ts +15 -2
- package/lib/utils/SimpleConnector.js +39 -4
- package/lib/utils/money.d.ts +2 -1
- package/lib/utils/money.js +17 -1
- package/lib/utils/validator.js +1 -1
- package/lib/utils/version.d.ts +7 -0
- package/lib/utils/version.js +21 -0
- package/package.json +1 -1
- package/src/entities/ActionAuth.ts +49 -0
- package/src/entities/Relation.ts +49 -0
- package/src/entities/RelationAuth.ts +49 -0
- package/src/entities/UserRelation.ts +44 -0
- package/lib/checkers/SyncCheckExecutor.d.ts +0 -9
- package/lib/checkers/SyncCheckExecutor.js +0 -103
|
@@ -5,21 +5,29 @@ import * as SubQuery from "../_SubQuery";
|
|
|
5
5
|
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
|
|
6
6
|
import { AppendOnlyAction } from "../../actions/action";
|
|
7
7
|
import * as Oper from "../Oper/Schema";
|
|
8
|
+
import * as ActionAuth from "../ActionAuth/Schema";
|
|
9
|
+
import * as Relation from "../Relation/Schema";
|
|
10
|
+
import * as RelationAuth from "../RelationAuth/Schema";
|
|
8
11
|
import * as User from "../User/Schema";
|
|
9
12
|
import * as UserEntityGrant from "../UserEntityGrant/Schema";
|
|
13
|
+
import * as UserRelation from "../UserRelation/Schema";
|
|
10
14
|
export declare type OpSchema = EntityShape & {
|
|
11
15
|
operId: ForeignKey<"oper">;
|
|
12
|
-
entity: "user" | "userEntityGrant" | string;
|
|
16
|
+
entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string;
|
|
13
17
|
entityId: String<64>;
|
|
14
18
|
};
|
|
15
19
|
export declare type OpAttr = keyof OpSchema;
|
|
16
20
|
export declare type Schema = EntityShape & {
|
|
17
21
|
operId: ForeignKey<"oper">;
|
|
18
|
-
entity: "user" | "userEntityGrant" | string;
|
|
22
|
+
entity: "actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string;
|
|
19
23
|
entityId: String<64>;
|
|
20
24
|
oper: Oper.Schema;
|
|
25
|
+
actionAuth?: ActionAuth.Schema;
|
|
26
|
+
relation?: Relation.Schema;
|
|
27
|
+
relationAuth?: RelationAuth.Schema;
|
|
21
28
|
user?: User.Schema;
|
|
22
29
|
userEntityGrant?: UserEntityGrant.Schema;
|
|
30
|
+
userRelation?: UserRelation.Schema;
|
|
23
31
|
} & {
|
|
24
32
|
[A in ExpressionKey]?: any;
|
|
25
33
|
};
|
|
@@ -32,10 +40,14 @@ declare type AttrFilter<E> = {
|
|
|
32
40
|
oper: Oper.Filter;
|
|
33
41
|
entity: E;
|
|
34
42
|
entityId: Q_StringValue;
|
|
43
|
+
actionAuth: ActionAuth.Filter;
|
|
44
|
+
relation: Relation.Filter;
|
|
45
|
+
relationAuth: RelationAuth.Filter;
|
|
35
46
|
user: User.Filter;
|
|
36
47
|
userEntityGrant: UserEntityGrant.Filter;
|
|
48
|
+
userRelation: UserRelation.Filter;
|
|
37
49
|
};
|
|
38
|
-
export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
|
50
|
+
export declare type Filter<E = Q_EnumValue<"actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
|
|
39
51
|
export declare type Projection = {
|
|
40
52
|
"#id"?: NodeId;
|
|
41
53
|
[k: string]: any;
|
|
@@ -47,8 +59,12 @@ export declare type Projection = {
|
|
|
47
59
|
oper?: Oper.Projection;
|
|
48
60
|
entity?: number;
|
|
49
61
|
entityId?: number;
|
|
62
|
+
actionAuth?: ActionAuth.Projection;
|
|
63
|
+
relation?: Relation.Projection;
|
|
64
|
+
relationAuth?: RelationAuth.Projection;
|
|
50
65
|
user?: User.Projection;
|
|
51
66
|
userEntityGrant?: UserEntityGrant.Projection;
|
|
67
|
+
userRelation?: UserRelation.Projection;
|
|
52
68
|
} & Partial<ExprOp<OpAttr | string>>;
|
|
53
69
|
declare type OperEntityIdProjection = OneOf<{
|
|
54
70
|
id: number;
|
|
@@ -56,12 +72,24 @@ declare type OperEntityIdProjection = OneOf<{
|
|
|
56
72
|
declare type OperIdProjection = OneOf<{
|
|
57
73
|
operId: number;
|
|
58
74
|
}>;
|
|
75
|
+
declare type ActionAuthIdProjection = OneOf<{
|
|
76
|
+
entityId: number;
|
|
77
|
+
}>;
|
|
78
|
+
declare type RelationIdProjection = OneOf<{
|
|
79
|
+
entityId: number;
|
|
80
|
+
}>;
|
|
81
|
+
declare type RelationAuthIdProjection = OneOf<{
|
|
82
|
+
entityId: number;
|
|
83
|
+
}>;
|
|
59
84
|
declare type UserIdProjection = OneOf<{
|
|
60
85
|
entityId: number;
|
|
61
86
|
}>;
|
|
62
87
|
declare type UserEntityGrantIdProjection = OneOf<{
|
|
63
88
|
entityId: number;
|
|
64
89
|
}>;
|
|
90
|
+
declare type UserRelationIdProjection = OneOf<{
|
|
91
|
+
entityId: number;
|
|
92
|
+
}>;
|
|
65
93
|
export declare type SortAttr = {
|
|
66
94
|
id: number;
|
|
67
95
|
} | {
|
|
@@ -78,10 +106,18 @@ export declare type SortAttr = {
|
|
|
78
106
|
entity: number;
|
|
79
107
|
} | {
|
|
80
108
|
entityId: number;
|
|
109
|
+
} | {
|
|
110
|
+
actionAuth: ActionAuth.SortAttr;
|
|
111
|
+
} | {
|
|
112
|
+
relation: Relation.SortAttr;
|
|
113
|
+
} | {
|
|
114
|
+
relationAuth: RelationAuth.SortAttr;
|
|
81
115
|
} | {
|
|
82
116
|
user: User.SortAttr;
|
|
83
117
|
} | {
|
|
84
118
|
userEntityGrant: UserEntityGrant.SortAttr;
|
|
119
|
+
} | {
|
|
120
|
+
userRelation: UserRelation.SortAttr;
|
|
85
121
|
} | {
|
|
86
122
|
[k: string]: any;
|
|
87
123
|
} | OneOf<ExprOp<OpAttr | string>>;
|
|
@@ -99,6 +135,39 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
|
|
|
99
135
|
} | {
|
|
100
136
|
operId: String<64>;
|
|
101
137
|
})) & ({
|
|
138
|
+
entity?: never;
|
|
139
|
+
entityId?: never;
|
|
140
|
+
actionAuth: ActionAuth.CreateSingleOperation;
|
|
141
|
+
} | {
|
|
142
|
+
entity: "actionAuth";
|
|
143
|
+
entityId: String<64>;
|
|
144
|
+
actionAuth: ActionAuth.UpdateOperation;
|
|
145
|
+
} | {
|
|
146
|
+
entity: "actionAuth";
|
|
147
|
+
entityId: String<64>;
|
|
148
|
+
} | {
|
|
149
|
+
entity?: never;
|
|
150
|
+
entityId?: never;
|
|
151
|
+
relation: Relation.CreateSingleOperation;
|
|
152
|
+
} | {
|
|
153
|
+
entity: "relation";
|
|
154
|
+
entityId: String<64>;
|
|
155
|
+
relation: Relation.UpdateOperation;
|
|
156
|
+
} | {
|
|
157
|
+
entity: "relation";
|
|
158
|
+
entityId: String<64>;
|
|
159
|
+
} | {
|
|
160
|
+
entity?: never;
|
|
161
|
+
entityId?: never;
|
|
162
|
+
relationAuth: RelationAuth.CreateSingleOperation;
|
|
163
|
+
} | {
|
|
164
|
+
entity: "relationAuth";
|
|
165
|
+
entityId: String<64>;
|
|
166
|
+
relationAuth: RelationAuth.UpdateOperation;
|
|
167
|
+
} | {
|
|
168
|
+
entity: "relationAuth";
|
|
169
|
+
entityId: String<64>;
|
|
170
|
+
} | {
|
|
102
171
|
entity?: never;
|
|
103
172
|
entityId?: never;
|
|
104
173
|
user: User.CreateSingleOperation;
|
|
@@ -120,6 +189,17 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
|
|
|
120
189
|
} | {
|
|
121
190
|
entity: "userEntityGrant";
|
|
122
191
|
entityId: String<64>;
|
|
192
|
+
} | {
|
|
193
|
+
entity?: never;
|
|
194
|
+
entityId?: never;
|
|
195
|
+
userRelation: UserRelation.CreateSingleOperation;
|
|
196
|
+
} | {
|
|
197
|
+
entity: "userRelation";
|
|
198
|
+
entityId: String<64>;
|
|
199
|
+
userRelation: UserRelation.UpdateOperation;
|
|
200
|
+
} | {
|
|
201
|
+
entity: "userRelation";
|
|
202
|
+
entityId: String<64>;
|
|
123
203
|
} | {
|
|
124
204
|
entity?: string;
|
|
125
205
|
entityId?: string;
|
|
@@ -135,6 +215,18 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|
|
135
215
|
oper?: never;
|
|
136
216
|
operId?: String<64> | null;
|
|
137
217
|
})) & ({
|
|
218
|
+
actionAuth?: ActionAuth.CreateSingleOperation | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
|
219
|
+
entityId?: never;
|
|
220
|
+
entity?: never;
|
|
221
|
+
} | {
|
|
222
|
+
relation?: Relation.CreateSingleOperation | Relation.UpdateOperation | Relation.RemoveOperation;
|
|
223
|
+
entityId?: never;
|
|
224
|
+
entity?: never;
|
|
225
|
+
} | {
|
|
226
|
+
relationAuth?: RelationAuth.CreateSingleOperation | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
|
227
|
+
entityId?: never;
|
|
228
|
+
entity?: never;
|
|
229
|
+
} | {
|
|
138
230
|
user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
|
|
139
231
|
entityId?: never;
|
|
140
232
|
entity?: never;
|
|
@@ -143,24 +235,40 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
|
|
|
143
235
|
entityId?: never;
|
|
144
236
|
entity?: never;
|
|
145
237
|
} | {
|
|
146
|
-
|
|
238
|
+
userRelation?: UserRelation.CreateSingleOperation | UserRelation.UpdateOperation | UserRelation.RemoveOperation;
|
|
239
|
+
entityId?: never;
|
|
240
|
+
entity?: never;
|
|
241
|
+
} | {
|
|
242
|
+
entity?: ("actionAuth" | "relation" | "relationAuth" | "user" | "userEntityGrant" | "userRelation" | string) | null;
|
|
147
243
|
entityId?: String<64> | null;
|
|
148
244
|
}) & {
|
|
149
245
|
[k: string]: any;
|
|
150
246
|
};
|
|
151
247
|
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
152
248
|
export declare type RemoveOperationData = {} & ({
|
|
249
|
+
actionAuth?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation;
|
|
250
|
+
} | {
|
|
251
|
+
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
252
|
+
} | {
|
|
253
|
+
relationAuth?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation;
|
|
254
|
+
} | {
|
|
153
255
|
user?: User.UpdateOperation | User.RemoveOperation;
|
|
154
256
|
} | {
|
|
155
257
|
userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
|
|
258
|
+
} | {
|
|
259
|
+
userRelation?: UserRelation.UpdateOperation | UserRelation.RemoveOperation;
|
|
156
260
|
} | {
|
|
157
261
|
[k: string]: any;
|
|
158
262
|
});
|
|
159
263
|
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
160
264
|
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
161
265
|
export declare type OperIdSubQuery = Selection<OperIdProjection>;
|
|
266
|
+
export declare type ActionAuthIdSubQuery = Selection<ActionAuthIdProjection>;
|
|
267
|
+
export declare type RelationIdSubQuery = Selection<RelationIdProjection>;
|
|
268
|
+
export declare type RelationAuthIdSubQuery = Selection<RelationAuthIdProjection>;
|
|
162
269
|
export declare type UserIdSubQuery = Selection<UserIdProjection>;
|
|
163
270
|
export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
|
|
271
|
+
export declare type UserRelationIdSubQuery = Selection<UserRelationIdProjection>;
|
|
164
272
|
export declare type OperEntityIdSubQuery = Selection<OperEntityIdProjection>;
|
|
165
273
|
export declare type EntityDef = {
|
|
166
274
|
Schema: Schema;
|
|
@@ -5,17 +5,20 @@ var action_1 = require("../../actions/action");
|
|
|
5
5
|
exports.desc = {
|
|
6
6
|
attributes: {
|
|
7
7
|
operId: {
|
|
8
|
+
notNull: true,
|
|
8
9
|
type: "ref",
|
|
9
10
|
ref: "oper"
|
|
10
11
|
},
|
|
11
12
|
entity: {
|
|
13
|
+
notNull: true,
|
|
12
14
|
type: "varchar",
|
|
13
15
|
params: {
|
|
14
16
|
length: 32
|
|
15
17
|
},
|
|
16
|
-
ref: ["user", "userEntityGrant"]
|
|
18
|
+
ref: ["actionAuth", "relation", "relationAuth", "user", "userEntityGrant", "userRelation"]
|
|
17
19
|
},
|
|
18
20
|
entityId: {
|
|
21
|
+
notNull: true,
|
|
19
22
|
type: "varchar",
|
|
20
23
|
params: {
|
|
21
24
|
length: 64
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { String } from "../../types/DataType";
|
|
2
|
+
import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
3
|
+
import { OneOf } from "../../types/Polyfill";
|
|
4
|
+
import * as SubQuery from "../_SubQuery";
|
|
5
|
+
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
|
|
6
|
+
import { GenericAction } from "../../actions/action";
|
|
7
|
+
import * as ActionAuth from "../ActionAuth/Schema";
|
|
8
|
+
import * as RelationAuth from "../RelationAuth/Schema";
|
|
9
|
+
import * as UserRelation from "../UserRelation/Schema";
|
|
10
|
+
import * as ModiEntity from "../ModiEntity/Schema";
|
|
11
|
+
import * as OperEntity from "../OperEntity/Schema";
|
|
12
|
+
export declare type OpSchema = EntityShape & {
|
|
13
|
+
entity: String<32>;
|
|
14
|
+
entityId: String<64>;
|
|
15
|
+
name: String<32>;
|
|
16
|
+
display: String<32>;
|
|
17
|
+
};
|
|
18
|
+
export declare type OpAttr = keyof OpSchema;
|
|
19
|
+
export declare type Schema = EntityShape & {
|
|
20
|
+
entity: String<32>;
|
|
21
|
+
entityId: String<64>;
|
|
22
|
+
name: String<32>;
|
|
23
|
+
display: String<32>;
|
|
24
|
+
actionAuth$relation?: Array<ActionAuth.Schema>;
|
|
25
|
+
actionAuth$relation$$aggr?: AggregationResult<ActionAuth.Schema>;
|
|
26
|
+
relationAuth$relation?: Array<RelationAuth.Schema>;
|
|
27
|
+
relationAuth$relation$$aggr?: AggregationResult<RelationAuth.Schema>;
|
|
28
|
+
userRelation$relation?: Array<UserRelation.Schema>;
|
|
29
|
+
userRelation$relation$$aggr?: AggregationResult<UserRelation.Schema>;
|
|
30
|
+
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
31
|
+
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
|
32
|
+
operEntity$entity?: Array<OperEntity.Schema>;
|
|
33
|
+
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
|
|
34
|
+
} & {
|
|
35
|
+
[A in ExpressionKey]?: any;
|
|
36
|
+
};
|
|
37
|
+
declare type AttrFilter = {
|
|
38
|
+
id: Q_StringValue | SubQuery.RelationIdSubQuery;
|
|
39
|
+
$$createAt$$: Q_DateValue;
|
|
40
|
+
$$seq$$: Q_StringValue;
|
|
41
|
+
$$updateAt$$: Q_DateValue;
|
|
42
|
+
entity: Q_StringValue;
|
|
43
|
+
entityId: Q_StringValue;
|
|
44
|
+
name: Q_StringValue;
|
|
45
|
+
display: Q_StringValue;
|
|
46
|
+
};
|
|
47
|
+
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
48
|
+
export declare type Projection = {
|
|
49
|
+
"#id"?: NodeId;
|
|
50
|
+
[k: string]: any;
|
|
51
|
+
id?: number;
|
|
52
|
+
$$createAt$$?: number;
|
|
53
|
+
$$updateAt$$?: number;
|
|
54
|
+
$$seq$$?: number;
|
|
55
|
+
entity?: number;
|
|
56
|
+
entityId?: number;
|
|
57
|
+
name?: number;
|
|
58
|
+
display?: number;
|
|
59
|
+
actionAuth$relation?: ActionAuth.Selection & {
|
|
60
|
+
$entity: "actionAuth";
|
|
61
|
+
};
|
|
62
|
+
actionAuth$relation$$aggr?: ActionAuth.Aggregation & {
|
|
63
|
+
$entity: "actionAuth";
|
|
64
|
+
};
|
|
65
|
+
relationAuth$relation?: RelationAuth.Selection & {
|
|
66
|
+
$entity: "relationAuth";
|
|
67
|
+
};
|
|
68
|
+
relationAuth$relation$$aggr?: RelationAuth.Aggregation & {
|
|
69
|
+
$entity: "relationAuth";
|
|
70
|
+
};
|
|
71
|
+
userRelation$relation?: UserRelation.Selection & {
|
|
72
|
+
$entity: "userRelation";
|
|
73
|
+
};
|
|
74
|
+
userRelation$relation$$aggr?: UserRelation.Aggregation & {
|
|
75
|
+
$entity: "userRelation";
|
|
76
|
+
};
|
|
77
|
+
modiEntity$entity?: ModiEntity.Selection & {
|
|
78
|
+
$entity: "modiEntity";
|
|
79
|
+
};
|
|
80
|
+
modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
|
|
81
|
+
$entity: "modiEntity";
|
|
82
|
+
};
|
|
83
|
+
operEntity$entity?: OperEntity.Selection & {
|
|
84
|
+
$entity: "operEntity";
|
|
85
|
+
};
|
|
86
|
+
operEntity$entity$$aggr?: OperEntity.Aggregation & {
|
|
87
|
+
$entity: "operEntity";
|
|
88
|
+
};
|
|
89
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
90
|
+
declare type RelationIdProjection = OneOf<{
|
|
91
|
+
id: number;
|
|
92
|
+
}>;
|
|
93
|
+
export declare type SortAttr = {
|
|
94
|
+
id: number;
|
|
95
|
+
} | {
|
|
96
|
+
$$createAt$$: number;
|
|
97
|
+
} | {
|
|
98
|
+
$$seq$$: number;
|
|
99
|
+
} | {
|
|
100
|
+
$$updateAt$$: number;
|
|
101
|
+
} | {
|
|
102
|
+
entity: number;
|
|
103
|
+
} | {
|
|
104
|
+
entityId: number;
|
|
105
|
+
} | {
|
|
106
|
+
name: number;
|
|
107
|
+
} | {
|
|
108
|
+
display: number;
|
|
109
|
+
} | {
|
|
110
|
+
[k: string]: any;
|
|
111
|
+
} | OneOf<ExprOp<OpAttr | string>>;
|
|
112
|
+
export declare type SortNode = {
|
|
113
|
+
$attr: SortAttr;
|
|
114
|
+
$direction?: "asc" | "desc";
|
|
115
|
+
};
|
|
116
|
+
export declare type Sorter = SortNode[];
|
|
117
|
+
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
|
118
|
+
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
|
|
119
|
+
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
|
120
|
+
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
|
|
121
|
+
entity?: string;
|
|
122
|
+
entityId?: string;
|
|
123
|
+
[K: string]: any;
|
|
124
|
+
}) & {
|
|
125
|
+
actionAuth$relation?: OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, ActionAuth.Filter> | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">> | OakOperation<ActionAuth.UpdateOperation["action"], Omit<ActionAuth.UpdateOperationData, "relation" | "relationId">, ActionAuth.Filter>>;
|
|
126
|
+
relationAuth$relation?: OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "relation" | "relationId">, RelationAuth.Filter> | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "relation" | "relationId">> | OakOperation<RelationAuth.UpdateOperation["action"], Omit<RelationAuth.UpdateOperationData, "relation" | "relationId">, RelationAuth.Filter>>;
|
|
127
|
+
userRelation$relation?: OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, UserRelation.Filter> | OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">> | OakOperation<UserRelation.UpdateOperation["action"], Omit<UserRelation.UpdateOperationData, "relation" | "relationId">, UserRelation.Filter>>;
|
|
128
|
+
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
129
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
130
|
+
};
|
|
131
|
+
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
132
|
+
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
133
|
+
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
134
|
+
export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
|
|
135
|
+
[k: string]: any;
|
|
136
|
+
actionAuth$relation?: ActionAuth.UpdateOperation | ActionAuth.RemoveOperation | OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<ActionAuth.CreateOperationData, "relation" | "relationId">> | ActionAuth.UpdateOperation | ActionAuth.RemoveOperation>;
|
|
137
|
+
relationAuth$relation?: RelationAuth.UpdateOperation | RelationAuth.RemoveOperation | OakOperation<"create", Omit<RelationAuth.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<RelationAuth.CreateOperationData, "relation" | "relationId">> | RelationAuth.UpdateOperation | RelationAuth.RemoveOperation>;
|
|
138
|
+
userRelation$relation?: UserRelation.UpdateOperation | UserRelation.RemoveOperation | OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">[]> | Array<OakOperation<"create", Omit<UserRelation.CreateOperationData, "relation" | "relationId">> | UserRelation.UpdateOperation | UserRelation.RemoveOperation>;
|
|
139
|
+
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
140
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
141
|
+
};
|
|
142
|
+
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
143
|
+
export declare type RemoveOperationData = {};
|
|
144
|
+
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
145
|
+
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
146
|
+
export declare type RelationIdSubQuery = Selection<RelationIdProjection>;
|
|
147
|
+
export declare type EntityDef = {
|
|
148
|
+
Schema: Schema;
|
|
149
|
+
OpSchema: OpSchema;
|
|
150
|
+
Action: OakMakeAction<GenericAction> | string;
|
|
151
|
+
Selection: Selection;
|
|
152
|
+
Aggregation: Aggregation;
|
|
153
|
+
Operation: Operation;
|
|
154
|
+
Create: CreateOperation;
|
|
155
|
+
Update: UpdateOperation;
|
|
156
|
+
Remove: RemoveOperation;
|
|
157
|
+
CreateSingle: CreateSingleOperation;
|
|
158
|
+
CreateMulti: CreateMultipleOperation;
|
|
159
|
+
};
|
|
160
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.desc = void 0;
|
|
4
|
+
var action_1 = require("../../actions/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
|
+
name: {
|
|
22
|
+
notNull: true,
|
|
23
|
+
type: "varchar",
|
|
24
|
+
params: {
|
|
25
|
+
length: 32
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
display: {
|
|
29
|
+
notNull: true,
|
|
30
|
+
type: "varchar",
|
|
31
|
+
params: {
|
|
32
|
+
length: 32
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
actionType: "crud",
|
|
37
|
+
actions: action_1.genericActions,
|
|
38
|
+
indexes: [
|
|
39
|
+
{
|
|
40
|
+
name: 'index_entity_entityId_name',
|
|
41
|
+
attributes: [
|
|
42
|
+
{
|
|
43
|
+
name: 'entity'
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'entityId'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'name'
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
config: {
|
|
53
|
+
unique: true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { String, ForeignKey } from "../../types/DataType";
|
|
2
|
+
import { Q_DateValue, Q_StringValue, Q_EnumValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
|
|
3
|
+
import { OneOf } from "../../types/Polyfill";
|
|
4
|
+
import * as SubQuery from "../_SubQuery";
|
|
5
|
+
import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
|
|
6
|
+
import { GenericAction } from "../../actions/action";
|
|
7
|
+
import * as Relation from "../Relation/Schema";
|
|
8
|
+
import * as ModiEntity from "../ModiEntity/Schema";
|
|
9
|
+
import * as OperEntity from "../OperEntity/Schema";
|
|
10
|
+
declare type Relations = string[];
|
|
11
|
+
export declare type OpSchema = EntityShape & {
|
|
12
|
+
relationId: ForeignKey<"relation">;
|
|
13
|
+
path: String<256>;
|
|
14
|
+
destEntity: String<32>;
|
|
15
|
+
deRelations: Relations;
|
|
16
|
+
};
|
|
17
|
+
export declare type OpAttr = keyof OpSchema;
|
|
18
|
+
export declare type Schema = EntityShape & {
|
|
19
|
+
relationId: ForeignKey<"relation">;
|
|
20
|
+
path: String<256>;
|
|
21
|
+
destEntity: String<32>;
|
|
22
|
+
deRelations: Relations;
|
|
23
|
+
relation: Relation.Schema;
|
|
24
|
+
modiEntity$entity?: Array<ModiEntity.Schema>;
|
|
25
|
+
modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
|
|
26
|
+
operEntity$entity?: Array<OperEntity.Schema>;
|
|
27
|
+
operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
|
|
28
|
+
} & {
|
|
29
|
+
[A in ExpressionKey]?: any;
|
|
30
|
+
};
|
|
31
|
+
declare type AttrFilter = {
|
|
32
|
+
id: Q_StringValue | SubQuery.RelationAuthIdSubQuery;
|
|
33
|
+
$$createAt$$: Q_DateValue;
|
|
34
|
+
$$seq$$: Q_StringValue;
|
|
35
|
+
$$updateAt$$: Q_DateValue;
|
|
36
|
+
relationId: Q_StringValue | SubQuery.RelationIdSubQuery;
|
|
37
|
+
relation: Relation.Filter;
|
|
38
|
+
path: Q_StringValue;
|
|
39
|
+
destEntity: Q_StringValue;
|
|
40
|
+
deRelations: Q_EnumValue<Relations>;
|
|
41
|
+
};
|
|
42
|
+
export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
|
|
43
|
+
export declare type Projection = {
|
|
44
|
+
"#id"?: NodeId;
|
|
45
|
+
[k: string]: any;
|
|
46
|
+
id?: number;
|
|
47
|
+
$$createAt$$?: number;
|
|
48
|
+
$$updateAt$$?: number;
|
|
49
|
+
$$seq$$?: number;
|
|
50
|
+
relationId?: number;
|
|
51
|
+
relation?: Relation.Projection;
|
|
52
|
+
path?: number;
|
|
53
|
+
destEntity?: number;
|
|
54
|
+
deRelations?: number;
|
|
55
|
+
modiEntity$entity?: ModiEntity.Selection & {
|
|
56
|
+
$entity: "modiEntity";
|
|
57
|
+
};
|
|
58
|
+
modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
|
|
59
|
+
$entity: "modiEntity";
|
|
60
|
+
};
|
|
61
|
+
operEntity$entity?: OperEntity.Selection & {
|
|
62
|
+
$entity: "operEntity";
|
|
63
|
+
};
|
|
64
|
+
operEntity$entity$$aggr?: OperEntity.Aggregation & {
|
|
65
|
+
$entity: "operEntity";
|
|
66
|
+
};
|
|
67
|
+
} & Partial<ExprOp<OpAttr | string>>;
|
|
68
|
+
declare type RelationAuthIdProjection = OneOf<{
|
|
69
|
+
id: number;
|
|
70
|
+
}>;
|
|
71
|
+
declare type RelationIdProjection = OneOf<{
|
|
72
|
+
relationId: number;
|
|
73
|
+
}>;
|
|
74
|
+
export declare type SortAttr = {
|
|
75
|
+
id: number;
|
|
76
|
+
} | {
|
|
77
|
+
$$createAt$$: number;
|
|
78
|
+
} | {
|
|
79
|
+
$$seq$$: number;
|
|
80
|
+
} | {
|
|
81
|
+
$$updateAt$$: number;
|
|
82
|
+
} | {
|
|
83
|
+
relationId: number;
|
|
84
|
+
} | {
|
|
85
|
+
relation: Relation.SortAttr;
|
|
86
|
+
} | {
|
|
87
|
+
path: number;
|
|
88
|
+
} | {
|
|
89
|
+
destEntity: number;
|
|
90
|
+
} | {
|
|
91
|
+
deRelations: number;
|
|
92
|
+
} | {
|
|
93
|
+
[k: string]: any;
|
|
94
|
+
} | OneOf<ExprOp<OpAttr | string>>;
|
|
95
|
+
export declare type SortNode = {
|
|
96
|
+
$attr: SortAttr;
|
|
97
|
+
$direction?: "asc" | "desc";
|
|
98
|
+
};
|
|
99
|
+
export declare type Sorter = SortNode[];
|
|
100
|
+
export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
|
|
101
|
+
export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
|
|
102
|
+
export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
|
|
103
|
+
export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "relationId">> & (({
|
|
104
|
+
relationId?: never;
|
|
105
|
+
relation: Relation.CreateSingleOperation;
|
|
106
|
+
} | {
|
|
107
|
+
relationId: String<64>;
|
|
108
|
+
relation?: Relation.UpdateOperation;
|
|
109
|
+
} | {
|
|
110
|
+
relationId: String<64>;
|
|
111
|
+
})) & {
|
|
112
|
+
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
113
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
114
|
+
};
|
|
115
|
+
export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
|
|
116
|
+
export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
|
|
117
|
+
export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
|
|
118
|
+
export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId">> & (({
|
|
119
|
+
relation: Relation.CreateSingleOperation;
|
|
120
|
+
relationId?: never;
|
|
121
|
+
} | {
|
|
122
|
+
relation: Relation.UpdateOperation;
|
|
123
|
+
relationId?: never;
|
|
124
|
+
} | {
|
|
125
|
+
relation: Relation.RemoveOperation;
|
|
126
|
+
relationId?: never;
|
|
127
|
+
} | {
|
|
128
|
+
relation?: never;
|
|
129
|
+
relationId?: String<64> | null;
|
|
130
|
+
})) & {
|
|
131
|
+
[k: string]: any;
|
|
132
|
+
modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
133
|
+
operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
|
|
134
|
+
};
|
|
135
|
+
export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
|
|
136
|
+
export declare type RemoveOperationData = {} & (({
|
|
137
|
+
relation?: Relation.UpdateOperation | Relation.RemoveOperation;
|
|
138
|
+
}));
|
|
139
|
+
export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
|
|
140
|
+
export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
|
|
141
|
+
export declare type RelationIdSubQuery = Selection<RelationIdProjection>;
|
|
142
|
+
export declare type RelationAuthIdSubQuery = Selection<RelationAuthIdProjection>;
|
|
143
|
+
export declare type EntityDef = {
|
|
144
|
+
Schema: Schema;
|
|
145
|
+
OpSchema: OpSchema;
|
|
146
|
+
Action: OakMakeAction<GenericAction> | string;
|
|
147
|
+
Selection: Selection;
|
|
148
|
+
Aggregation: Aggregation;
|
|
149
|
+
Operation: Operation;
|
|
150
|
+
Create: CreateOperation;
|
|
151
|
+
Update: UpdateOperation;
|
|
152
|
+
Remove: RemoveOperation;
|
|
153
|
+
CreateSingle: CreateSingleOperation;
|
|
154
|
+
CreateMulti: CreateMultipleOperation;
|
|
155
|
+
};
|
|
156
|
+
export {};
|