@servicetitan/data-query 31.2.0 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/accessor.js +7 -7
  2. package/dist/accessor.js.map +1 -1
  3. package/dist/array.operators.js +22 -23
  4. package/dist/array.operators.js.map +1 -1
  5. package/dist/common.interfaces.js +4 -1
  6. package/dist/common.interfaces.js.map +1 -1
  7. package/dist/data-result.interface.js +4 -1
  8. package/dist/data-result.interface.js.map +1 -1
  9. package/dist/data-source/async-data-source.js +28 -36
  10. package/dist/data-source/async-data-source.js.map +1 -1
  11. package/dist/data-source/data-source.js +2 -1
  12. package/dist/data-source/data-source.js.map +1 -1
  13. package/dist/data-source/in-memory-data-source.js +47 -50
  14. package/dist/data-source/in-memory-data-source.js.map +1 -1
  15. package/dist/data-source/index.js +2 -0
  16. package/dist/data-source/index.js.map +1 -1
  17. package/dist/filter-serialization.common.js +33 -43
  18. package/dist/filter-serialization.common.js.map +1 -1
  19. package/dist/filtering/filter-descriptor.interface.js +2 -2
  20. package/dist/filtering/filter-descriptor.interface.js.map +1 -1
  21. package/dist/filtering/filter-expression.factory.js +7 -8
  22. package/dist/filtering/filter-expression.factory.js.map +1 -1
  23. package/dist/filtering/filter-no-eval.js +42 -50
  24. package/dist/filtering/filter-no-eval.js.map +1 -1
  25. package/dist/filtering/filter.operators.js +42 -40
  26. package/dist/filtering/filter.operators.js.map +1 -1
  27. package/dist/funcs.js +5 -8
  28. package/dist/funcs.js.map +1 -1
  29. package/dist/grouping/aggregate.operators.js +4 -4
  30. package/dist/grouping/aggregate.operators.js.map +1 -1
  31. package/dist/grouping/group-descriptor.interface.js +4 -2
  32. package/dist/grouping/group-descriptor.interface.js.map +1 -1
  33. package/dist/grouping/group.operators.js +13 -12
  34. package/dist/grouping/group.operators.js.map +1 -1
  35. package/dist/index.js +13 -6
  36. package/dist/index.js.map +1 -1
  37. package/dist/mvc/deserialization.js +30 -31
  38. package/dist/mvc/deserialization.js.map +1 -1
  39. package/dist/mvc/operators.js +66 -48
  40. package/dist/mvc/operators.js.map +1 -1
  41. package/dist/odata-filtering.operators.js +68 -38
  42. package/dist/odata-filtering.operators.js.map +1 -1
  43. package/dist/odata.operators.js +12 -17
  44. package/dist/odata.operators.js.map +1 -1
  45. package/dist/sort-descriptor.js +4 -1
  46. package/dist/sort-descriptor.js.map +1 -1
  47. package/dist/sorting/sort-array.operator.js +10 -13
  48. package/dist/sorting/sort-array.operator.js.map +1 -1
  49. package/dist/sorting/sort.js +9 -10
  50. package/dist/sorting/sort.js.map +1 -1
  51. package/dist/state.js +4 -1
  52. package/dist/state.js.map +1 -1
  53. package/dist/transducers.js +93 -102
  54. package/dist/transducers.js.map +1 -1
  55. package/dist/utils.js +11 -20
  56. package/dist/utils.js.map +1 -1
  57. package/package.json +3 -3
package/dist/accessor.js CHANGED
@@ -2,23 +2,22 @@ import { isPresent } from './utils';
2
2
  const getterCache = {};
