oak-domain 4.3.1 → 4.5.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/LICENSE +232 -0
- package/README.md +3 -0
- package/lib/base-app-domain/Oper/Schema.d.ts +2 -2
- package/lib/base-app-domain/Oper/Storage.js +0 -1
- package/lib/base-app-domain/UserEntityGrant/Action.d.ts +5 -5
- package/lib/base-app-domain/UserEntityGrant/Action.js +5 -5
- package/lib/entities/Oper.d.ts +1 -1
- package/lib/store/AsyncRowStore.d.ts +1 -1
- package/lib/store/CascadeStore.js +6 -6
- package/lib/store/IntrinsicCheckers.js +20 -11
- package/lib/store/RelationAuth.js +3 -3
- package/lib/store/TriggerExecutor.d.ts +1 -1
- package/lib/store/TriggerExecutor.js +18 -12
- package/lib/store/checker.js +5 -5
- package/lib/store/filter.d.ts +1 -1
- package/lib/store/filter.js +2 -2
- package/lib/utils/assert.d.ts +0 -1
- package/lib/utils/relationPath.js +1 -1
- package/package.json +1 -1
- package/src/entities/ActionAuth.ts +41 -41
- package/src/entities/I18n.ts +45 -45
- package/src/entities/ModiEntity.ts +26 -26
- package/src/entities/Oper.ts +1 -1
- 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
- package/lib/checkers/index.d.ts +0 -5
- package/lib/checkers/index.js +0 -13
- package/lib/triggers/index.d.ts +0 -5
- package/lib/triggers/index.js +0 -26
package/src/entities/User.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { String, Int, Text, Image, Datetime } from '../types/DataType';
|
|
2
|
-
import { EntityShape } from '../types/Entity';
|
|
3
|
-
import { ActionDef } from '../types/Action';
|
|
4
|
-
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
-
|
|
6
|
-
export interface Schema extends EntityShape {
|
|
7
|
-
name?: String<16>;
|
|
8
|
-
nickname?: String<64>;
|
|
9
|
-
password?: Text;
|
|
10
|
-
ref?: Schema;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type UserAction = 'mergeTo';
|
|
14
|
-
type UserState = 'normal' | 'merged';
|
|
15
|
-
|
|
16
|
-
export type Action = UserAction;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export const UserActionDef: ActionDef<UserAction, UserState> = {
|
|
20
|
-
stm: {
|
|
21
|
-
mergeTo: ['normal', 'merged'],
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const entityDesc: EntityDesc<Schema, Action, '', {
|
|
26
|
-
userState: UserState,
|
|
27
|
-
}> = {
|
|
28
|
-
locales: {
|
|
29
|
-
zh_CN: {
|
|
30
|
-
name: '用户',
|
|
31
|
-
attr: {
|
|
32
|
-
name: '姓名',
|
|
33
|
-
nickname: '昵称',
|
|
34
|
-
password: '密码',
|
|
35
|
-
ref: '指向用户',
|
|
36
|
-
userState: '状态',
|
|
37
|
-
},
|
|
38
|
-
action: {
|
|
39
|
-
mergeTo: '合并',
|
|
40
|
-
},
|
|
41
|
-
v: {
|
|
42
|
-
userState: {
|
|
43
|
-
normal: '正常',
|
|
44
|
-
merged: '已被合并',
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
},
|
|
1
|
+
import { String, Int, Text, Image, Datetime } from '../types/DataType';
|
|
2
|
+
import { EntityShape } from '../types/Entity';
|
|
3
|
+
import { ActionDef } from '../types/Action';
|
|
4
|
+
import { EntityDesc } from '../types/EntityDesc';
|
|
5
|
+
|
|
6
|
+
export interface Schema extends EntityShape {
|
|
7
|
+
name?: String<16>;
|
|
8
|
+
nickname?: String<64>;
|
|
9
|
+
password?: Text;
|
|
10
|
+
ref?: Schema;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type UserAction = 'mergeTo';
|
|
14
|
+
type UserState = 'normal' | 'merged';
|
|
15
|
+
|
|
16
|
+
export type Action = UserAction;
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export const UserActionDef: ActionDef<UserAction, UserState> = {
|
|
20
|
+
stm: {
|
|
21
|
+
mergeTo: ['normal', 'merged'],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const entityDesc: EntityDesc<Schema, Action, '', {
|
|
26
|
+
userState: UserState,
|
|
27
|
+
}> = {
|
|
28
|
+
locales: {
|
|
29
|
+
zh_CN: {
|
|
30
|
+
name: '用户',
|
|
31
|
+
attr: {
|
|
32
|
+
name: '姓名',
|
|
33
|
+
nickname: '昵称',
|
|
34
|
+
password: '密码',
|
|
35
|
+
ref: '指向用户',
|
|
36
|
+
userState: '状态',
|
|
37
|
+
},
|
|
38
|
+
action: {
|
|
39
|
+
mergeTo: '合并',
|
|
40
|
+
},
|
|
41
|
+
v: {
|
|
42
|
+
userState: {
|
|
43
|
+
normal: '正常',
|
|
44
|
+
merged: '已被合并',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
49
|
};
|
|
@@ -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
|
+
};
|
package/lib/checkers/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EntityDict } from '../base-app-domain';
|
|
2
|
-
import { AsyncContext } from '../store/AsyncRowStore';
|
|
3
|
-
import { SyncContext } from '../store/SyncRowStore';
|
|
4
|
-
import { StorageSchema, EntityDict as BaseEntityDict, Checker } from '../types';
|
|
5
|
-
export declare function createDynamicCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>): Checker<ED, keyof ED, Cxt>[];
|
package/lib/checkers/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDynamicCheckers = void 0;
|
|
4
|
-
const checker_1 = require("../store/checker");
|
|
5
|
-
const modi_1 = require("../store/modi");
|
|
6
|
-
function createDynamicCheckers(schema) {
|
|
7
|
-
const checkers = [];
|
|
8
|
-
checkers.push(...(0, modi_1.createModiRelatedCheckers)(schema));
|
|
9
|
-
checkers.push(...(0, checker_1.createRemoveCheckers)(schema));
|
|
10
|
-
checkers.push(...(0, checker_1.createCreateCheckers)(schema));
|
|
11
|
-
return checkers;
|
|
12
|
-
}
|
|
13
|
-
exports.createDynamicCheckers = createDynamicCheckers;
|
package/lib/triggers/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { EntityDict as BaseEntityDict } from '../base-app-domain';
|
|
2
|
-
import { StorageSchema, EntityDict, Trigger } from '../types';
|
|
3
|
-
import { AsyncContext } from '../store/AsyncRowStore';
|
|
4
|
-
import { SyncContext } from '../store/SyncRowStore';
|
|
5
|
-
export declare function createDynamicTriggers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>): Trigger<ED, keyof ED, Cxt>[];
|
package/lib/triggers/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDynamicTriggers = void 0;
|
|
4
|
-
const modi_1 = require("../store/modi");
|
|
5
|
-
/* function createOperTriggers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>() {
|
|
6
|
-
return [
|
|
7
|
-
{
|
|
8
|
-
name: 'assign initial bornAt for local oper',
|
|
9
|
-
entity: 'oper',
|
|
10
|
-
action: 'create',
|
|
11
|
-
when: 'before',
|
|
12
|
-
fn({ operation }) {
|
|
13
|
-
const { data } = operation;
|
|
14
|
-
assert(!(data instanceof Array));
|
|
15
|
-
if (!data.bornAt) {
|
|
16
|
-
data.bornAt = Date.now();
|
|
17
|
-
}
|
|
18
|
-
return 1;
|
|
19
|
-
}
|
|
20
|
-
} as CreateTrigger<ED, 'oper', Cxt>
|
|
21
|
-
] as Trigger<ED, keyof ED, Cxt>[];
|
|
22
|
-
} */
|
|
23
|
-
function createDynamicTriggers(schema) {
|
|
24
|
-
return (0, modi_1.createModiRelatedTriggers)(schema);
|
|
25
|
-
}
|
|
26
|
-
exports.createDynamicTriggers = createDynamicTriggers;
|