semanticdb-core 1.0.38 → 1.0.39

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.
@@ -131,16 +131,43 @@ const isDimensionInLogicform = (logicform, dimension, strictMode = true) => {
131
131
  dimension.level &&
132
132
  tws.includes(dimension.level) &&
133
133
  logicform.preds) {
134
- const twPreds = logicform.preds.filter((pred) => pred.operator === '$count' &&
135
- pred.pred &&
136
- typeof pred.pred === 'string' &&
137
- pred.pred.startsWith('$'));
138
- if (twPreds.length > 0) {
139
- const minTWGranInLogicform = underscore_1.default.min(twPreds, (i) => tws.indexOf(i.pred.slice(1)));
140
- // 如果粒度没到,那么就返回false
141
- if (minTWGranInLogicform && typeof minTWGranInLogicform === 'object') {
142
- return (tws.indexOf(minTWGranInLogicform.pred.slice(1)) >=
143
- tws.indexOf(dimension.level));
134
+ // $count by timewindow
135
+ {
136
+ const twPreds = logicform.preds.filter((pred) => pred.operator === '$count' &&
137
+ pred.pred &&
138
+ typeof pred.pred === 'string' &&
139
+ pred.pred.startsWith('$'));
140
+ if (twPreds.length > 0) {
141
+ const minTWGranInLogicform = underscore_1.default.min(twPreds, (i) => tws.indexOf(i.pred.slice(1)));
142
+ // 如果粒度没到,那么就返回false
143
+ if (minTWGranInLogicform && typeof minTWGranInLogicform === 'object') {
144
+ return (tws.indexOf(minTWGranInLogicform.pred.slice(1)) >=
145
+ tws.indexOf(dimension.level));
146
+ }
147
+ }
148
+ }
149
+ {
150
+ const avgPreds = logicform.preds
151
+ .filter((pred) => pred.operator &&
152
+ ['$dailyavg', '$monthlyavg', '$yearlyavg', '$weeklyavg'].includes(pred.operator))
153
+ .map((pred) => {
154
+ if (pred.operator === '$dailyavg') {
155
+ return 'day';
156
+ }
157
+ else if (pred.operator === '$monthlyavg') {
158
+ return 'month';
159
+ }
160
+ else if (pred.operator === '$yearlyavg') {
161
+ return 'year';
162
+ }
163
+ else if (pred.operator === '$weeklyavg') {
164
+ return 'week';
165
+ }
166
+ return 'year';
167
+ });
168
+ if (avgPreds.length > 0) {
169
+ const minTWGranInLogicform = underscore_1.default.min(avgPreds, (i) => tws.indexOf(i));
170
+ return tws.indexOf(minTWGranInLogicform) >= tws.indexOf(dimension.level);
144
171
  }
145
172
  }
146
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "semanticdb-core",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [