oak-domain 3.0.3 → 3.0.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 (158) hide show
  1. package/lib/actions/action.d.ts +8 -8
  2. package/lib/actions/action.js +2 -2
  3. package/lib/actions/relation.d.ts +1 -1
  4. package/lib/actions/relation.js +9 -22
  5. package/lib/base-app-domain/ActionAuth/Schema.d.ts +68 -42
  6. package/lib/base-app-domain/ActionAuth/Storage.js +12 -15
  7. package/lib/base-app-domain/ActionDefDict.d.ts +2 -3
  8. package/lib/base-app-domain/ActionDefDict.js +3 -5
  9. package/lib/base-app-domain/EntityDict.d.ts +5 -1
  10. package/lib/base-app-domain/I18n/Schema.d.ts +24 -24
  11. package/lib/base-app-domain/I18n/Storage.js +5 -5
  12. package/lib/base-app-domain/Modi/Action.d.ts +4 -4
  13. package/lib/base-app-domain/Modi/Action.js +3 -3
  14. package/lib/base-app-domain/Modi/Schema.d.ts +24 -24
  15. package/lib/base-app-domain/Modi/Storage.js +3 -3
  16. package/lib/base-app-domain/ModiEntity/Schema.d.ts +128 -55
  17. package/lib/base-app-domain/ModiEntity/Storage.js +2 -2
  18. package/lib/base-app-domain/Oper/Schema.d.ts +30 -29
  19. package/lib/base-app-domain/Oper/Storage.js +1 -1
  20. package/lib/base-app-domain/OperEntity/Schema.d.ts +126 -53
  21. package/lib/base-app-domain/OperEntity/Storage.js +2 -2
  22. package/lib/base-app-domain/Path/Schema.d.ts +149 -0
  23. package/lib/base-app-domain/Path/Schema.js +2 -0
  24. package/lib/base-app-domain/Path/Storage.d.ts +3 -0
  25. package/lib/base-app-domain/Path/Storage.js +54 -0
  26. package/lib/base-app-domain/Relation/Schema.d.ts +34 -34
  27. package/lib/base-app-domain/Relation/Storage.js +6 -6
  28. package/lib/base-app-domain/Relation.d.ts +0 -8
  29. package/lib/base-app-domain/Relation.js +1 -7
  30. package/lib/base-app-domain/RelationAuth/Schema.d.ts +74 -40
  31. package/lib/base-app-domain/RelationAuth/Storage.js +9 -11
  32. package/lib/base-app-domain/Storage.js +20 -16
  33. package/lib/base-app-domain/User/Action.d.ts +4 -4
  34. package/lib/base-app-domain/User/Action.js +3 -3
  35. package/lib/base-app-domain/User/Schema.d.ts +40 -27
  36. package/lib/base-app-domain/User/Storage.js +1 -1
  37. package/lib/base-app-domain/UserEntityClaim/Schema.d.ts +264 -0
  38. package/lib/base-app-domain/UserEntityClaim/Schema.js +2 -0
  39. package/lib/base-app-domain/UserEntityClaim/Storage.d.ts +3 -0
  40. package/lib/base-app-domain/UserEntityClaim/Storage.js +37 -0
  41. package/lib/base-app-domain/UserEntityGrant/Action.d.ts +2 -2
  42. package/lib/base-app-domain/UserEntityGrant/Schema.d.ts +55 -81
  43. package/lib/base-app-domain/UserEntityGrant/Storage.js +7 -11
  44. package/lib/base-app-domain/UserRelation/Schema.d.ts +50 -36
  45. package/lib/base-app-domain/UserRelation/Storage.js +7 -7
  46. package/lib/base-app-domain/_SubQuery.d.ts +45 -15
  47. package/lib/base-app-domain/index.js +1 -1
  48. package/lib/checkers/index.js +6 -7
  49. package/lib/compiler/env.js +16 -18
  50. package/lib/compiler/localeBuilder.js +83 -79
  51. package/lib/compiler/schemalBuilder.d.ts +16 -0
  52. package/lib/compiler/schemalBuilder.js +1160 -1378
  53. package/lib/entities/ActionAuth.d.ts +3 -5
  54. package/lib/entities/ActionAuth.js +9 -7
  55. package/lib/entities/I18n.js +1 -1
  56. package/lib/entities/Modi.js +2 -2
  57. package/lib/entities/ModiEntity.js +1 -1
  58. package/lib/entities/Oper.js +1 -1
  59. package/lib/entities/OperEntity.js +1 -1
  60. package/lib/entities/Path.d.ts +8 -0
  61. package/lib/entities/Path.js +35 -0
  62. package/lib/entities/Relation.js +1 -1
  63. package/lib/entities/RelationAuth.d.ts +2 -2
  64. package/lib/entities/RelationAuth.js +1 -1
  65. package/lib/entities/User.js +2 -2
  66. package/lib/entities/UserEntityClaim.d.ts +13 -0
  67. package/lib/entities/UserEntityClaim.js +17 -0
  68. package/lib/entities/UserEntityGrant.d.ts +5 -4
  69. package/lib/entities/UserEntityGrant.js +4 -7
  70. package/lib/entities/UserRelation.js +1 -1
  71. package/lib/index.d.ts +23 -0
  72. package/lib/index.js +37 -0
  73. package/lib/store/AsyncRowStore.d.ts +2 -1
  74. package/lib/store/AsyncRowStore.js +75 -149
  75. package/lib/store/CascadeStore.js +917 -1291
  76. package/lib/store/RelationAuth.d.ts +9 -16
  77. package/lib/store/RelationAuth.js +750 -908
  78. package/lib/store/SyncRowStore.d.ts +1 -1
  79. package/lib/store/SyncRowStore.js +27 -26
  80. package/lib/store/TriggerExecutor.d.ts +17 -10
  81. package/lib/store/TriggerExecutor.js +350 -423
  82. package/lib/store/actionAuth.js +13 -28
  83. package/lib/store/actionDef.js +118 -193
  84. package/lib/store/checker.js +225 -361
  85. package/lib/store/filter.d.ts +2 -3
  86. package/lib/store/filter.js +451 -589
  87. package/lib/store/modi.js +116 -177
  88. package/lib/store/relation.js +17 -17
  89. package/lib/timers/oper.d.ts +1 -1
  90. package/lib/timers/oper.js +44 -47
  91. package/lib/timers/vaccum.d.ts +2 -2
  92. package/lib/timers/vaccum.js +100 -165
  93. package/lib/triggers/index.js +1 -1
  94. package/lib/types/Action.d.ts +7 -7
  95. package/lib/types/AppLoader.d.ts +8 -2
  96. package/lib/types/AppLoader.js +4 -4
  97. package/lib/types/Aspect.d.ts +1 -3
  98. package/lib/types/Auth.d.ts +15 -19
  99. package/lib/types/Connector.d.ts +19 -15
  100. package/lib/types/Connector.js +0 -7
  101. package/lib/types/DataType.d.ts +19 -18
  102. package/lib/types/DataType.js +1 -1
  103. package/lib/types/Demand.d.ts +25 -25
  104. package/lib/types/Endpoint.d.ts +1 -1
  105. package/lib/types/Entity.d.ts +57 -53
  106. package/lib/types/Entity.js +3 -3
  107. package/lib/types/EntityDesc.d.ts +2 -1
  108. package/lib/types/Environment.d.ts +4 -4
  109. package/lib/types/Exception.d.ts +29 -2
  110. package/lib/types/Exception.js +205 -205
  111. package/lib/types/Expression.d.ts +14 -14
  112. package/lib/types/Expression.js +54 -87
  113. package/lib/types/Geo.d.ts +6 -6
  114. package/lib/types/Locale.d.ts +5 -5
  115. package/lib/types/Polyfill.d.ts +9 -9
  116. package/lib/types/Port.d.ts +4 -4
  117. package/lib/types/RowStore.d.ts +3 -3
  118. package/lib/types/RowStore.js +18 -19
  119. package/lib/types/Storage.d.ts +5 -4
  120. package/lib/types/Style.d.ts +2 -2
  121. package/lib/types/Timer.d.ts +3 -3
  122. package/lib/types/Trigger.d.ts +30 -14
  123. package/lib/types/Trigger.js +6 -2
  124. package/lib/types/Watcher.d.ts +2 -2
  125. package/lib/types/index.d.ts +1 -0
  126. package/lib/types/index.js +2 -1
  127. package/lib/types/schema/DataTypes.d.ts +7 -7
  128. package/lib/utils/SimpleConnector.d.ts +24 -10
  129. package/lib/utils/SimpleConnector.js +166 -144
  130. package/lib/utils/assert.js +2 -2
  131. package/lib/utils/concurrent.d.ts +1 -1
  132. package/lib/utils/concurrent.js +31 -57
  133. package/lib/utils/date.js +2 -2
  134. package/lib/utils/geo.js +8 -8
  135. package/lib/utils/lodash.d.ts +3 -1
  136. package/lib/utils/lodash.js +21 -34
  137. package/lib/utils/mask.js +12 -13
  138. package/lib/utils/money.d.ts +1 -1
  139. package/lib/utils/money.js +22 -11
  140. package/lib/utils/projection.d.ts +4 -0
  141. package/lib/utils/projection.js +15 -0
  142. package/lib/utils/random/random.js +11 -16
  143. package/lib/utils/random/random.mp.js +7 -18
  144. package/lib/utils/random/random.web.js +6 -12
  145. package/lib/utils/string.d.ts +4 -4
  146. package/lib/utils/string.js +19 -32
  147. package/lib/utils/url.js +5 -4
  148. package/lib/utils/uuid.d.ts +1 -1
  149. package/lib/utils/uuid.js +46 -85
  150. package/lib/utils/validator.d.ts +4 -3
  151. package/lib/utils/validator.js +35 -32
  152. package/lib/utils/version.js +6 -6
  153. package/package.json +7 -7
  154. package/src/entities/ActionAuth.ts +10 -10
  155. package/src/entities/Path.ts +43 -0
  156. package/src/entities/RelationAuth.ts +2 -1
  157. package/src/entities/UserEntityClaim.ts +30 -0
  158. package/src/entities/UserEntityGrant.ts +9 -12