3
3
  const FIELD_REGEX = /\[(?:(\d+)|['"](.*?)['"])\]|((?:(?!\[.*?\]|\.).)+)/g;
4
4
  // tslint:disable-next-line:no-string-literal
5
- getterCache['undefined'] = obj => obj;
5
+ getterCache['undefined'] = (obj)=>obj;
6
6
  /**
7
7
  * @hidden
8
- */
9
- export const getter = (field, safe) => {
8
+ */ export const getter = (field, safe)=>{
10
9
  const key = field + safe;
11
10
  if (getterCache[key]) {
12
11
  return getterCache[key];
13
12
  }
14
13
  const fields = [];
15
- field.replace(FIELD_REGEX, (_, index, indexAccessor, field) => {
16
- fields.push(isPresent(index) ? index : (indexAccessor || field));
14
+ field.replace(FIELD_REGEX, (_, index, indexAccessor, field)=>{
15
+ fields.push(isPresent(index) ? index : indexAccessor || field);
17
16
  return undefined;
18
17
  });
19
- getterCache[key] = obj => {
18
+ getterCache[key] = (obj)=>{
20
19
  let result = obj;
21
- for (let idx = 0; idx < fields.length; idx++) {
20
+ for(let idx = 0; idx < fields.length; idx++){
22
21
  result = result[fields[idx]];
23
22
  if (!isPresent(result) && safe) {
24
23
  return result;
@@ -28,4 +27,5 @@ export const getter = (field, safe) => {
28
27
  };
29
28
  return getterCache[key];
30
29
  };
30
+
31
31
  //# sourceMappingURL=accessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessor.js","sourceRoot":"","sources":["../src/accessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,WAAW,GAAgC,EAAE,CAAC;AAEpD,MAAM,WAAW,GAAG,qDAAqD,CAAC;AAE1E,6CAA6C;AAC7C,WAAW,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,IAAc,EAAE,EAAE;IACpD,MAAM,GAAG,GAAG,KAAK,GAAG,IAAI,CAAC;IAEzB,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE;QAC1D,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,IAAI,KAAK,CAAC,CAAC,CAAC;QACjE,OAAO,SAAS,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,WAAW,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,EAAE;QACrB,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;YAC3C,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;gBAC7B,OAAO,MAAM,CAAC;YAClB,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC"}
1
+ {"version":3,"sources":["../src/accessor.ts"],"sourcesContent":["import { isPresent } from './utils';\n\nconst getterCache: { [key: string]: Function } = {};\n\nconst FIELD_REGEX = /\\[(?:(\\d+)|['\"](.*?)['\"])\\]|((?:(?!\\[.*?\\]|\\.).)+)/g;\n\n// tslint:disable-next-line:no-string-literal\ngetterCache['undefined'] = obj => obj;\n\n/**\n * @hidden\n */\nexport const getter = (field: string, safe?: boolean) => {\n const key = field + safe;\n\n if (getterCache[key]) {\n return getterCache[key];\n }\n\n const fields = [];\n field.replace(FIELD_REGEX, (_, index, indexAccessor, field) => {\n fields.push(isPresent(index) ? index : (indexAccessor || field));\n return undefined;\n });\n\n getterCache[key] = obj => {\n let result = obj;\n for (let idx = 0; idx < fields.length; idx++) {\n result = result[fields[idx]];\n if (!isPresent(result) && safe) {\n return result;\n }\n }\n\n return result;\n };\n\n return getterCache[key];\n};\n"],"names":["isPresent","getterCache","FIELD_REGEX","obj","getter","field","safe","key","fields","replace","_","index","indexAccessor","push","undefined","result","idx","length"],"mappings":"AAAA,SAASA,SAAS,QAAQ,UAAU;AAEpC,MAAMC,cAA2C,CAAC;AAElD,MAAMC,cAAc;AAEpB,6CAA6C;AAC7CD,WAAW,CAAC,YAAY,GAAGE,CAAAA,MAAOA;AAElC;;CAEC,GACD,OAAO,MAAMC,SAAS,CAACC,OAAeC;IAClC,MAAMC,MAAMF,QAAQC;IAEpB,IAAIL,WAAW,CAACM,IAAI,EAAE;QAClB,OAAON,WAAW,CAACM,IAAI;IAC3B;IAEA,MAAMC,SAAS,EAAE;IACjBH,MAAMI,OAAO,CAACP,aAAa,CAACQ,GAAGC,OAAOC,eAAeP;QACjDG,OAAOK,IAAI,CAACb,UAAUW,SAASA,QAASC,iBAAiBP;QACzD,OAAOS;IACX;IAEAb,WAAW,CAACM,IAAI,GAAGJ,CAAAA;QACf,IAAIY,SAASZ;QACb,IAAK,IAAIa,MAAM,GAAGA,MAAMR,OAAOS,MAAM,EAAED,MAAO;YAC1CD,SAASA,MAAM,CAACP,MAAM,CAACQ,IAAI,CAAC;YAC5B,IAAI,CAAChB,UAAUe,WAAWT,MAAM;gBAC5B,OAAOS;YACX;QACJ;QAEA,OAAOA;IACX;IAEA,OAAOd,WAAW,CAACM,IAAI;AAC3B,EAAE"}
@@ -26,24 +26,23 @@ import { sort } from './sorting/sort';
26
26
  *
27
27
  * const result = orderBy(data, [{ field: "name", dir: "asc" }]);
28
28
  * ```
29
- */
30
- export const orderBy = (data, descriptors, preprocessors = {}) => {
31
- if (descriptors.some(x => isPresent(x.dir))) {
29
+ */ export const orderBy = (data, descriptors, preprocessors = {})=>{
30
+ if (descriptors.some((x)=>isPresent(x.dir))) {
32
31
  data = data.slice(0);
33
32
  const comparer = composeSortDescriptors(descriptors, preprocessors);
34
33
  sort(data, 0, data.length, comparer);
35
34
  }
36
35
  return data;
37
36
  };
38
- const defaultComparer = (a, b) => a === b;
39
- const normalizeComparer = (comparer) => {
37
+ const defaultComparer = (a, b)=>a === b;
38
+ const normalizeComparer = (comparer)=>{
40
39
  if (isString(comparer)) {
41
40
  const accessor = getter(comparer);
42
- comparer = (a, b) => accessor(a) === accessor(b);
41
+ comparer = (a, b)=>accessor(a) === accessor(b);
43
42
  }
44
43
  return comparer;
45
44
  };
46
- const _distinct = (data, comparer) => data.filter((x, idx, xs) => xs.findIndex(comparer.bind(null, x)) === idx);
45
+ const _distinct = (data, comparer)=>data.filter((x, idx, xs)=>xs.findIndex(comparer.bind(null, x)) === idx);
47
46
  /**
48
47
  * Reduces the provided array so it contains only unique values.
49
48
  *
@@ -69,14 +68,12 @@ const _distinct = (data, comparer) => data.filter((x, idx, xs) => xs.findIndex(c
69
68
  * // { name: "Pepper", category: "Food", subcategory: "Vegetables" }
70
69
  * // ];
71
70
  * ```
72
- */
73
- export const distinct = (data, comparer = defaultComparer) => _distinct(data, normalizeComparer(comparer));
71
+ */ export const distinct = (data, comparer = defaultComparer)=>_distinct(data, normalizeComparer(comparer));
74
72
  /**
75
73
  * @hidden
76
- */
77
- export const count = (data, predicate) => {
74
+ */ export const count = (data, predicate)=>{
78
75
  let counter = 0;
79
- for (let idx = 0, length = data.length; idx < length; idx++) {
76
+ for(let idx = 0, length = data.length; idx < length; idx++){
80
77
  if (predicate(data[idx])) {
81
78
  counter++;
82
79
  }
@@ -85,8 +82,7 @@ export const count = (data, predicate) => {
85
82
  };
86
83
  /**
87
84
  * @hidden
88
- */
89
- export const limit = (data, predicate) => {
85
+ */ export const limit = (data, predicate)=>{
90
86
  if (predicate) {
91
87
  return data.filter(predicate);
92
88
  }
@@ -123,10 +119,12 @@ export const limit = (data, predicate) => {
123
119
  * });
124
120
  *
125
121
  * ```
126
- */
127
- export const process = (data, state, preprocessors = {}) => {
122
+ */ export const process = (data, state, preprocessors = {})=>{
128
123
  const { skip: skipCount, take: takeCount, filter: filterDescriptor, sort, group } = state;
129
- const sortDescriptors = [...normalizeGroups(group || []), ...sort || []];
124
+ const sortDescriptors = [
125
+ ...normalizeGroups(group || []),
126
+ ...sort || []
127
+ ];
130
128
  if (sortDescriptors.length) {
131
129
  data = orderBy(data, sortDescriptors, preprocessors);
132
130
  }
@@ -145,8 +143,7 @@ export const process = (data, state, preprocessors = {}) => {
145
143
  predicate = compileFilter(normalizeFilters(filterDescriptor), preprocessors);
146
144
  total = count(data, predicate);
147
145
  transformers.push(filter(predicate));
148
- }
149
- else {
146
+ } else {
150
147
  total = data.length;
151
148
  }
152
149
  if (isPresent(skipCount) && isPresent(takeCount)) {
@@ -155,14 +152,16 @@ export const process = (data, state, preprocessors = {}) => {
155
152
  }
156
153
  if (transformers.length) {
157
154
  const transform = compose(...transformers);
158
- const result = hasGroups ?
159
- groupBy(data, group, preprocessors, transform, limit(data, predicate)) :
160
- exec(transform(concat), [], data);
161
- return { data: result, total: total };
155
+ const result = hasGroups ? groupBy(data, group, preprocessors, transform, limit(data, predicate)) : exec(transform(concat), [], data);
156
+ return {
157
+ data: result,
158
+ total: total
159
+ };
162
160
  }
163
161
  return {
164
162
  data: hasGroups ? groupBy(data, group, preprocessors) : data,
165
163
  total: total
166
164
  };
167
165
  };
166
+
168
167
  //# sourceMappingURL=array.operators.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"array.operators.js","sourceRoot":"","sources":["../src/array.operators.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAI,IAAS,EAAE,WAA6B,EAAE,gBAAkC,EAAE,EAAO,EAAE;IAC9G,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC1C,IAAI,GAAG,IA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AAK,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO;QACH,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI;QAC5D,KAAK,EAAE,KAAK;KACf,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../src/array.operators.ts"],"sourcesContent":["import { SortDescriptor } from './sort-descriptor';\nimport { State } from './state';\nimport { DataResult } from './data-result.interface';\nimport { isPresent, isString } from './utils';\nimport { composeSortDescriptors } from './sorting/sort-array.operator';\nimport { groupBy, normalizeGroups } from './grouping/group.operators';\nimport { normalizeFilters } from './filtering/filter.operators';\nimport { compileFilter } from './filtering/filter-expression.factory';\nimport { CompositeFilterDescriptor } from './filtering/filter-descriptor.interface';\nimport { exec, skip, take, filter, concat } from './transducers';\nimport { Predicate, Preprocessors } from './common.interfaces';\nimport { getter } from './accessor';\nimport { compose } from './funcs';\nimport { sort } from './sorting/sort';\n\n/**\n * Orders the specified array according to the provided sort descriptors.\n *\n * @param {T[]} data - The data to be sorted.\n * @param {SortDescriptor[]} descriptors - The descriptors by which the data will be sorted.\n * @returns {T[]} - The sorted data.\n *\n * @example\n * ```ts-no-run\n * import { orderBy } from '@progress/kendo-data-query';\n *\n * const data = [\n * { name: \"Pork\", category: \"Food\", subcategory: \"Meat\" },\n * { name: \"Pepper\", category: \"Food\", subcategory: \"Vegetables\" },\n * { name: \"Beef\", category: \"Food\", subcategory: \"Meat\" }\n * ];\n *\n * const result = orderBy(data, [{ field: \"name\", dir: \"asc\" }]);\n * ```\n */\nexport const orderBy = <T>(data: T[], descriptors: SortDescriptor[], preprocessors: Preprocessors<T> = {}): T[] => {\n if (descriptors.some(x => isPresent(x.dir))) {\n data = data.slice(0);\n const comparer = composeSortDescriptors(descriptors, preprocessors);\n\n sort(data, 0, data.length, comparer);\n }\n return data;\n};\n\ntype Comparer = <T>(a: T, b: T) => boolean;\nconst defaultComparer: Comparer = (a, b): boolean => a === b;\n\nconst normalizeComparer = (comparer: Comparer | string): Comparer => {\n if (isString(comparer)) {\n const accessor = getter(<string>comparer);\n comparer = (a, b) => accessor(a) === accessor(b);\n }\n return <Comparer>comparer;\n};\n\nconst _distinct = <T>(data: T[], comparer: Comparer): T[] =>\n data.filter((x, idx, xs) => xs.findIndex(comparer.bind(null, x)) === idx);\n\n/**\n * Reduces the provided array so it contains only unique values.\n *\n * @param {T[]} data - The array that will be reduced.\n * @param {(Comparer | string)} comparer - An optional custom comparer function or the field name that will be used for comparison.\n * @returns {T[]} - The reduced data.\n *\n * @example\n * ```ts-no-run\n * import { distinct } from '@progress/kendo-data-query';\n *\n * const data = [\n * { name: \"Pork\", category: \"Food\", subcategory: \"Meat\" },\n * { name: \"Pepper\", category: \"Food\", subcategory: \"Vegetables\" },\n * { name: \"Beef\", category: \"Food\", subcategory: \"Meat\" }\n * ];\n *\n * const result = distinct(data, \"subcategory\");\n *\n * // output:\n * // result => [\n * // { name: \"Pork\", category: \"Food\", subcategory: \"Meat\" },\n * // { name: \"Pepper\", category: \"Food\", subcategory: \"Vegetables\" }\n * // ];\n * ```\n */\nexport const distinct = <T>(data: T[], comparer: Comparer | string = defaultComparer): T[] =>\n _distinct(data, normalizeComparer(comparer));\n\n/**\n * @hidden\n */\nexport const count = <T>(data: T[], predicate: Predicate): number => {\n let counter = 0;\n for (let idx = 0, length = data.length; idx < length; idx++) {\n if (predicate(data[idx])) {\n counter++;\n }\n }\n return counter;\n};\n\n/**\n * @hidden\n */\nexport const limit = <T>(data: T[], predicate: Predicate): T[] => {\n if (predicate) {\n return data.filter(predicate);\n }\n return data;\n};\n\n/**\n * Applies the specified operation descriptors to the data.\n *\n * @param {T[]} data - The data to be processed.\n * @param {State} state - The operation descriptors that will be applied to the data.\n * @returns {DataResult} - The processed data.\n *\n * @example\n * ```ts-no-run\n *\n * const result = process(data, {\n * skip: 10,\n * take: 20,\n * group: [{\n * field: 'category.categoryName',\n * aggregates: [\n * { aggregate: \"sum\", field: \"unitPrice\" },\n * { aggregate: \"sum\", field: \"unitsInStock\" }\n * ]\n * }],\n * sort: [{ field: 'productName', dir: 'desc' }],\n * filter: {\n * logic: \"or\",\n * filters: [\n * { field: \"discontinued\", operator: \"eq\", value: true },\n * { field: \"unitPrice\", operator: \"lt\", value: 22 }\n * ]\n * }\n * });\n *\n * ```\n */\nexport const process = <T>(\n data: T[],\n state: State,\n preprocessors: Preprocessors<T> = {}\n): DataResult => {\n const {\n skip: skipCount,\n take: takeCount,\n filter: filterDescriptor,\n sort,\n group\n } = state;\n\n const sortDescriptors = <SortDescriptor[]>[...normalizeGroups(group || []), ...sort || []];\n\n if (sortDescriptors.length) {\n data = orderBy(data, sortDescriptors, preprocessors);\n }\n\n const hasFilters = isPresent(filterDescriptor) && filter.length;\n const hasGroups = isPresent(group) && group.length;\n\n if (!hasFilters && !hasGroups) {\n return {\n data: takeCount ? data.slice(skipCount, skipCount + takeCount) : data,\n total: data.length\n };\n }\n\n let total;\n const transformers = [];\n\n let predicate;\n\n if (hasFilters) {\n predicate = compileFilter(normalizeFilters(<CompositeFilterDescriptor>filterDescriptor), preprocessors);\n\n total = count(data, predicate);\n\n transformers.push(filter(predicate));\n } else {\n total = data.length;\n }\n\n if (isPresent(skipCount) && isPresent(takeCount)) {\n transformers.push(skip(skipCount));\n transformers.push(take(takeCount));\n }\n\n if (transformers.length) {\n const transform = compose(...transformers);\n\n const result = hasGroups ?\n groupBy(data, group, preprocessors, transform, limit(data, predicate)) :\n exec(transform(concat), [], data);\n\n return { data: result, total: total };\n }\n\n return {\n data: hasGroups ? groupBy(data, group, preprocessors) : data,\n total: total\n };\n};\n"],"names":["isPresent","isString","composeSortDescriptors","groupBy","normalizeGroups","normalizeFilters","compileFilter","exec","skip","take","filter","concat","getter","compose","sort","orderBy","data","descriptors","preprocessors","some","x","dir","slice","comparer","length","defaultComparer","a","b","normalizeComparer","accessor","_distinct","idx","xs","findIndex","bind","distinct","count","predicate","counter","limit","process","state","skipCount","takeCount","filterDescriptor","group","sortDescriptors","hasFilters","hasGroups","total","transformers","push","transform","result"],"mappings":"AAGA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,UAAU;AAC9C,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,OAAO,EAAEC,eAAe,QAAQ,6BAA6B;AACtE,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,wCAAwC;AAEtE,SAASC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAEC,MAAM,QAAQ,gBAAgB;AAEjE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,OAAO,QAAQ,UAAU;AAClC,SAASC,IAAI,QAAQ,iBAAiB;AAEtC;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMC,UAAU,CAAIC,MAAWC,aAA+BC,gBAAkC,CAAC,CAAC;IACrG,IAAID,YAAYE,IAAI,CAACC,CAAAA,IAAKpB,UAAUoB,EAAEC,GAAG,IAAI;QACzCL,OAAOA,KAAKM,KAAK,CAAC;QAClB,MAAMC,WAAWrB,uBAAuBe,aAAaC;QAErDJ,KAAKE,MAAM,GAAGA,KAAKQ,MAAM,EAAED;IAC/B;IACA,OAAOP;AACX,EAAE;AAGF,MAAMS,kBAA4B,CAACC,GAAGC,IAAeD,MAAMC;AAE3D,MAAMC,oBAAoB,CAACL;IACvB,IAAItB,SAASsB,WAAW;QACpB,MAAMM,WAAWjB,OAAeW;QAChCA,WAAW,CAACG,GAAGC,IAAME,SAASH,OAAOG,SAASF;IAClD;IACA,OAAiBJ;AACrB;AAEA,MAAMO,YAAY,CAAId,MAAWO,WAC7BP,KAAKN,MAAM,CAAC,CAACU,GAAGW,KAAKC,KAAOA,GAAGC,SAAS,CAACV,SAASW,IAAI,CAAC,MAAMd,QAAQW;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GACD,OAAO,MAAMI,WAAW,CAAInB,MAAWO,WAA8BE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QAAQb,MAAMpB,MAAMqB;QAEpBa,aAAaC,IAAI,CAACzC,OAAO2B;IAC7B,OAAO;QACHY,QAAQjC,KAAKQ,MAAM;IACvB;IAEA,IAAIxB,UAAU0C,cAAc1C,UAAU2C,YAAY;QAC9CO,aAAaC,IAAI,CAAC3C,KAAKkC;QACvBQ,aAAaC,IAAI,CAAC1C,KAAKkC;IAC3B;IAEA,IAAIO,aAAa1B,MAAM,EAAE;QACrB,MAAM4B,YAAYvC,WAAWqC;QAE7B,MAAMG,SAASL,YACX7C,QAAQa,MAAM6B,OAAO3B,eAAekC,WAAWb,MAAMvB,MAAMqB,cAC3D9B,KAAK6C,UAAUzC,SAAS,EAAE,EAAEK;QAEhC,OAAO;YAAEA,MAAMqC;YAAQJ,OAAOA;QAAM;IACxC;IAEA,OAAO;QACHjC,MAAMgC,YAAY7C,QAAQa,MAAM6B,OAAO3B,iBAAiBF;QACxDiC,OAAOA;IACX;AACJ,EAAE"}
@@ -1,2 +1,5 @@
1
- export {};
1
+ /**
2
+ * @hidden
3
+ */ export { };
4
+
2
5
  //# sourceMappingURL=common.interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.interfaces.js","sourceRoot":"","sources":["../src/common.interfaces.ts"],"names":[],"mappings":""}
1
+ {"version":3,"sources":["../src/common.interfaces.ts"],"sourcesContent":["/**\n * @hidden\n */\nexport type Combinator = <T, U>(acc: U, curr: T) => U;\n\n/**\n * @hidden\n */\nexport type Reducer = (reduce: Combinator) => Transformer;\n\n/**\n * @hidden\n */\nexport type TransformerResult<T> = { __value: T, reduced: boolean };\n\n/**\n * @hidden\n */\nexport type Transformer = <T, U>(acc: U, curr: T, index: number) => U | TransformerResult<U>;\n\n/**\n * A type which represents a function that returns a Boolean value.\n *\n * @example\n * ```ts-no-run\n * const isGreaterThanTen: Predicate = (num: number) => num > 10;\n * isGreaterThanTen(2); // false\n * isGreaterThanTen(20); // true\n * ```\n */\nexport type Predicate = <T>(x: T) => boolean;\n\nexport type Preprocessors<T> = {\n [P in keyof T]?: (value: T[P]) => any;\n};\n"],"names":[],"mappings":"AAAA;;CAEC,GA8BD,WAEE"}
@@ -1,2 +1,5 @@
1
- export {};
1
+ /**
2
+ * The result of the [`process`]({% slug api_kendo-data-query_process%}) method applied to a data structure.
3
+ */ export { };
4
+
2
5
  //# sourceMappingURL=data-result.interface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-result.interface.js","sourceRoot":"","sources":["../src/data-result.interface.ts"],"names":[],"mappings":""}
1
+ {"version":3,"sources":["../src/data-result.interface.ts"],"sourcesContent":["import { GroupResult } from './grouping/group-descriptor.interface';\n\n/**\n * The result of the [`process`]({% slug api_kendo-data-query_process%}) method applied to a data structure.\n */\nexport interface DataResult<T = any> {\n /**\n * The data that will be rendered by the Grid as an array.\n */\n data: T[] | GroupResult<T>[];\n\n /**\n * The total number of records that are available.\n */\n total: number;\n}\n"],"names":[],"mappings":"AAEA;;CAEC,GACD,WAUC"}
@@ -1,42 +1,20 @@
1
- import axios from 'axios';
2
- import cloneDeep from 'lodash/cloneDeep';
3
- import { toJS, comparer } from 'mobx';
4
- export class AsyncDataSource {
5
- constructor(operations, idSelector, withCache) {
6
- Object.defineProperty(this, "idSelector", {
7
- enumerable: true,
8
- configurable: true,
9
- writable: true,
10
- value: void 0
11
- });
12
- Object.defineProperty(this, "operations", {
13
- enumerable: true,
14
- configurable: true,
15
- writable: true,
16
- value: void 0
17
- });
18
- Object.defineProperty(this, "withCache", {
19
- enumerable: true,
20
- configurable: true,
21
- writable: true,
22
- value: void 0
23
- });
24
- Object.defineProperty(this, "cached", {
25
- enumerable: true,
26
- configurable: true,
27
- writable: true,
28
- value: void 0
29
- });
30
- Object.defineProperty(this, "cancelation", {
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
31
5
  enumerable: true,
32
6
  configurable: true,
33
- writable: true,
34
- value: void 0
7
+ writable: true
35
8
  });
36
- this.operations = operations;
37
- this.idSelector = idSelector;
38
- this.withCache = withCache;
9
+ } else {
10
+ obj[key] = value;
39
11
  }
12
+ return obj;
13
+ }
14
+ import axios from 'axios';
15
+ import cloneDeep from 'lodash/cloneDeep';
16
+ import { toJS, comparer } from 'mobx';
17
+ export class AsyncDataSource {
40
18
  async getData(state) {
41
19
  if (this.cancelation) {
42
20
  this.cancelation.cancel();
@@ -47,7 +25,10 @@ export class AsyncDataSource {
47
25
  this.cancelation = axios.CancelToken.source();
48
26
  const result = toJS(await this.operations.get(state, this.cancelation.token));
49
27
  this.cancelation = undefined;
50
- this.cached = { state, result };
28
+ this.cached = {
29
+ state,
30
+ result
31
+ };
51
32
  return cloneDeep(result);
52
33
  }
53
34
  async addData(row, index) {
@@ -73,5 +54,16 @@ export class AsyncDataSource {
73
54
  this.cached = undefined;
74
55
  return result;
75
56
  }
57
+ constructor(operations, idSelector, withCache){
58
+ _define_property(this, "idSelector", void 0);
59
+ _define_property(this, "operations", void 0);
60
+ _define_property(this, "withCache", void 0);
61
+ _define_property(this, "cached", void 0);
62
+ _define_property(this, "cancelation", void 0);
63
+ this.operations = operations;
64
+ this.idSelector = idSelector;
65
+ this.withCache = withCache;
66
+ }
76
67
  }
68
+
77
69
  //# sourceMappingURL=async-data-source.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"async-data-source.js","sourceRoot":"","sources":["../../src/data-source/async-data-source.ts"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAStC,MAAM,OAAO,eAAe;IAaxB,YAAY,UAA8B,EAAE,UAA4B,EAAE,SAAmB;QAZ7F;;;;;WAA6B;QAErB;;;;;WAA+B;QAE/B;;;;;WAAoB;QACpB;;;;;WAGN;QAEM;;;;;WAAgC;QAGpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,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C,MAAM,EAAE,CAAC;YAC1B,MAAM,2CAA2C,CAAC;QACtD,CAAC;QAED,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAO;QACpB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;YAC1B,MAAM,2CAA2C,CAAC;QACtD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAEhD,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAExB,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
1
+ {"version":3,"sources":["../../src/data-source/async-data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { DataResult } from '../data-result.interface';\nimport axios, { CancelToken, CancelTokenSource } from 'axios';\nimport { DataSource, IdType } from './data-source';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { toJS, comparer } from 'mobx';\n\ninterface Operations<T, TId> {\n get(state: State, cancelToken?: CancelToken): Promise<DataResult<T>>;\n add?(item: T, index?: number): Promise<T>;\n update?(id: TId, changes: Partial<T>): Promise<void>;\n remove?(id: TId): Promise<T | undefined>;\n}\n\nexport class AsyncDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {\n idSelector?: (row: T) => TId;\n\n private operations: Operations<T, TId>;\n\n private withCache?: boolean;\n private cached?: {\n state: State;\n result: DataResult<T>;\n };\n\n private cancelation?: CancelTokenSource;\n\n constructor(operations: Operations<T, TId>, idSelector?: (row: T) => TId, withCache?: boolean) {\n this.operations = operations;\n this.idSelector = idSelector;\n this.withCache = withCache;\n }\n\n async getData(state: State) {\n if (this.cancelation) {\n this.cancelation.cancel();\n }\n\n if (this.withCache && this.cached && comparer.structural(this.cached.state, state)) {\n return cloneDeep(this.cached.result);\n }\n\n this.cancelation = axios.CancelToken.source();\n const result = toJS(await this.operations.get(state, this.cancelation.token));\n this.cancelation = undefined;\n\n this.cached = { state, result };\n\n return cloneDeep(result);\n }\n\n async addData(row: T, index?: number) {\n if (!this.operations.add) {\n throw 'missing add function in the operations';\n }\n\n const result = await this.operations.add(row, index);\n\n this.cached = undefined;\n\n return result;\n }\n\n async updateData(id: TId, changes: Partial<T>) {\n if (!this.operations.update) {\n throw 'missing update function in the operations';\n }\n\n await this.operations.update(id, changes);\n\n this.cached = undefined;\n }\n\n async removeData(id: TId) {\n if (!this.operations.remove) {\n throw 'missing remove function in the operations';\n }\n\n const result = await this.operations.remove(id);\n\n this.cached = undefined;\n\n return result;\n }\n}\n"],"names":["axios","cloneDeep","toJS","comparer","AsyncDataSource","getData","state","cancelation","cancel","withCache","cached","structural","result","CancelToken","source","operations","get","token","undefined","addData","row","index","add","updateData","id","changes","update","removeData","remove","constructor","idSelector"],"mappings":";;;;;;;;;;;;;AAEA,OAAOA,WAA+C,QAAQ;AAE9D,OAAOC,eAAe,mBAAmB;AACzC,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAStC,OAAO,MAAMC;IAmBT,MAAMC,QAAQC,KAAY,EAAE;QACxB,IAAI,IAAI,CAACC,WAAW,EAAE;YAClB,IAAI,CAACA,WAAW,CAACC,MAAM;QAC3B;QAEA,IAAI,IAAI,CAACC,SAAS,IAAI,IAAI,CAACC,MAAM,IAAIP,SAASQ,UAAU,CAAC,IAAI,CAACD,MAAM,CAACJ,KAAK,EAAEA,QAAQ;YAChF,OAAOL,UAAU,IAAI,CAACS,MAAM,CAACE,MAAM;QACvC;QAEA,IAAI,CAACL,WAAW,GAAGP,MAAMa,WAAW,CAACC,MAAM;QAC3C,MAAMF,SAASV,KAAK,MAAM,IAAI,CAACa,UAAU,CAACC,GAAG,CAACV,OAAO,IAAI,CAACC,WAAW,CAACU,KAAK;QAC3E,IAAI,CAACV,WAAW,GAAGW;QAEnB,IAAI,CAACR,MAAM,GAAG;YAAEJ;YAAOM;QAAO;QAE9B,OAAOX,UAAUW;IACrB;IAEA,MAAMO,QAAQC,GAAM,EAAEC,KAAc,EAAE;QAClC,IAAI,CAAC,IAAI,CAACN,UAAU,CAACO,GAAG,EAAE;YACtB,MAAM;QACV;QAEA,MAAMV,SAAS,MAAM,IAAI,CAACG,UAAU,CAACO,GAAG,CAACF,KAAKC;QAE9C,IAAI,CAACX,MAAM,GAAGQ;QAEd,OAAON;IACX;IAEA,MAAMW,WAAWC,EAAO,EAAEC,OAAmB,EAAE;QAC3C,IAAI,CAAC,IAAI,CAACV,UAAU,CAACW,MAAM,EAAE;YACzB,MAAM;QACV;QAEA,MAAM,IAAI,CAACX,UAAU,CAACW,MAAM,CAACF,IAAIC;QAEjC,IAAI,CAACf,MAAM,GAAGQ;IAClB;IAEA,MAAMS,WAAWH,EAAO,EAAE;QACtB,IAAI,CAAC,IAAI,CAACT,UAAU,CAACa,MAAM,EAAE;YACzB,MAAM;QACV;QAEA,MAAMhB,SAAS,MAAM,IAAI,CAACG,UAAU,CAACa,MAAM,CAACJ;QAE5C,IAAI,CAACd,MAAM,GAAGQ;QAEd,OAAON;IACX;IAxDAiB,YAAYd,UAA8B,EAAEe,UAA4B,EAAErB,SAAmB,CAAE;QAZ/FqB,uBAAAA,cAAAA,KAAAA;QAEA,uBAAQf,cAAR,KAAA;QAEA,uBAAQN,aAAR,KAAA;QACA,uBAAQC,UAAR,KAAA;QAKA,uBAAQH,eAAR,KAAA;QAGI,IAAI,CAACQ,UAAU,GAAGA;QAClB,IAAI,CAACe,UAAU,GAAGA;QAClB,IAAI,CAACrB,SAAS,GAAGA;IACrB;AAqDJ"}
@@ -1,2 +1,3 @@
1
- export {};
1
+ export { };
2
+
2
3
  //# sourceMappingURL=data-source.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-source.js","sourceRoot":"","sources":["../../src/data-source/data-source.ts"],"names":[],"mappings":""}
1
+ {"version":3,"sources":["../../src/data-source/data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { DataResult } from '../data-result.interface';\nimport { CompositeFilterDescriptor } from '../filtering/filter-descriptor.interface';\n\nexport type IdType = string | number;\n\nexport interface DataSource<T, TId extends IdType = never> {\n /**\n * Gets the table rows, applying the specified operation descriptors.\n * @param {State} state - The operation descriptors that will be applied to the data.\n */\n getData(params: State): Promise<DataResult<T>>;\n\n addData?(row: T, index?: number): Promise<T>;\n\n updateData?(id: TId, changes: Partial<T>): Promise<void>;\n\n removeData?(id: TId): Promise<T | undefined>;\n\n idSelector?(row: T): TId;\n\n /**\n * For persistent data stores (where objects persist across multiple getData calls),\n * gets all the data that is excluded by the filter. Undefined for non-persistent data stores.\n */\n getFilteredPersistentItems?(filter: CompositeFilterDescriptor): T[];\n}\n"],"names":[],"mappings":"AAMA,WAoBC"}
@@ -1,68 +1,53 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
1
14
  import { filterBy } from '../filtering/filter-expression.factory';
2
15
  import { process } from '../array.operators';
3
16
  import cloneDeep from 'lodash/cloneDeep';
4
17
  import cloneDeepWith from 'lodash/cloneDeepWith';
5
18
  import { toJS, comparer } from 'mobx';
6
19
  export class InMemoryDataSource {
7
- constructor(data, idSelector, preprocessors = {}, { cloneCustomizer } = {}) {
8
- Object.defineProperty(this, "idSelector", {
9
- enumerable: true,
10
- configurable: true,
11
- writable: true,
12
- value: void 0
13
- });
14
- Object.defineProperty(this, "clone", {
15
- enumerable: true,
16
- configurable: true,
17
- writable: true,
18
- value: void 0
19
- });
20
- Object.defineProperty(this, "data", {
21
- enumerable: true,
22
- configurable: true,
23
- writable: true,
24
- value: void 0
25
- });
26
- Object.defineProperty(this, "preprocessors", {
27
- enumerable: true,
28
- configurable: true,
29
- writable: true,
30
- value: void 0
31
- });
32
- Object.defineProperty(this, "cached", {
33
- enumerable: true,
34
- configurable: true,
35
- writable: true,
36
- value: void 0
37
- });
38
- this.clone = cloneCustomizer
39
- ? (value) => cloneDeepWith(value, cloneCustomizer)
40
- : cloneDeep;
41
- this.data = this.clone(toJS(data));
42
- this.idSelector = idSelector;
43
- this.preprocessors = preprocessors;
44
- }
45
20
  getData(state) {
46
21
  const { skip, take, sort, filter, group } = state;
47
- const sortedAndFiltered = this.cached && comparer.structural(this.cached.state, { sort, filter })
48
- ? this.cached.result
49
- : process(this.data, { sort, filter }, this.preprocessors);
22
+ const sortedAndFiltered = this.cached && comparer.structural(this.cached.state, {
23
+ sort,
24
+ filter
25
+ }) ? this.cached.result : process(this.data, {
26
+ sort,
27
+ filter
28
+ }, this.preprocessors);
50
29
  this.cached = {
51
- state: { sort, filter },
52
- result: sortedAndFiltered,
30
+ state: {
31
+ sort,
32
+ filter
33
+ },
34
+ result: sortedAndFiltered
53
35
  };
54
- const { data } = process(sortedAndFiltered.data, { skip, take, group }, this.preprocessors);
36
+ const { data } = process(sortedAndFiltered.data, {
37
+ skip,
38
+ take,
39
+ group
40
+ }, this.preprocessors);
55
41
  const { total } = sortedAndFiltered;
56
42
  return Promise.resolve({
57
43
  total,
58
- data: this.clone(data),
44
+ data: this.clone(data)
59
45
  });
60
46
  }
61
47
  addData(row, index) {
62
48
  if (index !== undefined) {
63
49
  this.data.splice(index, 0, this.clone(row));
64
- }
65
- else {
50
+ } else {
66
51
  this.data.push(this.clone(row));
67
52
  }
68
53
  this.cached = undefined;
@@ -72,7 +57,7 @@ export class InMemoryDataSource {
72
57
  if (!this.idSelector) {
73
58
  throw 'missing idSelector';
74
59
  }
75
- const row = this.data.find(row => this.idSelector(row) === id);
60
+ const row = this.data.find((row)=>this.idSelector(row) === id);
76
61
  if (row) {
77
62
  Object.assign(row, changes);
78
63
  this.cached = undefined;
@@ -83,7 +68,7 @@ export class InMemoryDataSource {
83
68
  if (!this.idSelector) {
84
69
  throw 'missing idSelector';
85
70
  }
86
- const index = this.data.findIndex(row => this.idSelector(row) === id);
71
+ const index = this.data.findIndex((row)=>this.idSelector(row) === id);
87
72
  if (index !== -1) {
88
73
  const row = this.data[index];
89
74
  this.data.splice(index, 1);
@@ -94,8 +79,20 @@ export class InMemoryDataSource {
94
79
  getFilteredPersistentItems(filter) {
95
80
  const set = new Set(this.data);
96
81
  const inFilter = filterBy(this.data, filter, this.preprocessors);
97
- inFilter.forEach(dataItem => set.delete(dataItem));
82
+ inFilter.forEach((dataItem)=>set.delete(dataItem));
98
83
  return this.clone(Array.from(set));
99
84
  }
85
+ constructor(data, idSelector, preprocessors = {}, { cloneCustomizer } = {}){
86
+ _define_property(this, "idSelector", void 0);
87
+ _define_property(this, "clone", void 0);
88
+ _define_property(this, "data", void 0);
89
+ _define_property(this, "preprocessors", void 0);
90
+ _define_property(this, "cached", void 0);
91
+ this.clone = cloneCustomizer ? (value)=>cloneDeepWith(value, cloneCustomizer) : cloneDeep;
92
+ this.data = this.clone(toJS(data));
93
+ this.idSelector = idSelector;
94
+ this.preprocessors = preprocessors;
95
+ }
100
96
  }
97
+
101
98
  //# sourceMappingURL=in-memory-data-source.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"in-memory-data-source.js","sourceRoot":"","sources":["../../src/data-source/in-memory-data-source.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,SAAS,MAAM,kBAAkB,CAAC;AACzC,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEtC,MAAM,OAAO,kBAAkB;IAY3B,YACI,IAAS,EACT,UAA4B,EAC5B,gBAAkC,EAAE,EACpC,EAAE,eAAe,KAAgD,EAAE;QAfvE;;;;;WAA6B;QAErB;;;;;WAA0B;QAC1B;;;;;WAA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AAC;QAEvE,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAE3B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;YAExB,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,CAAC;IACL,CAAC;IAED,0BAA0B,CAAC,MAAiC;QACxD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACjE,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,CAAC;CACJ"}
1
+ {"version":3,"sources":["../../src/data-source/in-memory-data-source.ts"],"sourcesContent":["import { State } from '../state';\nimport { Preprocessors } from '../common.interfaces';\nimport { CompositeFilterDescriptor } from '../filtering/filter-descriptor.interface';\nimport { DataResult } from '../data-result.interface';\nimport { filterBy } from '../filtering/filter-expression.factory';\nimport { process } from '../array.operators';\nimport { DataSource, IdType } from './data-source';\nimport cloneDeep from 'lodash/cloneDeep';\nimport cloneDeepWith from 'lodash/cloneDeepWith';\nimport { toJS, comparer } from 'mobx';\n\nexport class InMemoryDataSource<T, TId extends IdType = never> implements DataSource<T, TId> {\n idSelector?: (row: T) => TId;\n\n private clone: <U>(value: U) => U;\n private data: T[];\n private preprocessors: Preprocessors<T>;\n\n private cached?: {\n state: State;\n result: DataResult<T>;\n };\n\n constructor(\n data: T[],\n idSelector?: (row: T) => TId,\n preprocessors: Preprocessors<T> = {},\n { cloneCustomizer }: { cloneCustomizer?: (value: any) => any } = {}\n ) {\n this.clone = cloneCustomizer\n ? <U>(value: U) => cloneDeepWith(value, cloneCustomizer)\n : cloneDeep;\n this.data = this.clone(toJS(data));\n this.idSelector = idSelector;\n this.preprocessors = preprocessors;\n }\n\n getData(state: State) {\n const { skip, take, sort, filter, group } = state;\n\n const sortedAndFiltered =\n this.cached && comparer.structural(this.cached.state, { sort, filter })\n ? this.cached.result\n : process(this.data, { sort, filter }, this.preprocessors);\n\n this.cached = {\n state: { sort, filter },\n result: sortedAndFiltered,\n };\n\n const { data } = process(sortedAndFiltered.data, { skip, take, group }, this.preprocessors);\n const { total } = sortedAndFiltered;\n\n return Promise.resolve({\n total,\n data: this.clone(data),\n } as DataResult<T>);\n }\n\n addData(row: T, index?: number) {\n if (index !== undefined) {\n this.data.splice(index, 0, this.clone(row));\n } else {\n this.data.push(this.clone(row));\n }\n\n this.cached = undefined;\n\n return Promise.resolve(this.clone(row));\n }\n\n async updateData(id: TId, changes: Partial<T>) {\n if (!this.idSelector) {\n throw 'missing idSelector';\n }\n\n const row = this.data.find(row => this.idSelector!(row) === id);\n\n if (row) {\n Object.assign(row, changes);\n\n this.cached = undefined;\n }\n\n return Promise.resolve();\n }\n\n async removeData(id: TId) {\n if (!this.idSelector) {\n throw 'missing idSelector';\n }\n\n const index = this.data.findIndex(row => this.idSelector!(row) === id);\n\n if (index !== -1) {\n const row = this.data[index];\n this.data.splice(index, 1);\n\n this.cached = undefined;\n\n return Promise.resolve(row);\n }\n }\n\n getFilteredPersistentItems(filter: CompositeFilterDescriptor) {\n const set = new Set(this.data);\n const inFilter = filterBy(this.data, filter, this.preprocessors);\n inFilter.forEach(dataItem => set.delete(dataItem));\n return this.clone(Array.from(set));\n }\n}\n"],"names":["filterBy","process","cloneDeep","cloneDeepWith","toJS","comparer","InMemoryDataSource","getData","state","skip","take","sort","filter","group","sortedAndFiltered","cached","structural","result","data","preprocessors","total","Promise","resolve","clone","addData","row","index","undefined","splice","push","updateData","id","changes","idSelector","find","Object","assign","removeData","findIndex","getFilteredPersistentItems","set","Set","inFilter","forEach","dataItem","delete","Array","from","constructor","cloneCustomizer","value"],"mappings":";;;;;;;;;;;;;AAIA,SAASA,QAAQ,QAAQ,yCAAyC;AAClE,SAASC,OAAO,QAAQ,qBAAqB;AAE7C,OAAOC,eAAe,mBAAmB;AACzC,OAAOC,mBAAmB,uBAAuB;AACjD,SAASC,IAAI,EAAEC,QAAQ,QAAQ,OAAO;AAEtC,OAAO,MAAMC;IA0BTC,QAAQC,KAAY,EAAE;QAClB,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGL;QAE5C,MAAMM,oBACF,IAAI,CAACC,MAAM,IAAIV,SAASW,UAAU,CAAC,IAAI,CAACD,MAAM,CAACP,KAAK,EAAE;YAAEG;YAAMC;QAAO,KAC/D,IAAI,CAACG,MAAM,CAACE,MAAM,GAClBhB,QAAQ,IAAI,CAACiB,IAAI,EAAE;YAAEP;YAAMC;QAAO,GAAG,IAAI,CAACO,aAAa;QAEjE,IAAI,CAACJ,MAAM,GAAG;YACVP,OAAO;gBAAEG;gBAAMC;YAAO;YACtBK,QAAQH;QACZ;QAEA,MAAM,EAAEI,IAAI,EAAE,GAAGjB,QAAQa,kBAAkBI,IAAI,EAAE;YAAET;YAAMC;YAAMG;QAAM,GAAG,IAAI,CAACM,aAAa;QAC1F,MAAM,EAAEC,KAAK,EAAE,GAAGN;QAElB,OAAOO,QAAQC,OAAO,CAAC;YACnBF;YACAF,MAAM,IAAI,CAACK,KAAK,CAACL;QACrB;IACJ;IAEAM,QAAQC,GAAM,EAAEC,KAAc,EAAE;QAC5B,IAAIA,UAAUC,WAAW;YACrB,IAAI,CAACT,IAAI,CAACU,MAAM,CAACF,OAAO,GAAG,IAAI,CAACH,KAAK,CAACE;QAC1C,OAAO;YACH,IAA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AAkC,CAAC,CAAC,EACpC,EAAE8B,eAAe,EAA6C,GAAG,CAAC,CAAC,CACrE;QAhBFhB,uBAAAA,cAAAA,KAAAA;QAEA,uBAAQV,SAAR,KAAA;QACA,uBAAQL,QAAR,KAAA;QACA,uBAAQC,iBAAR,KAAA;QAEA,uBAAQJ,UAAR,KAAA;QAWI,IAAI,CAACQ,KAAK,GAAG0B,kBACP,CAAIC,QAAa/C,cAAc+C,OAAOD,mBACtC/C;QACN,IAAI,CAACgB,IAAI,GAAG,IAAI,CAACK,KAAK,CAACnB,KAAKc;QAC5B,IAAI,CAACe,UAAU,GAAGA;QAClB,IAAI,CAACd,aAAa,GAAGA;IACzB;AA2EJ"}
@@ -1,3 +1,5 @@
1
+ export { DataSource, IdType } from './data-source';
1
2
  export { InMemoryDataSource } from './in-memory-data-source';
2
3
  export { AsyncDataSource } from './async-data-source';
4
+
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data-source/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"sources":["../../src/data-source/index.ts"],"sourcesContent":["export { DataSource, IdType } from './data-source';\nexport { InMemoryDataSource } from './in-memory-data-source';\nexport { AsyncDataSource } from './async-data-source';\n"],"names":["DataSource","IdType","InMemoryDataSource","AsyncDataSource"],"mappings":"AAAA,SAASA,UAAU,EAAEC,MAAM,QAAQ,gBAAgB;AACnD,SAASC,kBAAkB,QAAQ,0BAA0B;AAC7D,SAASC,eAAe,QAAQ,sBAAsB"}