oak-domain 2.6.9 → 3.0.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.
Files changed (124) hide show
  1. package/lib/actions/action.d.ts +1 -1
  2. package/lib/actions/action.js +2 -2
  3. package/lib/base-app-domain/ActionAuth/Schema.d.ts +25 -21
  4. package/lib/base-app-domain/ActionAuth/Storage.js +6 -13
  5. package/lib/base-app-domain/ActionDefDict.d.ts +1 -0
  6. package/lib/base-app-domain/ActionDefDict.js +3 -1
  7. package/lib/base-app-domain/EntityDict.d.ts +2 -0
  8. package/lib/base-app-domain/I18n/Schema.d.ts +129 -0
  9. package/lib/base-app-domain/I18n/Schema.js +2 -0
  10. package/lib/base-app-domain/I18n/Storage.d.ts +3 -0
  11. package/lib/base-app-domain/I18n/Storage.js +59 -0
  12. package/lib/base-app-domain/Modi/Action.d.ts +1 -1
  13. package/lib/base-app-domain/Modi/Schema.d.ts +10 -9
  14. package/lib/base-app-domain/ModiEntity/Schema.d.ts +42 -28
  15. package/lib/base-app-domain/ModiEntity/Storage.js +1 -1
  16. package/lib/base-app-domain/Oper/Schema.d.ts +15 -13
  17. package/lib/base-app-domain/OperEntity/Schema.d.ts +41 -27
  18. package/lib/base-app-domain/OperEntity/Storage.js +1 -1
  19. package/lib/base-app-domain/Relation/Schema.d.ts +50 -22
  20. package/lib/base-app-domain/Relation/Storage.js +1 -4
  21. package/lib/base-app-domain/Relation.d.ts +10 -0
  22. package/lib/base-app-domain/Relation.js +10 -0
  23. package/lib/base-app-domain/RelationAuth/Schema.d.ts +67 -43
  24. package/lib/base-app-domain/RelationAuth/Storage.js +9 -12
  25. package/lib/base-app-domain/Storage.js +20 -18
  26. package/lib/base-app-domain/User/Action.d.ts +1 -1
  27. package/lib/base-app-domain/User/Schema.d.ts +20 -14
  28. package/lib/base-app-domain/User/Storage.js +1 -2
  29. package/lib/base-app-domain/UserEntityGrant/Action.d.ts +5 -0
  30. package/lib/base-app-domain/UserEntityGrant/Action.js +5 -0
  31. package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +53 -17
  32. package/lib/base-app-domain/UserEntityGrant/Storage.js +5 -7
  33. package/lib/base-app-domain/UserRelation/Schema.d.ts +35 -16
  34. package/lib/base-app-domain/UserRelation/Storage.js +21 -1
  35. package/lib/base-app-domain/_SubQuery.d.ts +40 -4
  36. package/lib/base-app-domain/index.d.ts +1 -0
  37. package/lib/base-app-domain/index.js +1 -0
  38. package/lib/checkers/index.d.ts +2 -2
  39. package/lib/checkers/index.js +2 -5
  40. package/lib/compiler/env.d.ts +3 -1
  41. package/lib/compiler/env.js +12 -2
  42. package/lib/compiler/localeBuilder.d.ts +22 -0
  43. package/lib/compiler/localeBuilder.js +169 -0
  44. package/lib/compiler/schemalBuilder.d.ts +9 -0
  45. package/lib/compiler/schemalBuilder.js +774 -362
  46. package/lib/entities/ActionAuth.d.ts +3 -2
  47. package/lib/entities/ActionAuth.js +21 -22
  48. package/lib/entities/I18n.d.ts +9 -0
  49. package/lib/entities/I18n.js +37 -0
  50. package/lib/entities/Modi.js +35 -33
  51. package/lib/entities/ModiEntity.js +12 -10
  52. package/lib/entities/Oper.js +15 -13
  53. package/lib/entities/OperEntity.js +12 -10
  54. package/lib/entities/Relation.d.ts +3 -3
  55. package/lib/entities/Relation.js +27 -25
  56. package/lib/entities/RelationAuth.d.ts +2 -5
  57. package/lib/entities/RelationAuth.js +27 -23
  58. package/lib/entities/User.js +20 -18
  59. package/lib/entities/UserEntityGrant.d.ts +2 -1
  60. package/lib/entities/UserEntityGrant.js +12 -7
  61. package/lib/entities/UserRelation.d.ts +3 -0
  62. package/lib/entities/UserRelation.js +30 -20
  63. package/lib/store/AsyncRowStore.d.ts +3 -0
  64. package/lib/store/AsyncRowStore.js +3 -0
  65. package/lib/store/CascadeStore.d.ts +9 -3
  66. package/lib/store/CascadeStore.js +247 -113
  67. package/lib/store/RelationAuth.d.ts +96 -0
  68. package/lib/store/RelationAuth.js +1307 -0
  69. package/lib/store/TriggerExecutor.d.ts +1 -2
  70. package/lib/store/TriggerExecutor.js +22 -22
  71. package/lib/store/actionAuth.d.ts +4 -0
  72. package/lib/store/actionAuth.js +40 -0
  73. package/lib/store/actionDef.d.ts +4 -3
  74. package/lib/store/actionDef.js +63 -45
  75. package/lib/store/checker.d.ts +2 -9
  76. package/lib/store/checker.js +39 -815
  77. package/lib/store/filter.d.ts +31 -18
  78. package/lib/store/filter.js +1256 -422
  79. package/lib/store/modi.d.ts +1 -1
  80. package/lib/store/modi.js +108 -9
  81. package/lib/store/relation.d.ts +3 -4
  82. package/lib/timers/oper.js +1 -1
  83. package/lib/timers/vaccum.js +2 -2
  84. package/lib/triggers/index.d.ts +2 -3
  85. package/lib/triggers/index.js +2 -5
  86. package/lib/types/Auth.d.ts +5 -0
  87. package/lib/types/DataType.d.ts +3 -0
  88. package/lib/types/Demand.d.ts +11 -0
  89. package/lib/types/Demand.js +2 -1
  90. package/lib/types/Entity.d.ts +10 -3
  91. package/lib/types/EntityDesc.d.ts +8 -0
  92. package/lib/types/EntityDesc.js +2 -0
  93. package/lib/types/Environment.d.ts +57 -0
  94. package/lib/types/Environment.js +2 -0
  95. package/lib/types/Exception.d.ts +6 -0
  96. package/lib/types/Exception.js +25 -1
  97. package/lib/types/Logger.d.ts +1 -0
  98. package/lib/types/Port.d.ts +3 -2
  99. package/lib/types/RowStore.d.ts +6 -4
  100. package/lib/types/Style.d.ts +1 -1
  101. package/lib/types/Trigger.d.ts +4 -5
  102. package/lib/types/Trigger.js +11 -6
  103. package/lib/types/index.d.ts +2 -0
  104. package/lib/types/index.js +2 -0
  105. package/lib/utils/SimpleConnector.js +1 -1
  106. package/lib/utils/money.js +1 -1
  107. package/lib/utils/string.d.ts +6 -0
  108. package/lib/utils/string.js +13 -1
  109. package/lib/utils/uuid.d.ts +5 -0
  110. package/lib/utils/uuid.js +64 -1
  111. package/package.json +3 -3
  112. package/src/entities/ActionAuth.ts +25 -33
  113. package/src/entities/I18n.ts +46 -0
  114. package/src/entities/Modi.ts +36 -36
  115. package/src/entities/ModiEntity.ts +14 -13
  116. package/src/entities/Oper.ts +17 -16
  117. package/src/entities/OperEntity.ts +13 -11
  118. package/src/entities/Relation.ts +31 -37
  119. package/src/entities/RelationAuth.ts +31 -37
  120. package/src/entities/User.ts +24 -21
  121. package/src/entities/UserEntityGrant.ts +16 -14
  122. package/src/entities/UserRelation.ts +33 -27
  123. package/lib/triggers/modi.d.ts +0 -5
  124. package/lib/triggers/modi.js +0 -72
