@servicetitan/data-query 19.2.0 → 20.0.1

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 (52) hide show
  1. package/dist/accessor.js +4 -8
  2. package/dist/accessor.js.map +1 -1
  3. package/dist/array.operators.js +33 -41
  4. package/dist/array.operators.js.map +1 -1
  5. package/dist/common.interfaces.js +1 -2
  6. package/dist/data-result.interface.js +1 -2
  7. package/dist/data-source/async-data-source.js +9 -16
  8. package/dist/data-source/async-data-source.js.map +1 -1
  9. package/dist/data-source/data-source.js +1 -2
  10. package/dist/data-source/in-memory-data-source.js +15 -22
  11. package/dist/data-source/in-memory-data-source.js.map +1 -1
  12. package/dist/data-source/index.js +2 -7
  13. package/dist/data-source/index.js.map +1 -1
  14. package/dist/filter-serialization.common.js +12 -24
  15. package/dist/filter-serialization.common.js.map +1 -1
  16. package/dist/filtering/filter-descriptor.interface.js +3 -7
  17. package/dist/filtering/filter-descriptor.interface.js.map +1 -1
  18. package/dist/filtering/filter-expression.factory.js +9 -14
  19. package/dist/filtering/filter-expression.factory.js.map +1 -1
  20. package/dist/filtering/filter-no-eval.js +28 -32
  21. package/dist/filtering/filter-no-eval.js.map +1 -1
  22. package/dist/filtering/filter.operators.js +8 -12
  23. package/dist/filtering/filter.operators.js.map +1 -1
  24. package/dist/funcs.js +4 -11
  25. package/dist/funcs.js.map +1 -1
  26. package/dist/grouping/aggregate.operators.js +5 -9
  27. package/dist/grouping/aggregate.operators.js.map +1 -1
  28. package/dist/grouping/group-descriptor.interface.js +1 -2
  29. package/dist/grouping/group-descriptor.interface.js.map +1 -1
  30. package/dist/grouping/group.operators.js +14 -19
  31. package/dist/grouping/group.operators.js.map +1 -1
  32. package/dist/index.js +13 -35
  33. package/dist/index.js.map +1 -1
  34. package/dist/mvc/deserialization.js +7 -12
  35. package/dist/mvc/deserialization.js.map +1 -1
  36. package/dist/mvc/operators.js +30 -35
  37. package/dist/mvc/operators.js.map +1 -1
  38. package/dist/odata-filtering.operators.js +15 -19
  39. package/dist/odata-filtering.operators.js.map +1 -1
  40. package/dist/odata.operators.js +9 -13
  41. package/dist/odata.operators.js.map +1 -1
  42. package/dist/sort-descriptor.js +1 -2
  43. package/dist/sorting/sort-array.operator.js +7 -11
  44. package/dist/sorting/sort-array.operator.js.map +1 -1
  45. package/dist/sorting/sort.js +3 -7
  46. package/dist/sorting/sort.js.map +1 -1
  47. package/dist/state.js +1 -2
  48. package/dist/transducers.js +27 -41
  49. package/dist/transducers.js.map +1 -1
  50. package/dist/utils.js +10 -23
  51. package/dist/utils.js.map +1 -1
  52. package/package.json +5 -4
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.transformCompositeFilter = void 0;
4
- const filter_descriptor_interface_1 = require("./filter-descriptor.interface");
5
- const accessor_1 = require("../accessor");
6
- const utils_1 = require("../utils");
1
+ import { isCompositeFilterDescriptor } from "./filter-descriptor.interface";
2
+ import { getter } from "../accessor";
3
+ import { isFunction, isPresent, isDate, isString, isBlank, isNumeric, isArray } from "../utils";
7
4
  const logic = {
8
5
  "or": {
9
6
  concat: (acc, fn) => a => acc(a) || fn(a),
@@ -23,22 +20,22 @@ const operatorsMap = {
23
20
  eq: (a, b) => a === b,
24
21
  gt: (a, b) => a > b,
25
22
  gte: (a, b) => a >= b,
26
- isempty: (a) => (0, utils_1.isBlank)(a) || a === '',
27
- isnotempty: (a) => (0, utils_1.isPresent)(a) && a !== '',
28
- isnotnull: (a) => (0, utils_1.isPresent)(a),
29
- isnull: (a) => (0, utils_1.isBlank)(a),
23
+ isempty: (a) => isBlank(a) || a === '',
24
+ isnotempty: (a) => isPresent(a) && a !== '',
25
+ isnotnull: (a) => isPresent(a),
26
+ isnull: (a) => isBlank(a),
30
27
  lt: (a, b) => a < b,
31
28
  lte: (a, b) => a <= b,
32
29
  neq: (a, b) => a != b,
33
30
  startswith: (a, b) => (a || "").lastIndexOf(b, 0) === 0,
34
31
  in: (a, b) => b.includes(a),
35
32
  notin: (a, b) => !b.includes(a),
36
- isinteger: (a) => (0, utils_1.isNumeric)(a) && Math.round(a) === a,
37
- isfractional: (a) => (0, utils_1.isNumeric)(a) && Math.round(a) !== a
33
+ isinteger: (a) => isNumeric(a) && Math.round(a) === a,
34
+ isfractional: (a) => isNumeric(a) && Math.round(a) !== a
38
35
  };
39
36
  const dateRegExp = /^\/Date\((.*?)\)\/$/;
40
37
  const convertValue = (value, ignoreCase) => {
41
- if (value != null && (0, utils_1.isString)(value)) {
38
+ if (value != null && isString(value)) {
42
39
  const date = dateRegExp.exec(value);
43
40
  if (date) {
44
41
  return new Date(+date[1]).getTime();
@@ -47,20 +44,20 @@ const convertValue = (value, ignoreCase) => {
47
44
  return value.toLowerCase();
48
45
  }
49
46
  }
50
- else if (value != null && (0, utils_1.isDate)(value)) {
47
+ else if (value != null && isDate(value)) {
51
48
  return value.getTime();
52
49
  }
53
- else if (value != null && (0, utils_1.isArray)(value)) {
54
- return value.map(v => (0, utils_1.isString)(v) ? v.toLowerCase() : v);
50
+ else if (value != null && isArray(value)) {
51
+ return value.map(v => isString(v) ? v.toLowerCase() : v);
55
52
  }
56
53
  return value;
57
54
  };
58
55
  const typedGetter = (prop, value, ignoreCase) => {
59
- if (!(0, utils_1.isPresent)(value)) {
56
+ if (!isPresent(value)) {
60
57
  return prop;
61
58
  }
62
59
  let acc = prop;
63
- if ((0, utils_1.isString)(value)) {
60
+ if (isString(value)) {
64
61
  const date = dateRegExp.exec(value);
65
62
  if (date) {
66
63
  value = new Date(+date[1]);
@@ -72,46 +69,45 @@ const typedGetter = (prop, value, ignoreCase) => {
72
69
  return x.toLowerCase();
73
70
  }
74
71
  else {
75
- return (0, utils_1.isNumeric)(x) ? x + "" : x;
72
+ return isNumeric(x) ? x + "" : x;
76
73
  }
77
74
  };
78
75
  }
79
76
  }
80
- if ((0, utils_1.isDate)(value)) {
77
+ if (isDate(value)) {
81
78
  return a => {
82
79
  const x = acc(a);
83
- return (0, utils_1.isDate)(x) ? x.getTime() : x;
80
+ return isDate(x) ? x.getTime() : x;
84
81
  };
85
82
  }
86
- if ((0, utils_1.isArray)(value) && ignoreCase) {
83
+ if (isArray(value) && ignoreCase) {
87
84
  acc = a => {
88
85
  const x = prop(a);
89
- return (0, utils_1.isString)(x) ? x.toLowerCase() : x;
86
+ return isString(x) ? x.toLowerCase() : x;
90
87
  };
91
88
  }
92
89
  return acc;
93
90
  };
94
91
  const transformFilter = ({ field, ignoreCase, value, operator }, preprocessors = {}) => {
95
- field = !(0, utils_1.isPresent)(field) ? a => a : field;
96
- ignoreCase = (0, utils_1.isPresent)(ignoreCase) ? ignoreCase : true;
97
- const itemProp = typedGetter((0, utils_1.isFunction)(field) ? field : a => {
98
- const value = (0, accessor_1.getter)(field, true)(a);
92
+ field = !isPresent(field) ? a => a : field;
93
+ ignoreCase = isPresent(ignoreCase) ? ignoreCase : true;
94
+ const itemProp = typedGetter(isFunction(field) ? field : a => {
95
+ const value = getter(field, true)(a);
99
96
  const preprocessor = preprocessors[field];
100
97
  return preprocessor ? preprocessor(value) : value;
101
98
  }, value, ignoreCase);
102
99
  value = convertValue(value, ignoreCase);
103
- const op = (0, utils_1.isFunction)(operator) ? operator : operatorsMap[operator];
100
+ const op = isFunction(operator) ? operator : operatorsMap[operator];
104
101
  return a => op(itemProp(a), value, ignoreCase);
105
102
  };
106
103
  /**
107
104
  * @hidden
108
105
  */
109
- const transformCompositeFilter = (filter, preprocessors = {}) => {
106
+ export const transformCompositeFilter = (filter, preprocessors = {}) => {
110
107
  const combiner = logic[filter.logic];
111
108
  return filter.filters
112
- .filter(utils_1.isPresent)
113
- .map(x => (0, filter_descriptor_interface_1.isCompositeFilterDescriptor)(x) ? (0, exports.transformCompositeFilter)(x, preprocessors) : transformFilter(x, preprocessors))
109
+ .filter(isPresent)
110
+ .map(x => isCompositeFilterDescriptor(x) ? transformCompositeFilter(x, preprocessors) : transformFilter(x, preprocessors))
114
111
  .reduce(combiner.concat, combiner.identity);
115
112
  };
116
- exports.transformCompositeFilter = transformCompositeFilter;
117
113
  //# sourceMappingURL=filter-no-eval.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-no-eval.js","sourceRoot":"","sources":["../../src/filtering/filter-no-eval.ts"],"names":[],"mappings":";;;AAAA,+EAAyH;AAEzH,0CAAqC;AACrC,oCAAgG;AAEhG,MAAM,KAAK,GAAG;IACV,IAAI,EAAE;QACF,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;KACxB;IACD,KAAK,EAAE;QACH,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACzC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;KACvB;CACJ,CAAC;AAEF,MAAM,YAAY,GAAG;IACjB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrD,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;IACvF,gBAAgB,EAAE,CAAC,CAAS,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CAAC,EAAE,aAAa,CAAC,CAAC;SACzH,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC,CAAC"}
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeFilters = void 0;
4
- const utils_1 = require("../utils");
5
- const filter_descriptor_interface_1 = require("./filter-descriptor.interface");
1
+ import { isPresent, isString, isArray } from '../utils';
2
+ import { isCompositeFilterDescriptor } from './filter-descriptor.interface';
6
3
  const operatorMap = (key) => ({
7
4
  "!=": "neq",
8
5
  "<": "lt",
@@ -40,10 +37,10 @@ const normalizeOperator = (descriptor) => {
40
37
  if (descriptor.filters) {
41
38
  descriptor.filters = descriptor.filters.map(filter => {
42
39
  const result = Object.assign({}, filter);
43
- if (!(0, filter_descriptor_interface_1.isCompositeFilterDescriptor)(filter) && (0, utils_1.isString)(filter.operator)) {
40
+ if (!isCompositeFilterDescriptor(filter) && isString(filter.operator)) {
44
41
  result.operator = operatorMap(filter.operator);
45
42
  }
46
- if ((0, filter_descriptor_interface_1.isCompositeFilterDescriptor)(filter)) {
43
+ if (isCompositeFilterDescriptor(filter)) {
47
44
  normalizeOperator(result);
48
45
  }
49
46
  return result;
@@ -51,9 +48,9 @@ const normalizeOperator = (descriptor) => {
51
48
  }
52
49
  };
53
50
  const normalizeDescriptor = (descriptor) => {
54
- if (!(0, filter_descriptor_interface_1.isCompositeFilterDescriptor)(descriptor)) {
51
+ if (!isCompositeFilterDescriptor(descriptor)) {
55
52
  return {
56
- filters: (0, utils_1.isArray)(descriptor) ? descriptor : [descriptor],
53
+ filters: isArray(descriptor) ? descriptor : [descriptor],
57
54
  logic: "and"
58
55
  };
59
56
  }
@@ -67,12 +64,11 @@ const normalizeDescriptor = (descriptor) => {
67
64
  * @returns {CompositeFilterDescriptor} - The normalized descriptor.
68
65
  */
69
66
  // tslint:enable:max-line-length
70
- const normalizeFilters = (descriptor) => {
71
- if ((0, utils_1.isPresent)(descriptor)) {
67
+ export const normalizeFilters = (descriptor) => {
68
+ if (isPresent(descriptor)) {
72
69
  descriptor = normalizeDescriptor(descriptor);
73
70
  normalizeOperator(descriptor);
74
71
  }
75
72
  return descriptor;
76
73
  };
77
- exports.normalizeFilters = normalizeFilters;
78
74
  //# sourceMappingURL=filter.operators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.operators.js","sourceRoot":"","sources":["../../src/filtering/filter.operators.ts"],"names":[],"mappings":";;;AAAA,oCAAwD;AACxD,+EAAyH;AAEzH,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1B,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,EAAE,EAAE,KAAK;IACT,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,sBAAsB,EAAE,KAAK;IAC7B,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,KAAK;IAC1B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,KAAK;IACpB,EAAE,EAAE,KAAK;IACT,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,gBAAgB;CACnC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC;AAE7B,MAA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AAC;AANW,QAAA,gBAAgB,oBAM3B"}
1
+ {"version":3,"file":"filter.operators.js","sourceRoot":"","sources":["../../src/filtering/filter.operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAA+C,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAEzH,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC1B,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,EAAE,EAAE,KAAK;IACT,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,IAAI;IACjB,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,sBAAsB,EAAE,KAAK;IAC7B,UAAU,EAAE,IAAI;IAChB,mBAAmB,EAAE,KAAK;IAC1B,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,KAAK;IACpB,EAAE,EAAE,KAAK;IACT,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;IACjB,cAAc,EAAE,gBAAgB;CACnC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC;AAE7B,MAAM,iBAAiB,GAAG,CAAC,UAAqC,EAAE,EAAE;IAChE,IAAI,UAAU,CAAC,OAAO,EAAE;QACpB,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACjD,MAAM,MAAM,GAAQ,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;YAC9C,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBACnE,MAAM,CAAC,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;aAClD;YACD,IAAI,2BAA2B,CAAC,MAAM,CAAC,EAAE;gBACrC,iBAAiB,CAAC,MAAM,CAAC,CAAC;aAC7B;YAED,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAA6B,EAAE;IAClE,IAAI,CAAC,2BAA2B,CAAC,UAAU,CAAC,EAAE;QAC1C,OAAO;YACH,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;YACxD,KAAK,EAAE,KAAK;SACf,CAAC;KACL;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,iCAAiC;AACjC;;;;;GAKG;AACH,gCAAgC;AAChC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAAwD,EAA6B,EAAE;IACpH,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE;QACvB,UAAU,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC7C,iBAAiB,CAA4B,UAAU,CAAC,CAAC;KAC5D;IACD,OAAkC,UAAU,CAAC;AACjD,CAAC,CAAC"}
package/dist/funcs.js CHANGED
@@ -1,25 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.identity = exports.constant = exports.compose = exports.ifElse = void 0;
4
1
  /**
5
2
  * @hidden
6
3
  */
7
- const ifElse = (predicate, right, left) => value => predicate(value) ? right(value) : left(value);
8
- exports.ifElse = ifElse;
4
+ export const ifElse = (predicate, right, left) => value => predicate(value) ? right(value) : left(value);
9
5
  /**
10
6
  * @hidden
11
7
  * Performs the right-to-left function composition. Functions should have a unary.
12
8
  */
13
- const compose = (...args) => (data) => args.reduceRight((acc, curr) => curr(acc), data);
14
- exports.compose = compose;
9
+ export const compose = (...args) => (data) => args.reduceRight((acc, curr) => curr(acc), data);
15
10
  /**
16
11
  * @hidden
17
12
  */
18
- const constant = x => () => x;
19
- exports.constant = constant;
13
+ export const constant = x => () => x;
20
14
  /**
21
15
  * @hidden
22
16
  */
23
- const identity = x => x;
24
- exports.identity = identity;
17
+ export const identity = x => x;
25
18
  //# sourceMappingURL=funcs.js.map
package/dist/funcs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"funcs.js","sourceRoot":"","sources":["../src/funcs.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAA5F,QAAA,MAAM,UAAsF;AAEzG;;;GAGG;AACI,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAAlF,QAAA,OAAO,WAA2E;AAE/F;;GAEG;AACI,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAAxB,QAAA,QAAQ,YAAgB;AAErC;;GAEG;AACI,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAAlB,QAAA,QAAQ,YAAU"}
1
+ {"version":3,"file":"funcs.js","sourceRoot":"","sources":["../src/funcs.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAEzG;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.aggregateBy = void 0;
4
- const transducers_1 = require("../transducers");
5
- const identity = (0, transducers_1.map)(x => x);
1
+ import { exec, map, aggregatesCombinator, expandAggregates } from '../transducers';
2
+ const identity = map(x => x);
6
3
  // tslint:disable:max-line-length
7
4
  /**
8
5
  * Applies the specified [`AggregateDescriptors`]({% slug api_kendo-data-query_aggregatedescriptor %}) to the data. Returns an [`AggregateResult`]({% slug api_kendo-data-query_aggregateresult %}) instance.
@@ -33,13 +30,12 @@ const identity = (0, transducers_1.map)(x => x);
33
30
  * For more information, refer to the [`aggregateresult`]({% slug api_kendo-data-query_aggregateresult %}) configuration.
34
31
  */
35
32
  // tslint:enable:max-line-length
36
- const aggregateBy = (data, descriptors = [], preprocessors = {}, transformers = identity) => {
33
+ export const aggregateBy = (data, descriptors = [], preprocessors = {}, transformers = identity) => {
37
34
  const initialValue = {};
38
35
  if (!descriptors.length) {
39
36
  return initialValue;
40
37
  }
41
- const result = (0, transducers_1.exec)(transformers((0, transducers_1.aggregatesCombinator)(descriptors, preprocessors)), initialValue, data);
42
- return (0, transducers_1.expandAggregates)(result);
38
+ const result = exec(transformers(aggregatesCombinator(descriptors, preprocessors)), initialValue, data);
39
+ return expandAggregates(result);
43
40
  };
44
- exports.aggregateBy = aggregateBy;
45
41
  //# sourceMappingURL=aggregate.operators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate.operators.js","sourceRoot":"","sources":["../../src/grouping/aggregate.operators.ts"],"names":[],"mappings":";;;AAAA,gDAAoG;AAqBpG,MAAM,QAAQ,GAAG,IAAA,iBAAG,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE7B,iCAAiC;AACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,gCAAgC;AACzB,MAAM,WAAW,GAAG,CAAI,IAAS,EAAE,cAAqC,EAAE,EAAE,gBAAkC,EAAE,EAAE,eAAoD,QAAQ,EAAmB,EAAE;IACtM,MAAM,YAAY,GAAG,EAAE,CAAC;IAExB,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;QACrB,OAAO,YAAY,CAAC;KACvB;IAED,MAAM,MAAM,GAAG,IAAA,kBAAI,EAAC,YAAY,CAAC,IAAA,kCAAoB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACxG,OAAO,IAAA,8BAAgB,EAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC;AATW,QAAA,WAAW,eAStB"}
1
+ {"version":3,"file":"aggregate.operators.js","sourceRoot":"","sources":["../../src/grouping/aggregate.operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,oBAAoB,EAAE,gBAAgB,EAAmB,MAAM,gBAAgB,CAAC;AAqBpG,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAE7B,iCAAiC;AACjC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,gCAAgC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,IAAS,EAAE,cAAqC,EAAE,EAAE,gBAAkC,EAAE,EAAE,eAAoD,QAAQ,EAAmB,EAAE;IACtM,MAAM,YAAY,GAAG,EAAE,CAAC;IAExB,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;QACrB,OAAO,YAAY,CAAC;KACvB;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,oBAAoB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;IACxG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  // tslint:enable:max-line-length
4
3
  //# sourceMappingURL=group-descriptor.interface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"group-descriptor.interface.js","sourceRoot":"","sources":["../../src/grouping/group-descriptor.interface.ts"],"names":[],"mappings":";;AA2CA,gCAAgC"}
1
+ {"version":3,"file":"group-descriptor.interface.js","sourceRoot":"","sources":["../../src/grouping/group-descriptor.interface.ts"],"names":[],"mappings":";AA2CA,gCAAgC"}
@@ -1,19 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.groupBy = exports.normalizeGroups = void 0;
4
- const transducers_1 = require("../transducers");
5
- const utils_1 = require("../utils");
6
- const aggregate_operators_1 = require("./aggregate.operators");
7
- const filter_expression_factory_1 = require("../filtering/filter-expression.factory");
1
+ import { exec, map, groupCombinator } from '../transducers';
2
+ import { isArray, isPresent } from '../utils';
3
+ import { aggregateBy } from './aggregate.operators';
4
+ import { filterBy } from '../filtering/filter-expression.factory';
8
5
  /**
9
6
  * @hidden
10
7
  */
11
- const normalizeGroups = (descriptors) => {
12
- descriptors = (0, utils_1.isArray)(descriptors) ? descriptors : [descriptors];
8
+ export const normalizeGroups = (descriptors) => {
9
+ descriptors = isArray(descriptors) ? descriptors : [descriptors];
13
10
  return descriptors.map(x => Object.assign({ dir: "asc" }, x));
14
11
  };
15
- exports.normalizeGroups = normalizeGroups;
16
- const identity = (0, transducers_1.map)(x => x);
12
+ const identity = map(x => x);
17
13
  /**
18
14
  * Groups the provided data according to the specified descriptors.
19
15
  *
@@ -37,34 +33,34 @@ const identity = (0, transducers_1.map)(x => x);
37
33
  * const result = groupBy(data, [{ field: "subcategory" }]);
38
34
  * ```
39
35
  */
40
- const groupBy = (data, descriptors = [], preprocessors = {}, transformers = identity, originalData = data) => {
41
- descriptors = (0, exports.normalizeGroups)(descriptors);
36
+ export const groupBy = (data, descriptors = [], preprocessors = {}, transformers = identity, originalData = data) => {
37
+ descriptors = normalizeGroups(descriptors);
42
38
  if (!descriptors.length) {
43
39
  return data;
44
40
  }
45
41
  const descriptor = descriptors[0];
46
42
  const initialValue = {};
47
- const view = (0, transducers_1.exec)(transformers((0, transducers_1.groupCombinator)(descriptor.field, preprocessors)), initialValue, data);
43
+ const view = exec(transformers(groupCombinator(descriptor.field, preprocessors)), initialValue, data);
48
44
  const result = [];
49
45
  Object.keys(view).forEach(field => {
50
46
  Object.keys(view[field]).forEach(value => {
51
47
  const group = view[field][value];
52
48
  let aggregateResult = {};
53
49
  let filteredData = originalData;
54
- if ((0, utils_1.isPresent)(descriptor.aggregates)) {
55
- filteredData = (0, filter_expression_factory_1.filterBy)(originalData, {
50
+ if (isPresent(descriptor.aggregates)) {
51
+ filteredData = filterBy(originalData, {
56
52
  field: descriptor.field,
57
53
  ignoreCase: false,
58
54
  operator: 'eq',
59
55
  value: group.value
60
56
  }, preprocessors);
61
- aggregateResult = (0, aggregate_operators_1.aggregateBy)(filteredData, descriptor.aggregates, preprocessors);
57
+ aggregateResult = aggregateBy(filteredData, descriptor.aggregates, preprocessors);
62
58
  }
63
59
  result[group.__position] = {
64
60
  aggregates: aggregateResult,
65
61
  field: field,
66
62
  items: descriptors.length > 1 ?
67
- (0, exports.groupBy)(group.items, descriptors.slice(1), preprocessors, identity, filteredData)
63
+ groupBy(group.items, descriptors.slice(1), preprocessors, identity, filteredData)
68
64
  : group.items,
69
65
  value: group.value
70
66
  };
@@ -72,5 +68,4 @@ const groupBy = (data, descriptors = [], preprocessors = {}, transformers = iden
72
68
  });
73
69
  return result;
74
70
  };
75
- exports.groupBy = groupBy;
76
71
  //# sourceMappingURL=group.operators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"group.operators.js","sourceRoot":"","sources":["../../src/grouping/group.operators.ts"],"names":[],"mappings":";;;AACA,gDAA4D;AAC5D,oCAA8C;AAC9C,+DAAoD;AACpD,sFAAkE;AAGlE;;GAEG;AACI,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,EAAE;IAC3C,WAAW,GAAG,IAAA,eAAO,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;IACjE,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B;AAEF,MAAM,QAAQ,GAAY,IAAA,iBAAG,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACI,MAAM,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AC,KAAK,CAAC,UAAU,CAAC,GAAG;gBACvB,UAAU,EAAE,eAAe;gBAC3B,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;oBAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC;oBACjF,CAAC,CAAC,KAAK,CAAC,KAAK;gBACjB,KAAK,EAAE,KAAK,CAAC,KAAK;aACrB,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -1,36 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AsyncDataSource = exports.InMemoryDataSource = exports.aggregateBy = exports.normalizeGroups = exports.normalizeFilters = exports.composeSortDescriptors = exports.groupBy = exports.compileFilter = exports.filterBy = exports.getter = exports.distinct = exports.process = exports.orderBy = exports.translateAggregateResults = exports.translateDataSourceResultGroups = exports.toDataSourceRequest = exports.toDataSourceRequestString = exports.toODataString = exports.isCompositeFilterDescriptor = void 0;
4
- var filter_descriptor_interface_1 = require("./filtering/filter-descriptor.interface");
5
- Object.defineProperty(exports, "isCompositeFilterDescriptor", { enumerable: true, get: function () { return filter_descriptor_interface_1.isCompositeFilterDescriptor; } });
6
- var odata_operators_1 = require("./odata.operators");
7
- Object.defineProperty(exports, "toODataString", { enumerable: true, get: function () { return odata_operators_1.toODataString; } });
8
- var operators_1 = require("./mvc/operators");
9
- Object.defineProperty(exports, "toDataSourceRequestString", { enumerable: true, get: function () { return operators_1.toDataSourceRequestString; } });
10
- Object.defineProperty(exports, "toDataSourceRequest", { enumerable: true, get: function () { return operators_1.toDataSourceRequest; } });
11
- var deserialization_1 = require("./mvc/deserialization");
12
- Object.defineProperty(exports, "translateDataSourceResultGroups", { enumerable: true, get: function () { return deserialization_1.translateDataSourceResultGroups; } });
13
- Object.defineProperty(exports, "translateAggregateResults", { enumerable: true, get: function () { return deserialization_1.translateAggregateResults; } });
14
- var array_operators_1 = require("./array.operators");
15
- Object.defineProperty(exports, "orderBy", { enumerable: true, get: function () { return array_operators_1.orderBy; } });
16
- Object.defineProperty(exports, "process", { enumerable: true, get: function () { return array_operators_1.process; } });
17
- Object.defineProperty(exports, "distinct", { enumerable: true, get: function () { return array_operators_1.distinct; } });
18
- var accessor_1 = require("./accessor");
19
- Object.defineProperty(exports, "getter", { enumerable: true, get: function () { return accessor_1.getter; } });
20
- var filter_expression_factory_1 = require("./filtering/filter-expression.factory");
21
- Object.defineProperty(exports, "filterBy", { enumerable: true, get: function () { return filter_expression_factory_1.filterBy; } });
22
- Object.defineProperty(exports, "compileFilter", { enumerable: true, get: function () { return filter_expression_factory_1.compileFilter; } });
23
- var group_operators_1 = require("./grouping/group.operators");
24
- Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return group_operators_1.groupBy; } });
25
- var sort_array_operator_1 = require("./sorting/sort-array.operator");
26
- Object.defineProperty(exports, "composeSortDescriptors", { enumerable: true, get: function () { return sort_array_operator_1.composeSortDescriptors; } });
27
- var filter_operators_1 = require("./filtering/filter.operators");
28
- Object.defineProperty(exports, "normalizeFilters", { enumerable: true, get: function () { return filter_operators_1.normalizeFilters; } });
29
- var group_operators_2 = require("./grouping/group.operators");
30
- Object.defineProperty(exports, "normalizeGroups", { enumerable: true, get: function () { return group_operators_2.normalizeGroups; } });
31
- var aggregate_operators_1 = require("./grouping/aggregate.operators");
32
- Object.defineProperty(exports, "aggregateBy", { enumerable: true, get: function () { return aggregate_operators_1.aggregateBy; } });
33
- var data_source_1 = require("./data-source");
34
- Object.defineProperty(exports, "InMemoryDataSource", { enumerable: true, get: function () { return data_source_1.InMemoryDataSource; } });
35
- Object.defineProperty(exports, "AsyncDataSource", { enumerable: true, get: function () { return data_source_1.AsyncDataSource; } });
1
+ export { isCompositeFilterDescriptor } from './filtering/filter-descriptor.interface';
2
+ export { toODataString } from './odata.operators';
3
+ export { toDataSourceRequestString, toDataSourceRequest } from './mvc/operators';
4
+ export { translateDataSourceResultGroups, translateAggregateResults } from './mvc/deserialization';
5
+ export { orderBy, process, distinct } from './array.operators';
6
+ export { getter } from './accessor';
7
+ export { filterBy, compileFilter } from './filtering/filter-expression.factory';
8
+ export { groupBy } from './grouping/group.operators';
9
+ export { composeSortDescriptors } from './sorting/sort-array.operator';
10
+ export { normalizeFilters } from './filtering/filter.operators';
11
+ export { normalizeGroups } from './grouping/group.operators';
12
+ export { aggregateBy } from './grouping/aggregate.operators';
13
+ export { InMemoryDataSource, AsyncDataSource } from './data-source';
36
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,uFAAmI;AAA7E,0IAAA,2BAA2B,OAAA;AACjF,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,6CAAyG;AAAhG,sHAAA,yBAAyB,OAAA;AAA0B,gHAAA,mBAAmB,OAAA;AAC/E,yDAAsH;AAA7G,kIAAA,+BAA+B,OAAA;AAAqB,4HAAA,yBAAyB,OAAA;AAEtF,qDAA+D;AAAtD,0GAAA,OAAO,OAAA;AAAE,0GAAA,OAAO,OAAA;AAAE,2GAAA,QAAQ,OAAA;AACnC,uCAAoC;AAA3B,kGAAA,MAAM,OAAA;AACf,mFAAgF;AAAvE,qHAAA,QAAQ,OAAA;AAAE,0HAAA,aAAa,OAAA;AAChC,8DAAqD;AAA5C,0GAAA,OAAO,OAAA;AAChB,qEAAiF;AAA9D,6HAAA,sBAAsB,OAAA;AACzC,iEAAgE;AAAvD,oHAAA,gBAAgB,OAAA;AACzB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AAExB,sEAAkF;AAAzE,kHAAA,WAAW,OAAA;AAGpB,6CAAuF;AAA1D,iHAAA,kBAAkB,OAAA;AAAE,8GAAA,eAAe,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAA+C,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AACnI,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAA0B,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,+BAA+B,EAAqB,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEtH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAY,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAuB,MAAM,gCAAgC,CAAC;AAGlF,OAAO,EAAsB,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA"}
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.translateAggregateResults = exports.translateDataSourceResultGroups = void 0;
4
- const utils_1 = require("../utils");
5
- const funcs_1 = require("../funcs");
1
+ import { isPresent } from '../utils';
2
+ import { compose } from '../funcs';
6
3
  // tslint:enable:max-line-length
7
4
  const set = (field, target, value) => {
8
5
  target[field] = value;
@@ -11,7 +8,7 @@ const set = (field, target, value) => {
11
8
  const toCamelCase = str => str.replace(/(^[A-Z])/g, (_, g1) => g1.toLowerCase());
12
9
  const prop = (fieldName) => (obj) => {
13
10
  const value = obj[fieldName];
14
- if ((0, utils_1.isPresent)(value)) {
11
+ if (isPresent(value)) {
15
12
  return value;
16
13
  }
17
14
  return obj[toCamelCase(fieldName)];
@@ -22,7 +19,7 @@ const value = prop("Value");
22
19
  const convert = mapper => values => Object.keys(values).reduce(mapper.bind(null, values), {});
23
20
  const translateAggregate = convert((source, acc, field) => set(field.toLowerCase(), acc, source[field]));
24
21
  const translateAggregates = convert((source, acc, field) => set(field, acc, translateAggregate(source[field])));
25
- const valueOrDefault = (value, defaultValue) => (0, utils_1.isPresent)(value) ? value : defaultValue;
22
+ const valueOrDefault = (value, defaultValue) => isPresent(value) ? value : defaultValue;
26
23
  const normalizeGroup = group => ({
27
24
  aggregates: group.Aggregates || group.aggregates,
28
25
  field: group.Member || group.member || group.field,
@@ -30,7 +27,7 @@ const normalizeGroup = group => ({
30
27
  items: group.Items || group.items,
31
28
  value: valueOrDefault(group.Key, valueOrDefault(group.key, group.value))
32
29
  });
33
- const translateGroup = (0, funcs_1.compose)(({ field, hasSubgroups, value, aggregates, items }) => ({
30
+ const translateGroup = compose(({ field, hasSubgroups, value, aggregates, items }) => ({
34
31
  aggregates: translateAggregates(aggregates),
35
32
  field,
36
33
  items: hasSubgroups ? items.map(translateGroup) : items,
@@ -42,14 +39,12 @@ const translateGroup = (0, funcs_1.compose)(({ field, hasSubgroups, value, aggre
42
39
  * @param data - The value of the `Data` field of the response.
43
40
  * @returns {GroupResult[]} - The converted result.
44
41
  */
45
- const translateDataSourceResultGroups = (data) => data.map(translateGroup);
46
- exports.translateDataSourceResultGroups = translateDataSourceResultGroups;
42
+ export const translateDataSourceResultGroups = (data) => data.map(translateGroup);
47
43
  /**
48
44
  * Converts the `AggregateResults` field content, which is returned by the UI for ASP.NET MVC `ToDataSourceResult` method, to a comparable format.
49
45
  * @param data - The value of the `AggregateResults` field of the response.
50
46
  * @returns {AggregateResult} - The converted result.
51
47
  */
52
48
  // tslint:enable:max-line-length
53
- const translateAggregateResults = (data) => ((data || []).reduce((acc, x) => set(member(x), acc, set(aggregateMethodName(x).toLowerCase(), acc[member(x)] || {}, value(x))), {}));
54
- exports.translateAggregateResults = translateAggregateResults;
49
+ export const translateAggregateResults = (data) => ((data || []).reduce((acc, x) => set(member(x), acc, set(aggregateMethodName(x).toLowerCase(), acc[member(x)] || {}, value(x))), {}));
55
50
  //# sourceMappingURL=deserialization.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deserialization.js","sourceRoot":"","sources":["../../src/mvc/deserialization.ts"],"names":[],"mappings":";;;AACA,oCAAqC;AACrC,oCAAmC;AA6BnC,gCAAgC;AAEhC,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;IACjC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;IACtB,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAEjF,MAAM,IAAI,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,GAAQ,EAAE,EAAE;IAC7C,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC;IAC7B,IAAI,IAAA,iBAAS,EAAC,KAAK,CAAC,EAAE;QAClB,OAAO,KAAK,CAAC;KAChB;IACD,OAAO,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,MAAM,mBAAmB,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACxD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;AAE5B,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,MA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