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
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
|
-
import { LocaleDef } from '../types/Locale';
|
|
3
2
|
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { Schema as Relation } from './Relation';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
5
|
|
|
5
6
|
export interface Schema extends EntityShape {
|
|
6
7
|
entity: String<32>;
|
|
7
8
|
entityId: String<64>;
|
|
8
|
-
relation:
|
|
9
|
+
relation: Relation;
|
|
9
10
|
};
|
|
11
|
+
type Action = 'confirm';
|
|
10
12
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
const entityDesc: EntityDesc<Schema, Action> = {
|
|
14
|
+
locales: {
|
|
15
|
+
zh_CN: {
|
|
16
|
+
name: '用户授权',
|
|
17
|
+
attr: {
|
|
18
|
+
relation: '关系',
|
|
19
|
+
entity: '关联对象',
|
|
20
|
+
entityId: '关联对象id',
|
|
21
|
+
},
|
|
22
|
+
action: {
|
|
23
|
+
confirm: '领取',
|
|
24
|
+
},
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
27
|
};
|
|
@@ -4,41 +4,47 @@ import { EntityShape } from '../types/Entity';
|
|
|
4
4
|
import { Index } from '../types/Storage';
|
|
5
5
|
import { Schema as User } from './User';
|
|
6
6
|
import { Schema as Relation } from './Relation';
|
|
7
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
7
8
|
|
|
8
9
|
export interface Schema extends EntityShape {
|
|
9
10
|
user: User;
|
|
10
11
|
relation: Relation;
|
|
12
|
+
entity: String<32>;
|
|
13
|
+
entityId: String<64>;
|
|
11
14
|
};
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: 'relation',
|
|
16
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
17
|
+
locales: {
|
|
18
|
+
zh_CN: {
|
|
19
|
+
name: '用户对象关系',
|
|
20
|
+
attr: {
|
|
21
|
+
user: '关系',
|
|
22
|
+
relation: '目标关系',
|
|
23
|
+
entity: '目标对象',
|
|
24
|
+
entityId: '目标对象ID',
|
|
23
25
|
},
|
|
24
|
-
],
|
|
25
|
-
config: {
|
|
26
|
-
unique: true,
|
|
27
26
|
},
|
|
28
27
|
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
indexes: [
|
|
29
|
+
{
|
|
30
|
+
name: 'index_user_entity_entityId_relation',
|
|
31
|
+
attributes: [
|
|
32
|
+
{
|
|
33
|
+
name: 'user',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'entity',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'entityId',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'relation',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
config: {
|
|
46
|
+
unique: true,
|
|
47
|
+
},
|
|
42
48
|
},
|
|
43
|
-
|
|
49
|
+
]
|
|
44
50
|
};
|
package/lib/triggers/modi.d.ts
DELETED
package/lib/triggers/modi.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var triggers = [
|
|
5
|
-
{
|
|
6
|
-
name: '当modi被应用时,将相应的operate完成',
|
|
7
|
-
entity: 'modi',
|
|
8
|
-
action: 'apply',
|
|
9
|
-
when: 'after',
|
|
10
|
-
fn: function (_a, context, option) {
|
|
11
|
-
var operation = _a.operation;
|
|
12
|
-
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
13
|
-
var filter, modies, modies_1, modies_1_1, modi, targetEntity, id, action, data, filter_1, e_1_1;
|
|
14
|
-
var e_1, _b;
|
|
15
|
-
return tslib_1.__generator(this, function (_c) {
|
|
16
|
-
switch (_c.label) {
|
|
17
|
-
case 0:
|
|
18
|
-
filter = operation.filter;
|
|
19
|
-
return [4 /*yield*/, context.select('modi', {
|
|
20
|
-
data: {
|
|
21
|
-
id: 1,
|
|
22
|
-
action: 1,
|
|
23
|
-
data: 1,
|
|
24
|
-
filter: 1,
|
|
25
|
-
targetEntity: 1,
|
|
26
|
-
},
|
|
27
|
-
filter: filter,
|
|
28
|
-
}, option)];
|
|
29
|
-
case 1:
|
|
30
|
-
modies = _c.sent();
|
|
31
|
-
_c.label = 2;
|
|
32
|
-
case 2:
|
|
33
|
-
_c.trys.push([2, 7, 8, 9]);
|
|
34
|
-
modies_1 = tslib_1.__values(modies), modies_1_1 = modies_1.next();
|
|
35
|
-
_c.label = 3;
|
|
36
|
-
case 3:
|
|
37
|
-
if (!!modies_1_1.done) return [3 /*break*/, 6];
|
|
38
|
-
modi = modies_1_1.value;
|
|
39
|
-
targetEntity = modi.targetEntity, id = modi.id, action = modi.action, data = modi.data, filter_1 = modi.filter;
|
|
40
|
-
return [4 /*yield*/, context.operate(targetEntity, {
|
|
41
|
-
id: id,
|
|
42
|
-
action: action,
|
|
43
|
-
data: data,
|
|
44
|
-
filter: filter_1,
|
|
45
|
-
}, Object.assign({}, option, {
|
|
46
|
-
blockTrigger: true,
|
|
47
|
-
}))];
|
|
48
|
-
case 4:
|
|
49
|
-
_c.sent();
|
|
50
|
-
_c.label = 5;
|
|
51
|
-
case 5:
|
|
52
|
-
modies_1_1 = modies_1.next();
|
|
53
|
-
return [3 /*break*/, 3];
|
|
54
|
-
case 6: return [3 /*break*/, 9];
|
|
55
|
-
case 7:
|
|
56
|
-
e_1_1 = _c.sent();
|
|
57
|
-
e_1 = { error: e_1_1 };
|
|
58
|
-
return [3 /*break*/, 9];
|
|
59
|
-
case 8:
|
|
60
|
-
try {
|
|
61
|
-
if (modies_1_1 && !modies_1_1.done && (_b = modies_1.return)) _b.call(modies_1);
|
|
62
|
-
}
|
|
63
|
-
finally { if (e_1) throw e_1.error; }
|
|
64
|
-
return [7 /*endfinally*/];
|
|
65
|
-
case 9: return [2 /*return*/, modies.length];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
exports.default = triggers;
|