@@ -1,21 +1,24 @@
1
- import { String } from "../../types/DataType";
2
- import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
1
+ import { ForeignKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
3
3
  import { OneOf } from "../../types/Polyfill";
4
- import * as SubQuery from "../_SubQuery";
5
- import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
6
- import { GenericAction } from "../../actions/action";
4
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult } from "../../types/Entity";
5
+ import { Action, ParticularAction } from "./Action";
6
+ import { String } from "../../types/DataType";
7
+ import { EntityShape } from "../../types/Entity";
8
+ import * as Relation from "../Relation/Schema";
7
9
  import * as ModiEntity from "../ModiEntity/Schema";
8
10
  import * as OperEntity from "../OperEntity/Schema";
9
11
  export declare type OpSchema = EntityShape & {
10
12
  entity: String<32>;
11
13
  entityId: String<64>;
12
- relation: String<32>;
14
+ relationId: ForeignKey<"relation">;
13
15
  };
14
16
  export declare type OpAttr = keyof OpSchema;
15
17
  export declare type Schema = EntityShape & {
16
18
  entity: String<32>;
17
19
  entityId: String<64>;
18
- relation: String<32>;
20
+ relationId: ForeignKey<"relation">;
21
+ relation: Relation.Schema;
19
22
  modiEntity$entity?: Array<ModiEntity.Schema>;
20
23
  modiEntity$entity$$aggr?: AggregationResult<ModiEntity.Schema>;
21
24
  operEntity$entity?: Array<OperEntity.Schema>;
@@ -24,13 +27,16 @@ export declare type Schema = EntityShape & {
24
27
  [A in ExpressionKey]?: any;
25
28
  };
26
29
  declare type AttrFilter = {
27
- id: Q_StringValue | SubQuery.UserEntityGrantIdSubQuery;
30
+ id: Q_StringValue;
28
31
  $$createAt$$: Q_DateValue;
29
32
  $$seq$$: Q_StringValue;
30
33
  $$updateAt$$: Q_DateValue;
31
34
  entity: Q_StringValue;
32
35
  entityId: Q_StringValue;
33
- relation: Q_StringValue;
36
+ relationId: Q_StringValue;
37
+ relation: Relation.Filter;
38
+ modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
39
+ operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
34
40
  };
35
41
  export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
36
42
  export declare type Projection = {
@@ -42,7 +48,8 @@ export declare type Projection = {
42
48
  $$seq$$?: number;
43
49
  entity?: number;
44
50
  entityId?: number;
45
- relation?: number;
51
+ relationId?: number;
52
+ relation?: Relation.Projection;
46
53
  modiEntity$entity?: ModiEntity.Selection & {
47
54
  $entity: "modiEntity";
48
55
  };
@@ -59,6 +66,9 @@ export declare type Projection = {
59
66
  declare type UserEntityGrantIdProjection = OneOf<{
60
67
  id: number;
61
68
  }>;
69
+ declare type RelationIdProjection = OneOf<{
70
+ relationId: number;
71
+ }>;
62
72
  export declare type SortAttr = {
63
73
  id: number;
64
74
  } | {
@@ -72,7 +82,9 @@ export declare type SortAttr = {
72
82
  } | {
73
83
  entityId: number;
74
84
  } | {
75
- relation: number;
85
+ relationId: number;
86
+ } | {
87
+ relation: Relation.SortAttr;
76
88
  } | {
77
89
  [k: string]: any;
78
90
  } | OneOf<ExprOp<OpAttr | string>>;
@@ -82,9 +94,17 @@ export declare type SortNode = {
82
94
  };
83
95
  export declare type Sorter = SortNode[];
84
96
  export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
85
- export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
97
+ export declare type Selection<P extends Object = Projection> = SelectOperation<P>;
86
98
  export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
87
- export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId">> & ({
99
+ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "relationId">> & (({
100
+ relationId?: never;
101
+ relation: Relation.CreateSingleOperation;
102
+ } | {
103
+ relationId: ForeignKey<"relation">;
104
+ relation?: Relation.UpdateOperation;
105
+ } | {
106
+ relationId: ForeignKey<"relation">;
107
+ })) & ({
88
108
  entity?: string;
89
109
  entityId?: string;
90
110
  [K: string]: any;
@@ -95,20 +115,35 @@ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity"
95
115
  export declare type CreateSingleOperation = OakOperation<"create", CreateOperationData>;
96
116
  export declare type CreateMultipleOperation = OakOperation<"create", Array<CreateOperationData>>;
97
117
  export declare type CreateOperation = CreateSingleOperation | CreateMultipleOperation;
98
- export declare type UpdateOperationData = FormUpdateData<OpSchema> & {
118
+ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "relationId">> & (({
119
+ relation: Relation.CreateSingleOperation;
120
+ relationId?: never;
121
+ } | {
122
+ relation: Relation.UpdateOperation;
123
+ relationId?: never;
124
+ } | {
125
+ relation: Relation.RemoveOperation;
126
+ relationId?: never;
127
+ } | {
128
+ relation?: never;
129
+ relationId?: ForeignKey<"relation"> | null;
130
+ })) & {
99
131
  [k: string]: any;
100
132
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
101
133
  operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
102
134
  };
103
- export declare type UpdateOperation = OakOperation<"update" | string, UpdateOperationData, Filter, Sorter>;
104
- export declare type RemoveOperationData = {};
135
+ export declare type UpdateOperation = OakOperation<"update" | ParticularAction | string, UpdateOperationData, Filter, Sorter>;
136
+ export declare type RemoveOperationData = {} & (({
137
+ relation?: Relation.UpdateOperation | Relation.RemoveOperation;
138
+ }));
105
139
  export declare type RemoveOperation = OakOperation<"remove", RemoveOperationData, Filter, Sorter>;
106
140
  export declare type Operation = CreateOperation | UpdateOperation | RemoveOperation;
141
+ export declare type RelationIdSubQuery = Selection<RelationIdProjection>;
107
142
  export declare type UserEntityGrantIdSubQuery = Selection<UserEntityGrantIdProjection>;
108
143
  export declare type EntityDef = {
109
144
  Schema: Schema;
110
145
  OpSchema: OpSchema;
111
- Action: OakMakeAction<GenericAction> | string;
146
+ Action: OakMakeAction<Action> | string;
112
147
  Selection: Selection;
113
148
  Aggregation: Aggregation;
114
149
  Operation: Operation;
@@ -117,5 +152,6 @@ export declare type EntityDef = {
117
152
  Remove: RemoveOperation;
118
153
  CreateSingle: CreateSingleOperation;
119
154
  CreateMulti: CreateMultipleOperation;
155
+ ParticularAction: ParticularAction;
120
156
  };
121
157
  export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.desc = void 0;
4
- var action_1 = require("../../actions/action");
4
+ var Action_1 = require("./Action");
5
5
  exports.desc = {
6
6
  attributes: {
7
7
  entity: {
@@ -18,14 +18,12 @@ exports.desc = {
18
18
  length: 64
19
19
  }
20
20
  },
21
- relation: {
21
+ relationId: {
22
22
  notNull: true,
23
- type: "varchar",
24
- params: {
25
- length: 32
26
- }
23
+ type: "ref",
24
+ ref: "relation"
27
25
  }
28
26
  },
29
27
  actionType: "crud",
30
- actions: action_1.genericActions
28
+ actions: Action_1.actions
31
29
  };
@@ -1,9 +1,10 @@
1
- import { String, ForeignKey } from "../../types/DataType";
2
- import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey } from "../../types/Demand";
1
+ import { ForeignKey } from "../../types/DataType";
2
+ import { Q_DateValue, Q_StringValue, NodeId, MakeFilter, ExprOp, ExpressionKey, SubQueryPredicateMetadata } from "../../types/Demand";
3
3
  import { OneOf } from "../../types/Polyfill";
4
- import * as SubQuery from "../_SubQuery";
5
- import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, EntityShape, AggregationResult } from "../../types/Entity";
4
+ import { FormCreateData, FormUpdateData, DeduceAggregation, Operation as OakOperation, Selection as OakSelection, MakeAction as OakMakeAction, AggregationResult } from "../../types/Entity";
6
5
  import { GenericAction } from "../../actions/action";
6
+ import { String } from "../../types/DataType";
7
+ import { EntityShape } from "../../types/Entity";
7
8
  import * as User from "../User/Schema";
8
9
  import * as Relation from "../Relation/Schema";
9
10
  import * as ModiEntity from "../ModiEntity/Schema";
@@ -11,11 +12,15 @@ import * as OperEntity from "../OperEntity/Schema";
11
12
  export declare type OpSchema = EntityShape & {
12
13
  userId: ForeignKey<"user">;
13
14
  relationId: ForeignKey<"relation">;
15
+ entity: String<32>;
16
+ entityId: String<64>;
14
17
  };
15
18
  export declare type OpAttr = keyof OpSchema;
16
19
  export declare type Schema = EntityShape & {
17
20
  userId: ForeignKey<"user">;
18
21
  relationId: ForeignKey<"relation">;
22
+ entity: String<32>;
23
+ entityId: String<64>;
19
24
  user: User.Schema;
20
25
  relation: Relation.Schema;
21
26
  modiEntity$entity?: Array<ModiEntity.Schema>;
@@ -26,14 +31,18 @@ export declare type Schema = EntityShape & {
26
31
  [A in ExpressionKey]?: any;
27
32
  };
28
33
  declare type AttrFilter = {
29
- id: Q_StringValue | SubQuery.UserRelationIdSubQuery;
34
+ id: Q_StringValue;
30
35
  $$createAt$$: Q_DateValue;
31
36
  $$seq$$: Q_StringValue;
32
37
  $$updateAt$$: Q_DateValue;
33
- userId: Q_StringValue | SubQuery.UserIdSubQuery;
38
+ userId: Q_StringValue;
34
39
  user: User.Filter;
35
- relationId: Q_StringValue | SubQuery.RelationIdSubQuery;
40
+ relationId: Q_StringValue;
36
41
  relation: Relation.Filter;
42
+ entity: Q_StringValue;
43
+ entityId: Q_StringValue;
44
+ modiEntity$entity: ModiEntity.Filter & SubQueryPredicateMetadata;
45
+ operEntity$entity: OperEntity.Filter & SubQueryPredicateMetadata;
37
46
  };
38
47
  export declare type Filter = MakeFilter<AttrFilter & ExprOp<OpAttr | string>>;
39
48
  export declare type Projection = {
@@ -47,6 +56,8 @@ export declare type Projection = {
47
56
  user?: User.Projection;
48
57
  relationId?: number;
49
58
  relation?: Relation.Projection;
59
+ entity?: number;
60
+ entityId?: number;
50
61
  modiEntity$entity?: ModiEntity.Selection & {
51
62
  $entity: "modiEntity";
52
63
  };
@@ -85,6 +96,10 @@ export declare type SortAttr = {
85
96
  relationId: number;
86
97
  } | {
87
98
  relation: Relation.SortAttr;
99
+ } | {
100
+ entity: number;
101
+ } | {
102
+ entityId: number;
88
103
  } | {
89
104
  [k: string]: any;
90
105
  } | OneOf<ExprOp<OpAttr | string>>;
@@ -94,25 +109,29 @@ export declare type SortNode = {
94
109
  };
95
110
  export declare type Sorter = SortNode[];
96
111
  export declare type SelectOperation<P extends Object = Projection> = OakSelection<"select", P, Filter, Sorter>;
97
- export declare type Selection<P extends Object = Projection> = Omit<SelectOperation<P>, "action">;
112
+ export declare type Selection<P extends Object = Projection> = SelectOperation<P>;
98
113
  export declare type Aggregation = DeduceAggregation<Projection, Filter, Sorter>;
99
- export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "userId" | "relationId">> & (({
114
+ export declare type CreateOperationData = FormCreateData<Omit<OpSchema, "entity" | "entityId" | "userId" | "relationId">> & (({
100
115
  userId?: never;
101
116
  user: User.CreateSingleOperation;
102
117
  } | {
103
- userId: String<64>;
118
+ userId: ForeignKey<"user">;
104
119
  user?: User.UpdateOperation;
105
120
  } | {
106
- userId: String<64>;
121
+ userId: ForeignKey<"user">;
107
122
  }) & ({
108
123
  relationId?: never;
109
124
  relation: Relation.CreateSingleOperation;
110
125
  } | {
111
- relationId: String<64>;
126
+ relationId: ForeignKey<"relation">;
112
127
  relation?: Relation.UpdateOperation;
113
128
  } | {
114
- relationId: String<64>;
115
- })) & {
129
+ relationId: ForeignKey<"relation">;
130
+ })) & ({
131
+ entity?: string;
132
+ entityId?: string;
133
+ [K: string]: any;
134
+ }) & {
116
135
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
117
136
  operEntity$entity?: OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<OperEntity.CreateOperationData, "entity" | "entityId">>>;
118
137
  };
@@ -130,7 +149,7 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId"
130
149
  userId?: never;
131
150
  } | {
132
151
  user?: never;
133
- userId?: String<64> | null;
152
+ userId?: ForeignKey<"user"> | null;
134
153
  }) & ({
135
154
  relation: Relation.CreateSingleOperation;
136
155
  relationId?: never;
@@ -142,7 +161,7 @@ export declare type UpdateOperationData = FormUpdateData<Omit<OpSchema, "userId"
142
161
  relationId?: never;
143
162
  } | {
144
163
  relation?: never;
145
- relationId?: String<64> | null;
164
+ relationId?: ForeignKey<"relation"> | null;
146
165
  })) & {
147
166
  [k: string]: any;
148
167
  modiEntity$entity?: OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">[]> | Array<OakOperation<"create", Omit<ModiEntity.CreateOperationData, "entity" | "entityId">>>;
@@ -13,17 +13,37 @@ exports.desc = {
13
13
  notNull: true,
14
14
  type: "ref",
15
15
  ref: "relation"
16
+ },
17
+ entity: {
18
+ notNull: true,
19
+ type: "varchar",
20
+ params: {
21
+ length: 32
22
+ }
23
+ },
24
+ entityId: {
25
+ notNull: true,
26
+ type: "varchar",
27
+ params: {
28
+ length: 64
29
+ }
16
30
  }
17
31
  },
18
32
  actionType: "crud",
19
33
  actions: action_1.genericActions,
20
34
  indexes: [
21
35
  {
22
- name: 'index_user_relation',
36
+ name: 'index_user_entity_entityId_relation',
23
37
  attributes: [
24
38
  {
25
39
  name: "userId"
26
40
  },
41
+ {
42
+ name: 'entity'
43
+ },
44
+ {
45
+ name: 'entityId'
46
+ },
27
47
  {
28
48
  name: "relationId"
29
49
  },
@@ -1,4 +1,5 @@
1
1
  import * as ActionAuth from "./ActionAuth/Schema";
2
+ import * as I18n from "./I18n/Schema";
2
3
  import * as Modi from "./Modi/Schema";
3
4
  import * as ModiEntity from "./ModiEntity/Schema";
4
5
  import * as Oper from "./Oper/Schema";
@@ -9,10 +10,23 @@ import * as User from "./User/Schema";
9
10
  import * as UserEntityGrant from "./UserEntityGrant/Schema";
10
11
  import * as UserRelation from "./UserRelation/Schema";
11
12
  export declare type ActionAuthIdSubQuery = {
12
- [K in "$in" | "$nin"]?: (ActionAuth.ActionAuthIdSubQuery & {
13
+ [K in "$in" | "$nin"]?: (ModiEntity.ActionAuthIdSubQuery & {
14
+ entity: "modiEntity";
15
+ }) | (OperEntity.ActionAuthIdSubQuery & {
16
+ entity: "operEntity";
17
+ }) | (ActionAuth.ActionAuthIdSubQuery & {
13
18
  entity: "actionAuth";
14
19
  }) | any;
15
20
  };
21
+ export declare type I18nIdSubQuery = {
22
+ [K in "$in" | "$nin"]?: (ModiEntity.I18nIdSubQuery & {
23
+ entity: "modiEntity";
24
+ }) | (OperEntity.I18nIdSubQuery & {
25
+ entity: "operEntity";
26
+ }) | (I18n.I18nIdSubQuery & {
27
+ entity: "i18n";
28
+ }) | any;
29
+ };
16
30
  export declare type ModiIdSubQuery = {
17
31
  [K in "$in" | "$nin"]?: (ModiEntity.ModiIdSubQuery & {
18
32
  entity: "modiEntity";
@@ -42,14 +56,24 @@ export declare type RelationIdSubQuery = {
42
56
  entity: "actionAuth";
43
57
  }) | (RelationAuth.RelationIdSubQuery & {
44
58
  entity: "relationAuth";
59
+ }) | (UserEntityGrant.RelationIdSubQuery & {
60
+ entity: "userEntityGrant";
45
61
  }) | (UserRelation.RelationIdSubQuery & {
46
62
  entity: "userRelation";
63
+ }) | (ModiEntity.RelationIdSubQuery & {
64
+ entity: "modiEntity";
65
+ }) | (OperEntity.RelationIdSubQuery & {
66
+ entity: "operEntity";
47
67
  }) | (Relation.RelationIdSubQuery & {
48
68
  entity: "relation";
49
69
  }) | any;
50
70
  };
51
71
  export declare type RelationAuthIdSubQuery = {
52
- [K in "$in" | "$nin"]?: (RelationAuth.RelationAuthIdSubQuery & {
72
+ [K in "$in" | "$nin"]?: (ModiEntity.RelationAuthIdSubQuery & {
73
+ entity: "modiEntity";
74
+ }) | (OperEntity.RelationAuthIdSubQuery & {
75
+ entity: "operEntity";
76
+ }) | (RelationAuth.RelationAuthIdSubQuery & {
53
77
  entity: "relationAuth";
54
78
  }) | any;
55
79
  };
@@ -60,17 +84,29 @@ export declare type UserIdSubQuery = {
60
84
  entity: "user";
61
85
  }) | (UserRelation.UserIdSubQuery & {
62
86
  entity: "userRelation";
87
+ }) | (ModiEntity.UserIdSubQuery & {
88
+ entity: "modiEntity";
89
+ }) | (OperEntity.UserIdSubQuery & {
90
+ entity: "operEntity";
63
91
  }) | (User.UserIdSubQuery & {
64
92
  entity: "user";
65
93
  }) | any;
66
94
  };
67
95
  export declare type UserEntityGrantIdSubQuery = {
68
- [K in "$in" | "$nin"]?: (UserEntityGrant.UserEntityGrantIdSubQuery & {
96
+ [K in "$in" | "$nin"]?: (ModiEntity.UserEntityGrantIdSubQuery & {
97
+ entity: "modiEntity";
98
+ }) | (OperEntity.UserEntityGrantIdSubQuery & {
99
+ entity: "operEntity";
100
+ }) | (UserEntityGrant.UserEntityGrantIdSubQuery & {
69
101
  entity: "userEntityGrant";
70
102
  }) | any;
71
103
  };
72
104
  export declare type UserRelationIdSubQuery = {
73
- [K in "$in" | "$nin"]?: (UserRelation.UserRelationIdSubQuery & {
105
+ [K in "$in" | "$nin"]?: (ModiEntity.UserRelationIdSubQuery & {
106
+ entity: "modiEntity";
107
+ }) | (OperEntity.UserRelationIdSubQuery & {
108
+ entity: "operEntity";
109
+ }) | (UserRelation.UserRelationIdSubQuery & {
74
110
  entity: "userRelation";
75
111
  }) | any;
76
112
  };
@@ -1,3 +1,4 @@
1
1
  export * from './EntityDict';
2
2
  export * from './Storage';
3
3
  export * from './ActionDefDict';
4
+ export * from './Relation';
@@ -4,3 +4,4 @@ var tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./EntityDict"), exports);
5
5
  tslib_1.__exportStar(require("./Storage"), exports);
6
6
  tslib_1.__exportStar(require("./ActionDefDict"), exports);
7
+ tslib_1.__exportStar(require("./Relation"), exports);
@@ -1,5 +1,5 @@
1
1
  import { EntityDict } from '../base-app-domain';
2
2
  import { AsyncContext } from '../store/AsyncRowStore';
3
3
  import { SyncContext } from '../store/SyncRowStore';
4
- import { StorageSchema, EntityDict as BaseEntityDict, Checker, AuthDefDict } from '../types';
5
- export declare function createDynamicCheckers<ED extends EntityDict & BaseEntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>>(schema: StorageSchema<ED>, authDict?: AuthDefDict<ED>): Checker<ED, keyof ED, Cxt>[];
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>[];
@@ -4,14 +4,11 @@ exports.createDynamicCheckers = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var checker_1 = require("../store/checker");
6
6
  var modi_1 = require("../store/modi");
7
- function createDynamicCheckers(schema, authDict) {
7
+ function createDynamicCheckers(schema) {
8
8
  var checkers = [];
9
9
  checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, modi_1.createModiRelatedCheckers)(schema)), false));
10
- checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createRemoveCheckers)(schema, authDict)), false));
10
+ checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createRemoveCheckers)(schema)), false));
11
11
  checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createCreateCheckers)(schema)), false));
12
- if (authDict) {
13
- checkers.push.apply(checkers, tslib_1.__spreadArray([], tslib_1.__read((0, checker_1.createAuthCheckers)(schema, authDict)), false));
14
- }
15
12
  return checkers;
16
13
  }
17
14
  exports.createDynamicCheckers = createDynamicCheckers;
@@ -4,9 +4,11 @@ export declare const ENTITY_PATH_IN_OAK_GENERAL_BUSINESS: () => string;
4
4
  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
- export declare const RESERVED_ENTITIES: string[];
7
+ export declare const RESERVED_ENTITY_NAMES: string[];
8
8
  export declare const ENTITY_NAME_MAX_LENGTH = 32;
9
9
  export declare const STRING_LITERAL_MAX_LENGTH = 24;
10
10
  export declare const NUMERICAL_LITERL_DEFAULT_PRECISION = 8;
11
11
  export declare const NUMERICAL_LITERL_DEFAULT_SCALE = 2;
12
12
  export declare const INT_LITERL_DEFAULT_WIDTH = 4;
13
+ export declare const SYSTEM_RESERVE_ENTITIES: string[];
14
+ export declare const OAK_EXTERNAL_LIBS_FILEPATH: (path: string) => string;
@@ -1,6 +1,8 @@
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.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;
3
+ exports.OAK_EXTERNAL_LIBS_FILEPATH = exports.SYSTEM_RESERVE_ENTITIES = 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_ENTITY_NAMES = 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
+ var tslib_1 = require("tslib");
5
+ var path_1 = tslib_1.__importDefault(require("path"));
4
6
  exports.LIB_OAK_DOMAIN = 'oak-domain';
5
7
  var LIB_OAK_GENERAL_BUSINESS = 'oak-general-business';
6
8
  var LIB_PATH = function () { return 'lib'; };
@@ -31,10 +33,18 @@ var ACTION_CONSTANT_IN_OAK_DOMAIN = function (level) {
31
33
  };
32
34
  exports.ACTION_CONSTANT_IN_OAK_DOMAIN = ACTION_CONSTANT_IN_OAK_DOMAIN;
33
35
  // export const OUTPUT_PATH = 'app-domain/entities';
34
- exports.RESERVED_ENTITIES = ['Schema', 'Filter', 'Query', 'SubQuery', 'Entity', 'Selection', 'Operation', 'File', 'Common',
36
+ exports.RESERVED_ENTITY_NAMES = ['Schema', 'Filter', 'Query', 'SubQuery', 'Entity', 'Selection', 'Operation', 'File', 'Common', 'Config', 'Configuration',
35
37
  'Locale', 'Projection', 'Data'];
36
38
  exports.ENTITY_NAME_MAX_LENGTH = 32;
37
39
  exports.STRING_LITERAL_MAX_LENGTH = 24;
38
40
  exports.NUMERICAL_LITERL_DEFAULT_PRECISION = 8;
39
41
  exports.NUMERICAL_LITERL_DEFAULT_SCALE = 2;
40
42
  exports.INT_LITERL_DEFAULT_WIDTH = 4;
43
+ // 暂放在这儿
44
+ exports.SYSTEM_RESERVE_ENTITIES = ['user', 'relation', 'oper', 'operEntity', 'modi', 'modiEntity',
45
+ 'userRelation', 'actionAuth', 'relationAuth', 'relation', 'userEntityGrant', 'i18n'];
46
+ // 项目依赖的第三方oak lib配置文件所在的固定路径
47
+ var OAK_EXTERNAL_LIBS_FILEPATH = function (path) {
48
+ return path_1.default.join(path, 'config/oakExternalLib.json');
49
+ };
50
+ exports.OAK_EXTERNAL_LIBS_FILEPATH = OAK_EXTERNAL_LIBS_FILEPATH;
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import { Hash } from 'crypto';
3
+ /**
4
+ * 这个类的作用是把项目和所有相关的模块下的locales编译成为src/data/i18n中的数据
5
+ */
6
+ export default class LocaleBuilder {
7
+ asLib: boolean;
8
+ dependencies: string[];
9
+ pwd: string;
10
+ locales: Record<string, [string, string, string, object]>;
11
+ hash: Hash;
12
+ constructor(asLib?: boolean);
13
+ /**
14
+ * 将locales输出成为data/i18n.ts中的数据
15
+ * 如果有Dependency需要引出来
16
+ */
17
+ private outputDataFile;
18
+ private parseFile;
19
+ private traverse;
20
+ private buildproject;
21
+ build(watch?: boolean): void;
22
+ }