@dcupl/common 1.0.2 → 1.1.0-beta.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.
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __values = (this && this.__values) || function(o) {
14
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
15
+ if (m) return m.call(o);
16
+ if (o && typeof o.length === "number") return {
17
+ next: function () {
18
+ if (o && i >= o.length) o = void 0;
19
+ return { value: o && o[i++], done: !o };
20
+ }
21
+ };
22
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
23
+ };
24
+ var __read = (this && this.__read) || function (o, n) {
25
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
26
+ if (!m) return o;
27
+ var i = m.call(o), r, ar = [], e;
28
+ try {
29
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30
+ }
31
+ catch (error) { e = { error: error }; }
32
+ finally {
33
+ try {
34
+ if (r && !r.done && (m = i["return"])) m.call(i);
35
+ }
36
+ finally { if (e) throw e.error; }
37
+ }
38
+ return ar;
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.pivot = void 0;
42
+ var getAggregation_1 = require("./getAggregation");
43
+ var indices_controller_1 = require("./indices.controller");
44
+ var pivotPathSeparator = '__';
45
+ function pivot(relevantData, options, response, paths, parentPath) {
46
+ var e_1, _a;
47
+ var _b;
48
+ if (response === void 0) { response = { key: 'root' }; }
49
+ if (paths === void 0) { paths = {}; }
50
+ if (parentPath === void 0) { parentPath = 'root'; }
51
+ var indicesCtrl = new indices_controller_1.IndicesController();
52
+ options.columns.forEach(function (column) {
53
+ if (column.attribute) {
54
+ indicesCtrl.getOrCreateIndex(column.attribute, relevantData);
55
+ }
56
+ });
57
+ options.rows.forEach(function (row) {
58
+ if (row.attribute) {
59
+ indicesCtrl.getOrCreateIndex(row.attribute, relevantData);
60
+ }
61
+ });
62
+ options.values.forEach(function (value) {
63
+ if (value.attribute) {
64
+ indicesCtrl.getOrCreateIndex(value.attribute, relevantData);
65
+ }
66
+ });
67
+ /**
68
+ * Rows
69
+ */
70
+ if (options.rows && options.rows.length > 0) {
71
+ response.rows = response.rows || [];
72
+ var item = getPivotRowItem(relevantData, options.rows[0], options, indicesCtrl, paths, parentPath);
73
+ response.rows.push(item);
74
+ }
75
+ /**
76
+ * Columns
77
+ */
78
+ if (options.columns && options.columns.length > 0) {
79
+ response.columns = response.columns || [];
80
+ var item = getPivotColumnItem(relevantData, options.columns[0], options, indicesCtrl, paths, parentPath);
81
+ response.columns.push(item);
82
+ }
83
+ /**
84
+ * Value Aggregations
85
+ */
86
+ if (response.key === 'root') {
87
+ try {
88
+ for (var _c = __values(options.values), _d = _c.next(); !_d.done; _d = _c.next()) {
89
+ var value = _d.value;
90
+ response.values = response.values || [];
91
+ var agg = (0, getAggregation_1.getAggregation)(value, relevantData, indicesCtrl.getIndex(value.attribute), value.attribute);
92
+ paths[parentPath] = agg;
93
+ response.values.push(agg);
94
+ }
95
+ }
96
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
97
+ finally {
98
+ try {
99
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
100
+ }
101
+ finally { if (e_1) throw e_1.error; }
102
+ }
103
+ }
104
+ if ((_b = options.options) === null || _b === void 0 ? void 0 : _b.includePaths) {
105
+ Object.defineProperty(response, 'paths', { enumerable: false, value: paths });
106
+ }
107
+ return response;
108
+ }
109
+ exports.pivot = pivot;
110
+ function getPivotRowItem(modelData, options, globalOptions, modelIndexMap, paths, parentPath) {
111
+ var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
112
+ if (paths === void 0) { paths = {}; }
113
+ if (parentPath === void 0) { parentPath = ''; }
114
+ var item = { key: options.attribute };
115
+ var indexMap = modelIndexMap.getIndex(options.attribute);
116
+ try {
117
+ for (var _e = __values(indexMap.entries()), _f = _e.next(); !_f.done; _f = _e.next()) {
118
+ var _g = __read(_f.value, 2), key = _g[0], itemKeys = _g[1];
119
+ var rowItem = {
120
+ key: key,
121
+ };
122
+ var relevantData = new Map();
123
+ try {
124
+ for (var itemKeys_1 = (e_3 = void 0, __values(itemKeys)), itemKeys_1_1 = itemKeys_1.next(); !itemKeys_1_1.done; itemKeys_1_1 = itemKeys_1.next()) {
125
+ var key_1 = itemKeys_1_1.value;
126
+ if (!modelData.has(key_1)) {
127
+ continue;
128
+ }
129
+ relevantData.set(key_1, modelData.get(key_1));
130
+ }
131
+ }
132
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
133
+ finally {
134
+ try {
135
+ if (itemKeys_1_1 && !itemKeys_1_1.done && (_b = itemKeys_1.return)) _b.call(itemKeys_1);
136
+ }
137
+ finally { if (e_3) throw e_3.error; }
138
+ }
139
+ if (!relevantData.size)
140
+ continue;
141
+ try {
142
+ for (var _h = (e_4 = void 0, __values(globalOptions.values)), _j = _h.next(); !_j.done; _j = _h.next()) {
143
+ var value = _j.value;
144
+ rowItem.values = rowItem.values || [];
145
+ var agg = (0, getAggregation_1.getAggregation)(value, relevantData, modelIndexMap.getIndex(value.attribute), value.attribute);
146
+ paths[parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key] = agg;
147
+ rowItem.values.push(agg);
148
+ }
149
+ }
150
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
151
+ finally {
152
+ try {
153
+ if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
154
+ }
155
+ finally { if (e_4) throw e_4.error; }
156
+ }
157
+ item.rows = item.rows || [];
158
+ item.rows.push(rowItem);
159
+ if (globalOptions.rows.length > 1) {
160
+ var newOptions = __assign(__assign({}, globalOptions), { rows: globalOptions.rows.slice(1) });
161
+ pivot(relevantData, newOptions, rowItem, paths, parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key);
162
+ }
163
+ else {
164
+ if (globalOptions.columns) {
165
+ try {
166
+ for (var _k = (e_5 = void 0, __values(globalOptions.columns)), _l = _k.next(); !_l.done; _l = _k.next()) {
167
+ var columnOption = _l.value;
168
+ rowItem.columns = rowItem.columns || [];
169
+ var columnItem = getPivotColumnItem(relevantData, columnOption, globalOptions, modelIndexMap, paths, parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key);
170
+ rowItem.columns.push(columnItem);
171
+ }
172
+ }
173
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
174
+ finally {
175
+ try {
176
+ if (_l && !_l.done && (_d = _k.return)) _d.call(_k);
177
+ }
178
+ finally { if (e_5) throw e_5.error; }
179
+ }
180
+ }
181
+ }
182
+ }
183
+ }
184
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
185
+ finally {
186
+ try {
187
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
188
+ }
189
+ finally { if (e_2) throw e_2.error; }
190
+ }
191
+ return item;
192
+ }
193
+ function getPivotColumnItem(modelData, options, globalOptions, modelIndexMap, paths, parentPath) {
194
+ var e_6, _a, e_7, _b, e_8, _c;
195
+ if (paths === void 0) { paths = {}; }
196
+ if (parentPath === void 0) { parentPath = ''; }
197
+ var item = { key: options.attribute };
198
+ var indexMap = modelIndexMap.getIndex(options.attribute);
199
+ try {
200
+ for (var _d = __values(indexMap.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
201
+ var _f = __read(_e.value, 2), key = _f[0], itemKeys = _f[1];
202
+ var rowItem = {
203
+ key: key,
204
+ };
205
+ var relevantData = new Map();
206
+ try {
207
+ for (var itemKeys_2 = (e_7 = void 0, __values(itemKeys)), itemKeys_2_1 = itemKeys_2.next(); !itemKeys_2_1.done; itemKeys_2_1 = itemKeys_2.next()) {
208
+ var key_2 = itemKeys_2_1.value;
209
+ if (!modelData.has(key_2)) {
210
+ continue;
211
+ }
212
+ relevantData.set(key_2, modelData.get(key_2));
213
+ }
214
+ }
215
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
216
+ finally {
217
+ try {
218
+ if (itemKeys_2_1 && !itemKeys_2_1.done && (_b = itemKeys_2.return)) _b.call(itemKeys_2);
219
+ }
220
+ finally { if (e_7) throw e_7.error; }
221
+ }
222
+ if (!relevantData.size)
223
+ continue;
224
+ try {
225
+ for (var _g = (e_8 = void 0, __values(globalOptions.values)), _h = _g.next(); !_h.done; _h = _g.next()) {
226
+ var value = _h.value;
227
+ rowItem.values = rowItem.values || [];
228
+ var agg = (0, getAggregation_1.getAggregation)(value, relevantData, modelIndexMap.getIndex(value.attribute), value.attribute);
229
+ paths[parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key] = agg;
230
+ rowItem.values.push(agg);
231
+ }
232
+ }
233
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
234
+ finally {
235
+ try {
236
+ if (_h && !_h.done && (_c = _g.return)) _c.call(_g);
237
+ }
238
+ finally { if (e_8) throw e_8.error; }
239
+ }
240
+ item.columns = item.columns || [];
241
+ item.columns.push(rowItem);
242
+ if (globalOptions.columns.length > 1) {
243
+ var newOptions = __assign(__assign({}, globalOptions), { columns: globalOptions.columns.slice(1) });
244
+ pivot(relevantData, newOptions, rowItem, paths, parentPath + pivotPathSeparator + options.attribute + pivotPathSeparator + key);
245
+ }
246
+ }
247
+ }
248
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
249
+ finally {
250
+ try {
251
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
252
+ }
253
+ finally { if (e_6) throw e_6.error; }
254
+ }
255
+ return item;
256
+ }
257
+ //# sourceMappingURL=pivot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot.js","sourceRoot":"","sources":["../../src/pivot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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AAC;oBAC5F,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBAC1B;;;;;;;;;YAED,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;YAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAE3B,IAAI,aAAa,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpC,IAAM,UAAU,yBAAQ,aAAa,KAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAE,CAAC;gBACjF,KAAK,CACH,YAAY,EACZ,UAAU,EACV,OAAO,EACP,KAAK,EACL,UAAU,GAAG,kBAAkB,GAAG,OAAO,CAAC,SAAS,GAAG,kBAAkB,GAAG,GAAG,CAC/E,CAAC;aACH;SACF;;;;;;;;;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -9,6 +9,7 @@ export type AggregationOptions = {
9
9
  types: AggregationType[];
10
10
  distinctOptions?: {
11
11
  limit?: number;
12
+ skipKeys?: boolean;
12
13
  };
13
14
  groupOptions?: {
14
15
  limit?: number;
@@ -27,7 +28,7 @@ export type AggregationGroupOption = {
27
28
  export type AggregationDistinctValue = {
28
29
  value: string;
29
30
  count: number;
30
- keys: string[];
31
+ keys?: string[];
31
32
  };
32
33
  export type AggregationGroupValue = {
33
34
  option: AggregationGroupOption;
@@ -0,0 +1,3 @@
1
+ import { Aggregation, AggregationDistinctValue, AggregationOptions, InverseIndexValuesMap, ListItem } from './types';
2
+ export declare const getAggregation: (options: AggregationOptions, relevantData: Map<string, ListItem>, indexMap: InverseIndexValuesMap, attribute: string) => Aggregation;
3
+ export declare const getDistinct: (options: AggregationOptions, data: Map<string, ListItem>, indexMap: InverseIndexValuesMap) => AggregationDistinctValue[];
@@ -0,0 +1,229 @@
1
+ var __values = (this && this.__values) || function(o) {
2
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
+ if (m) return m.call(o);
4
+ if (o && typeof o.length === "number") return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
+ };
12
+ var __read = (this && this.__read) || function (o, n) {
13
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
14
+ if (!m) return o;
15
+ var i = m.call(o), r, ar = [], e;
16
+ try {
17
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
18
+ }
19
+ catch (error) { e = { error: error }; }
20
+ finally {
21
+ try {
22
+ if (r && !r.done && (m = i["return"])) m.call(i);
23
+ }
24
+ finally { if (e) throw e.error; }
25
+ }
26
+ return ar;
27
+ };
28
+ import { Decimal } from 'decimal.js-light';
29
+ export var getAggregation = function (options, relevantData, indexMap, attribute) {
30
+ if (!attribute) {
31
+ throw new Error('Attribute not found');
32
+ }
33
+ var aggregation = {
34
+ attribute: attribute,
35
+ types: options.types,
36
+ };
37
+ var numberAgg;
38
+ if (aggregation.types.includes('sum') || aggregation.types.includes('avg') || aggregation.types.includes('count')) {
39
+ numberAgg = getNumberAggregation(attribute, relevantData);
40
+ }
41
+ var minMax;
42
+ if (aggregation.types.includes('min') || aggregation.types.includes('max')) {
43
+ minMax = getMinMax(options.attribute, relevantData);
44
+ }
45
+ options.types.forEach(function (type) {
46
+ if (type === 'sum') {
47
+ aggregation.sum = numberAgg === null || numberAgg === void 0 ? void 0 : numberAgg.sum;
48
+ }
49
+ else if (type === 'avg') {
50
+ aggregation.avg = numberAgg === null || numberAgg === void 0 ? void 0 : numberAgg.average;
51
+ }
52
+ else if (type === 'count') {
53
+ aggregation.count = numberAgg === null || numberAgg === void 0 ? void 0 : numberAgg.count;
54
+ }
55
+ else if (type === 'min') {
56
+ aggregation.min = minMax && minMax[0];
57
+ }
58
+ else if (type === 'max') {
59
+ aggregation.max = minMax && minMax[1];
60
+ }
61
+ else if (type === 'distinct') {
62
+ aggregation.distinct = getDistinct(options, relevantData, indexMap);
63
+ }
64
+ else if (type === 'group') {
65
+ aggregation.group = getGroups(options, relevantData);
66
+ }
67
+ });
68
+ return aggregation;
69
+ };
70
+ var getMinMax = function (attribute, data) {
71
+ var e_1, _a;
72
+ var values = Array.from(data.values())
73
+ .filter(Boolean)
74
+ .map(function (item) { return item[attribute]; });
75
+ if (!values) {
76
+ return undefined;
77
+ }
78
+ var minV = values[0];
79
+ var maxV = values[0];
80
+ try {
81
+ for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
82
+ var a = values_1_1.value;
83
+ if (a < minV)
84
+ minV = a;
85
+ if (a > maxV)
86
+ maxV = a;
87
+ }
88
+ }
89
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
90
+ finally {
91
+ try {
92
+ if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
93
+ }
94
+ finally { if (e_1) throw e_1.error; }
95
+ }
96
+ return [minV, maxV];
97
+ };
98
+ var getGroups = function (options, data) {
99
+ var e_2, _a, e_3, _b;
100
+ var _c, _d, _e, _f;
101
+ var values = [];
102
+ (_d = (_c = options.groupOptions) === null || _c === void 0 ? void 0 : _c.groups) === null || _d === void 0 ? void 0 : _d.forEach(function (group) {
103
+ values.push({
104
+ option: group,
105
+ count: 0,
106
+ keys: [],
107
+ });
108
+ });
109
+ var notFound = {
110
+ option: { value: ['$dcupl_not_found'] },
111
+ count: 0,
112
+ keys: [],
113
+ };
114
+ try {
115
+ for (var _g = __values(data.values()), _h = _g.next(); !_h.done; _h = _g.next()) {
116
+ var item = _h.value;
117
+ var relevantEntry = item[options.attribute];
118
+ try {
119
+ for (var values_2 = (e_3 = void 0, __values(values)), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
120
+ var group = values_2_1.value;
121
+ if ((typeof group.option.value !== 'undefined' && group.option.value.includes(relevantEntry)) ||
122
+ (typeof group.option.from !== 'undefined' &&
123
+ group.option.from < relevantEntry &&
124
+ typeof group.option.to !== 'undefined' &&
125
+ group.option.to > relevantEntry)) {
126
+ group.count++;
127
+ group.keys.push(item.key);
128
+ }
129
+ else {
130
+ if ((_e = options === null || options === void 0 ? void 0 : options.groupOptions) === null || _e === void 0 ? void 0 : _e.calculateNotFound) {
131
+ notFound.count++;
132
+ notFound.keys.push(item.key);
133
+ }
134
+ }
135
+ }
136
+ }
137
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
138
+ finally {
139
+ try {
140
+ if (values_2_1 && !values_2_1.done && (_b = values_2.return)) _b.call(values_2);
141
+ }
142
+ finally { if (e_3) throw e_3.error; }
143
+ }
144
+ }
145
+ }
146
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
147
+ finally {
148
+ try {
149
+ if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
150
+ }
151
+ finally { if (e_2) throw e_2.error; }
152
+ }
153
+ if ((_f = options === null || options === void 0 ? void 0 : options.groupOptions) === null || _f === void 0 ? void 0 : _f.calculateNotFound) {
154
+ values.push(notFound);
155
+ }
156
+ return values;
157
+ };
158
+ var getNumberAggregation = function (attribute, data) {
159
+ var e_4, _a;
160
+ var aggSum = new Decimal(0);
161
+ try {
162
+ for (var _b = __values(data.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
163
+ var item = _c.value;
164
+ if (!item)
165
+ continue;
166
+ var value = item[attribute];
167
+ if (Array.isArray(value)) {
168
+ value.forEach(function (val) {
169
+ if (typeof val === 'number') {
170
+ aggSum = aggSum.add(val);
171
+ }
172
+ });
173
+ }
174
+ else {
175
+ if (typeof value === 'number') {
176
+ aggSum = aggSum.add(value);
177
+ }
178
+ }
179
+ }
180
+ }
181
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
182
+ finally {
183
+ try {
184
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
185
+ }
186
+ finally { if (e_4) throw e_4.error; }
187
+ }
188
+ var agg = {
189
+ average: aggSum.dividedBy(data.size).toNumber(),
190
+ count: data.size,
191
+ sum: aggSum.toNumber(),
192
+ };
193
+ return agg;
194
+ };
195
+ export var getDistinct = function (options, data, indexMap) {
196
+ var e_5, _a;
197
+ var _b, _c;
198
+ var values = [];
199
+ try {
200
+ for (var indexMap_1 = __values(indexMap), indexMap_1_1 = indexMap_1.next(); !indexMap_1_1.done; indexMap_1_1 = indexMap_1.next()) {
201
+ var _d = __read(indexMap_1_1.value, 2), attributeValue = _d[0], itemKeys = _d[1];
202
+ if (options.excludeUndefineds && attributeValue === undefined) {
203
+ continue;
204
+ }
205
+ if (itemKeys.find(function (key) { return data.has(key); })) {
206
+ var value = {
207
+ value: attributeValue,
208
+ count: itemKeys.length,
209
+ };
210
+ if (!((_b = options.distinctOptions) === null || _b === void 0 ? void 0 : _b.skipKeys)) {
211
+ value.keys = itemKeys;
212
+ }
213
+ values.push(value);
214
+ if (((_c = options.distinctOptions) === null || _c === void 0 ? void 0 : _c.limit) && values.length >= options.distinctOptions.limit) {
215
+ break;
216
+ }
217
+ }
218
+ }
219
+ }
220
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
221
+ finally {
222
+ try {
223
+ if (indexMap_1_1 && !indexMap_1_1.done && (_a = indexMap_1.return)) _a.call(indexMap_1);
224
+ }
225
+ finally { if (e_5) throw e_5.error; }
226
+ }
227
+ return values;
228
+ };
229
+ //# sourceMappingURL=getAggregation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAggregation.js","sourceRoot":"","sources":["../../src/getAggregation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,MAAM,CAAC,IAAM,cAAc,GAAG,UAC5B,OAA2B,EAC3B,YAAmC,EACnC,QAA+B,EAC/B,SAAiB;IAEjB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;K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GAA+B,EAAE,CAAC;;QAE9C,KAAyC,IAAA,aAAA,SAAA,QAAQ,CAAA,kCAAA,wDAAE;YAAxC,IAAA,KAAA,6BAA0B,EAAzB,cAAc,QAAA,EAAE,QAAQ,QAAA;YAClC,IAAI,OAAO,CAAC,iBAAiB,IAAI,cAAc,KAAK,SAAS,EAAE;gBAC7D,SAAS;aACV;YACD,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAb,CAAa,CAAC,EAAE;gBACzC,IAAM,KAAK,GAA6B;oBACtC,KAAK,EAAE,cAAc;oBACrB,KAAK,EAAE,QAAQ,CAAC,MAAM;iBACvB,CAAC;gBACF,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,QAAQ,CAAA,EAAE;oBACtC,KAAK,CAAC,IAAI,GAAG,QAAQ,CAAC;iBACvB;gBAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAEnB,IAAI,CAAA,MAAA,OAAO,CAAC,eAAe,0CAAE,KAAK,KAAI,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE;oBACpF,MAAM;iBACP;aACF;SACF;;;;;;;;;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,9 +1,12 @@
1
- export * from './queryData';
1
+ export * from './changeDetection';
2
2
  export * from './computeSuggestions';
3
- export * from './helper';
3
+ export * from './getAggregation';
4
4
  export * from './getFacets';
5
- export * from './types';
6
- export * from './changeDetection';
5
+ export * from './helper';
6
+ export * from './indices.controller';
7
7
  export * from './performance';
8
+ export * from './pivot';
8
9
  export * from './query-builder';
9
10
  export * from './query.helper';
11
+ export * from './queryData';
12
+ export * from './types';
@@ -1,10 +1,13 @@
1
- export * from './queryData';
1
+ export * from './changeDetection';
2
2
  export * from './computeSuggestions';
3
- export * from './helper';
3
+ export * from './getAggregation';
4
4
  export * from './getFacets';
5
- export * from './types';
6
- export * from './changeDetection';
5
+ export * from './helper';
6
+ export * from './indices.controller';
7
7
  export * from './performance';
8
+ export * from './pivot';
8
9
  export * from './query-builder';
9
10
  export * from './query.helper';
11
+ export * from './queryData';
12
+ export * from './types';
10
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { InverseIndexValuesMap, InverseIndexDataValuesMap, ListItem } from './types';
2
+ export declare class IndicesController {
3
+ private indexMap;
4
+ private dataMap;
5
+ constructor();
6
+ reset(attributeKey?: string): void;
7
+ fillDataMap(attributeKey: string, attributeValue: Array<string | undefined | ListItem>): void;
8
+ fillInverseIndex(attributeKey: string, originKey: string, foreignKeys: Array<string | undefined | ListItem>): void;
9
+ getIndex(attributeKey: string, context?: any): InverseIndexValuesMap | undefined;
10
+ getData(attributeKey: string, context?: any): InverseIndexDataValuesMap | undefined;
11
+ getOrCreateIndex(attributeKey: string, relevantData: Map<string, ListItem>, context?: any): InverseIndexValuesMap;
12
+ getIndexName(attributeKey: string, context?: any): string;
13
+ }