oak-domain 4.1.0 → 4.2.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/ActionAuth/Schema.d.ts +185 -185
- package/lib/base-app-domain/ActionDefDict.d.ts +2 -2
- package/lib/base-app-domain/I18n/Schema.d.ts +128 -128
- package/lib/base-app-domain/Modi/Schema.d.ts +135 -135
- package/lib/base-app-domain/ModiEntity/Schema.d.ts +383 -383
- package/lib/base-app-domain/Oper/Schema.d.ts +158 -152
- package/lib/base-app-domain/Oper/Storage.js +19 -1
- package/lib/base-app-domain/OperEntity/Schema.d.ts +372 -372
- package/lib/base-app-domain/Path/Schema.d.ts +148 -148
- package/lib/base-app-domain/Relation/Schema.d.ts +187 -187
- package/lib/base-app-domain/RelationAuth/Schema.d.ts +213 -213
- package/lib/base-app-domain/User/Action.d.ts +1 -0
- package/lib/base-app-domain/User/Action.js +3 -3
- package/lib/base-app-domain/User/Schema.d.ts +209 -209
- package/lib/base-app-domain/UserEntityClaim/Schema.d.ts +263 -263
- package/lib/base-app-domain/UserEntityGrant/Action.d.ts +5 -5
- package/lib/base-app-domain/UserEntityGrant/Action.js +5 -5
- package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +130 -130
- package/lib/base-app-domain/UserRelation/Schema.d.ts +207 -207
- package/lib/compiler/localeBuilder.d.ts +27 -27
- package/lib/compiler/localeBuilder.js +215 -215
- package/lib/compiler/routerBuilder.js +263 -263
- package/lib/compiler/schemalBuilder.js +4167 -4160
- package/lib/entities/Oper.d.ts +2 -1
- package/lib/entities/Oper.js +16 -1
- package/lib/entities/User.d.ts +10 -0
- package/lib/entities/User.js +3 -2
- package/lib/index.d.ts +0 -22
- package/lib/index.js +1 -35
- package/lib/store/AsyncRowStore.d.ts +66 -65
- package/lib/store/AsyncRowStore.js +180 -180
- package/lib/store/CascadeStore.js +7 -31
- package/lib/store/RelationAuth.d.ts +103 -103
- package/lib/store/RelationAuth.js +1209 -1343
- package/lib/store/SyncRowStore.d.ts +29 -29
- package/lib/store/TriggerExecutor.js +468 -468
- package/lib/store/actionDef.js +278 -278
- package/lib/store/checker.js +487 -487
- package/lib/triggers/index.d.ts +2 -2
- package/lib/triggers/index.js +21 -1
- package/lib/types/Aspect.d.ts +13 -13
- package/lib/types/Configuration.d.ts +42 -0
- package/lib/types/Configuration.js +3 -0
- package/lib/types/Connector.d.ts +38 -38
- package/lib/types/Context.d.ts +7 -7
- package/lib/types/Entity.d.ts +4 -4
- package/lib/types/Environment.d.ts +93 -93
- package/lib/types/Exception.d.ts +155 -155
- package/lib/types/Exception.js +436 -436
- package/lib/types/Sync.d.ts +48 -0
- package/lib/types/Sync.js +8 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/utils/SimpleConnector.d.ts +64 -64
- package/lib/utils/SimpleConnector.js +206 -206
- package/lib/utils/assert.d.ts +5 -5
- package/lib/utils/projection.d.ts +1 -1
- package/lib/utils/relationPath.d.ts +31 -0
- package/lib/utils/relationPath.js +202 -0
- package/package.json +51 -51
- package/src/entities/ActionAuth.ts +41 -41
- package/src/entities/I18n.ts +45 -45
- package/src/entities/Modi.ts +69 -69
- package/src/entities/ModiEntity.ts +26 -26
- package/src/entities/Oper.ts +48 -32
- package/src/entities/OperEntity.ts +27 -27
- package/src/entities/Path.ts +43 -43
- package/src/entities/Relation.ts +43 -43
- package/src/entities/RelationAuth.ts +44 -44
- package/src/entities/User.ts +48 -48
- package/src/entities/UserEntityClaim.ts +29 -29
- package/src/entities/UserEntityGrant.ts +24 -24
- package/src/entities/UserRelation.ts +50 -50
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destructDirectPath = exports.destructRelationPath = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const assert_1 = tslib_1.__importDefault(require("assert"));
|
|
6
|
+
const relation_1 = require("../store/relation");
|
|
7
|
+
/**
|
|
8
|
+
* 根据entity的相对path,以及定义的userRelationFilter,找到根结点对象上相应的userRelations
|
|
9
|
+
* @param schema
|
|
10
|
+
* @param entity
|
|
11
|
+
* @param path
|
|
12
|
+
* @param relationFilter
|
|
13
|
+
* @param recursive
|
|
14
|
+
*/
|
|
15
|
+
function destructRelationPath(schema, entity, path, relationFilter, recursive) {
|
|
16
|
+
(0, assert_1.default)(!recursive, 'recursive的情况还没处理,等跑出来再说, by Xc');
|
|
17
|
+
if (path === '') {
|
|
18
|
+
return {
|
|
19
|
+
projection: {
|
|
20
|
+
id: 1,
|
|
21
|
+
userRelation$entity: {
|
|
22
|
+
$entity: 'userRelation',
|
|
23
|
+
data: {
|
|
24
|
+
id: 1,
|
|
25
|
+
relationId: 1,
|
|
26
|
+
relation: {
|
|
27
|
+
id: 1,
|
|
28
|
+
name: 1,
|
|
29
|
+
},
|
|
30
|
+
entity: 1,
|
|
31
|
+
entityId: 1,
|
|
32
|
+
userId: 1,
|
|
33
|
+
},
|
|
34
|
+
filter: relationFilter,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
getData: (d) => {
|
|
38
|
+
return d.userRelation$entity;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const paths = path.split('.');
|
|
43
|
+
const makeIter = (e, idx) => {
|
|
44
|
+
if (idx === paths.length) {
|
|
45
|
+
return {
|
|
46
|
+
projection: {
|
|
47
|
+
id: 1,
|
|
48
|
+
userRelation$entity: {
|
|
49
|
+
$entity: 'userRelation',
|
|
50
|
+
data: {
|
|
51
|
+
id: 1,
|
|
52
|
+
relationId: 1,
|
|
53
|
+
relation: {
|
|
54
|
+
id: 1,
|
|
55
|
+
name: 1,
|
|
56
|
+
},
|
|
57
|
+
entity: 1,
|
|
58
|
+
entityId: 1,
|
|
59
|
+
userId: 1,
|
|
60
|
+
},
|
|
61
|
+
filter: relationFilter,
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
getData: (d) => {
|
|
65
|
+
return d.userRelation$entity;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const attr = paths[idx];
|
|
70
|
+
const rel = (0, relation_1.judgeRelation)(schema, e, attr);
|
|
71
|
+
if (rel === 2) {
|
|
72
|
+
const { projection, getData } = makeIter(attr, idx + 1);
|
|
73
|
+
return {
|
|
74
|
+
projection: {
|
|
75
|
+
id: 1,
|
|
76
|
+
[attr]: projection,
|
|
77
|
+
},
|
|
78
|
+
getData: (d) => d[attr] && getData(d[attr]),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
else if (typeof rel === 'string') {
|
|
82
|
+
const { projection, getData } = makeIter(rel, idx + 1);
|
|
83
|
+
return {
|
|
84
|
+
projection: {
|
|
85
|
+
id: 1,
|
|
86
|
+
[attr]: projection,
|
|
87
|
+
},
|
|
88
|
+
getData: (d) => d[attr] && getData(d[attr]),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
(0, assert_1.default)(rel instanceof Array);
|
|
93
|
+
const [e2] = rel;
|
|
94
|
+
const { projection, getData } = makeIter(e2, idx + 1);
|
|
95
|
+
return {
|
|
96
|
+
projection: {
|
|
97
|
+
id: 1,
|
|
98
|
+
[attr]: {
|
|
99
|
+
$entity: e2,
|
|
100
|
+
data: projection,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
getData: (d) => d[attr] && d[attr].map((ele) => getData(ele)),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return makeIter(entity, 0);
|
|
108
|
+
}
|
|
109
|
+
exports.destructRelationPath = destructRelationPath;
|
|
110
|
+
/**
|
|
111
|
+
* 根据entity的相对path,找到对应的根结点对象上的直接userId
|
|
112
|
+
* @param schema
|
|
113
|
+
* @param entity
|
|
114
|
+
* @param path
|
|
115
|
+
* @param recursive
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
function destructDirectPath(schema, entity, path, recursive) {
|
|
119
|
+
(0, assert_1.default)(!recursive, '直接对象上不可能有recursive');
|
|
120
|
+
(0, assert_1.default)(path, '直接对象的路径最终要指向user对象,不可能为空');
|
|
121
|
+
const paths = path.split('.');
|
|
122
|
+
const makeIter = (e, idx) => {
|
|
123
|
+
const attr = paths[idx];
|
|
124
|
+
const rel = (0, relation_1.judgeRelation)(schema, e, attr);
|
|
125
|
+
if (idx === paths.length - 1) {
|
|
126
|
+
if (rel === 2) {
|
|
127
|
+
(0, assert_1.default)(attr === 'user');
|
|
128
|
+
return {
|
|
129
|
+
projection: {
|
|
130
|
+
id: 1,
|
|
131
|
+
entity: 1,
|
|
132
|
+
entityId: 1,
|
|
133
|
+
},
|
|
134
|
+
getData: (d) => {
|
|
135
|
+
if (d) {
|
|
136
|
+
return {
|
|
137
|
+
entity: e,
|
|
138
|
+
entityId: d.id,
|
|
139
|
+
userId: d.entityId,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
(0, assert_1.default)(rel === 'user');
|
|
147
|
+
return {
|
|
148
|
+
projection: {
|
|
149
|
+
id: 1,
|
|
150
|
+
[`${attr}Id`]: 1,
|
|
151
|
+
},
|
|
152
|
+
getData: (d) => {
|
|
153
|
+
if (d) {
|
|
154
|
+
return {
|
|
155
|
+
entity: e,
|
|
156
|
+
entityId: d.id,
|
|
157
|
+
userId: d[`${attr}Id`]
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (rel === 2) {
|
|
165
|
+
const { projection, getData } = makeIter(attr, idx + 1);
|
|
166
|
+
return {
|
|
167
|
+
projection: {
|
|
168
|
+
id: 1,
|
|
169
|
+
[attr]: projection,
|
|
170
|
+
},
|
|
171
|
+
getData: (d) => d[attr] && getData(d[attr]),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
else if (typeof rel === 'string') {
|
|
175
|
+
const { projection, getData } = makeIter(rel, idx + 1);
|
|
176
|
+
return {
|
|
177
|
+
projection: {
|
|
178
|
+
id: 1,
|
|
179
|
+
[attr]: projection,
|
|
180
|
+
},
|
|
181
|
+
getData: (d) => d[attr] && getData(d[attr]),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
(0, assert_1.default)(rel instanceof Array);
|
|
186
|
+
const [e2, fk] = rel;
|
|
187
|
+
const { projection, getData } = makeIter(e2, idx + 1);
|
|
188
|
+
return {
|
|
189
|
+
projection: {
|
|
190
|
+
id: 1,
|
|
191
|
+
[attr]: {
|
|
192
|
+
$entity: e2,
|
|
193
|
+
data: projection,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
getData: (d) => d[attr] && d[attr].map((ele) => getData(ele)),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return makeIter(entity, 0);
|
|
201
|
+
}
|
|
202
|
+
exports.destructDirectPath = destructDirectPath;
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "oak-domain",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"author": {
|
|
5
|
-
"name": "XuChang"
|
|
6
|
-
},
|
|
7
|
-
"scripts": {
|
|
8
|
-
"make:domain": "ts-node scripts/make.ts",
|
|
9
|
-
"build": "tsc",
|
|
10
|
-
"prebuild": "npm run make:domain",
|
|
11
|
-
"test": "ts-node test/test.ts"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"lib/**/*",
|
|
15
|
-
"src/entities/*"
|
|
16
|
-
],
|
|
17
|
-
"main": "lib/index",
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@babel/cli": "^7.12.13",
|
|
20
|
-
"@babel/core": "^7.12.13",
|
|
21
|
-
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
22
|
-
"@babel/preset-env": "^7.12.13",
|
|
23
|
-
"@babel/preset-typescript": "^7.12.13",
|
|
24
|
-
"@types/assert": "^1.5.6",
|
|
25
|
-
"@types/cross-spawn": "^6.0.2",
|
|
26
|
-
"@types/fs-extra": "^9.0.13",
|
|
27
|
-
"@types/lodash": "^4.14.182",
|
|
28
|
-
"@types/mocha": "^8.2.0",
|
|
29
|
-
"@types/node": "^20.6.1",
|
|
30
|
-
"@types/node-schedule": "^2.1.0",
|
|
31
|
-
"@types/react": "^17.0.2",
|
|
32
|
-
"@types/uuid": "^8.3.0",
|
|
33
|
-
"@types/wechat-miniprogram": "^3.4.1",
|
|
34
|
-
"assert": "^2.0.0",
|
|
35
|
-
"cross-env": "^7.0.2",
|
|
36
|
-
"cross-spawn": "^7.0.3",
|
|
37
|
-
"fs-extra": "^10.0.0",
|
|
38
|
-
"lodash": "^4.17.21",
|
|
39
|
-
"mocha": "^8.2.1",
|
|
40
|
-
"node-watch": "^0.7.4",
|
|
41
|
-
"ts-node": "^10.9.1",
|
|
42
|
-
"tslib": "^2.4.0",
|
|
43
|
-
"typescript": "^5.2.2"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"dayjs": "^1.11.9",
|
|
47
|
-
"node-schedule": "^2.1.1",
|
|
48
|
-
"uuid": "^9.0.0",
|
|
49
|
-
"webidl-conversions": "^5.0.0"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "oak-domain",
|
|
3
|
+
"version": "4.2.0",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "XuChang"
|
|
6
|
+
},
|
|
7
|
+
"scripts": {
|
|
8
|
+
"make:domain": "ts-node scripts/make.ts",
|
|
9
|
+
"build": "tsc",
|
|
10
|
+
"prebuild": "npm run make:domain",
|
|
11
|
+
"test": "ts-node test/test.ts"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"lib/**/*",
|
|
15
|
+
"src/entities/*"
|
|
16
|
+
],
|
|
17
|
+
"main": "lib/index",
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@babel/cli": "^7.12.13",
|
|
20
|
+
"@babel/core": "^7.12.13",
|
|
21
|
+
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
|
22
|
+
"@babel/preset-env": "^7.12.13",
|
|
23
|
+
"@babel/preset-typescript": "^7.12.13",
|
|
24
|
+
"@types/assert": "^1.5.6",
|
|
25
|
+
"@types/cross-spawn": "^6.0.2",
|
|
26
|
+
"@types/fs-extra": "^9.0.13",
|
|
27
|
+
"@types/lodash": "^4.14.182",
|
|
28
|
+
"@types/mocha": "^8.2.0",
|
|
29
|
+
"@types/node": "^20.6.1",
|
|
30
|
+
"@types/node-schedule": "^2.1.0",
|
|
31
|
+
"@types/react": "^17.0.2",
|
|
32
|
+
"@types/uuid": "^8.3.0",
|
|
33
|
+
"@types/wechat-miniprogram": "^3.4.1",
|
|
34
|
+
"assert": "^2.0.0",
|
|
35
|
+
"cross-env": "^7.0.2",
|
|
36
|
+
"cross-spawn": "^7.0.3",
|
|
37
|
+
"fs-extra": "^10.0.0",
|
|
38
|
+
"lodash": "^4.17.21",
|
|
39
|
+
"mocha": "^8.2.1",
|
|
40
|
+
"node-watch": "^0.7.4",
|
|
41
|
+
"ts-node": "^10.9.1",
|
|
42
|
+
"tslib": "^2.4.0",
|
|
43
|
+
"typescript": "^5.2.2"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"dayjs": "^1.11.9",
|
|
47
|
+
"node-schedule": "^2.1.1",
|
|
48
|
+
"uuid": "^9.0.0",
|
|
49
|
+
"webidl-conversions": "^5.0.0"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { EntityShape } from '../types/Entity';
|
|
2
|
-
import { Schema as Relation } from './Relation';
|
|
3
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
-
import { Schema as Path } from './Path';
|
|
5
|
-
|
|
6
|
-
type Actions = string[];
|
|
7
|
-
|
|
8
|
-
export interface Schema extends EntityShape {
|
|
9
|
-
relation?: Relation;
|
|
10
|
-
path: Path;
|
|
11
|
-
deActions: Actions;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
15
|
-
locales: {
|
|
16
|
-
zh_CN: {
|
|
17
|
-
name: '用户授权',
|
|
18
|
-
attr: {
|
|
19
|
-
relation: '关系',
|
|
20
|
-
path: '路径',
|
|
21
|
-
deActions: '目标对象动作',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
indexes: [
|
|
26
|
-
{
|
|
27
|
-
name: 'index_relation_path',
|
|
28
|
-
attributes: [
|
|
29
|
-
{
|
|
30
|
-
name: 'relation',
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'path',
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
config: {
|
|
37
|
-
unique: true,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
};
|
|
1
|
+
import { EntityShape } from '../types/Entity';
|
|
2
|
+
import { Schema as Relation } from './Relation';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
import { Schema as Path } from './Path';
|
|
5
|
+
|
|
6
|
+
type Actions = string[];
|
|
7
|
+
|
|
8
|
+
export interface Schema extends EntityShape {
|
|
9
|
+
relation?: Relation;
|
|
10
|
+
path: Path;
|
|
11
|
+
deActions: Actions;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
15
|
+
locales: {
|
|
16
|
+
zh_CN: {
|
|
17
|
+
name: '用户授权',
|
|
18
|
+
attr: {
|
|
19
|
+
relation: '关系',
|
|
20
|
+
path: '路径',
|
|
21
|
+
deActions: '目标对象动作',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
indexes: [
|
|
26
|
+
{
|
|
27
|
+
name: 'index_relation_path',
|
|
28
|
+
attributes: [
|
|
29
|
+
{
|
|
30
|
+
name: 'relation',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'path',
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
config: {
|
|
37
|
+
unique: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
package/src/entities/I18n.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
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
|
-
static: true,
|
|
44
|
-
},
|
|
45
|
-
};
|
|
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
|
+
static: true,
|
|
44
|
+
},
|
|
45
|
+
};
|
package/src/entities/Modi.ts
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { ActionDef } from '../types/Action';
|
|
2
|
-
import { String } from '../types/DataType';
|
|
3
|
-
import { EntityShape } from '../types/Entity';
|
|
4
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
-
|
|
6
|
-
export interface Schema extends EntityShape {
|
|
7
|
-
targetEntity: String<32>; // 要操作的目标对象
|
|
8
|
-
entity: String<32>; // 关联的目标对象
|
|
9
|
-
entityId: String<64>; // 关联的目标对象id
|
|
10
|
-
action: String<16>;
|
|
11
|
-
data: Object;
|
|
12
|
-
filter?: Object;
|
|
13
|
-
extra?: Object;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
type IState = 'active' | 'applied' | 'abandoned';
|
|
17
|
-
type IAction = 'apply' | 'abandon';
|
|
18
|
-
|
|
19
|
-
const IActionDef: ActionDef<IAction, IState> = {
|
|
20
|
-
stm: {
|
|
21
|
-
apply: ['active', 'applied'],
|
|
22
|
-
abandon: ['active', 'abandoned'],
|
|
23
|
-
},
|
|
24
|
-
is: 'active',
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
type Action = IAction;
|
|
28
|
-
|
|
29
|
-
const entityDesc: EntityDesc<Schema, Action, '', {
|
|
30
|
-
iState: IState,
|
|
31
|
-
}> = {
|
|
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
|
-
},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
indexes: [
|
|
59
|
-
{
|
|
60
|
-
name: 'index_state',
|
|
61
|
-
attributes: [
|
|
62
|
-
{
|
|
63
|
-
name: 'iState',
|
|
64
|
-
direction: 'ASC',
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
],
|
|
69
|
-
};
|
|
1
|
+
import { ActionDef } from '../types/Action';
|
|
2
|
+
import { String } from '../types/DataType';
|
|
3
|
+
import { EntityShape } from '../types/Entity';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
+
|
|
6
|
+
export interface Schema extends EntityShape {
|
|
7
|
+
targetEntity: String<32>; // 要操作的目标对象
|
|
8
|
+
entity: String<32>; // 关联的目标对象
|
|
9
|
+
entityId: String<64>; // 关联的目标对象id
|
|
10
|
+
action: String<16>;
|
|
11
|
+
data: Object;
|
|
12
|
+
filter?: Object;
|
|
13
|
+
extra?: Object;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type IState = 'active' | 'applied' | 'abandoned';
|
|
17
|
+
type IAction = 'apply' | 'abandon';
|
|
18
|
+
|
|
19
|
+
const IActionDef: ActionDef<IAction, IState> = {
|
|
20
|
+
stm: {
|
|
21
|
+
apply: ['active', 'applied'],
|
|
22
|
+
abandon: ['active', 'abandoned'],
|
|
23
|
+
},
|
|
24
|
+
is: 'active',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type Action = IAction;
|
|
28
|
+
|
|
29
|
+
const entityDesc: EntityDesc<Schema, Action, '', {
|
|
30
|
+
iState: IState,
|
|
31
|
+
}> = {
|
|
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
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
indexes: [
|
|
59
|
+
{
|
|
60
|
+
name: 'index_state',
|
|
61
|
+
attributes: [
|
|
62
|
+
{
|
|
63
|
+
name: 'iState',
|
|
64
|
+
direction: 'ASC',
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { Schema as Modi } from './Modi';
|
|
4
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
-
|
|
6
|
-
export interface Schema extends EntityShape {
|
|
7
|
-
modi: Modi,
|
|
8
|
-
entity: String<32>;
|
|
9
|
-
entityId: String<64>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
-
locales: {
|
|
14
|
-
zh_CN: {
|
|
15
|
-
name: '更新对象连接',
|
|
16
|
-
attr: {
|
|
17
|
-
modi: '更新',
|
|
18
|
-
entity: '关联对象',
|
|
19
|
-
entityId: '关联对象id',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
configuration: {
|
|
24
|
-
actionType: 'appendOnly',
|
|
25
|
-
}
|
|
26
|
-
};
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { Schema as Modi } from './Modi';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
+
|
|
6
|
+
export interface Schema extends EntityShape {
|
|
7
|
+
modi: Modi,
|
|
8
|
+
entity: String<32>;
|
|
9
|
+
entityId: String<64>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
+
locales: {
|
|
14
|
+
zh_CN: {
|
|
15
|
+
name: '更新对象连接',
|
|
16
|
+
attr: {
|
|
17
|
+
modi: '更新',
|
|
18
|
+
entity: '关联对象',
|
|
19
|
+
entityId: '关联对象id',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
configuration: {
|
|
24
|
+
actionType: 'appendOnly',
|
|
25
|
+
}
|
|
26
|
+
};
|