oak-domain 2.6.6 → 2.6.7

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.
@@ -5,7 +5,6 @@ import * as SubQuery from "../_SubQuery";
5
5
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
6
  import { Action, ParticularAction, IState } from "./Action";
7
7
  import * as ModiEntity from "../ModiEntity/Schema";
8
- import * as OperEntity from "../OperEntity/Schema";
9
8
  export declare type OpSchema = EntityShape & {
10
9
  targetEntity: String<32>;
11
10
  entity: String<32>;
@@ -28,8 +27,6 @@ export declare type Schema = EntityShape & {
28
27
  iState?: IState | null;
29
28
  modiEntity$modi?: Array<ModiEntity.Schema>;
30
29
  modiEntity$modi$$aggr?: AggregationResult<ModiEntity.Schema>;
31
- operEntity$entity?: Array<OperEntity.Schema>;
32
- operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
33
30
  } & {
34
31
  [A in ExpressionKey]?: any;
35
32
  };
@@ -69,12 +66,6 @@ export declare type Projection = {
69
66
  modiEntity$modi$$aggr?: ModiEntity.Aggregation & {
70
67
  $entity: "modiEntity";
71
68
  };
72
- operEntity$entity?: OperEntity.Selection & {
73
- $entity: "operEntity";
74
- };
75
- operEntity$entity$$aggr?: OperEntity.Aggregation & {
76
- $entity: "operEntity";
77
- };
78
69
  } & Partial<ExprOp<OpAttr | string>>;
79
70
  declare type ModiIdProjection = OneOf<{
80
71
  id: number;
@@ -114,7 +105,6 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
114
105
  [K: string]: any;
115
106
  }) & {
116
107
  modiEntity$modi?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">>>;
117
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
118
108
  };
119
109
  export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
120
110
  export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
@@ -122,7 +112,6 @@ export declare type CreateOperation = CreateSingleOperation | CreateMultipleOper
122
112
  export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
123
113
  [k: string]: any;
124
114
  modiEntity$modi?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "modi" | "modiId">>>;
125
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
126
115
  };
127
116
  export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
128
117
  export declare type RemoveOperationData = {};
@@ -12,6 +12,7 @@ export declare type OpSchema = EntityShape & {
12
12
  filter?: Object | null;
13
13
  extra?: Object | null;
14
14
  operatorId?: ForeignKey<"user"> | null;
15
+ targetEntity: String<32>;
15
16
  };
16
17
  export declare type OpAttr = keyof OpSchema;
