oak-domain 2.6.9 → 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 +63 -45
- 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/Port.d.ts +3 -2
- 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/money.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
package/lib/utils/uuid.d.ts
CHANGED
|
@@ -10,3 +10,8 @@ export declare function generateNewIdAsync(option?: GenerateIdOption): Promise<s
|
|
|
10
10
|
export declare function produceIds(): Promise<void>;
|
|
11
11
|
export declare function setGenerateIdOption(option: GenerateIdOption): Promise<void>;
|
|
12
12
|
export declare function generateNewId(): string;
|
|
13
|
+
/**
|
|
14
|
+
* 在一些特殊场景下根据数据生成指定的uuid,长度不能超过36byte
|
|
15
|
+
* @param: input: 输入的数据数组,应保证唯一性
|
|
16
|
+
*/
|
|
17
|
+
export declare function formUuid(...input: string[]): string;
|
package/lib/utils/uuid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateNewId = exports.setGenerateIdOption = exports.produceIds = exports.generateNewIdAsync = exports.expandUuidTo36Bytes = exports.shrinkUuidTo32Bytes = exports.sequentialUuid = void 0;
|
|
3
|
+
exports.formUuid = exports.generateNewId = exports.setGenerateIdOption = exports.produceIds = exports.generateNewIdAsync = exports.expandUuidTo36Bytes = exports.shrinkUuidTo32Bytes = exports.sequentialUuid = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var uuid_1 = require("uuid");
|
|
6
6
|
var random_1 = require("./random/random");
|
|
@@ -192,3 +192,66 @@ function generateNewId() {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
exports.generateNewId = generateNewId;
|
|
195
|
+
function stringToArrayBuffer(str) {
|
|
196
|
+
var bytes = new Array();
|
|
197
|
+
var len, c;
|
|
198
|
+
len = str.length;
|
|
199
|
+
for (var i = 0; i < len; i++) {
|
|
200
|
+
c = str.charCodeAt(i);
|
|
201
|
+
if (c >= 0x010000 && c <= 0x10FFFF) {
|
|
202
|
+
bytes.push(((c >> 18) & 0x07) | 0xF0);
|
|
203
|
+
bytes.push(((c >> 12) & 0x3F) | 0x80);
|
|
204
|
+
bytes.push(((c >> 6) & 0x3F) | 0x80);
|
|
205
|
+
bytes.push((c & 0x3F) | 0x80);
|
|
206
|
+
}
|
|
207
|
+
else if (c >= 0x000800 && c <= 0x00FFFF) {
|
|
208
|
+
bytes.push(((c >> 12) & 0x0F) | 0xE0);
|
|
209
|
+
bytes.push(((c >> 6) & 0x3F) | 0x80);
|
|
210
|
+
bytes.push((c & 0x3F) | 0x80);
|
|
211
|
+
}
|
|
212
|
+
else if (c >= 0x000080 && c <= 0x0007FF) {
|
|
213
|
+
bytes.push(((c >> 6) & 0x1F) | 0xC0);
|
|
214
|
+
bytes.push((c & 0x3F) | 0x80);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
bytes.push(c & 0xFF);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
var array = new Int8Array(bytes.length);
|
|
221
|
+
for (var i = 0; i <= bytes.length; i++) {
|
|
222
|
+
array[i] = bytes[i];
|
|
223
|
+
}
|
|
224
|
+
return array;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* 在一些特殊场景下根据数据生成指定的uuid,长度不能超过36byte
|
|
228
|
+
* @param: input: 输入的数据数组,应保证唯一性
|
|
229
|
+
*/
|
|
230
|
+
function formUuid() {
|
|
231
|
+
var input = [];
|
|
232
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
233
|
+
input[_i] = arguments[_i];
|
|
234
|
+
}
|
|
235
|
+
var uuid = input.join('-');
|
|
236
|
+
if (uuid.length <= 36) {
|
|
237
|
+
return uuid;
|
|
238
|
+
}
|
|
239
|
+
var buffer = stringToArrayBuffer(uuid);
|
|
240
|
+
var b = new Array(16);
|
|
241
|
+
var i = 0;
|
|
242
|
+
do {
|
|
243
|
+
b[i++] = 0;
|
|
244
|
+
} while (i < 16);
|
|
245
|
+
i = 0;
|
|
246
|
+
while (i < buffer.length) {
|
|
247
|
+
b[i % 16] += buffer[i];
|
|
248
|
+
i++;
|
|
249
|
+
}
|
|
250
|
+
i = 0;
|
|
251
|
+
do {
|
|
252
|
+
b[i] = b[i] % 256;
|
|
253
|
+
i++;
|
|
254
|
+
} while (i < 16);
|
|
255
|
+
return unsafeStringify(b);
|
|
256
|
+
}
|
|
257
|
+
exports.formUuid = formUuid;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oak-domain",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "XuChang"
|
|
6
6
|
},
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"make:domain": "ts-node scripts/make.ts",
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"prebuild": "npm run make:domain",
|
|
11
|
-
"test": "ts-node test/
|
|
11
|
+
"test": "ts-node test/test.ts"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"lib/**/*",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@types/lodash": "^4.14.182",
|
|
27
27
|
"@types/luxon": "^2.0.9",
|
|
28
28
|
"@types/mocha": "^8.2.0",
|
|
29
|
-
"@types/node": "^14.
|
|
29
|
+
"@types/node": "^14.18.48",
|
|
30
30
|
"@types/node-schedule": "^2.1.0",
|
|
31
31
|
"@types/react": "^17.0.2",
|
|
32
32
|
"@types/uuid": "^8.3.0",
|
|
@@ -1,49 +1,41 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
|
-
import { LocaleDef } from '../types/Locale';
|
|
3
2
|
import { EntityShape } from '../types/Entity';
|
|
4
|
-
import { Index } from '../types/Storage';
|
|
5
3
|
import { Schema as Relation } from './Relation';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
6
5
|
|
|
7
6
|
type Actions = string[];
|
|
7
|
+
type Paths = string[];
|
|
8
8
|
|
|
9
9
|
export interface Schema extends EntityShape {
|
|
10
|
-
relation
|
|
11
|
-
|
|
10
|
+
relation?: Relation;
|
|
11
|
+
paths: Paths;
|
|
12
12
|
destEntity: String<32>;
|
|
13
13
|
deActions: Actions;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
name: 'path',
|
|
16
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
17
|
+
locales: {
|
|
18
|
+
zh_CN: {
|
|
19
|
+
name: '用户授权',
|
|
20
|
+
attr: {
|
|
21
|
+
relation: '关系',
|
|
22
|
+
paths: '路径',
|
|
23
|
+
destEntity: '目标对象',
|
|
24
|
+
deActions: '目标对象动作',
|
|
26
25
|
},
|
|
27
|
-
],
|
|
28
|
-
config: {
|
|
29
|
-
unique: true,
|
|
30
26
|
},
|
|
31
27
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
relation: '关系',
|
|
44
|
-
path: '路径',
|
|
45
|
-
destEntity: '目标对象',
|
|
46
|
-
deActions: '目标对象动作',
|
|
28
|
+
indexes: [
|
|
29
|
+
{
|
|
30
|
+
name: 'index_entity_relation',
|
|
31
|
+
attributes: [
|
|
32
|
+
{
|
|
33
|
+
name: 'destEntity',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'relation',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
47
39
|
},
|
|
48
|
-
|
|
40
|
+
],
|
|
49
41
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
|
|
5
|
+
export interface Schema extends EntityShape {
|
|
6
|
+
module: String<64>;
|
|
7
|
+
position: String<188>;
|
|
8
|
+
namespace: String<256>;
|
|
9
|
+
language: String<32>;
|
|
10
|
+
data: Object;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
+
locales: {
|
|
15
|
+
zh_CN: {
|
|
16
|
+
name: '用户授权',
|
|
17
|
+
attr: {
|
|
18
|
+
module: '模块',
|
|
19
|
+
position: '文件位置',
|
|
20
|
+
namespace: '命名空间',
|
|
21
|
+
language: '语言',
|
|
22
|
+
data: '数据'
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
indexes: [
|
|
27
|
+
{
|
|
28
|
+
name: 'namespace_language',
|
|
29
|
+
attributes: [
|
|
30
|
+
{
|
|
31
|
+
name: 'namespace',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'language',
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
config: {
|
|
38
|
+
unique: true,
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
configuration: {
|
|
43
|
+
actionType: 'readOnly',
|
|
44
|
+
static: true,
|
|
45
|
+
}
|
|
46
|
+
};
|
package/src/entities/Modi.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ActionDef } from '../types/Action';
|
|
2
2
|
import { String } from '../types/DataType';
|
|
3
3
|
import { EntityShape } from '../types/Entity';
|
|
4
|
-
import {
|
|
5
|
-
import { Index } from '../types/Storage';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
6
5
|
|
|
7
6
|
export interface Schema extends EntityShape {
|
|
8
7
|
targetEntity: String<32>; // 要操作的目标对象
|
|
@@ -27,43 +26,44 @@ const IActionDef: ActionDef<IAction, IState> = {
|
|
|
27
26
|
|
|
28
27
|
type Action = IAction;
|
|
29
28
|
|
|
30
|
-
const
|
|
31
|
-
{
|
|
32
|
-
name: 'index_state',
|
|
33
|
-
attributes: [
|
|
34
|
-
{
|
|
35
|
-
name: 'iState',
|
|
36
|
-
direction: 'ASC',
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const locale: LocaleDef<Schema, Action, '', {
|
|
29
|
+
const entityDesc: EntityDesc<Schema, Action, '', {
|
|
43
30
|
iState: IState,
|
|
44
31
|
}> = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
32
|
+
locales: {
|
|
33
|
+
zh_CN: {
|
|
34
|
+
name: '更新',
|
|
35
|
+
attr: {
|
|
36
|
+
targetEntity: '目标对象',
|
|
37
|
+
entity: '关联对象',
|
|
38
|
+
entityId: '关联对象Id',
|
|
39
|
+
action: '动作',
|
|
40
|
+
data: '数据',
|
|
41
|
+
filter: '条件',
|
|
42
|
+
extra: '其它',
|
|
43
|
+
iState: '状态',
|
|
44
|
+
},
|
|
45
|
+
action: {
|
|
46
|
+
abandon: '放弃',
|
|
47
|
+
apply: '应用',
|
|
48
|
+
},
|
|
49
|
+
v: {
|
|
50
|
+
iState: {
|
|
51
|
+
active: '活跃的',
|
|
52
|
+
abandoned: '放弃的',
|
|
53
|
+
applied: '应用的',
|
|
54
|
+
},
|
|
66
55
|
},
|
|
67
56
|
},
|
|
68
57
|
},
|
|
58
|
+
indexes: [
|
|
59
|
+
{
|
|
60
|
+
name: 'index_state',
|
|
61
|
+
attributes: [
|
|
62
|
+
{
|
|
63
|
+
name: 'iState',
|
|
64
|
+
direction: 'ASC',
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
69
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape
|
|
3
|
-
import { LocaleDef } from '../types/Locale';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
4
3
|
import { Schema as Modi } from './Modi';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
5
|
|
|
6
6
|
export interface Schema extends EntityShape {
|
|
7
7
|
modi: Modi,
|
|
@@ -9,17 +9,18 @@ export interface Schema extends EntityShape {
|
|
|
9
9
|
entityId: String<64>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
entity: '关联对象',
|
|
22
|
-
entityId: '关联对象id',
|
|
12
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
+
locales: {
|
|
14
|
+
zh_CN: {
|
|
15
|
+
name: '更新对象连接',
|
|
16
|
+
attr: {
|
|
17
|
+
modi: '更新',
|
|
18
|
+
entity: '关联对象',
|
|
19
|
+
entityId: '关联对象id',
|
|
20
|
+
},
|
|
23
21
|
},
|
|
24
22
|
},
|
|
23
|
+
configuration: {
|
|
24
|
+
actionType: 'appendOnly',
|
|
25
|
+
}
|
|
25
26
|
};
|
package/src/entities/Oper.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { String, Int, Datetime, Image, Boolean, Text } from '../types/DataType';
|
|
2
|
-
import { EntityShape
|
|
3
|
-
import { LocaleDef } from '../types/Locale';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
4
3
|
import { Schema as User } from './User';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
5
|
|
|
6
6
|
export interface Schema extends EntityShape {
|
|
7
7
|
action: String<16>;
|
|
@@ -12,20 +12,21 @@ export interface Schema extends EntityShape {
|
|
|
12
12
|
targetEntity: String<32>;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
operator: '操作者',
|
|
28
|
-
targetEntity: '关联对象',
|
|
15
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
16
|
+
locales: {
|
|
17
|
+
zh_CN: {
|
|
18
|
+
name: '操作',
|
|
19
|
+
attr: {
|
|
20
|
+
action: '动作',
|
|
21
|
+
data: '数据',
|
|
22
|
+
filter: '选择条件',
|
|
23
|
+
extra: '其它',
|
|
24
|
+
operator: '操作者',
|
|
25
|
+
targetEntity: '关联对象',
|
|
26
|
+
},
|
|
29
27
|
},
|
|
30
28
|
},
|
|
29
|
+
configuration: {
|
|
30
|
+
actionType: 'appendOnly',
|
|
31
|
+
}
|
|
31
32
|
};
|
|
@@ -2,6 +2,7 @@ import { String } from '../types/DataType';
|
|
|
2
2
|
import { EntityShape, Configuration } from '../types/Entity';
|
|
3
3
|
import { LocaleDef } from '../types/Locale';
|
|
4
4
|
import { Schema as Oper } from './Oper';
|
|
5
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
6
|
|
|
6
7
|
export interface Schema extends EntityShape {
|
|
7
8
|
oper: Oper,
|
|
@@ -9,17 +10,18 @@ export interface Schema extends EntityShape {
|
|
|
9
10
|
entityId: String<64>;
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
entity: '关联对象',
|
|
22
|
-
entityId: '关联对象id',
|
|
13
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
+
locales: {
|
|
15
|
+
zh_CN: {
|
|
16
|
+
name: '操作对象连接',
|
|
17
|
+
attr: {
|
|
18
|
+
oper: '操作',
|
|
19
|
+
entity: '关联对象',
|
|
20
|
+
entityId: '关联对象id',
|
|
21
|
+
},
|
|
23
22
|
},
|
|
24
23
|
},
|
|
24
|
+
configuration: {
|
|
25
|
+
actionType: 'appendOnly',
|
|
26
|
+
}
|
|
25
27
|
};
|
package/src/entities/Relation.ts
CHANGED
|
@@ -1,49 +1,43 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
|
-
import { LocaleDef } from '../types/Locale';
|
|
3
2
|
import { EntityShape } from '../types/Entity';
|
|
4
|
-
import {
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
4
|
|
|
6
5
|
export interface Schema extends EntityShape {
|
|
7
6
|
entity: String<32>;
|
|
8
|
-
entityId
|
|
9
|
-
name
|
|
10
|
-
display
|
|
7
|
+
entityId?: String<64>; // 可以为空
|
|
8
|
+
name?: String<32>;
|
|
9
|
+
display?: String<32>;
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
name: 'entityId',
|
|
12
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
+
locales: {
|
|
14
|
+
zh_CN: {
|
|
15
|
+
name: '用户授权',
|
|
16
|
+
attr: {
|
|
17
|
+
name: '关系',
|
|
18
|
+
entity: '目标对象',
|
|
19
|
+
entityId: '目标对象id',
|
|
20
|
+
display: '显示值',
|
|
23
21
|
},
|
|
24
|
-
{
|
|
25
|
-
name: 'name',
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
config: {
|
|
29
|
-
unique: true,
|
|
30
22
|
},
|
|
31
23
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
24
|
+
indexes: [
|
|
25
|
+
{
|
|
26
|
+
name: 'index_targetEntity_entityId_name',
|
|
27
|
+
attributes: [
|
|
28
|
+
{
|
|
29
|
+
name: 'entity',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'entityId',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'name',
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
config: {
|
|
39
|
+
unique: true,
|
|
40
|
+
},
|
|
47
41
|
},
|
|
48
|
-
|
|
42
|
+
]
|
|
49
43
|
};
|
|
@@ -1,49 +1,43 @@
|
|
|
1
1
|
import { String } from '../types/DataType';
|
|
2
|
-
import { LocaleDef } from '../types/Locale';
|
|
3
2
|
import { EntityShape } from '../types/Entity';
|
|
4
|
-
import { Index } from '../types/Storage';
|
|
5
3
|
import { Schema as Relation } from './Relation';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// destRelation需要有sourceRelation才能授权/除权
|
|
9
7
|
export interface Schema extends EntityShape {
|
|
10
|
-
|
|
8
|
+
sourceRelation: Relation;
|
|
11
9
|
path: String<256>;
|
|
12
|
-
|
|
13
|
-
deRelations: Relations;
|
|
10
|
+
destRelation: Relation;
|
|
14
11
|
};
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
+
indexes: [
|
|
15
|
+
{
|
|
16
|
+
name: 'index_entity_relation_path',
|
|
17
|
+
attributes: [
|
|
18
|
+
{
|
|
19
|
+
name: 'sourceRelation',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'path',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'destRelation',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
config: {
|
|
29
|
+
unique: true,
|
|
26
30
|
},
|
|
27
|
-
],
|
|
28
|
-
config: {
|
|
29
|
-
unique: true,
|
|
30
31
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
zh_CN: {
|
|
41
|
-
name: '用户授权',
|
|
42
|
-
attr: {
|
|
43
|
-
relation: '关系',
|
|
44
|
-
path: '路径',
|
|
45
|
-
destEntity: '目标对象',
|
|
46
|
-
deRelations: '目标对象关系',
|
|
32
|
+
],
|
|
33
|
+
locales: {
|
|
34
|
+
zh_CN: {
|
|
35
|
+
name: '用户授权',
|
|
36
|
+
attr: {
|
|
37
|
+
sourceRelation: '源关系',
|
|
38
|
+
path: '路径',
|
|
39
|
+
destRelation: '目标关系',
|
|
40
|
+
},
|
|
47
41
|
},
|
|
48
|
-
}
|
|
42
|
+
}
|
|
49
43
|
};
|
package/src/entities/User.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { String, Int, Text, Image, Datetime } from '../types/DataType';
|
|
2
|
-
import { LocaleDef } from '../types/Locale';
|
|
3
2
|
import { EntityShape } from '../types/Entity';
|
|
4
3
|
import { ActionDef } from '../types/Action';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
5
|
|
|
6
6
|
export interface Schema extends EntityShape {
|
|
7
7
|
name?: String<16>;
|
|
@@ -15,32 +15,35 @@ type UserState = 'normal' | 'merged';
|
|
|
15
15
|
|
|
16
16
|
type Action = UserAction;
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
const UserActionDef: ActionDef<UserAction, UserState> = {
|
|
19
20
|
stm: {
|
|
20
21
|
mergeTo: ['normal', 'merged'],
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
const
|
|
25
|
-
userState: UserState
|
|
25
|
+
const entityDesc: EntityDesc<Schema, Action, '', {
|
|
26
|
+
userState: UserState,
|
|
26
27
|
}> = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
action: {
|
|
37
|
-
mergeTo: '合并',
|
|
38
|
-
},
|
|
39
|
-
v: {
|
|
40
|
-
userState: {
|
|
41
|
-
normal: '正常',
|
|
42
|
-
merged: '已被合并',
|
|
28
|
+
locales: {
|
|
29
|
+
zh_CN: {
|
|
30
|
+
name: '用户',
|
|
31
|
+
attr: {
|
|
32
|
+
name: '姓名',
|
|
33
|
+
nickname: '昵称',
|
|
34
|
+
password: '密码',
|
|
35
|
+
ref: '指向用户',
|
|
36
|
+
userState: '状态',
|
|
43
37
|
},
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
action: {
|
|
39
|
+
mergeTo: '合并',
|
|
40
|
+
},
|
|
41
|
+
v: {
|
|
42
|
+
userState: {
|
|
43
|
+
normal: '正常',
|
|
44
|
+
merged: '已被合并',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
46
49
|
};
|