oak-domain 5.0.16 → 5.0.17
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/store/IntrinsicCheckers.js +4 -4
- package/lib/store/checker.js +5 -5
- package/lib/store/filter.js +2 -0
- package/lib/types/Connector.d.ts +2 -1
- package/lib/types/Exception.d.ts +27 -25
- package/lib/types/Exception.js +46 -7
- package/lib/utils/SimpleConnector.d.ts +2 -1
- package/lib/utils/assert.d.ts +0 -1
- package/lib/utils/relationPath.js +1 -1
- package/package.json +1 -1
- package/src/entities/ModiEntity.ts +26 -26
- package/src/entities/OperEntity.ts +27 -27
- package/src/entities/Relation.ts +43 -43
- package/src/entities/UserEntityClaim.ts +29 -29
- package/src/entities/UserEntityGrant.ts +24 -24
- package/src/entities/UserRelation.ts +50 -50
|
@@ -79,7 +79,7 @@ function createUniqueCheckers(schema) {
|
|
|
79
79
|
entity,
|
|
80
80
|
action: 'create',
|
|
81
81
|
type: 'logicalData',
|
|
82
|
-
priority: types_1.CHECKER_MAX_PRIORITY,
|
|
82
|
+
priority: types_1.CHECKER_MAX_PRIORITY,
|
|
83
83
|
checker: (operation, context) => {
|
|
84
84
|
const { data } = operation;
|
|
85
85
|
if (data instanceof Array) {
|
|
@@ -95,9 +95,9 @@ function createUniqueCheckers(schema) {
|
|
|
95
95
|
}
|
|
96
96
|
}, {
|
|
97
97
|
entity,
|
|
98
|
-
action: 'update',
|
|
98
|
+
action: 'update',
|
|
99
99
|
type: 'logicalData',
|
|
100
|
-
priority: types_1.CHECKER_MAX_PRIORITY,
|
|
100
|
+
priority: types_1.CHECKER_MAX_PRIORITY,
|
|
101
101
|
checker: (operation, context) => {
|
|
102
102
|
const { data, filter: operationFilter } = operation;
|
|
103
103
|
if (data) {
|
|
@@ -227,7 +227,7 @@ function createActionTransformerCheckers(actionDefDict) {
|
|
|
227
227
|
action: 'create',
|
|
228
228
|
type: 'logical',
|
|
229
229
|
entity,
|
|
230
|
-
priority: 10,
|
|
230
|
+
priority: 10,
|
|
231
231
|
checker: (operation) => {
|
|
232
232
|
const { data } = operation;
|
|
233
233
|
if (data instanceof Array) {
|
package/lib/store/checker.js
CHANGED
|
@@ -67,7 +67,7 @@ function translateCheckerInAsyncContext(checker, schema) {
|
|
|
67
67
|
blockTrigger: true,
|
|
68
68
|
});
|
|
69
69
|
const e = new Exception_1.OakRowInconsistencyException(errMsg);
|
|
70
|
-
e.addData(entity2, rows2);
|
|
70
|
+
e.addData(entity2, rows2, context.getSchema());
|
|
71
71
|
throw e;
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
@@ -265,7 +265,7 @@ function createRemoveCheckers(schema) {
|
|
|
265
265
|
promises.push(result.then(([row]) => {
|
|
266
266
|
if (row) {
|
|
267
267
|
const err = new Exception_1.OakRowInconsistencyException(`您无法删除存在有效数据「${e}」关联的行`);
|
|
268
|
-
err.addData(e, [row]);
|
|
268
|
+
err.addData(e, [row], context.getSchema());
|
|
269
269
|
throw err;
|
|
270
270
|
}
|
|
271
271
|
}));
|
|
@@ -274,7 +274,7 @@ function createRemoveCheckers(schema) {
|
|
|
274
274
|
const [row] = result;
|
|
275
275
|
if (row) {
|
|
276
276
|
const err = new Exception_1.OakRowInconsistencyException(`您无法删除存在有效数据「${e}」关联的行`);
|
|
277
|
-
err.addData(e, [row]);
|
|
277
|
+
err.addData(e, [row], context.getSchema());
|
|
278
278
|
throw err;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -300,7 +300,7 @@ function createRemoveCheckers(schema) {
|
|
|
300
300
|
promises.push(result.then(([row]) => {
|
|
301
301
|
if (row) {
|
|
302
302
|
const e = new Exception_1.OakRowInconsistencyException(`您无法删除存在有效数据「${otm}」关联的行`);
|
|
303
|
-
e.addData(otm, [row]);
|
|
303
|
+
e.addData(otm, [row], context.getSchema());
|
|
304
304
|
throw e;
|
|
305
305
|
}
|
|
306
306
|
}));
|
|
@@ -317,7 +317,7 @@ function createRemoveCheckers(schema) {
|
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
const e = new Exception_1.OakRowInconsistencyException(`您无法删除存在有效数据「${otm}」关联的行`);
|
|
320
|
-
e.addData(otm, [row]);
|
|
320
|
+
e.addData(otm, [row], context.getSchema());
|
|
321
321
|
throw e;
|
|
322
322
|
}
|
|
323
323
|
}
|
package/lib/store/filter.js
CHANGED
|
@@ -425,6 +425,7 @@ function unionFilterSegment(entity, schema, ...filters) {
|
|
|
425
425
|
['#sqp']: sqpOp1,
|
|
426
426
|
})
|
|
427
427
|
});
|
|
428
|
+
return true;
|
|
428
429
|
}
|
|
429
430
|
else {
|
|
430
431
|
// not in情况子查询变成and
|
|
@@ -434,6 +435,7 @@ function unionFilterSegment(entity, schema, ...filters) {
|
|
|
434
435
|
['#sqp']: sqpOp1,
|
|
435
436
|
})
|
|
436
437
|
});
|
|
438
|
+
return true;
|
|
437
439
|
}
|
|
438
440
|
}
|
|
439
441
|
}
|
package/lib/types/Connector.d.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { IncomingHttpHeaders } from "http";
|
|
3
3
|
import { SyncContext } from "../store/SyncRowStore";
|
|
4
4
|
import { EntityDict, OpRecord } from "./Entity";
|
|
5
|
+
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
5
6
|
import { OakException } from "./Exception";
|
|
6
|
-
export interface Connector<ED extends EntityDict, FrontCxt extends SyncContext<ED>> {
|
|
7
|
+
export interface Connector<ED extends EntityDict & BaseEntityDict, FrontCxt extends SyncContext<ED>> {
|
|
7
8
|
callAspect: (name: string, params: any, context?: FrontCxt) => Promise<{
|
|
8
9
|
result: any;
|
|
9
10
|
opRecords?: OpRecord<ED>[];
|
package/lib/types/Exception.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { StorageSchema } from ".";
|
|
1
2
|
import { EntityDict, OpRecord } from "./Entity";
|
|
2
|
-
|
|
3
|
+
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
4
|
+
export declare class OakException<ED extends EntityDict & BaseEntityDict> extends Error {
|
|
3
5
|
opRecords: OpRecord<ED>[];
|
|
4
6
|
constructor(message?: string);
|
|
5
|
-
addData<T extends keyof ED>(entity: T, rows: Partial<ED[T]['
|
|
7
|
+
addData<T extends keyof ED>(entity: T, rows: Partial<ED[T]['Schema']>[], schema: StorageSchema<ED>): void;
|
|
6
8
|
setOpRecords(opRecords: OpRecord<ED>[]): void;
|
|
7
9
|
getSerialData(): {
|
|
8
10
|
name: string;
|
|
@@ -17,19 +19,19 @@ export declare class OakException<ED extends EntityDict> extends Error {
|
|
|
17
19
|
tag2?: boolean;
|
|
18
20
|
tag3?: any;
|
|
19
21
|
}
|
|
20
|
-
export declare class OakMakeSureByMySelfException<ED extends EntityDict> extends OakException<ED> {
|
|
22
|
+
export declare class OakMakeSureByMySelfException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
21
23
|
}
|
|
22
|
-
export declare class OakDataException<ED extends EntityDict> extends OakException<ED> {
|
|
24
|
+
export declare class OakDataException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
23
25
|
}
|
|
24
|
-
export declare class OakNoRelationDefException<ED extends EntityDict, T extends keyof ED> extends OakDataException<ED> {
|
|
26
|
+
export declare class OakNoRelationDefException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakDataException<ED> {
|
|
25
27
|
entity: T;
|
|
26
28
|
actions: ED[T]['Action'][];
|
|
27
29
|
constructor(entity: T, actions: ED[T]['Action'][], msg?: string);
|
|
28
30
|
toString(): string;
|
|
29
31
|
}
|
|
30
|
-
export declare class OakOperExistedException<ED extends EntityDict> extends OakDataException<ED> {
|
|
32
|
+
export declare class OakOperExistedException<ED extends EntityDict & BaseEntityDict> extends OakDataException<ED> {
|
|
31
33
|
}
|
|
32
|
-
export declare class OakRowUnexistedException<ED extends EntityDict> extends OakDataException<ED> {
|
|
34
|
+
export declare class OakRowUnexistedException<ED extends EntityDict & BaseEntityDict> extends OakDataException<ED> {
|
|
33
35
|
private rows;
|
|
34
36
|
constructor(rows: Array<{
|
|
35
37
|
entity: any;
|
|
@@ -44,9 +46,9 @@ export declare class OakRowUnexistedException<ED extends EntityDict> extends Oak
|
|
|
44
46
|
/**
|
|
45
47
|
* 可接受的、由用户操作造成的异常
|
|
46
48
|
*/
|
|
47
|
-
export declare class OakUserException<ED extends EntityDict> extends OakException<ED> {
|
|
49
|
+
export declare class OakUserException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
48
50
|
}
|
|
49
|
-
export declare class OakUniqueViolationException<ED extends EntityDict> extends OakUserException<ED> {
|
|
51
|
+
export declare class OakUniqueViolationException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
50
52
|
rows: Array<{
|
|
51
53
|
id?: string;
|
|
52
54
|
attrs: string[];
|
|
@@ -56,7 +58,7 @@ export declare class OakUniqueViolationException<ED extends EntityDict> extends
|
|
|
56
58
|
attrs: string[];
|
|
57
59
|
}>, message?: string);
|
|
58
60
|
}
|
|
59
|
-
export declare class OakImportDataParseException<ED extends EntityDict> extends OakUserException<ED> {
|
|
61
|
+
export declare class OakImportDataParseException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
60
62
|
line: number;
|
|
61
63
|
header?: string;
|
|
62
64
|
constructor(message: string, line: number, header?: string);
|
|
@@ -64,21 +66,21 @@ export declare class OakImportDataParseException<ED extends EntityDict> extends
|
|
|
64
66
|
/**
|
|
65
67
|
* 网络中断异常
|
|
66
68
|
*/
|
|
67
|
-
export declare class OakNetworkException<ED extends EntityDict> extends OakException<ED> {
|
|
69
|
+
export declare class OakNetworkException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
68
70
|
}
|
|
69
|
-
export declare class OakServerProxyException<ED extends EntityDict> extends OakException<ED> {
|
|
71
|
+
export declare class OakServerProxyException<ED extends EntityDict & BaseEntityDict> extends OakException<ED> {
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
72
74
|
* 数据不一致异常,系统认为现有的数据不允许相应的动作时抛此异常
|
|
73
75
|
*
|
|
74
76
|
*/
|
|
75
|
-
export declare class OakRowInconsistencyException<ED extends EntityDict> extends OakUserException<ED> {
|
|
77
|
+
export declare class OakRowInconsistencyException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
76
78
|
toString(): string;
|
|
77
79
|
}
|
|
78
80
|
/**
|
|
79
81
|
* 当输入的数据非法时抛此异常,attributes表示非法的属性
|
|
80
82
|
*/
|
|
81
|
-
export declare class OakInputIllegalException<ED extends EntityDict> extends OakUserException<ED> {
|
|
83
|
+
export declare class OakInputIllegalException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
82
84
|
private attributes;
|
|
83
85
|
private entity;
|
|
84
86
|
constructor(entity: keyof ED, attributes: string[], message?: string);
|
|
@@ -90,19 +92,19 @@ export declare class OakInputIllegalException<ED extends EntityDict> extends Oak
|
|
|
90
92
|
/**
|
|
91
93
|
* 属性为空时抛的异常
|
|
92
94
|
*/
|
|
93
|
-
export declare class OakAttrNotNullException<ED extends EntityDict> extends OakInputIllegalException<ED> {
|
|
95
|
+
export declare class OakAttrNotNullException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
|
|
94
96
|
constructor(entity: keyof ED, attributes: string[], message?: string);
|
|
95
97
|
}
|
|
96
98
|
/**
|
|
97
99
|
* 属性不允许更新抛的异常,前端可以用这个异常来处理update时对应属性的露出
|
|
98
100
|
*/
|
|
99
|
-
export declare class OakAttrCantUpdateException<ED extends EntityDict> extends OakInputIllegalException<ED> {
|
|
101
|
+
export declare class OakAttrCantUpdateException<ED extends EntityDict & BaseEntityDict> extends OakInputIllegalException<ED> {
|
|
100
102
|
constructor(entity: keyof ED, attributes: string[], message?: string);
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
103
105
|
* 用户权限不够时抛的异常
|
|
104
106
|
*/
|
|
105
|
-
export declare class OakUserUnpermittedException<ED extends EntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
107
|
+
export declare class OakUserUnpermittedException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
106
108
|
private entity;
|
|
107
109
|
private operation;
|
|
108
110
|
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string);
|
|
@@ -111,7 +113,7 @@ export declare class OakUserUnpermittedException<ED extends EntityDict, T extend
|
|
|
111
113
|
/**
|
|
112
114
|
* 用户查询权限不够抛出异常
|
|
113
115
|
*/
|
|
114
|
-
export declare class OakUserInvisibleException<ED extends EntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
116
|
+
export declare class OakUserInvisibleException<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
115
117
|
private entity;
|
|
116
118
|
private operation;
|
|
117
119
|
constructor(entity: T, operation: ED[T]['Selection'] | ED[T]['Operation'], message?: string);
|
|
@@ -120,19 +122,19 @@ export declare class OakUserInvisibleException<ED extends EntityDict, T extends
|
|
|
120
122
|
/**
|
|
121
123
|
* 用户未登录抛的异常
|
|
122
124
|
*/
|
|
123
|
-
export declare class OakUnloggedInException<ED extends EntityDict> extends OakUserException<ED> {
|
|
125
|
+
export declare class OakUnloggedInException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
124
126
|
constructor(message?: string);
|
|
125
127
|
}
|
|
126
128
|
/**
|
|
127
129
|
* 用户未登录抛的异常
|
|
128
130
|
*/
|
|
129
|
-
export declare class OakRowLockedException<ED extends EntityDict> extends OakUserException<ED> {
|
|
131
|
+
export declare class OakRowLockedException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
130
132
|
constructor(message?: string);
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* 要插入行时,发现已经有相同的行数据
|
|
134
136
|
*/
|
|
135
|
-
export declare class OakCongruentRowExists<ED extends EntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
137
|
+
export declare class OakCongruentRowExists<ED extends EntityDict & BaseEntityDict, T extends keyof ED> extends OakUserException<ED> {
|
|
136
138
|
private data;
|
|
137
139
|
private entity;
|
|
138
140
|
constructor(entity: T, data: ED[T]['OpSchema'], message?: string);
|
|
@@ -143,13 +145,13 @@ export declare class OakCongruentRowExists<ED extends EntityDict, T extends keyo
|
|
|
143
145
|
/**
|
|
144
146
|
* 死锁抛的异常
|
|
145
147
|
*/
|
|
146
|
-
export declare class OakDeadlock<ED extends EntityDict> extends OakUserException<ED> {
|
|
148
|
+
export declare class OakDeadlock<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
147
149
|
constructor(message?: string | undefined);
|
|
148
150
|
}
|
|
149
151
|
/**
|
|
150
152
|
* 前置条件不满足抛的异常
|
|
151
153
|
*/
|
|
152
|
-
export declare class OakPreConditionUnsetException<ED extends EntityDict> extends OakUserException<ED> {
|
|
154
|
+
export declare class OakPreConditionUnsetException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
153
155
|
entity?: keyof ED;
|
|
154
156
|
code?: string;
|
|
155
157
|
constructor(message?: string | undefined, entity?: keyof ED | undefined, code?: string | undefined);
|
|
@@ -158,14 +160,14 @@ export declare class OakPreConditionUnsetException<ED extends EntityDict> extend
|
|
|
158
160
|
/**
|
|
159
161
|
* 调用外部接口抛出的异常
|
|
160
162
|
*/
|
|
161
|
-
export declare class OakExternalException<ED extends EntityDict> extends OakUserException<ED> {
|
|
163
|
+
export declare class OakExternalException<ED extends EntityDict & BaseEntityDict> extends OakUserException<ED> {
|
|
162
164
|
code?: string;
|
|
163
165
|
source: string;
|
|
164
166
|
data?: any;
|
|
165
167
|
constructor(source: string, code?: string, message?: string, data?: any);
|
|
166
168
|
toString(): string;
|
|
167
169
|
}
|
|
168
|
-
export declare function makeException<ED extends EntityDict>(data: {
|
|
170
|
+
export declare function makeException<ED extends EntityDict & BaseEntityDict>(data: {
|
|
169
171
|
name: string;
|
|
170
172
|
message?: string;
|
|
171
173
|
opRecords: OpRecord<ED>[];
|
package/lib/types/Exception.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeException = exports.OakExternalException = exports.OakPreConditionUnsetException = exports.OakDeadlock = exports.OakCongruentRowExists = exports.OakRowLockedException = exports.OakUnloggedInException = exports.OakUserInvisibleException = exports.OakUserUnpermittedException = exports.OakAttrCantUpdateException = exports.OakAttrNotNullException = exports.OakInputIllegalException = exports.OakRowInconsistencyException = exports.OakServerProxyException = exports.OakNetworkException = exports.OakImportDataParseException = exports.OakUniqueViolationException = exports.OakUserException = exports.OakRowUnexistedException = exports.OakOperExistedException = exports.OakNoRelationDefException = exports.OakDataException = exports.OakMakeSureByMySelfException = exports.OakException = void 0;
|
|
4
|
+
const relation_1 = require("../store/relation");
|
|
5
|
+
const lodash_1 = require("../utils/lodash");
|
|
4
6
|
class OakException extends Error {
|
|
5
7
|
opRecords;
|
|
6
8
|
constructor(message) {
|
|
@@ -17,17 +19,54 @@ class OakException extends Error {
|
|
|
17
19
|
}
|
|
18
20
|
this.opRecords = [];
|
|
19
21
|
}
|
|
20
|
-
addData(entity, rows) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
[entity]
|
|
22
|
+
addData(entity, rows, schema) {
|
|
23
|
+
const rowDict = {};
|
|
24
|
+
const addToRowDict = (entity, row) => {
|
|
25
|
+
if (!rowDict[entity]) {
|
|
26
|
+
rowDict[entity] = {
|
|
27
|
+
[row.id]: row,
|
|
28
|
+
};
|
|
25
29
|
}
|
|
30
|
+
else {
|
|
31
|
+
if (rowDict[entity][row.id]) {
|
|
32
|
+
Object.assign(rowDict[entity][row.id], row);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
rowDict[entity][row.id] = row;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const addInner = (entity, row) => {
|
|
40
|
+
const ownAttrs = [];
|
|
41
|
+
for (const attr in row) {
|
|
42
|
+
const rel = (0, relation_1.judgeRelation)(schema, entity, attr);
|
|
43
|
+
if (rel === 1) {
|
|
44
|
+
ownAttrs.push(attr);
|
|
45
|
+
}
|
|
46
|
+
else if (rel === 2) {
|
|
47
|
+
addInner(attr, row[attr]);
|
|
48
|
+
}
|
|
49
|
+
else if (typeof rel === 'string') {
|
|
50
|
+
addInner(rel, row[attr]);
|
|
51
|
+
}
|
|
52
|
+
else if (rel instanceof Array) {
|
|
53
|
+
(row[attr]).forEach((ele) => addInner(rel[0], ele));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
addToRowDict(entity, (0, lodash_1.pick)(row, ownAttrs));
|
|
26
57
|
};
|
|
27
58
|
for (const row of rows) {
|
|
28
|
-
|
|
59
|
+
addInner(entity, row);
|
|
60
|
+
}
|
|
61
|
+
for (const entity in rowDict) {
|
|
62
|
+
const record = {
|
|
63
|
+
a: 's',
|
|
64
|
+
d: {
|
|
65
|
+
[entity]: rowDict[entity],
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
this.opRecords.push(record);
|
|
29
69
|
}
|
|
30
|
-
this.opRecords.push(record);
|
|
31
70
|
}
|
|
32
71
|
setOpRecords(opRecords) {
|
|
33
72
|
this.opRecords = opRecords;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { IncomingHttpHeaders } from "http";
|
|
3
3
|
import { SyncContext } from '../store/SyncRowStore';
|
|
4
4
|
import { Connector, EntityDict, OakException, OpRecord } from "../types";
|
|
5
|
+
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
5
6
|
import { AccessConfiguration } from '../types/Configuration';
|
|
6
|
-
export default class SimpleConnector<ED extends EntityDict, FrontCxt extends SyncContext<ED>> implements Connector<ED, FrontCxt> {
|
|
7
|
+
export default class SimpleConnector<ED extends EntityDict & BaseEntityDict, FrontCxt extends SyncContext<ED>> implements Connector<ED, FrontCxt> {
|
|
7
8
|
static ASPECT_ROUTER: string;
|
|
8
9
|
static BRIDGE_ROUTER: string;
|
|
9
10
|
static SUBSCRIBE_ROUTER: string;
|
package/lib/utils/assert.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ function destructRelationPath(schema, entity, path, relationFilter, recursive) {
|
|
|
60
60
|
},
|
|
61
61
|
filter: relationFilter,
|
|
62
62
|
} // as ED['userRelation']['Selection']
|
|
63
|
-
},
|
|
63
|
+
},
|
|
64
64
|
getData: (d) => {
|
|
65
65
|
return d.userRelation$entity;
|
|
66
66
|
},
|
package/package.json
CHANGED
|
@@ -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
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape, Configuration } from '../types/Entity';
|
|
3
|
-
import { LocaleDef } from '../types/Locale';
|
|
4
|
-
import { Schema as Oper } from './Oper';
|
|
5
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
6
|
-
|
|
7
|
-
export interface Schema extends EntityShape {
|
|
8
|
-
oper: Oper,
|
|
9
|
-
entity: String<32>;
|
|
10
|
-
entityId: String<64>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
-
locales: {
|
|
15
|
-
zh_CN: {
|
|
16
|
-
name: '操作对象连接',
|
|
17
|
-
attr: {
|
|
18
|
-
oper: '操作',
|
|
19
|
-
entity: '关联对象',
|
|
20
|
-
entityId: '关联对象id',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
configuration: {
|
|
25
|
-
actionType: 'appendOnly',
|
|
26
|
-
}
|
|
27
|
-
};
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape, Configuration } from '../types/Entity';
|
|
3
|
+
import { LocaleDef } from '../types/Locale';
|
|
4
|
+
import { Schema as Oper } from './Oper';
|
|
5
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
6
|
+
|
|
7
|
+
export interface Schema extends EntityShape {
|
|
8
|
+
oper: Oper,
|
|
9
|
+
entity: String<32>;
|
|
10
|
+
entityId: String<64>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
14
|
+
locales: {
|
|
15
|
+
zh_CN: {
|
|
16
|
+
name: '操作对象连接',
|
|
17
|
+
attr: {
|
|
18
|
+
oper: '操作',
|
|
19
|
+
entity: '关联对象',
|
|
20
|
+
entityId: '关联对象id',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
configuration: {
|
|
25
|
+
actionType: 'appendOnly',
|
|
26
|
+
}
|
|
27
|
+
};
|
package/src/entities/Relation.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
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
|
-
entity: String<32>;
|
|
7
|
-
entityId?: String<64>; // 可以为空
|
|
8
|
-
name?: String<32>;
|
|
9
|
-
display?: String<32>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
-
locales: {
|
|
14
|
-
zh_CN: {
|
|
15
|
-
name: '用户授权',
|
|
16
|
-
attr: {
|
|
17
|
-
name: '关系',
|
|
18
|
-
entity: '目标对象',
|
|
19
|
-
entityId: '目标对象id',
|
|
20
|
-
display: '显示值',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
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
|
-
},
|
|
41
|
-
},
|
|
42
|
-
]
|
|
43
|
-
};
|
|
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
|
+
entity: String<32>;
|
|
7
|
+
entityId?: String<64>; // 可以为空
|
|
8
|
+
name?: String<32>;
|
|
9
|
+
display?: String<32>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
13
|
+
locales: {
|
|
14
|
+
zh_CN: {
|
|
15
|
+
name: '用户授权',
|
|
16
|
+
attr: {
|
|
17
|
+
name: '关系',
|
|
18
|
+
entity: '目标对象',
|
|
19
|
+
entityId: '目标对象id',
|
|
20
|
+
display: '显示值',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
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
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]
|
|
43
|
+
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
-
import { Schema as UserEntityGrant } from './UserEntityGrant';
|
|
5
|
-
import { Schema as User } from './User';
|
|
6
|
-
import { Schema as Relation } from './Relation';
|
|
7
|
-
import { Schema as UserRelation } from './UserRelation';
|
|
8
|
-
|
|
9
|
-
export interface Schema extends EntityShape {
|
|
10
|
-
ueg: UserEntityGrant;
|
|
11
|
-
user: User;
|
|
12
|
-
relation: Relation;
|
|
13
|
-
claimEntityId: String<64>;
|
|
14
|
-
userRelation: UserRelation;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const entityDesc: EntityDesc<Schema, ''> = {
|
|
18
|
-
locales: {
|
|
19
|
-
zh_CN: {
|
|
20
|
-
name: '用户授权领取',
|
|
21
|
-
attr: {
|
|
22
|
-
ueg: '授权',
|
|
23
|
-
user: '用户',
|
|
24
|
-
relation: '关系',
|
|
25
|
-
claimEntityId: '对象Id',
|
|
26
|
-
userRelation: '用户关系',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
import { Schema as UserEntityGrant } from './UserEntityGrant';
|
|
5
|
+
import { Schema as User } from './User';
|
|
6
|
+
import { Schema as Relation } from './Relation';
|
|
7
|
+
import { Schema as UserRelation } from './UserRelation';
|
|
8
|
+
|
|
9
|
+
export interface Schema extends EntityShape {
|
|
10
|
+
ueg: UserEntityGrant;
|
|
11
|
+
user: User;
|
|
12
|
+
relation: Relation;
|
|
13
|
+
claimEntityId: String<64>;
|
|
14
|
+
userRelation: UserRelation;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const entityDesc: EntityDesc<Schema, ''> = {
|
|
18
|
+
locales: {
|
|
19
|
+
zh_CN: {
|
|
20
|
+
name: '用户授权领取',
|
|
21
|
+
attr: {
|
|
22
|
+
ueg: '授权',
|
|
23
|
+
user: '用户',
|
|
24
|
+
relation: '关系',
|
|
25
|
+
claimEntityId: '对象Id',
|
|
26
|
+
userRelation: '用户关系',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
30
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
-
|
|
5
|
-
type RelationIds = string[];
|
|
6
|
-
|
|
7
|
-
export interface Schema extends EntityShape {
|
|
8
|
-
relationEntity: String<32>;
|
|
9
|
-
relationEntityFilter: Object;
|
|
10
|
-
relationIds: RelationIds;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const entityDesc: EntityDesc<Schema, ''> = {
|
|
14
|
-
locales: {
|
|
15
|
-
zh_CN: {
|
|
16
|
-
name: '用户授权',
|
|
17
|
-
attr: {
|
|
18
|
-
relationIds: '关系',
|
|
19
|
-
relationEntity: '关联对象',
|
|
20
|
-
relationEntityFilter: '对象限定条件',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
4
|
+
|
|
5
|
+
type RelationIds = string[];
|
|
6
|
+
|
|
7
|
+
export interface Schema extends EntityShape {
|
|
8
|
+
relationEntity: String<32>;
|
|
9
|
+
relationEntityFilter: Object;
|
|
10
|
+
relationIds: RelationIds;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const entityDesc: EntityDesc<Schema, ''> = {
|
|
14
|
+
locales: {
|
|
15
|
+
zh_CN: {
|
|
16
|
+
name: '用户授权',
|
|
17
|
+
attr: {
|
|
18
|
+
relationIds: '关系',
|
|
19
|
+
relationEntity: '关联对象',
|
|
20
|
+
relationEntityFilter: '对象限定条件',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { String } from '../types/DataType';
|
|
2
|
-
import { LocaleDef } from '../types/Locale';
|
|
3
|
-
import { EntityShape } from '../types/Entity';
|
|
4
|
-
import { Index } from '../types/Storage';
|
|
5
|
-
import { Schema as User } from './User';
|
|
6
|
-
import { Schema as Relation } from './Relation';
|
|
7
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
8
|
-
|
|
9
|
-
export interface Schema extends EntityShape {
|
|
10
|
-
user: User;
|
|
11
|
-
relation: Relation;
|
|
12
|
-
entity: String<32>;
|
|
13
|
-
entityId: String<64>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const entityDesc: EntityDesc<Schema> = {
|
|
17
|
-
locales: {
|
|
18
|
-
zh_CN: {
|
|
19
|
-
name: '用户对象关系',
|
|
20
|
-
attr: {
|
|
21
|
-
user: '关系',
|
|
22
|
-
relation: '目标关系',
|
|
23
|
-
entity: '目标对象',
|
|
24
|
-
entityId: '目标对象ID',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
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
|
-
},
|
|
48
|
-
},
|
|
49
|
-
]
|
|
50
|
-
};
|
|
1
|
+
import { String } from '../types/DataType';
|
|
2
|
+
import { LocaleDef } from '../types/Locale';
|
|
3
|
+
import { EntityShape } from '../types/Entity';
|
|
4
|
+
import { Index } from '../types/Storage';
|
|
5
|
+
import { Schema as User } from './User';
|
|
6
|
+
import { Schema as Relation } from './Relation';
|
|
7
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
8
|
+
|
|
9
|
+
export interface Schema extends EntityShape {
|
|
10
|
+
user: User;
|
|
11
|
+
relation: Relation;
|
|
12
|
+
entity: String<32>;
|
|
13
|
+
entityId: String<64>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const entityDesc: EntityDesc<Schema> = {
|
|
17
|
+
locales: {
|
|
18
|
+
zh_CN: {
|
|
19
|
+
name: '用户对象关系',
|
|
20
|
+
attr: {
|
|
21
|
+
user: '关系',
|
|
22
|
+
relation: '目标关系',
|
|
23
|
+
entity: '目标对象',
|
|
24
|
+
entityId: '目标对象ID',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
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
|
+
},
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
};
|