@@ -1,8 +1,8 @@
1
1
  import { RefAttr } from "./Demand";
2
2
  import { Geo } from "./Geo";
3
- export declare type RefOrExpression<A> = RefAttr<A> | Expression<A>;
4
- declare type MathType<A> = RefOrExpression<A> | number;
5
- declare type StringType<A> = RefOrExpression<A> | string;
3
+ export type RefOrExpression<A> = RefAttr<A> | Expression<A>;
4
+ type MathType<A> = RefOrExpression<A> | number;
5
+ type StringType<A> = RefOrExpression<A> | string;
6
6
  interface Add<A> {
7
7
  $add: (MathType<A>)[];
8
8
  }
@@ -30,8 +30,8 @@ interface Ceil<A> {
30
30
  interface Pow<A> {
31
31
  $pow: [MathType<A>, MathType<A>];
32
32
  }
33
- declare type MathExpression<A> = Add<A> | Subtract<A> | Multiply<A> | Divide<A> | Abs<A> | Round<A> | Floor<A> | Ceil<A> | Pow<A>;
34
- declare type CmpType<A> = RefOrExpression<A> | string | number;
33
+ type MathExpression<A> = Add<A> | Subtract<A> | Multiply<A> | Divide<A> | Abs<A> | Round<A> | Floor<A> | Ceil<A> | Pow<A>;
34
+ type CmpType<A> = RefOrExpression<A> | string | number;
35
35
  interface Gt<A> {
36
36
  $gt: [CmpType<A>, CmpType<A>];
37
37
  }
@@ -59,14 +59,14 @@ interface EndsWith<A> {
59
59
  interface Includes<A> {
60
60
  $includes: [RefOrExpression<A> | string, RefOrExpression<A> | string];
61
61
  }
62
- declare type CompareExpression<A> = Lt<A> | Gt<A> | Lte<A> | Gte<A> | Eq<A> | Ne<A> | StartsWith<A> | EndsWith<A> | Includes<A>;
62
+ type CompareExpression<A> = Lt<A> | Gt<A> | Lte<A> | Gte<A> | Eq<A> | Ne<A> | StartsWith<A> | EndsWith<A> | Includes<A>;
63
63
  interface BoolTrue<A> {
64
64
  $true: Expression<A>;
65
65
  }
66
66
  interface BoolFalse<A> {
67
67
  $false: Expression<A>;
68
68
  }
69
- declare type BoolExpression<A> = BoolTrue<A> | BoolFalse<A>;
69
+ type BoolExpression<A> = BoolTrue<A> | BoolFalse<A>;
70
70
  interface LogicAnd<A> {
71
71
  $and: Expression<A>[];
72
72
  }
@@ -76,7 +76,7 @@ interface LogicOr<A> {
76
76
  interface LogicNot<A> {
77
77
  $not: Expression<A>;
78
78
  }
79
- declare type LogicExpression<A> = LogicAnd<A> | LogicOr<A> | LogicNot<A>;
79
+ type LogicExpression<A> = LogicAnd<A> | LogicOr<A> | LogicNot<A>;
80
80
  interface DateYear<A> {
81
81
  $year: RefOrExpression<A> | Date | number;
82
82
  }
@@ -110,18 +110,18 @@ interface DateCeiling<A> {
110
110
  interface DateFloor<A> {
111
111
  $dateFloor: [RefOrExpression<A> | Date | number, 'y' | 'M' | 'd' | 'h' | 'm' | 's'];
112
112
  }
113
- declare type DateExpression<A> = DateYear<A> | DateMonth<A> | DateWeekday<A> | DateWeekOfYear<A> | DateDay<A> | DateDayOfYear<A> | DateDayOfMonth<A> | DateDayOfWeek<A> | DateDiff<A> | DateCeiling<A> | DateFloor<A>;
113
+ type DateExpression<A> = DateYear<A> | DateMonth<A> | DateWeekday<A> | DateWeekOfYear<A> | DateDay<A> | DateDayOfYear<A> | DateDayOfMonth<A> | DateDayOfWeek<A> | DateDiff<A> | DateCeiling<A> | DateFloor<A>;
114
114
  interface StringConcat<A> {
115
115
  $concat: StringType<A>[];
116
116
  }
117
- declare type StringExpression<A> = StringConcat<A>;
117
+ type StringExpression<A> = StringConcat<A>;
118
118
  interface GeoContains<A> {
119
119
  $contains: [RefOrExpression<A> | Geo, RefOrExpression<A> | Geo];
120
120
  }
121
121
  interface GeoDistance<A> {
122
122
  $distance: [RefOrExpression<A> | Geo, RefOrExpression<A> | Geo];
123
123
  }
124
- declare type GeoExpression<A> = GeoContains<A> | GeoDistance<A>;
124
+ type GeoExpression<A> = GeoContains<A> | GeoDistance<A>;
125
125
  interface AggrCountExpression<A> {
126
126
  $$count: RefOrExpression<A>;
127
127
  }
@@ -137,9 +137,9 @@ interface AggrMinExpression<A> {
137
137
  interface AggrAvgExpression<A> {
138
138
  $$avg: RefOrExpression<A>;
139
139
  }
140
- export declare type AggrExpression<A> = AggrAvgExpression<A> | AggrCountExpression<A> | AggrSumExpression<A> | AggrMaxExpression<A> | AggrMinExpression<A>;
141
- export declare type Expression<A> = GeoExpression<A> | DateExpression<A> | LogicExpression<A> | BoolExpression<A> | CompareExpression<A> | MathExpression<A> | StringExpression<A> | AggrExpression<A>;
142
- export declare type ExpressionConstant = Geo | number | Date | string | boolean;
140
+ export type AggrExpression<A> = AggrAvgExpression<A> | AggrCountExpression<A> | AggrSumExpression<A> | AggrMaxExpression<A> | AggrMinExpression<A>;
141
+ export type Expression<A> = GeoExpression<A> | DateExpression<A> | LogicExpression<A> | BoolExpression<A> | CompareExpression<A> | MathExpression<A> | StringExpression<A>;
142
+ export type ExpressionConstant = Geo | number | Date | string | boolean;
143
143
  export declare function isGeoExpression<A>(expression: any): expression is GeoExpression<A>;
144
144
  export declare function isDateExpression<A>(expression: any): expression is DateExpression<A>;
145
145
  export declare function isLogicExpression<A>(expression: any): expression is LogicExpression<A>;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAttrRefInExpression = exports.execOp = exports.opMultipleParams = exports.isExpression = exports.isAggrExpression = exports.isStringExpression = exports.isMathExpression = exports.isCompareExpression = exports.isBoolExpression = exports.isLogicExpression = exports.isDateExpression = exports.isGeoExpression = void 0;
4
- var tslib_1 = require("tslib");
5
- var assert_1 = tslib_1.__importDefault(require("assert"));
6
- var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
7
- var weekOfYear_1 = tslib_1.__importDefault(require("dayjs/plugin/weekOfYear"));
8
- var dayOfYear_1 = tslib_1.__importDefault(require("dayjs/plugin/dayOfYear"));
9
- var geo_1 = require("../utils/geo");
4
+ const tslib_1 = require("tslib");
5
+ const assert_1 = tslib_1.__importDefault(require("assert"));
6
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
7
+ const weekOfYear_1 = tslib_1.__importDefault(require("dayjs/plugin/weekOfYear"));
8
+ const dayOfYear_1 = tslib_1.__importDefault(require("dayjs/plugin/dayOfYear"));
9
+ const geo_1 = require("../utils/geo");
10
10
  dayjs_1.default.extend(weekOfYear_1.default);
11
11
  dayjs_1.default.extend(dayOfYear_1.default);
12
12
  ;
@@ -45,7 +45,7 @@ dayjs_1.default.extend(dayOfYear_1.default);
45
45
  ;
46
46
  function isGeoExpression(expression) {
47
47
  if (Object.keys(expression).length == 1) {
48
- var op = Object.keys(expression)[0];
48
+ const op = Object.keys(expression)[0];
49
49
  if (['$contains', '$distance'].includes(op)) {
50
50
  return true;
51
51
  }
@@ -55,7 +55,7 @@ function isGeoExpression(expression) {
55
55
  exports.isGeoExpression = isGeoExpression;
56
56
  function isDateExpression(expression) {
57
57
  if (Object.keys(expression).length == 1) {
58
- var op = Object.keys(expression)[0];
58
+ const op = Object.keys(expression)[0];
59
59
  if (['$year', '$month', '$weekday', '$weekOfYear', '$day', '$dayOfMonth',
60
60
  '$dayOfWeek', '$dayOfYear', '$dateDiff', '$dateCeil', '$dateFloor'].includes(op)) {
61
61
  return true;
@@ -66,7 +66,7 @@ function isDateExpression(expression) {
66
66
  exports.isDateExpression = isDateExpression;
67
67
  function isLogicExpression(expression) {
68
68
  if (Object.keys(expression).length == 1) {
69
- var op = Object.keys(expression)[0];
69
+ const op = Object.keys(expression)[0];
70
70
  if (['$and', '$or', '$not'].includes(op)) {
71
71
  return true;
72
72
  }
@@ -76,7 +76,7 @@ function isLogicExpression(expression) {
76
76
  exports.isLogicExpression = isLogicExpression;
77
77
  function isBoolExpression(expression) {
78
78
  if (Object.keys(expression).length == 1) {
79
- var op = Object.keys(expression)[0];
79
+ const op = Object.keys(expression)[0];
80
80
  if (['$true', '$false'].includes(op)) {
81
81
  return true;
82
82
  }
@@ -86,7 +86,7 @@ function isBoolExpression(expression) {
86
86
  exports.isBoolExpression = isBoolExpression;
87
87
  function isCompareExpression(expression) {
88
88
  if (Object.keys(expression).length == 1) {
89
- var op = Object.keys(expression)[0];
89
+ const op = Object.keys(expression)[0];
90
90
  if (['$gt', '$lt', '$gte', '$lte', '$eq', '$ne',
91
91
  '$startsWith', '$endsWith', '$includes'].includes(op)) {
92
92
  return true;
@@ -97,7 +97,7 @@ function isCompareExpression(expression) {
97
97
  exports.isCompareExpression = isCompareExpression;
98
98
  function isMathExpression(expression) {
99
99
  if (Object.keys(expression).length == 1) {
100
- var op = Object.keys(expression)[0];
100
+ const op = Object.keys(expression)[0];
101
101
  if (['$add', '$subtract', '$multiply', '$divide', '$abs', '$pow',
102
102
  '$round', '$floor', '$ceil'].includes(op)) {
103
103
  return true;
@@ -108,7 +108,7 @@ function isMathExpression(expression) {
108
108
  exports.isMathExpression = isMathExpression;
109
109
  function isStringExpression(expression) {
110
110
  if (Object.keys(expression).length == 1) {
111
- var op = Object.keys(expression)[0];
111
+ const op = Object.keys(expression)[0];
112
112
  if (['$concat'].includes(op)) {
113
113
  return true;
114
114
  }
@@ -118,7 +118,7 @@ function isStringExpression(expression) {
118
118
  exports.isStringExpression = isStringExpression;
119
119
  function isAggrExpression(expression) {
120
120
  if (Object.keys(expression).length == 1) {
121
- var op = Object.keys(expression)[0];
121
+ const op = Object.keys(expression)[0];
122
122
  if (['$$max', '$$min', '$$sum', '$$avg', '$$count'].includes(op)) {
123
123
  return true;
124
124
  }
@@ -137,7 +137,6 @@ function opMultipleParams(op) {
137
137
  }
138
138
  exports.opMultipleParams = opMultipleParams;
139
139
  function execOp(op, params, obscure) {
140
- var e_1, _a, e_2, _b;
141
140
  if (obscure && (params === undefined || params.includes(undefined))) {
142
141
  return true;
143
142
  }
@@ -171,23 +170,23 @@ function execOp(op, params, obscure) {
171
170
  }
172
171
  case '$add': {
173
172
  if (typeof params[0] === 'number') {
174
- var result_1 = 0;
175
- params.forEach(function (ele) { return result_1 += ele; });
176
- return result_1;
173
+ let result = 0;
174
+ params.forEach((ele) => result += ele);
175
+ return result;
177
176
  }
178
177
  else {
179
- var result_2 = '';
180
- params.forEach(function (ele) { return result_2 += ele; });
181
- return result_2;
178
+ let result = '';
179
+ params.forEach((ele) => result += ele);
180
+ return result;
182
181
  }
183
182
  }
184
183
  case '$subtract': {
185
184
  return params[0] - params[1];
186
185
  }
187
186
  case '$multiply': {
188
- var result_3 = 1;
189
- params.forEach(function (ele) { return result_3 = result_3 * ele; });
190
- return result_3;
187
+ let result = 1;
188
+ params.forEach((ele) => result = result * ele);
189
+ return result;
191
190
  }
192
191
  case '$divide': {
193
192
  return params[0] / params[1];
@@ -218,73 +217,53 @@ function execOp(op, params, obscure) {
218
217
  return !params;
219
218
  }
220
219
  case '$and': {
221
- try {
222
- for (var params_1 = tslib_1.__values(params), params_1_1 = params_1.next(); !params_1_1.done; params_1_1 = params_1.next()) {
223
- var p = params_1_1.value;
224
- if (!p) {
225
- return false;
226
- }
220
+ for (const p of params) {
221
+ if (!p) {
222
+ return false;
227
223
  }
228
224
  }
229
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
230
- finally {
231
- try {
232
- if (params_1_1 && !params_1_1.done && (_a = params_1.return)) _a.call(params_1);
233
- }
234
- finally { if (e_1) throw e_1.error; }
235
- }
236
225
  return true;
237
226
  }
238
227
  case '$or': {
239
- try {
240
- for (var params_2 = tslib_1.__values(params), params_2_1 = params_2.next(); !params_2_1.done; params_2_1 = params_2.next()) {
241
- var p = params_2_1.value;
242
- if (!!p) {
243
- return true;
244
- }
245
- }
246
- }
247
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
248
- finally {
249
- try {
250
- if (params_2_1 && !params_2_1.done && (_b = params_2.return)) _b.call(params_2);
228
+ for (const p of params) {
229
+ if (!!p) {
230
+ return true;
251
231
  }
252
- finally { if (e_2) throw e_2.error; }
253
232
  }
254
233
  return false;
255
234
  }
256
235
  case '$year': {
257
- var value = (0, dayjs_1.default)(params);
236
+ const value = (0, dayjs_1.default)(params);
258
237
  return value.year();
259
238
  }
260
239
  case '$month': {
261
- var value = (0, dayjs_1.default)(params);
240
+ const value = (0, dayjs_1.default)(params);
262
241
  return value.month();
263
242
  }
264
243
  case '$weekday': {
265
- var value = (0, dayjs_1.default)(params);
244
+ const value = (0, dayjs_1.default)(params);
266
245
  return value.day(); // 0~6
267
246
  }
268
247
  case '$weekOfYear': {
269
- var value = (0, dayjs_1.default)(params);
248
+ const value = (0, dayjs_1.default)(params);
270
249
  return value.week();
271
250
  }
272
251
  case '$day':
273
252
  case '$dayOfMonth': {
274
- var value = (0, dayjs_1.default)(params);
253
+ const value = (0, dayjs_1.default)(params);
275
254
  return value.date();
276
255
  }
277
256
  case '$dayOfWeek': {
278
- var value = (0, dayjs_1.default)(params);
257
+ const value = (0, dayjs_1.default)(params);
279
258
  return value.day(); // 0~6
280
259
  }
281
260
  case '$dayOfYear': {
282
- var value = (0, dayjs_1.default)(params);
261
+ const value = (0, dayjs_1.default)(params);
283
262
  return value.dayOfYear(); // 0~6
284
263
  }
285
264
  case '$dateDiff': {
286
- var value1 = (0, dayjs_1.default)(params[0]);
287
- var value2 = (0, dayjs_1.default)(params[1]);
265
+ const value1 = (0, dayjs_1.default)(params[0]);
266
+ const value2 = (0, dayjs_1.default)(params[1]);
288
267
  switch (params[2]) {
289
268
  case 'y':
290
269
  case 'M':
@@ -300,7 +279,7 @@ function execOp(op, params, obscure) {
300
279
  }
301
280
  }
302
281
  case '$dateCeil': {
303
- var value = (0, dayjs_1.default)(params[0]);
282
+ const value = (0, dayjs_1.default)(params[0]);
304
283
  switch (params[1]) {
305
284
  case 'y': {
306
285
  return value.startOf('year').millisecond();
@@ -326,7 +305,7 @@ function execOp(op, params, obscure) {
326
305
  }
327
306
  }
328
307
  case '$dateFloor': {
329
- var value = (0, dayjs_1.default)(params[0]);
308
+ const value = (0, dayjs_1.default)(params[0]);
330
309
  switch (params[1]) {
331
310
  case 'y': {
332
311
  return value.endOf('year').millisecond();
@@ -352,9 +331,9 @@ function execOp(op, params, obscure) {
352
331
  }
353
332
  }
354
333
  case '$distance': {
355
- var _c = tslib_1.__read(params, 2), geo1 = _c[0], geo2 = _c[1];
356
- var type1 = geo1.type, coordinate1 = geo1.coordinate;
357
- var type2 = geo2.type, coordinate2 = geo2.coordinate;
334
+ const [geo1, geo2] = params;
335
+ const { type: type1, coordinate: coordinate1 } = geo1;
336
+ const { type: type2, coordinate: coordinate2 } = geo2;
358
337
  if (type1 !== 'point' || type2 !== 'point') {
359
338
  throw new Error('目前只支持point类型的距离运算');
360
339
  }
@@ -367,7 +346,7 @@ function execOp(op, params, obscure) {
367
346
  return params.join('');
368
347
  }
369
348
  default: {
370
- (0, assert_1.default)(false, "\u4E0D\u80FD\u8BC6\u522B\u7684expression\u8FD0\u7B97\u7B26\uFF1A".concat(op));
349
+ (0, assert_1.default)(false, `不能识别的expression运算符:${op}`);
371
350
  }
372
351
  }
373
352
  }
@@ -381,12 +360,10 @@ exports.execOp = execOp;
381
360
  * }
382
361
  */
383
362
  function getAttrRefInExpression(expression) {
384
- var _a;
385
- var result = (_a = {},
386
- _a['#current'] = [],
387
- _a);
388
- var check = function (node) {
389
- var _a, e_3, _b;
363
+ const result = {
364
+ ['#current']: [],
365
+ };
366
+ const check = (node) => {
390
367
  if (node['#attr']) {
391
368
  result['#current'].push(node['#attr']);
392
369
  }
@@ -395,28 +372,18 @@ function getAttrRefInExpression(expression) {
395
372
  result[node['#refId']].push(node['#refAttr']);
396
373
  }
397
374
  else {
398
- Object.assign(result, (_a = {},
399
- _a[node['#refId']] = [node['#refAttr']],
400
- _a));
375
+ Object.assign(result, {
376
+ [node['#refId']]: [node['#refAttr']],
377
+ });
401
378
  }
402
379
  }
403
380
  else if (node instanceof Array) {
404
- try {
405
- for (var node_1 = tslib_1.__values(node), node_1_1 = node_1.next(); !node_1_1.done; node_1_1 = node_1.next()) {
406
- var subNode = node_1_1.value;
407
- check(subNode);
408
- }
409
- }
410
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
411
- finally {
412
- try {
413
- if (node_1_1 && !node_1_1.done && (_b = node_1.return)) _b.call(node_1);
414
- }
415
- finally { if (e_3) throw e_3.error; }
381
+ for (const subNode of node) {
382
+ check(subNode);
416
383
  }
417
384
  }
418
385
  else if (typeof node === 'object') {
419
- for (var attr in node) {
386
+ for (const attr in node) {
420
387
  check(node[attr]);
421
388
  }
422
389
  }
@@ -1,8 +1,8 @@
1
- export declare type Point = [number, number];
2
- export declare type Path = Array<Point>;
3
- export declare type Polygon = Array<Path>;
4
- export declare type Circle = [Point, number];
5
- export declare type SingleGeo = {
1
+ export type Point = [number, number];
2
+ export type Path = Array<Point>;
3
+ export type Polygon = Array<Path>;
4
+ export type Circle = [Point, number];
5
+ export type SingleGeo = {
6
6
  type: 'point';
7
7
  coordinate: Point;
8
8
  } | {
@@ -15,4 +15,4 @@ export declare type SingleGeo = {
15
15
  type: 'circle';
16
16
  coordinate: Circle;
17
17
  };
18
- export declare type Geo = SingleGeo | SingleGeo[];
18
+ export type Geo = SingleGeo | SingleGeo[];
@@ -1,17 +1,17 @@
1
1
  import { EntityShape } from "./Entity";
2
- declare type Language = 'zh_CN' | 'en_US';
3
- declare type LocaleOfSchema<S extends Record<string, any>> = {
2
+ type Language = 'zh_CN' | 'en_US';
3
+ type LocaleOfSchema<S extends Record<string, any>> = {
4
4
  [A in keyof Required<Omit<S, keyof EntityShape>>]: string;
5
5
  };
6
- declare type LocaleOfStringEnum<A extends string> = {
6
+ type LocaleOfStringEnum<A extends string> = {
7
7
  [K in A]: string;
8
8
  };
9
- declare type LocaleOfValue<V extends Record<string, string>> = {
9
+ type LocaleOfValue<V extends Record<string, string>> = {
10
10
  [K in keyof V]: {
11
11
  [K2 in V[K]]: string;
12
12
  };
13
13
  };
14
- export declare type LocaleDef<Sc extends Record<string, any>, Ac extends string, R extends string, V extends Record<string, string>> = {
14
+ export type LocaleDef<Sc extends Record<string, any>, Ac extends string, R extends string, V extends Record<string, string>> = {
15
15
  [L in Language]?: {
16
16
  name: string;
17
17
  attr: LocaleOfSchema<Sc> & {
@@ -1,24 +1,24 @@
1
- export declare type OmitInferKey<T, R> = {
1
+ export type OmitInferKey<T, R> = {
2
2
  [K in keyof T as T extends R ? never : K]: T[K];
3
3
  };
4
- export declare type OmitInferValue<T, R> = {
4
+ export type OmitInferValue<T, R> = {
5
5
  [K in keyof T as T extends R ? never : K]: T[K];
6
6
  };
7
- export declare type ValueOf<Obj> = Obj[keyof Obj];
8
- export declare type OneOnly<Obj, Key extends keyof Obj> = {
7
+ export type ValueOf<Obj> = Obj[keyof Obj];
8
+ export type OneOnly<Obj, Key extends keyof Obj> = {
9
9
  [key in Exclude<keyof Obj, Key>]?: undefined;
10
10
  } & Pick<Obj, Key>;
11
- export declare type OneOfByKey<Obj> = {
11
+ export type OneOfByKey<Obj> = {
12
12
  [key in keyof Obj]: OneOnly<Obj, key>;
13
13
  };
14
- export declare type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;
15
- declare type IsOptional<T, K extends keyof T> = {
14
+ export type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;
15
+ type IsOptional<T, K extends keyof T> = {
16
16
  [K1 in Exclude<keyof T, K>]: T[K1];
17
17
  } & {
18
18
  K?: T[K];
19
19
  } extends T ? K : never;
20
- export declare type OptionalKeys<T> = {
20
+ export type OptionalKeys<T> = {
21
21
  [K in keyof T]: IsOptional<T, K>;
22
22
  }[keyof T];
23
- export declare type SyncOrAsync<T> = T | Promise<T>;
23
+ export type SyncOrAsync<T> = T | Promise<T>;
24
24
  export {};
@@ -1,18 +1,18 @@
1
1
  import { AsyncContext } from "../store/AsyncRowStore";
2
2
  import { EntityDict } from "./Entity";
3
- export declare type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
3
+ export type Exportation<ED extends EntityDict, T extends keyof ED, K extends string, Cxt extends AsyncContext<ED>> = {
4
4
  name: string;
5
5
  id: string;
6
6
  entity: T;
7
7
  projection: ED[T]['Selection']['data'];
8
8
  headers?: K[];
9
9
  makeHeaders?: (dataList: Partial<ED[T]['Schema']>[]) => string[];
10
- fn: (data: ED[T]['Schema'], context?: AsyncContext<ED>, properties?: Record<string, any>) => Promise<Partial<Record<string, string | number | boolean | null>>> | Partial<Record<string, string | number | boolean | null>>;
10
+ fn: (data: ED[T]['Schema'], context?: Cxt, properties?: Record<string, any>) => Promise<Partial<Record<string, string | number | boolean | null>>> | Partial<Record<string, string | number | boolean | null>>;
11
11
  };
12
- export declare type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
12
+ export type Importation<ED extends EntityDict, T extends keyof ED, K extends string, Cxt extends AsyncContext<ED>> = {
13
13
  name: string;
14
14
  id: string;
15
15
  entity: T;
16
16
  headers: K[];
17
- fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any>) => Promise<ED[T]['CreateMulti']['data']>;
17
+ fn: (data: Partial<Record<K, string | number | boolean>>[], context: Cxt, option?: Record<string, any>) => Promise<ED[T]['CreateMulti']['data']>;
18
18
  };
@@ -2,11 +2,11 @@ import { OperationResult, EntityDict } from './Entity';
2
2
  import { StorageSchema } from './Storage';
3
3
  import { AsyncContext } from '../store/AsyncRowStore';
4
4
  import { SyncContext } from '../store/SyncRowStore';
5
- export declare type TxnOption = {
5
+ export type TxnOption = {
6
6
  isolationLevel: 'repeatable read' | 'serializable';
7
7
  };
8
- export declare type SelectionRewriter<ED extends EntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>> = (schema: StorageSchema<ED>, entity: keyof ED, selection: ED[keyof ED]['Selection'], context: Cxt) => void | Promise<void>;
9
- export declare type OperationRewriter<ED extends EntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>> = (schema: StorageSchema<ED>, entity: keyof ED, operate: ED[keyof ED]['Operation'], context: Cxt) => void | Promise<void>;
8
+ export type SelectionRewriter<ED extends EntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>> = (schema: StorageSchema<ED>, entity: keyof ED, selection: ED[keyof ED]['Selection'], context: Cxt) => void | Promise<void>;
9
+ export type OperationRewriter<ED extends EntityDict, Cxt extends AsyncContext<ED> | SyncContext<ED>> = (schema: StorageSchema<ED>, entity: keyof ED, operate: ED[keyof ED]['Operation'], context: Cxt) => void | Promise<void>;
10
10
  export declare abstract class RowStore<ED extends EntityDict> {
11
11
  protected storageSchema: StorageSchema<ED>;
12
12
  constructor(storageSchema: StorageSchema<ED>);
@@ -1,34 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RowStore = void 0;
4
- var lodash_1 = require("../utils/lodash");
5
- var RowStore = /** @class */ (function () {
6
- function RowStore(storageSchema) {
4
+ const lodash_1 = require("../utils/lodash");
5
+ class RowStore {
6
+ storageSchema;
7
+ constructor(storageSchema) {
7
8
  this.storageSchema = storageSchema;
8
9
  }
9
- RowStore.prototype.getSchema = function () {
10
+ getSchema() {
10
11
  return this.storageSchema;
11
- };
12
- RowStore.prototype.mergeOperationResult = function (result, toBeMerged) {
13
- for (var entity in toBeMerged) {
14
- for (var action in toBeMerged[entity]) {
15
- var value = (0, lodash_1.get)(result, "".concat(entity, ".").concat(action));
12
+ }
13
+ mergeOperationResult(result, toBeMerged) {
14
+ for (const entity in toBeMerged) {
15
+ for (const action in toBeMerged[entity]) {
16
+ const value = (0, lodash_1.get)(result, `${entity}.${action}`);
16
17
  if (typeof value === 'number') {
17
- (0, lodash_1.set)(result, "".concat(entity, ".").concat(action), value + toBeMerged[entity][action]);
18
+ (0, lodash_1.set)(result, `${entity}.${action}`, value + toBeMerged[entity][action]);
18
19
  }
19
20
  else {
20
- (0, lodash_1.set)(result, "".concat(entity, ".").concat(action), toBeMerged[entity][action]);
21
+ (0, lodash_1.set)(result, `${entity}.${action}`, toBeMerged[entity][action]);
21
22
  }
22
23
  }
23
24
  }
24
- };
25
- RowStore.prototype.mergeMultipleResults = function (toBeMerged) {
26
- var _this = this;
27
- var result = {};
28
- toBeMerged.forEach(function (ele) { return _this.mergeOperationResult(result, ele); });
25
+ }
26
+ mergeMultipleResults(toBeMerged) {
27
+ const result = {};
28
+ toBeMerged.forEach(ele => this.mergeOperationResult(result, ele));
29
29
  return result;
30
- };
31
- return RowStore;
32
- }());
30
+ }
31
+ }
33
32
  exports.RowStore = RowStore;
34
33
  ;
@@ -1,7 +1,7 @@
1
1
  import { ActionType } from '.';
2
2
  import { EntityDict, EntityShape, InstinctiveAttributes } from './Entity';
3
3
  import { DataType, DataTypeParams } from './schema/DataTypes';
4
- export declare type Ref = 'ref';
4
+ export type Ref = 'ref';
5
5
  export interface Column<SH extends EntityShape> {
6
6
  name: keyof SH | `${string}State`;
7
7
  size?: number;
@@ -28,12 +28,12 @@ export interface Attribute {
28
28
  sequenceStart?: number;
29
29
  enumeration?: string[];
30
30
  }
31
- export declare type Attributes<SH extends EntityShape> = Omit<{
31
+ export type Attributes<SH extends EntityShape> = Omit<{
32
32
  [attrName in keyof SH]: Attribute;
33
33
  }, InstinctiveAttributes>;
34
34
  export interface EntityConfig {
35
35
  }
36
- export declare type UniqConstraint<SH extends EntityShape> = {
36
+ export type UniqConstraint<SH extends EntityShape> = {
37
37
  attributes: Array<keyof SH>;
38
38
  type?: string;
39
39
  };
@@ -51,7 +51,8 @@ export interface StorageDesc<SH extends EntityShape> {
51
51
  actionType: ActionType;
52
52
  relation?: string[];
53
53
  view?: true;
54
+ recursiveDepth?: number;
54
55
  }
55
- export declare type StorageSchema<ED extends EntityDict> = {
56
+ export type StorageSchema<ED extends EntityDict> = {
56
57
  [K in keyof ED]: StorageDesc<ED[K]['OpSchema']>;
57
58
  };
@@ -1,7 +1,7 @@
1
1
  import { EntityDict } from './Entity';
2
2
  import { EntityDict as BaseEntityDict } from '../base-app-domain';
3
- declare type ThemeColor = 'default' | 'success' | 'warning' | 'error' | 'primary' | 'danger';
4
- export declare type ColorDict<ED extends BaseEntityDict & EntityDict> = {
3
+ type ThemeColor = 'default' | 'success' | 'warning' | 'error' | 'primary' | 'danger';
4
+ export type ColorDict<ED extends BaseEntityDict & EntityDict> = {
5
5
  [T in keyof ED]?: {
6
6
  [A in keyof ED[T]['OpSchema']]?: {
7
7
  [E in ED[T]['OpSchema'][A]]?: ThemeColor | `#${string}`;
@@ -1,12 +1,12 @@
1
1
  import { RecurrenceRule, RecurrenceSpecDateRange, RecurrenceSpecObjLit } from 'node-schedule';
2
2
  import { EntityDict } from './Entity';
3
3
  import { AsyncContext } from '../store/AsyncRowStore';
4
- declare type RoutineFn<ED extends EntityDict, Cxt extends AsyncContext<ED>> = (context: Cxt) => Promise<string>;
5
- export declare type Routine<ED extends EntityDict, Cxt extends AsyncContext<ED>> = {
4
+ type RoutineFn<ED extends EntityDict, Cxt extends AsyncContext<ED>> = (context: Cxt) => Promise<string>;
5
+ export type Routine<ED extends EntityDict, Cxt extends AsyncContext<ED>> = {
6
6
  name: string;
7
7
  fn: RoutineFn<ED, Cxt>;
8
8
  };
9
- export declare type Timer<ED extends EntityDict, Cxt extends AsyncContext<ED>> = {
9
+ export type Timer<ED extends EntityDict, Cxt extends AsyncContext<ED>> = {
10
10
  name: string;
11
11
  cron: RecurrenceRule | RecurrenceSpecDateRange | RecurrenceSpecObjLit | Date | string | number;
12
12
  fn: RoutineFn<ED, Cxt>;