oak-domain 4.2.2 → 4.2.4

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.
Files changed (53) hide show
  1. package/lib/base-app-domain/ActionDefDict.d.ts +8 -8
  2. package/lib/base-app-domain/Oper/Schema.d.ts +158 -158
  3. package/lib/base-app-domain/Oper/Storage.js +56 -56
  4. package/lib/base-app-domain/User/Action.d.ts +11 -11
  5. package/lib/base-app-domain/User/Action.js +12 -12
  6. package/lib/base-app-domain/UserEntityGrant/Action.d.ts +5 -5
  7. package/lib/base-app-domain/UserEntityGrant/Action.js +5 -5
  8. package/lib/compiler/schemalBuilder.js +4167 -4167
  9. package/lib/entities/Oper.d.ts +12 -12
  10. package/lib/entities/Oper.js +36 -36
  11. package/lib/entities/User.d.ts +18 -18
  12. package/lib/entities/User.js +32 -32
  13. package/lib/index.d.ts +1 -1
  14. package/lib/index.js +3 -3
  15. package/lib/store/AsyncRowStore.d.ts +66 -66
  16. package/lib/store/CascadeStore.d.ts +109 -109
  17. package/lib/store/CascadeStore.js +1728 -1726
  18. package/lib/store/RelationAuth.js +1209 -1209
  19. package/lib/store/TriggerExecutor.js +468 -468
  20. package/lib/store/actionDef.js +278 -278
  21. package/lib/store/checker.js +487 -487
  22. package/lib/store/relation.d.ts +12 -12
  23. package/lib/store/relation.js +74 -74
  24. package/lib/triggers/index.d.ts +5 -5
  25. package/lib/triggers/index.js +28 -28
  26. package/lib/types/Configuration.d.ts +42 -42
  27. package/lib/types/Configuration.js +3 -3
  28. package/lib/types/Connector.d.ts +39 -38
  29. package/lib/types/Entity.d.ts +209 -209
  30. package/lib/types/Sync.d.ts +74 -69
  31. package/lib/types/Sync.js +9 -9
  32. package/lib/types/index.d.ts +27 -27
  33. package/lib/types/index.js +30 -30
  34. package/lib/utils/SimpleConnector.d.ts +81 -64
  35. package/lib/utils/SimpleConnector.js +217 -206
  36. package/lib/utils/assert.d.ts +5 -5
  37. package/lib/utils/projection.d.ts +4 -4
  38. package/lib/utils/relationPath.d.ts +31 -31
  39. package/lib/utils/relationPath.js +202 -202
  40. package/package.json +51 -51
  41. package/src/entities/ActionAuth.ts +41 -41
  42. package/src/entities/I18n.ts +45 -45
  43. package/src/entities/Modi.ts +69 -69
  44. package/src/entities/ModiEntity.ts +26 -26
  45. package/src/entities/Oper.ts +48 -48
  46. package/src/entities/OperEntity.ts +27 -27
  47. package/src/entities/Path.ts +43 -43
  48. package/src/entities/Relation.ts +43 -43
  49. package/src/entities/RelationAuth.ts +44 -44
  50. package/src/entities/User.ts +48 -48
  51. package/src/entities/UserEntityClaim.ts +29 -29
  52. package/src/entities/UserEntityGrant.ts +24 -24
  53. package/src/entities/UserRelation.ts +50 -50
@@ -1,4 +1,4 @@
1
- import { EntityDict } from '../types/Entity';
2
- import { EntityDict as BaseEntityDict } from '../base-app-domain';
3
- import { StorageSchema } from '../types/Storage';
4
- export declare function makeProjection<ED extends BaseEntityDict & EntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>): ED[T]["Selection"]["data"];
1
+ import { EntityDict } from '../types/Entity';
2
+ import { EntityDict as BaseEntityDict } from '../base-app-domain';
3
+ import { StorageSchema } from '../types/Storage';
4
+ export declare function makeProjection<ED extends BaseEntityDict & EntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>): ED[T]["Selection"]["data"];
@@ -1,31 +1,31 @@
1
- import { StorageSchema } from '../types/Storage';
2
- import { EntityDict as BaseEntityDict } from "../base-app-domain";
3
- import { EntityDict } from "../types/Entity";
4
- /**
5
- * 根据entity的相对path,以及定义的userRelationFilter,找到根结点对象上相应的userRelations
6
- * @param schema
7
- * @param entity
8
- * @param path
9
- * @param relationFilter
10
- * @param recursive
11
- */
12
- export declare function destructRelationPath<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(schema: StorageSchema<ED>, entity: T, path: string, relationFilter: ED['userRelation']['Selection']['filter'], recursive?: boolean): {
13
- projection: ED[T]['Selection']['data'];
14
- getData: (d: Partial<ED[T]['Schema']>) => ED['userRelation']['Schema'][] | undefined;
15
- };
16
- /**
17
- * 根据entity的相对path,找到对应的根结点对象上的直接userId
18
- * @param schema
19
- * @param entity
20
- * @param path
21
- * @param recursive
22
- * @returns
23
- */
24
- export declare function destructDirectPath<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(schema: StorageSchema<ED>, entity: T, path: string, recursive?: boolean): {
25
- projection: ED[T]['Selection']['data'];
26
- getData: (d: Partial<ED[T]['Schema']>) => {
27
- entity: keyof ED;
28
- entityId: string;
29
- userId: string;
30
- }[] | undefined;
31
- };
1
+ import { StorageSchema } from '../types/Storage';
2
+ import { EntityDict as BaseEntityDict } from "../base-app-domain";
3
+ import { EntityDict } from "../types/Entity";
4
+ /**
5
+ * 根据entity的相对path,以及定义的userRelationFilter,找到根结点对象上相应的userRelations
6
+ * @param schema
7
+ * @param entity
8
+ * @param path
9
+ * @param relationFilter
10
+ * @param recursive
11
+ */
12
+ export declare function destructRelationPath<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(schema: StorageSchema<ED>, entity: T, path: string, relationFilter: ED['userRelation']['Selection']['filter'], recursive?: boolean): {
13
+ projection: ED[T]['Selection']['data'];
14
+ getData: (d: Partial<ED[T]['Schema']>) => ED['userRelation']['Schema'][] | undefined;
15
+ };
16
+ /**
17
+ * 根据entity的相对path,找到对应的根结点对象上的直接userId
18
+ * @param schema
19
+ * @param entity
20
+ * @param path
21
+ * @param recursive
22
+ * @returns
23
+ */
24
+ export declare function destructDirectPath<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(schema: StorageSchema<ED>, entity: T, path: string, recursive?: boolean): {
25
+ projection: ED[T]['Selection']['data'];
26
+ getData: (d: Partial<ED[T]['Schema']>) => {
27
+ entity: keyof ED;
28
+ entityId: string;
29
+ userId: string;
30
+ }[] | undefined;
31
+ };
@@ -1,202 +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
- } // as ED['userRelation']['Selection']
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)).flat().filter(ele => !!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)).flat().filter(ele => !!ele),
197
- };
198
- }
199
- };
200
- return makeIter(entity, 0);
201
- }
202
- exports.destructDirectPath = destructDirectPath;
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
+ } // as ED['userRelation']['Selection']
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)).flat().filter(ele => !!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)).flat().filter(ele => !!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.2.2",
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.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,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
+ };