17
18
  export declare type Schema = EntityShape & {
@@ -20,6 +21,7 @@ export declare type Schema = EntityShape & {
20
21
  filter?: Object | null;
21
22
  extra?: Object | null;
22
23
  operatorId?: ForeignKey<"user"> | null;
24
+ targetEntity: String<32>;
23
25
  operator?: User.Schema | null;
24
26
  operEntity$oper?: Array<OperEntity.Schema>;
25
27
  operEntity$oper$$aggr?: AggregationResult<OperEntity.Schema>;
@@ -37,6 +39,7 @@ declare type AttrFilter = {
37
39
  extra: Object;
38
40
  operatorId: Q_StringValue | SubQuery.UserIdSubQuery;
39
41
  operator: User.Filter;
42
+ targetEntity: Q_StringValue;
40
43
  };
41
44
  export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
42
45
  export declare type Projection = {
@@ -52,6 +55,7 @@ export declare type Projection = {
52
55
  extra?: number;
53
56
  operatorId?: number;
54
57
  operator?: User.Projection;
58
+ targetEntity?: number;
55
59
  operEntity$oper?: OperEntity.Selection & {
56
60
  $entity: "operEntity";
57
61
  };
@@ -79,6 +83,8 @@ export declare type SortAttr = {
79
83
  operatorId: number;
80
84
  } | {
81
85
  operator: User.SortAttr;
86
+ } | {
87
+ targetEntity: number;
82
88
  } | {
83
89
  [k: string]: any;
84
90
  } | OneOf<ExprOp<OpAttr | string>>;
@@ -22,6 +22,12 @@ exports.desc = {
22
22
  operatorId: {
23
23
  type: "ref",
24
24
  ref: "user"
25
+ },
26
+ targetEntity: {
27
+ type: "varchar",
28
+ params: {
29
+ length: 32
30
+ }
25
31
  }
26
32
  },
27
33
  actionType: "appendOnly",
@@ -5,21 +5,19 @@ import * as SubQuery from "../_SubQuery";
5
5
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape } from "../../types/Entity";
6
6
  import { AppendOnlyAction } from "../../actions/action";
7
7
  import * as Oper from "../Oper/Schema";
8
- import * as Modi from "../Modi/Schema";
9
8
  import * as User from "../User/Schema";
10
9
  import * as UserEntityGrant from "../UserEntityGrant/Schema";
11
10
  export declare type OpSchema = EntityShape & {
12
11
  operId: ForeignKey<"oper">;
13
- entity: "modi" | "user" | "userEntityGrant" | string;
12
+ entity: "user" | "userEntityGrant" | string;
14
13
  entityId: String<64>;
15
14
  };
16
15
  export declare type OpAttr = keyof OpSchema;
17
16
  export declare type Schema = EntityShape & {
18
17
  operId: ForeignKey<"oper">;
19
- entity: "modi" | "user" | "userEntityGrant" | string;
18
+ entity: "user" | "userEntityGrant" | string;
20
19
  entityId: String<64>;
21
20
  oper: Oper.Schema;
22
- modi?: Modi.Schema;
23
21
  user?: User.Schema;
24
22
  userEntityGrant?: UserEntityGrant.Schema;
25
23
  } & {
@@ -34,11 +32,10 @@ declare type AttrFilter<E> = {
34
32
  oper: Oper.Filter;
35
33
  entity: E;
36
34
  entityId: Q_StringValue;
37
- modi: Modi.Filter;
38
35
  user: User.Filter;
39
36
  userEntityGrant: UserEntityGrant.Filter;
40
37
  };
41
- export declare type Filter<E = Q_EnumValue<"modi" | "user" | "userEntityGrant" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
38
+ export declare type Filter<E = Q_EnumValue<"user" | "userEntityGrant" | string>> = MakeFilter<AttrFilter<E> & ExprOp<OpAttr | string>>;
42
39
  export declare type Projection = {
43
40
  "#id"?: NodeId;
44
41
  [k: string]: any;
@@ -50,7 +47,6 @@ export declare type Projection = {
50
47
  oper?: Oper.Projection;
51
48
  entity?: number;
52
49
  entityId?: number;
53
- modi?: Modi.Projection;
54
50
  user?: User.Projection;
55
51
  userEntityGrant?: UserEntityGrant.Projection;
56
52
  } & Partial<ExprOp<OpAttr | string>>;
@@ -60,9 +56,6 @@ declare type OperEntityIdProjection = OneOf<{
60
56
  declare type OperIdProjection = OneOf<{
61
57
  operId: number;
62
58
  }>;
63
- declare type ModiIdProjection = OneOf<{
64
- entityId: number;
65
- }>;
66
59
  declare type UserIdProjection = OneOf<{
67
60
  entityId: number;
68
61
  }>;
@@ -85,8 +78,6 @@ export declare type SortAttr = {
85
78
  entity: number;
86
79
  } | {
87
80
  entityId: number;
88
- } | {
89
- modi: Modi.SortAttr;
90
81
  } | {
91
82
  user: User.SortAttr;
92
83
  } | {
@@ -108,17 +99,6 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
108
99
  } | {
109
100
  operId: String<64>;
110
101
  })) & ({
111
- entity?: never;
112
- entityId?: never;
113
- modi: Modi.CreateSingleOperation;
114
- } | {
115
- entity: "modi";
116
- entityId: String<64>;
117
- modi: Modi.UpdateOperation;
118
- } | {
119
- entity: "modi";
120
- entityId: String<64>;
121
- } | {
122
102
  entity?: never;
123
103
  entityId?: never;
124
104
  user: User.CreateSingleOperation;
@@ -155,10 +135,6 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
155
135
  oper?: never;
156
136
  operId?: String<64> | null;
157
137
  })) & ({
158
- modi?: Modi.CreateSingleOperation | Modi.UpdateOperation | Modi.RemoveOperation;
159
- entityId?: never;
160
- entity?: never;
161
- } | {
162
138
  user?: User.CreateSingleOperation | User.UpdateOperation | User.RemoveOperation;
163
139
  entityId?: never;
164
140
  entity?: never;
@@ -167,15 +143,13 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity"
167
143
  entityId?: never;
168
144
  entity?: never;
169
145
  } | {
170
- entity?: ("modi" | "user" | "userEntityGrant" | string) | null;
146
+ entity?: ("user" | "userEntityGrant" | string) | null;
171
147
  entityId?: String<64> | null;
172
148
  }) & {
173
149
  [k: string]: any;
174
150
  };
175
151
  export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
176
152
  export declare type RemoveOperationData = {} & ({
177
- modi?: Modi.UpdateOperation | Modi.RemoveOperation;
178
- } | {
179
153
  user?: User.UpdateOperation | User.RemoveOperation;
180
154
  } | {
181
155
  userEntityGrant?: UserEntityGrant.UpdateOperation | UserEntityGrant.RemoveOperation;
@@ -185,7 +159,6 @@ export declare type RemoveOperationData = {} & ({
185
159
  export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
186
160
  export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
187
161
  export declare type OperIdSubQuery = Selection<OperIdProjection>;
188
- export declare type ModiIdSubQuery = Selection<ModiIdProjection>;
189
162
  export declare type UserIdSubQuery = Selection<UserIdProjection>;
190
163
  export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
191
164
  export declare type OperEntityIdSubQuery = Selection<OperEntityIdProjection>;
@@ -13,7 +13,7 @@ exports.desc = {
13
13
  params: {
14
14
  length: 32
15
15
  },
16
- ref: ["modi", "user", "userEntityGrant"]
16
+ ref: ["user", "userEntityGrant"]
17
17
  },
18
18
  entityId: {
19
19
  type: "varchar",
@@ -6,8 +6,8 @@ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOper
6
6
  import { Action, ParticularAction, UserState } from "./Action";
7
7
  import { RelationAction } from "../../actions/action";
8
8
  import * as Oper from "../Oper/Schema";
9
- import * as OperEntity from "../OperEntity/Schema";
10
9
  import * as ModiEntity from "../ModiEntity/Schema";
10
+ import * as OperEntity from "../OperEntity/Schema";
11
11
  export declare type OpSchema = EntityShape & {
12
12
  name?: String<16> | null;
13
13
  nickname?: String<64> | null;
@@ -27,10 +27,10 @@ export declare type Schema = EntityShape & {
27
27
  oper$operator$$aggr?: AggregationResult<Oper.Schema>;
28
28
  user$ref?: Array<Schema>;
29
29
  user$ref$$aggr?: AggregationResult<Schema>;
30
- operEntity$entity?: Array<OperEntity.Schema>;
31
- operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
32
30
  modiEntity$entity?: Array<ModiEntity.Schema>;
33
31
  modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
32
+ operEntity$entity?: Array<OperEntity.Schema>;
33
+ operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
34
34
  } & {
35
35
  [A in ExpressionKey]?: any;
36
36
  };
@@ -72,18 +72,18 @@ export declare type Projection = {
72
72
  user$ref$$aggr?: Aggregation & {
73
73
  $entity: "user";
74
74
  };
75
- operEntity$entity?: OperEntity.Selection & {
76
- $entity: "operEntity";
77
- };
78
- operEntity$entity$$aggr?: OperEntity.Aggregation & {
79
- $entity: "operEntity";
80
- };
81
75
  modiEntity$entity?: ModiEntity.Selection & {
82
76
  $entity: "modiEntity";
83
77
  };
84
78
  modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
85
79
  $entity: "modiEntity";
86
80
  };
81
+ operEntity$entity?: OperEntity.Selection & {
82
+ $entity: "operEntity";
83
+ };
84
+ operEntity$entity$$aggr?: OperEntity.Aggregation & {
85
+ $entity: "operEntity";
86
+ };
87
87
  } & Partial<ExprOp<OpAttr | string>>;
88
88
  declare type UserIdProjection = OneOf<{
89
89
  id: number;
@@ -131,8 +131,8 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "refId">
131
131
  })) & {
132
132
  oper$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
133
133
  user$ref?: OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "ref" | "refId">, Filter> | OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">> | OakOperation<UpdateOperation["action"], Omit<UpdateOperationData, "ref" | "refId">, Filter>>;
134
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
135
134
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
135
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
136
136
  };
137
137
  export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
138
138
  export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
@@ -153,8 +153,8 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "refId">
153
153
  [k: string]: any;
154
154
  oper$operator?: OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">[]> | Array<OakOperation<"create", Omit<Oper.CreateOperationData, "operator" | "operatorId">>>;
155
155
  user$ref?: UpdateOperation | RemoveOperation | OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">[]> | Array<OakOperation<"create", Omit<CreateOperationData, "ref" | "refId">> | UpdateOperation | RemoveOperation>;
156
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
157
156
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
157
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
158
158
  };
159
159
  export declare type UpdateOperation = OakOperation<"update" | ParticularAction | RelationAction | string, UpdateOperationData, Filter, Sorter>;
160
160
  export declare type RemoveOperationData = {} & (({
@@ -4,8 +4,8 @@ import { OneOf } from "../../types/Polyfill";
4
4
  import * as SubQuery from "../_SubQuery";
5
5
  import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
6
  import { GenericAction } from "../../actions/action";
7
- import * as OperEntity from "../OperEntity/Schema";
8
7
  import * as ModiEntity from "../ModiEntity/Schema";
8
+ import * as OperEntity from "../OperEntity/Schema";
9
9
  export declare type OpSchema = EntityShape & {
10
10
  entity: String<32>;
11
11
  entityId: String<64>;
@@ -16,10 +16,10 @@ export declare type Schema = EntityShape & {
16
16
  entity: String<32>;
17
17
  entityId: String<64>;
18
18
  relation: String<32>;
19
- operEntity$entity?: Array<OperEntity.Schema>;
20
- operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
21
19
  modiEntity$entity?: Array<ModiEntity.Schema>;
22
20
  modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
21
+ operEntity$entity?: Array<OperEntity.Schema>;
22
+ operEntity$entity$$aggr?: AggregationResult<OperEntity.Schema>;
23
23
  } & {
24
24
  [A in ExpressionKey]?: any;
25
25
  };
@@ -43,18 +43,18 @@ export declare type Projection = {
43
43
  entity?: number;
44
44
  entityId?: number;
45
45
  relation?: number;
46
- operEntity$entity?: OperEntity.Selection & {
47
- $entity: "operEntity";
48
- };
49
- operEntity$entity$$aggr?: OperEntity.Aggregation & {
50
- $entity: "operEntity";
51
- };
52
46
  modiEntity$entity?: ModiEntity.Selection & {
53
47
  $entity: "modiEntity";
54
48
  };
55
49
  modiEntity$entity$$aggr?: ModiEntity.Aggregation & {
56
50
  $entity: "modiEntity";
57
51
  };
52
+ operEntity$entity?: OperEntity.Selection & {
53
+ $entity: "operEntity";
54
+ };
55
+ operEntity$entity$$aggr?: OperEntity.Aggregation & {
56
+ $entity: "operEntity";
57
+ };
58
58
  } & Partial<ExprOp<OpAttr | string>>;
59
59
  declare type UserEntityGrantIdProjection = OneOf<{
60
60
  id: number;
@@ -89,16 +89,16 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
89
89
  entityId?: string;
90
90
  [K: string]: any;
91
91
  }) & {
92
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
93
92
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
93
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
94
94
  };
95
95
  export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
96
96
  export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
97
97
  export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
98
98
  export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
99
99
  [k: string]: any;
100
- operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
101
100
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
101
+ operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
102
102
  };
103
103
  export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
104
104
  export declare type RemoveOperationData = {};
@@ -5,6 +5,7 @@ export declare const ENTITY_PATH_IN_OAK_DOMAIN: () => string;
5
5
  export declare const TYPE_PATH_IN_OAK_DOMAIN: (level?: number) => string;
6
6
  export declare const ACTION_CONSTANT_IN_OAK_DOMAIN: (level?: number) => string;
7
7
  export declare const RESERVED_ENTITIES: string[];
8
+ export declare const ENTITY_NAME_MAX_LENGTH = 32;
8
9
  export declare const STRING_LITERAL_MAX_LENGTH = 24;
9
10
  export declare const NUMERICAL_LITERL_DEFAULT_PRECISION = 8;
10
11
  export declare const NUMERICAL_LITERL_DEFAULT_SCALE = 2;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INT_LITERL_DEFAULT_WIDTH = exports.NUMERICAL_LITERL_DEFAULT_SCALE = exports.NUMERICAL_LITERL_DEFAULT_PRECISION = exports.STRING_LITERAL_MAX_LENGTH = exports.RESERVED_ENTITIES = exports.ACTION_CONSTANT_IN_OAK_DOMAIN = exports.TYPE_PATH_IN_OAK_DOMAIN = exports.ENTITY_PATH_IN_OAK_DOMAIN = exports.ENTITY_PATH_IN_OAK_GENERAL_BUSINESS = exports.LIB_PATH = exports.LIB_OAK_DOMAIN = void 0;
3
+ exports.INT_LITERL_DEFAULT_WIDTH = exports.NUMERICAL_LITERL_DEFAULT_SCALE = exports.NUMERICAL_LITERL_DEFAULT_PRECISION = exports.STRING_LITERAL_MAX_LENGTH = exports.ENTITY_NAME_MAX_LENGTH = exports.RESERVED_ENTITIES = exports.ACTION_CONSTANT_IN_OAK_DOMAIN = exports.TYPE_PATH_IN_OAK_DOMAIN = exports.ENTITY_PATH_IN_OAK_DOMAIN = exports.ENTITY_PATH_IN_OAK_GENERAL_BUSINESS = exports.LIB_PATH = exports.LIB_OAK_DOMAIN = void 0;
4
4
  exports.LIB_OAK_DOMAIN = 'oak-domain';
5
5
  var LIB_OAK_GENERAL_BUSINESS = 'oak-general-business';
6
6
  var LIB_PATH = function () { return 'lib'; };
@@ -33,6 +33,7 @@ exports.ACTION_CONSTANT_IN_OAK_DOMAIN = ACTION_CONSTANT_IN_OAK_DOMAIN;
33
33
  // export const OUTPUT_PATH = 'app-domain/entities';
34
34
  exports.RESERVED_ENTITIES = ['Schema', 'Filter', 'Query', 'SubQuery', 'Entity', 'Selection', 'Operation', 'File', 'Common',
35
35
  'Locale', 'Projection', 'Data'];
36
+ exports.ENTITY_NAME_MAX_LENGTH = 32;
36
37
  exports.STRING_LITERAL_MAX_LENGTH = 24;
37
38
  exports.NUMERICAL_LITERL_DEFAULT_PRECISION = 8;
38
39
  exports.NUMERICAL_LITERL_DEFAULT_SCALE = 2;
@@ -344,6 +344,18 @@ function getStringEnumValues(filename, program, obj, node) {
344
344
  }
345
345
  }
346
346
  }
347
+ function checkNameLegal(filename, attrName, upperCase) {
348
+ (0, assert_1.default)(attrName.length <= env_1.ENTITY_NAME_MAX_LENGTH, "\u6587\u4EF6\u300C".concat(filename, "\u300D\uFF1A\u300C").concat(attrName, "\u300D\u7684\u540D\u79F0\u5B9A\u4E49\u8FC7\u957F\uFF0C\u4E0D\u80FD\u8D85\u8FC7\u300C").concat(env_1.ENTITY_NAME_MAX_LENGTH, "\u300D\u957F\u5EA6"));
349
+ if (upperCase) {
350
+ (0, assert_1.default)(/[A-Z][a-z|A-Z|0-9]+/i.test(attrName), "\u6587\u4EF6\u300C".concat(filename, "\u300D\uFF1A\u300C").concat(attrName, "\u300D\u7684\u540D\u79F0\u5FC5\u987B\u4EE5\u5927\u5199\u5B57\u6BCD\u5F00\u59CB\uFF0C\u4E14\u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u548C\u6570\u5B57"));
351
+ }
352
+ else if (upperCase === false) {
353
+ (0, assert_1.default)(/[a-z][a-z|A-Z|0-9]+/i.test(attrName), "\u6587\u4EF6\u300C".concat(filename, "\u300D\uFF1A\u300C").concat(attrName, "\u300D\u7684\u540D\u79F0\u5FC5\u987B\u4EE5\u5C0F\u5199\u5B57\u6BCD\u5F00\u59CB\uFF0C\u4E14\u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u548C\u6570\u5B57"));
354
+ }
355
+ else {
356
+ (0, assert_1.default)(/[a-z|A-Z][a-z|A-Z|0-9]+/i.test(attrName), "\u6587\u4EF6\u300C".concat(filename, "\u300D\uFF1A\u300C").concat(attrName, "\u300D\u7684\u540D\u79F0\u5FC5\u987B\u4EE5\u5B57\u6BCD\u5F00\u59CB\uFF0C\u4E14\u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u548C\u6570\u5B57"));
357
+ }
358
+ }
347
359
  function analyzeEntity(filename, path, program, relativePath) {
348
360
  var _a;
349
361
  var fullPath = "".concat(path, "/").concat(filename);
@@ -355,6 +367,7 @@ function analyzeEntity(filename, path, program, relativePath) {
355
367
  // removeFromRelationShip(moduleName);
356
368
  console.warn("\u51FA\u73B0\u4E86\u540C\u540D\u7684Entity\u5B9A\u4E49\u300C".concat(moduleName, "\u300D\uFF0C\u5C06\u4F7F\u7528").concat(fullPath, "\u53D6\u4EE3\u6389\u9ED8\u8BA4\u5BF9\u8C61\uFF0C\u8BF7\u68C0\u67E5\u65B0\u7684\u5BF9\u8C61\u7ED3\u6784\u53CA\u76F8\u5173\u5E38\u91CF\u5B9A\u4E49\u4E0E\u539F\u6709\u7684\u517C\u5BB9\uFF0C\u5426\u5219\u539F\u6709\u5BF9\u8C61\u7684\u76F8\u5173\u903B\u8F91\u4F1A\u51FA\u73B0\u4E0D\u53EF\u77E5\u5F02\u5E38"));
357
369
  }
370
+ checkNameLegal(filename, moduleName, true);
358
371
  var referencedSchemas = [];
359
372
  var schemaAttrs = [];
360
373
  var hasFulltextIndex = false;
@@ -406,6 +419,7 @@ function analyzeEntity(filename, path, program, relativePath) {
406
419
  var _a, _b;
407
420
  var _c = attrNode, type = _c.type, name = _c.name, questionToken = _c.questionToken;
408
421
  var attrName = name.text;
422
+ checkNameLegal(filename, attrName, false);
409
423
  if (ts.isTypeReferenceNode(type)
410
424
  && ts.isIdentifier(type.typeName)) {
411
425
  if ((referencedSchemas.includes(type.typeName.text) || type.typeName.text === 'Schema')) {
@@ -516,27 +530,27 @@ function analyzeEntity(filename, path, program, relativePath) {
516
530
  _a[moduleName] = 1,
517
531
  _a));
518
532
  }
533
+ else if (hasEntityAttr_1 || hasEntityIdAttr_1) {
534
+ throw new Error("\u6587\u4EF6\u300C".concat(filename, "\u300D\uFF1A\u5C5E\u6027 \u5B9A\u4E49\u4E2D\u53EA\u5305\u542B").concat(hasEntityAttr_1 ? 'entity' : 'entityId', "\uFF0C\u4E0D\u7B26\u5408\u5B9A\u4E49\u89C4\u8303\u3002entity/entityId\u5FC5\u987B\u8054\u5408\u51FA\u73B0\uFF0C\u4EE3\u8868\u4E0D\u5B9A\u5BF9\u8C61\u7684\u53CD\u5411\u6307\u9488"));
535
+ }
519
536
  beforeSchema = false;
520
- // 对于不是Oper的对象,全部建立和OperEntity的反指关系
521
- if (!['Oper', 'OperEntity', 'ModiEntity'].includes(moduleName)) {
522
- if (ReversePointerRelations['OperEntity'] && !ReversePointerRelations['OperEntity'].includes(moduleName)) {
523
- ReversePointerRelations['OperEntity'].push(moduleName);
537
+ // 对于不是Modi和Oper的对象,全部建立和ModiEntity的反指关系
538
+ if (!['Modi', 'Oper', 'OperEntity', 'ModiEntity'].includes(moduleName) && !toModi) {
539
+ if (ReversePointerRelations['ModiEntity'] && !ReversePointerRelations['ModiEntity'].includes(moduleName)) {
540
+ ReversePointerRelations['ModiEntity'].push(moduleName);
524
541
  }
525
542
  else {
526
543
  (0, lodash_1.assign)(ReversePointerRelations, (_b = {},
527
- _b['OperEntity'] = [moduleName],
544
+ _b['ModiEntity'] = [moduleName],
528
545
  _b));
529
546
  }
530
- // 对于不是Modi的对象,全部建立和ModiEntity的反指关系
531
- if (!['Modi'].includes(moduleName) && !toModi) {
532
- if (ReversePointerRelations['ModiEntity'] && !ReversePointerRelations['ModiEntity'].includes(moduleName)) {
533
- ReversePointerRelations['ModiEntity'].push(moduleName);
534
- }
535
- else {
536
- (0, lodash_1.assign)(ReversePointerRelations, (_c = {},
537
- _c['ModiEntity'] = [moduleName],
538
- _c));
539
- }
547
+ if (ReversePointerRelations['OperEntity'] && !ReversePointerRelations['OperEntity'].includes(moduleName)) {
548
+ ReversePointerRelations['OperEntity'].push(moduleName);
549
+ }
550
+ else {
551
+ (0, lodash_1.assign)(ReversePointerRelations, (_c = {},
552
+ _c['OperEntity'] = [moduleName],
553
+ _c));
540
554
  }
541
555
  }
542
556
  }
@@ -7,4 +7,5 @@ export interface Schema extends EntityShape {
7
7
  filter?: Object;
8
8
  extra?: Object;
9
9
  operator?: User;
10
+ targetEntity: String<32>;
10
11
  }
@@ -13,6 +13,7 @@ var locale = {
13
13
  filter: '选择条件',
14
14
  extra: '其它',
15
15
  operator: '操作者',
16
+ targetEntity: '关联对象',
16
17
  },
17
18
  },
18
19
  };
@@ -2,7 +2,7 @@
2
2
  import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult } from "../types";
3
3
  import { IncomingHttpHeaders } from "http";
4
4
  export declare abstract class AsyncContext<ED extends EntityDict> implements Context {
5
- private rowStore;
5
+ rowStore: AsyncRowStore<ED, this>;
6
6
  private uuid?;
7
7
  opRecords: OpRecord<ED>[];
8
8
  private scene?;
@@ -12,6 +12,10 @@ export declare abstract class AsyncContext<ED extends EntityDict> implements Con
12
12
  commit: Array<() => Promise<void>>;
13
13
  rollback: Array<() => Promise<void>>;
14
14
  };
15
+ /**
16
+ * 在返回结果前调用,对数据行进行一些预处理,比如将一些敏感的列隐藏
17
+ */
18
+ abstract refineOpRecords(): Promise<void>;
15
19
  constructor(store: AsyncRowStore<ED, AsyncContext<ED>>, headers?: IncomingHttpHeaders);
16
20
  setHeaders(headers: IncomingHttpHeaders): void;
17
21
  getHeader(key: string): string | string[] | undefined;
@@ -1,6 +1,6 @@
1
1
  import { EntityDict, OperateOption, SelectOption, OperationResult, AggregationResult } from "../types/Entity";
2
2
  import { EntityDict as BaseEntityDict } from '../base-app-domain';
3
- import { RowStore } from '../types/RowStore';
3
+ import { OperationRewriter, RowStore, SelectionRewriter } from '../types/RowStore';
4
4
  import { StorageSchema } from '../types/Storage';
5
5
  import { SyncContext } from "./SyncRowStore";
6
6
  import { AsyncContext } from "./AsyncRowStore";
@@ -9,6 +9,12 @@ export declare abstract class CascadeStore<ED extends EntityDict & BaseEntityDic
9
9
  constructor(storageSchema: StorageSchema<ED>);
10
10
  protected abstract supportManyToOneJoin(): boolean;
11
11
  protected abstract supportMultipleCreate(): boolean;
12
+ private selectionRewriters;
13
+ private operationRewriters;
14
+ private reinforceSelection;
15
+ private reinforceOperation;
16
+ registerOperationRewriter(rewriter: OperationRewriter<ED>): void;
17
+ registerSelectionRewriter(rewriter: SelectionRewriter<ED>): void;
12
18
  protected abstract selectAbjointRow<T extends keyof ED, OP extends SelectOption, Cxt extends SyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Partial<ED[T]['Schema']>[];
13
19
  protected abstract updateAbjointRow<T extends keyof ED, OP extends OperateOption, Cxt extends SyncContext<ED>>(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): number;
14
20
  protected abstract selectAbjointRowAsync<T extends keyof ED, OP extends SelectOption, Cxt extends AsyncContext<ED>>(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Promise<Partial<ED[T]['Schema']>[]>;