oak-domain 2.6.10 → 3.0.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/actions/action.d.ts +1 -1
- package/lib/actions/action.js +2 -2
- package/lib/base-app-domain/ActionAuth/Schema.d.ts +25 -21
- package/lib/base-app-domain/ActionAuth/Storage.js +6 -13
- package/lib/base-app-domain/ActionDefDict.d.ts +1 -0
- package/lib/base-app-domain/ActionDefDict.js +3 -1
- package/lib/base-app-domain/EntityDict.d.ts +2 -0
- package/lib/base-app-domain/I18n/Schema.d.ts +129 -0
- package/lib/base-app-domain/I18n/Schema.js +2 -0
- package/lib/base-app-domain/I18n/Storage.d.ts +3 -0
- package/lib/base-app-domain/I18n/Storage.js +59 -0
- package/lib/base-app-domain/Modi/Action.d.ts +1 -1
- package/lib/base-app-domain/Modi/Schema.d.ts +10 -9
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +42 -28
- package/lib/base-app-domain/ModiEntity/Storage.js +1 -1
- package/lib/base-app-domain/Oper/Schema.d.ts +15 -13
- package/lib/base-app-domain/OperEntity/Schema.d.ts +41 -27
- package/lib/base-app-domain/OperEntity/Storage.js +1 -1
- package/lib/base-app-domain/Relation/Schema.d.ts +50 -22
- package/lib/base-app-domain/Relation/Storage.js +1 -4
- package/lib/base-app-domain/Relation.d.ts +10 -0
- package/lib/base-app-domain/Relation.js +10 -0
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +67 -43
- package/lib/base-app-domain/RelationAuth/Storage.js +9 -12
- package/lib/base-app-domain/Storage.js +20 -18
- package/lib/base-app-domain/User/Action.d.ts +1 -1
- package/lib/base-app-domain/User/Schema.d.ts +20 -14
- package/lib/base-app-domain/User/Storage.js +1 -2
- package/lib/base-app-domain/UserEntityGrant/Action.d.ts +5 -0
- package/lib/base-app-domain/UserEntityGrant/Action.js +5 -0
- package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +53 -17
- package/lib/base-app-domain/UserEntityGrant/Storage.js +5 -7
- package/lib/base-app-domain/UserRelation/Schema.d.ts +35 -16
- package/lib/base-app-domain/UserRelation/Storage.js +21 -1
- package/lib/base-app-domain/_SubQuery.d.ts +40 -4
- package/lib/base-app-domain/index.d.ts +1 -0
- package/lib/base-app-domain/index.js +1 -0
- package/lib/checkers/index.d.ts +2 -2
- package/lib/checkers/index.js +2 -5
- package/lib/compiler/env.d.ts +3 -1
- package/lib/compiler/env.js +12 -2
- package/lib/compiler/localeBuilder.d.ts +22 -0
- package/lib/compiler/localeBuilder.js +169 -0
- package/lib/compiler/schemalBuilder.d.ts +9 -0
- package/lib/compiler/schemalBuilder.js +774 -362
- package/lib/entities/ActionAuth.d.ts +3 -2
- package/lib/entities/ActionAuth.js +21 -22
- package/lib/entities/I18n.d.ts +9 -0
- package/lib/entities/I18n.js +37 -0
- package/lib/entities/Modi.js +35 -33
- package/lib/entities/ModiEntity.js +12 -10
- package/lib/entities/Oper.js +15 -13
- package/lib/entities/OperEntity.js +12 -10
- package/lib/entities/Relation.d.ts +3 -3
- package/lib/entities/Relation.js +27 -25
- package/lib/entities/RelationAuth.d.ts +2 -5
- package/lib/entities/RelationAuth.js +27 -23
- package/lib/entities/User.js +20 -18
- package/lib/entities/UserEntityGrant.d.ts +2 -1
- package/lib/entities/UserEntityGrant.js +12 -7
- package/lib/entities/UserRelation.d.ts +3 -0
- package/lib/entities/UserRelation.js +30 -20
- package/lib/store/AsyncRowStore.d.ts +3 -0
- package/lib/store/AsyncRowStore.js +3 -0
- package/lib/store/CascadeStore.d.ts +9 -3
- package/lib/store/CascadeStore.js +247 -113
- package/lib/store/RelationAuth.d.ts +96 -0
- package/lib/store/RelationAuth.js +1307 -0
- package/lib/store/TriggerExecutor.d.ts +1 -2
- package/lib/store/TriggerExecutor.js +22 -22
- package/lib/store/actionAuth.d.ts +4 -0
- package/lib/store/actionAuth.js +40 -0
- package/lib/store/actionDef.d.ts +4 -3
- package/lib/store/actionDef.js +14 -10
- package/lib/store/checker.d.ts +2 -9
- package/lib/store/checker.js +39 -815
- package/lib/store/filter.d.ts +31 -18
- package/lib/store/filter.js +1256 -422
- package/lib/store/modi.d.ts +1 -1
- package/lib/store/modi.js +108 -9
- package/lib/store/relation.d.ts +3 -4
- package/lib/timers/oper.js +1 -1
- package/lib/timers/vaccum.js +2 -2
- package/lib/triggers/index.d.ts +2 -3
- package/lib/triggers/index.js +2 -5
- package/lib/types/Auth.d.ts +5 -0
- package/lib/types/DataType.d.ts +3 -0
- package/lib/types/Demand.d.ts +11 -0
- package/lib/types/Demand.js +2 -1
- package/lib/types/Entity.d.ts +10 -3
- package/lib/types/EntityDesc.d.ts +8 -0
- package/lib/types/EntityDesc.js +2 -0
- package/lib/types/Environment.d.ts +57 -0
- package/lib/types/Environment.js +2 -0
- package/lib/types/Exception.d.ts +6 -0
- package/lib/types/Exception.js +25 -1
- package/lib/types/Logger.d.ts +1 -0
- package/lib/types/RowStore.d.ts +6 -4
- package/lib/types/Style.d.ts +1 -1
- package/lib/types/Trigger.d.ts +4 -5
- package/lib/types/Trigger.js +11 -6
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +2 -0
- package/lib/utils/SimpleConnector.js +1 -1
- package/lib/utils/string.d.ts +6 -0
- package/lib/utils/string.js +13 -1
- package/lib/utils/uuid.d.ts +5 -0
- package/lib/utils/uuid.js +64 -1
- package/package.json +3 -3
- package/src/entities/ActionAuth.ts +25 -33
- package/src/entities/I18n.ts +46 -0
- package/src/entities/Modi.ts +36 -36
- package/src/entities/ModiEntity.ts +14 -13
- package/src/entities/Oper.ts +17 -16
- package/src/entities/OperEntity.ts +13 -11
- package/src/entities/Relation.ts +31 -37
- package/src/entities/RelationAuth.ts +31 -37
- package/src/entities/User.ts +24 -21
- package/src/entities/UserEntityGrant.ts +16 -14
- package/src/entities/UserRelation.ts +33 -27
- package/lib/triggers/modi.d.ts +0 -5
- package/lib/triggers/modi.js +0 -72
|
@@ -2,9 +2,10 @@ import { String } from '../types/DataType';
|
|
|
2
2
|
import { EntityShape } from '../types/Entity';
|
|
3
3
|
import { Schema as Relation } from './Relation';
|
|
4
4
|
declare type Actions = string[];
|
|
5
|
+
declare type Paths = string[];
|
|
5
6
|
export interface Schema extends EntityShape {
|
|
6
|
-
relation
|
|
7
|
-
|
|
7
|
+
relation?: Relation;
|
|
8
|
+
paths: Paths;
|
|
8
9
|
destEntity: String<32>;
|
|
9
10
|
deActions: Actions;
|
|
10
11
|
}
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '用户授权',
|
|
8
|
+
attr: {
|
|
9
|
+
relation: '关系',
|
|
10
|
+
paths: '路径',
|
|
11
|
+
destEntity: '目标对象',
|
|
12
|
+
deActions: '目标对象动作',
|
|
10
13
|
},
|
|
11
|
-
{
|
|
12
|
-
name: 'path',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
config: {
|
|
16
|
-
unique: true,
|
|
17
14
|
},
|
|
18
15
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
indexes: [
|
|
17
|
+
{
|
|
18
|
+
name: 'index_entity_relation',
|
|
19
|
+
attributes: [
|
|
20
|
+
{
|
|
21
|
+
name: 'destEntity',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'relation',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
28
27
|
},
|
|
29
|
-
|
|
28
|
+
],
|
|
30
29
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
;
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '用户授权',
|
|
8
|
+
attr: {
|
|
9
|
+
module: '模块',
|
|
10
|
+
position: '文件位置',
|
|
11
|
+
namespace: '命名空间',
|
|
12
|
+
language: '语言',
|
|
13
|
+
data: '数据'
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
indexes: [
|
|
18
|
+
{
|
|
19
|
+
name: 'namespace_language',
|
|
20
|
+
attributes: [
|
|
21
|
+
{
|
|
22
|
+
name: 'namespace',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'language',
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
config: {
|
|
29
|
+
unique: true,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
configuration: {
|
|
34
|
+
actionType: 'readOnly',
|
|
35
|
+
static: true,
|
|
36
|
+
}
|
|
37
|
+
};
|
package/lib/entities/Modi.js
CHANGED
|
@@ -8,40 +8,42 @@ var IActionDef = {
|
|
|
8
8
|
},
|
|
9
9
|
is: 'active',
|
|
10
10
|
};
|
|
11
|
-
var
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
action: {
|
|
36
|
-
abandon: '放弃',
|
|
37
|
-
apply: '应用',
|
|
38
|
-
},
|
|
39
|
-
v: {
|
|
40
|
-
iState: {
|
|
41
|
-
active: '活跃的',
|
|
42
|
-
abandoned: '放弃的',
|
|
43
|
-
applied: '应用的',
|
|
11
|
+
var entityDesc = {
|
|
12
|
+
locales: {
|
|
13
|
+
zh_CN: {
|
|
14
|
+
name: '更新',
|
|
15
|
+
attr: {
|
|
16
|
+
targetEntity: '目标对象',
|
|
17
|
+
entity: '关联对象',
|
|
18
|
+
entityId: '关联对象Id',
|
|
19
|
+
action: '动作',
|
|
20
|
+
data: '数据',
|
|
21
|
+
filter: '条件',
|
|
22
|
+
extra: '其它',
|
|
23
|
+
iState: '状态',
|
|
24
|
+
},
|
|
25
|
+
action: {
|
|
26
|
+
abandon: '放弃',
|
|
27
|
+
apply: '应用',
|
|
28
|
+
},
|
|
29
|
+
v: {
|
|
30
|
+
iState: {
|
|
31
|
+
active: '活跃的',
|
|
32
|
+
abandoned: '放弃的',
|
|
33
|
+
applied: '应用的',
|
|
34
|
+
},
|
|
44
35
|
},
|
|
45
36
|
},
|
|
46
37
|
},
|
|
38
|
+
indexes: [
|
|
39
|
+
{
|
|
40
|
+
name: 'index_state',
|
|
41
|
+
attributes: [
|
|
42
|
+
{
|
|
43
|
+
name: 'iState',
|
|
44
|
+
direction: 'ASC',
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
],
|
|
47
49
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
entityId: '关联对象id',
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '更新对象连接',
|
|
8
|
+
attr: {
|
|
9
|
+
modi: '更新',
|
|
10
|
+
entity: '关联对象',
|
|
11
|
+
entityId: '关联对象id',
|
|
12
|
+
},
|
|
14
13
|
},
|
|
15
14
|
},
|
|
15
|
+
configuration: {
|
|
16
|
+
actionType: 'appendOnly',
|
|
17
|
+
}
|
|
16
18
|
};
|
package/lib/entities/Oper.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
targetEntity: '关联对象',
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '操作',
|
|
8
|
+
attr: {
|
|
9
|
+
action: '动作',
|
|
10
|
+
data: '数据',
|
|
11
|
+
filter: '选择条件',
|
|
12
|
+
extra: '其它',
|
|
13
|
+
operator: '操作者',
|
|
14
|
+
targetEntity: '关联对象',
|
|
15
|
+
},
|
|
17
16
|
},
|
|
18
17
|
},
|
|
18
|
+
configuration: {
|
|
19
|
+
actionType: 'appendOnly',
|
|
20
|
+
}
|
|
19
21
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
entityId: '关联对象id',
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '操作对象连接',
|
|
8
|
+
attr: {
|
|
9
|
+
oper: '操作',
|
|
10
|
+
entity: '关联对象',
|
|
11
|
+
entityId: '关联对象id',
|
|
12
|
+
},
|
|
14
13
|
},
|
|
15
14
|
},
|
|
15
|
+
configuration: {
|
|
16
|
+
actionType: 'appendOnly',
|
|
17
|
+
}
|
|
16
18
|
};
|
|
@@ -2,7 +2,7 @@ import { String } from '../types/DataType';
|
|
|
2
2
|
import { EntityShape } from '../types/Entity';
|
|
3
3
|
export interface Schema extends EntityShape {
|
|
4
4
|
entity: String<32>;
|
|
5
|
-
entityId
|
|
6
|
-
name
|
|
7
|
-
display
|
|
5
|
+
entityId?: String<64>;
|
|
6
|
+
name?: String<32>;
|
|
7
|
+
display?: String<32>;
|
|
8
8
|
}
|
package/lib/entities/Relation.js
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
name: '
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '用户授权',
|
|
8
|
+
attr: {
|
|
9
|
+
name: '关系',
|
|
10
|
+
entity: '目标对象',
|
|
11
|
+
entityId: '目标对象id',
|
|
12
|
+
display: '显示值',
|
|
10
13
|
},
|
|
11
|
-
{
|
|
12
|
-
name: 'entityId',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'name',
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
config: {
|
|
19
|
-
unique: true,
|
|
20
14
|
},
|
|
21
15
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
indexes: [
|
|
17
|
+
{
|
|
18
|
+
name: 'index_targetEntity_entityId_name',
|
|
19
|
+
attributes: [
|
|
20
|
+
{
|
|
21
|
+
name: 'entity',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'entityId',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'name',
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
config: {
|
|
31
|
+
unique: true,
|
|
32
|
+
},
|
|
31
33
|
},
|
|
32
|
-
|
|
34
|
+
]
|
|
33
35
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
2
|
import { EntityShape } from '../types/Entity';
|
|
3
3
|
import { Schema as Relation } from './Relation';
|
|
4
|
-
declare type Relations = string[];
|
|
5
4
|
export interface Schema extends EntityShape {
|
|
6
|
-
|
|
5
|
+
sourceRelation: Relation;
|
|
7
6
|
path: String<256>;
|
|
8
|
-
|
|
9
|
-
deRelations: Relations;
|
|
7
|
+
destRelation: Relation;
|
|
10
8
|
}
|
|
11
|
-
export {};
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
indexes: [
|
|
6
|
+
{
|
|
7
|
+
name: 'index_entity_relation_path',
|
|
8
|
+
attributes: [
|
|
9
|
+
{
|
|
10
|
+
name: 'sourceRelation',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'path',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'destRelation',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
config: {
|
|
20
|
+
unique: true,
|
|
10
21
|
},
|
|
11
|
-
{
|
|
12
|
-
name: 'path',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
config: {
|
|
16
|
-
unique: true,
|
|
17
22
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
deRelations: '目标对象关系',
|
|
23
|
+
],
|
|
24
|
+
locales: {
|
|
25
|
+
zh_CN: {
|
|
26
|
+
name: '用户授权',
|
|
27
|
+
attr: {
|
|
28
|
+
sourceRelation: '源关系',
|
|
29
|
+
path: '路径',
|
|
30
|
+
destRelation: '目标关系',
|
|
31
|
+
},
|
|
28
32
|
},
|
|
29
|
-
}
|
|
33
|
+
}
|
|
30
34
|
};
|
package/lib/entities/User.js
CHANGED
|
@@ -6,24 +6,26 @@ var UserActionDef = {
|
|
|
6
6
|
mergeTo: ['normal', 'merged'],
|
|
7
7
|
},
|
|
8
8
|
};
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
action: {
|
|
20
|
-
mergeTo: '合并',
|
|
21
|
-
},
|
|
22
|
-
v: {
|
|
23
|
-
userState: {
|
|
24
|
-
normal: '正常',
|
|
25
|
-
merged: '已被合并',
|
|
9
|
+
var entityDesc = {
|
|
10
|
+
locales: {
|
|
11
|
+
zh_CN: {
|
|
12
|
+
name: '用户',
|
|
13
|
+
attr: {
|
|
14
|
+
name: '姓名',
|
|
15
|
+
nickname: '昵称',
|
|
16
|
+
password: '密码',
|
|
17
|
+
ref: '指向用户',
|
|
18
|
+
userState: '状态',
|
|
26
19
|
},
|
|
27
|
-
|
|
20
|
+
action: {
|
|
21
|
+
mergeTo: '合并',
|
|
22
|
+
},
|
|
23
|
+
v: {
|
|
24
|
+
userState: {
|
|
25
|
+
normal: '正常',
|
|
26
|
+
merged: '已被合并',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
},
|
|
28
30
|
},
|
|
29
31
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
2
|
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { Schema as Relation } from './Relation';
|
|
3
4
|
export interface Schema extends EntityShape {
|
|
4
5
|
entity: String<32>;
|
|
5
6
|
entityId: String<64>;
|
|
6
|
-
relation:
|
|
7
|
+
relation: Relation;
|
|
7
8
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '用户授权',
|
|
8
|
+
attr: {
|
|
9
|
+
relation: '关系',
|
|
10
|
+
entity: '关联对象',
|
|
11
|
+
entityId: '关联对象id',
|
|
12
|
+
},
|
|
13
|
+
action: {
|
|
14
|
+
confirm: '领取',
|
|
15
|
+
},
|
|
11
16
|
},
|
|
12
17
|
},
|
|
13
18
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { String } from '../types/DataType';
|
|
1
2
|
import { EntityShape } from '../types/Entity';
|
|
2
3
|
import { Schema as User } from './User';
|
|
3
4
|
import { Schema as Relation } from './Relation';
|
|
4
5
|
export interface Schema extends EntityShape {
|
|
5
6
|
user: User;
|
|
6
7
|
relation: Relation;
|
|
8
|
+
entity: String<32>;
|
|
9
|
+
entityId: String<64>;
|
|
7
10
|
}
|
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
;
|
|
4
|
-
var
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
{
|
|
9
|
-
|
|
4
|
+
var entityDesc = {
|
|
5
|
+
locales: {
|
|
6
|
+
zh_CN: {
|
|
7
|
+
name: '用户对象关系',
|
|
8
|
+
attr: {
|
|
9
|
+
user: '关系',
|
|
10
|
+
relation: '目标关系',
|
|
11
|
+
entity: '目标对象',
|
|
12
|
+
entityId: '目标对象ID',
|
|
10
13
|
},
|
|
11
|
-
{
|
|
12
|
-
name: 'relation',
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
config: {
|
|
16
|
-
unique: true,
|
|
17
14
|
},
|
|
18
15
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
indexes: [
|
|
17
|
+
{
|
|
18
|
+
name: 'index_user_entity_entityId_relation',
|
|
19
|
+
attributes: [
|
|
20
|
+
{
|
|
21
|
+
name: 'user',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'entity',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'entityId',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'relation',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
config: {
|
|
34
|
+
unique: true,
|
|
35
|
+
},
|
|
26
36
|
},
|
|
27
|
-
|
|
37
|
+
]
|
|
28
38
|
};
|
|
@@ -34,6 +34,7 @@ export declare abstract class AsyncContext<ED extends EntityDict> implements Con
|
|
|
34
34
|
select<T extends keyof ED, OP extends SelectOption>(entity: T, selection: ED[T]['Selection'], option: OP): Promise<Partial<ED[T]["Schema"]>[]>;
|
|
35
35
|
aggregate<T extends keyof ED, OP extends SelectOption>(entity: T, aggregation: ED[T]['Aggregation'], option: OP): Promise<AggregationResult<ED[T]["Schema"]>>;
|
|
36
36
|
count<T extends keyof ED, OP extends SelectOption>(entity: T, selection: Pick<ED[T]['Selection'], 'filter' | 'count'>, option: OP): Promise<number>;
|
|
37
|
+
exec(script: string, txnId?: string): Promise<void>;
|
|
37
38
|
mergeMultipleResults(toBeMerged: OperationResult<ED>[]): OperationResult<ED>;
|
|
38
39
|
getCurrentTxnId(): string | undefined;
|
|
39
40
|
getSchema(): import("../types").StorageSchema<ED>;
|
|
@@ -43,6 +44,7 @@ export declare abstract class AsyncContext<ED extends EntityDict> implements Con
|
|
|
43
44
|
abstract getCurrentUserId(allowUnloggedIn?: boolean): string | undefined;
|
|
44
45
|
abstract toString(): string;
|
|
45
46
|
abstract allowUserUpdate(): boolean;
|
|
47
|
+
abstract openRootMode(): () => void;
|
|
46
48
|
}
|
|
47
49
|
export interface AsyncRowStore<ED extends EntityDict, Cxt extends Context> extends RowStore<ED> {
|
|
48
50
|
operate<T extends keyof ED, OP extends OperateOption>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): Promise<OperationResult<ED>>;
|
|
@@ -52,4 +54,5 @@ export interface AsyncRowStore<ED extends EntityDict, Cxt extends Context> exten
|
|
|
52
54
|
begin(option?: TxnOption): Promise<string>;
|
|
53
55
|
commit(txnId: string): Promise<void>;
|
|
54
56
|
rollback(txnId: string): Promise<void>;
|
|
57
|
+
exec(script: string, txnId?: string): Promise<void>;
|
|
55
58
|
}
|
|
@@ -165,6 +165,9 @@ var AsyncContext = /** @class */ (function () {
|
|
|
165
165
|
AsyncContext.prototype.count = function (entity, selection, option) {
|
|
166
166
|
return this.rowStore.count(entity, selection, this, option);
|
|
167
167
|
};
|
|
168
|
+
AsyncContext.prototype.exec = function (script, txnId) {
|
|
169
|
+
return this.rowStore.exec(script, txnId);
|
|
170
|
+
};
|
|
168
171
|
AsyncContext.prototype.mergeMultipleResults = function (toBeMerged) {
|
|
169
172
|
return this.rowStore.mergeMultipleResults(toBeMerged);
|
|
170
173
|
};
|
|
@@ -11,10 +11,12 @@ export declare abstract class CascadeStore<ED extends EntityDict & BaseEntityDic
|
|
|
11
11
|
protected abstract supportMultipleCreate(): boolean;
|
|
12
12
|
private selectionRewriters;
|
|
13
13
|
private operationRewriters;
|
|
14
|
-
private
|
|
14
|
+
private reinforceSelectionAsync;
|
|
15
|
+
private reinforceSelectionSync;
|
|
16
|
+
private reinforceSelectionInner;
|
|
15
17
|
private reinforceOperation;
|
|
16
|
-
registerOperationRewriter(rewriter: OperationRewriter<ED>): void;
|
|
17
|
-
registerSelectionRewriter(rewriter: SelectionRewriter<ED>): void;
|
|
18
|
+
registerOperationRewriter(rewriter: OperationRewriter<ED, AsyncContext<ED> | SyncContext<ED>>): void;
|
|
19
|
+
registerSelectionRewriter(rewriter: SelectionRewriter<ED, AsyncContext<ED> | SyncContext<ED>>): void;
|
|
18
20
|
protected abstract selectAbjointRow<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Partial<ED[T]['Schema']>[];
|
|
19
21
|
protected abstract updateAbjointRow<T extends keyof ED, OP extends OperateOption, Cxt extends SyncContext<ED>>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): number;
|
|
20
22
|
protected abstract selectAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Promise<Partial<ED[T]['Schema']>[]>;
|
|
@@ -94,4 +96,8 @@ export declare abstract class CascadeStore<ED extends EntityDict & BaseEntityDic
|
|
|
94
96
|
private addToResultSelections;
|
|
95
97
|
private addSingleRowToResultSelections;
|
|
96
98
|
protected cascadeSelectAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Promise<Partial<ED[T]['Schema']>[]>;
|
|
99
|
+
protected selectAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Promise<Partial<ED[T]['Schema']>[]>;
|
|
100
|
+
protected selectSync<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Partial<ED[T]['Schema']>[];
|
|
101
|
+
protected operateSync<T extends keyof ED, Cxt extends SyncContext<ED>, OP extends OperateOption>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): OperationResult<ED>;
|
|
102
|
+
protected operateAsync<T extends keyof ED, Cxt extends AsyncContext<ED>, OP extends OperateOption>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): Promise<OperationResult<ED>>;
|
|
97
103
|
}
|