@izara_project/izara-shared-search-and-sort 1.0.9 → 1.0.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-shared-search-and-sort",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Shared Libraries frontend/backend for Search and Sort stack",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@ import { objectHash as hash } from '@izara_project/izara-shared-core';
26
26
  import lodash from 'lodash';
27
27
  const { isEmpty } = lodash;
28
28
  import filtersSharedLib from './FiltersSharedLib.js';
29
- import LogicalStructureSharedLib from './LogicalStructureSharedLib'
29
+ import LogicalStructureSharedLib from './LogicalStructureSharedLib.js'
30
30
 
31
31
  async function createRequiredData(
32
32
  objType,
@@ -73,12 +73,19 @@ async function createRequiredData(
73
73
  console.log('initial data: ', { linkSteps });
74
74
 
75
75
  let [fieldName, returnValue, linkPathErrorObject, linkPathErrorsFound] = await createLinkPath(
76
+ objType,
76
77
  linkSteps,
77
78
  requiredDataLinkStepObjects,
78
79
  requiredDataLinkSteps,
79
80
  perParentCombinations,
80
81
  complexFilterCombinations,
81
82
  values,
83
+ {
84
+ objType: objType,
85
+ initialLogicalElementId: initialLogicalElementId,
86
+ logicalElements: logicalElements
87
+ },
88
+ [],
82
89
  errorsObject,
83
90
  errorsFound
84
91
  );
@@ -133,15 +140,6 @@ async function createRequiredData(
133
140
  linkPathObjectId: pathId
134
141
  };
135
142
 
136
- let requiredFieldNameObject = {
137
- // fieldName: fieldName,
138
- fieldName: setObject,
139
- linkPathObjects: {
140
- [pathId]: pathObject
141
- },
142
- linkPathSteps: returnValue.linkStepObjects
143
- };
144
-
145
143
  if (returnValue.hasOwnProperty('complexFilterCombinations')) {
146
144
  // requiredFieldNameObject.complexFilterCombinations = returnValue.complexFilterCombinations;
147
145
  Object.assign(setComplexFilterCombinations, returnValue.complexFilterCombinations);
@@ -154,6 +152,15 @@ async function createRequiredData(
154
152
  };
155
153
  };
156
154
 
155
+ let requiredFieldNameObject = {
156
+ // fieldName: fieldName,
157
+ fieldName: setObject,
158
+ linkPathObjects: {
159
+ [pathId]: pathObject
160
+ },
161
+ linkPathSteps: returnValue.linkStepObjects
162
+ };
163
+
157
164
  if (returnValue.hasOwnProperty('perParentCombinations')) {
158
165
  // requiredFieldNameObject.perParentCombinations = returnValue.perParentCombinations;
159
166
  Object.assign(setPerParentCombinations, returnValue.perParentCombinations);
@@ -183,7 +190,12 @@ async function createRequiredData(
183
190
  console.log("------- requiredData has only fieldName ---------");
184
191
 
185
192
  let requiredFieldNameObject = {
186
- fieldName: fieldName
193
+ fieldName: {
194
+ fieldName: fieldName
195
+ },
196
+ //* don hash
197
+ linkPathObjects: {},
198
+ linkPathSteps: {}
187
199
  };
188
200
  console.log("requiredFieldNameObject: ", requiredFieldNameObject);
189
201
 
@@ -268,6 +280,7 @@ async function createRequiredData(
268
280
 
269
281
 
270
282
  async function createLinkPath(
283
+ objType,
271
284
  linkSteps,
272
285
  requiredDataLinkStepObjects,
273
286
  requiredDataLinkSteps,
@@ -339,12 +352,13 @@ async function createLinkPath(
339
352
  }
340
353
 
341
354
  let conditionsPromise = checkConditionsLink(
342
- // let [conditions, conditionErrObject, conditionErrFound] = await this.checkConditionsLink(
355
+ // let [conditions, conditionErrObject, conditionErrFound] = await checkConditionsLink(
343
356
  linkStep.pathLinkType.objType,
344
357
  linkStep,
345
358
  perParentCombinations,
346
359
  complexFilterCombinations,
347
360
  values,
361
+ filtersStructure,
348
362
  linkSteps,
349
363
  requiredDataLinkStepObjects,
350
364
  requiredDataLinkSteps,
@@ -352,8 +366,14 @@ async function createLinkPath(
352
366
  errorsObject,
353
367
  errorsFound
354
368
  );
369
+ // console.log('checkConditionsLink in link', {
370
+ // conditions,
371
+ // conditionErrObject,
372
+ // conditionErrFound
373
+ // });
355
374
 
356
375
  [fieldName, returnValue, errorsObject, errorsFound, sortObj] = await createLinkPath(
376
+ linkStep.pathLinkType.objType,
357
377
  linkSteps,
358
378
  requiredDataLinkStepObjects,
359
379
  requiredDataLinkSteps,
@@ -629,7 +649,7 @@ async function createLinkPath(
629
649
  console.log('returnValue', returnValue);
630
650
  }
631
651
  }
632
- return [fieldName, returnValue, errorsObject, errorsFound]
652
+ return [fieldName, returnValue, errorsObject, errorsFound, sortObj]
633
653
  }
634
654
 
635
655
 
@@ -798,13 +818,17 @@ async function checkConditionsLink(
798
818
  for (const sortField of linkStepObject.sortFields) {
799
819
  console.log('sortField: ', sortField);
800
820
  console.log('requiredDataLinkSteps: ', requiredDataLinkSteps);
821
+ console.log('requiredDataLinkStepObjects: ', requiredDataLinkStepObjects);
801
822
  let requiredDataLinkStepSortField = requiredDataLinkStepObjects[sortField.requiredDataLinkStepObjectId];
802
823
  console.log('requiredDataLinkStepSortField: ', requiredDataLinkStepSortField);
803
-
804
- console.log(' requiredDataLinkStepSortField.linkSteps: ', requiredDataLinkStepSortField.linkSteps);
824
+ console.log(' requiredDataLinkStepSortField.linkSteps: ', {
825
+ linkSteps: requiredDataLinkStepSortField.linkSteps,
826
+ requiredDataLinkStepSortField: requiredDataLinkStepSortField
827
+ });
805
828
 
806
829
  //* make all linkPath in here and send out to combine allLinkPath
807
- let [fieldName, childLinkStep, linkErrorsObject, linkErrorsFound] = await createLinkPath(
830
+ let [fieldName, childLinkStep, linkErrorsObject, linkErrorsFound, sortObj] = await createLinkPath(
831
+ linkStepObject.pathLinkType.objType,
808
832
  requiredDataLinkStepSortField.linkSteps,
809
833
  requiredDataLinkStepObjects,
810
834
  requiredDataLinkSteps,
@@ -820,7 +844,8 @@ async function checkConditionsLink(
820
844
  fieldName,
821
845
  childLinkStep,
822
846
  linkErrorsObject,
823
- linkErrorsFound
847
+ linkErrorsFound,
848
+ sortObj
824
849
  });
825
850
 
826
851
  if (linkErrorsFound > 0) {
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  import { objectHash as hash } from '@izara_project/izara-shared-core';
21
21
  import lodash from 'lodash';
22
+ import objectHash from 'object-hash';
22
23
  const { isEmpty } = lodash;
23
24
 
24
25
  function validateFilterElement(
@@ -75,58 +76,65 @@ function createFiltersRequest(
75
76
  let filterMainId = null;
76
77
  let filterMainObject = {};
77
78
  let operation = null;
79
+ let nextFilterElementId = null;
78
80
 
79
81
  let errorsObject = {};
80
82
  let errorsFound = [];
81
83
  let status = 'valid';
82
84
 
83
- //* validate combine logicalStructure
84
- let [validateObject, validateFilterMainId, validateFilterObject, validateErrorsObject, validateErrors] = validateCombinationStructure(
85
- objType,
86
- initialLogicalElementId,
87
- logicalElements,
88
- values
89
- );
90
- console.log('return validateCombinationStructure: ', {
91
- validateObject,
92
- validateFilterMainId,
93
- validateFilterObject,
94
- validateErrorsObject,
95
- validateErrors
96
- });
97
-
98
- if (!validateObject || validateErrors.length > 0) {
99
- Object.assign(errorsObject, validateErrorsObject);
100
- errorsFound = errorsFound.concat(validateErrors);
101
- return [
102
- null,
103
- 'invalid',
104
- errorsObject,
105
- errorsFound
106
- ];
107
- };
85
+ // //* validate combine logicalStructure
86
+ // let [validateObject, validateFilterMainId, validateFilterObject, validateErrorsObject, validateErrors] = validateCombinationStructure(
87
+ // objType,
88
+ // initialLogicalElementId,
89
+ // logicalElements,
90
+ // values
91
+ // );
92
+ // console.log('return validateCombinationStructure: ', {
93
+ // validateObject,
94
+ // validateFilterMainId,
95
+ // validateFilterObject,
96
+ // validateErrorsObject,
97
+ // validateErrors
98
+ // });
99
+
100
+ // if (!validateObject || validateErrors.length > 0) {
101
+ // Object.assign(errorsObject, validateErrorsObject);
102
+ // errorsFound = errorsFound.concat(validateErrors);
103
+ // return [
104
+ // null,
105
+ // 'invalid',
106
+ // errorsObject,
107
+ // errorsFound
108
+ // ];
109
+ // };
108
110
 
109
111
  let operationErrorsObject = {};
110
112
  let operationErrors = [];
113
+ let returnFilterElements = {};
111
114
 
112
115
  [
113
116
  filterMainId,
114
117
  filterMainObject,
115
118
  operation,
116
119
  operationErrorsObject,
117
- operationErrors
120
+ operationErrors,
121
+ nextFilterElementId,
122
+ returnFilterElements
118
123
  ] = filterLogicalElements(
119
124
  objType,
120
125
  initialLogicalElementId,
121
126
  logicalElements,
122
127
  values,
123
128
  );
129
+
124
130
  console.log('final return filterLogicalElements: ', {
125
131
  filterMainId,
126
132
  filterMainObject,
127
133
  operation,
128
134
  operationErrorsObject,
129
- operationErrors
135
+ operationErrors,
136
+ nextFilterElementId,
137
+ returnFilterElements
130
138
  });
131
139
 
132
140
  if (errorsFound.length > 0 || filterMainId === null) {
@@ -141,10 +149,9 @@ function createFiltersRequest(
141
149
  };
142
150
 
143
151
  let filterElements = {};
144
- if (filterMainObject.filterElement.hasOwnProperty('filterElements')) {
145
- filterElements = filterMainObject.filterElement.filterElements;
146
-
147
- delete filterMainObject.filterElement.filterElements;
152
+ // if (filterMainObject.filterElement.hasOwnProperty('filterElements') || isEmpty(returnFilterElements)) {
153
+ if (!isEmpty(returnFilterElements)) {
154
+ filterElements = returnFilterElements;
148
155
  Object.assign(filterElements, { [filterMainId]: filterMainObject });
149
156
  };
150
157
 
@@ -260,7 +267,9 @@ function validateCombinationStructure(
260
267
  initialLogicalElementId = nextElementId;
261
268
  };
262
269
 
263
- } else if (logicalElementType === 'closeBracket') {
270
+ }
271
+
272
+ if (logicalElementType === 'closeBracket') {
264
273
  console.log('----------------- closeBracket --------------');
265
274
 
266
275
  return [
@@ -627,7 +636,9 @@ function validateOperation(
627
636
  // check if is an operation, if not simply return currentFilterMainId
628
637
  if (!runningFilterObject || !lastLogicalOperator) {
629
638
  console.log("+++ validate no operation, R E T U R N currentFilterMainId ++");
630
- return [currentFilterMainId, currentFilterObject, null, errorsFound];
639
+ let filterElements = currentFilterObject.filterElement.filterElements;
640
+ delete currentFilterObject.filterElement.filterElements;
641
+ return [currentFilterMainId, currentFilterObject, null, errorsFound, filterElements];
631
642
  }
632
643
 
633
644
  let filterElements = splitFilterElements(
@@ -637,6 +648,8 @@ function validateOperation(
637
648
  currentFilterObject
638
649
  );
639
650
 
651
+ console.log("----------------------------------------------------- filterElements", filterElements);
652
+
640
653
  // create new operation FilterObject
641
654
  let operationFilterObject = {
642
655
  objType: objType,
@@ -654,6 +667,7 @@ function validateOperation(
654
667
  console.log("==== validate operationFilterMainId After Hash =====", operationFilterMainId);
655
668
 
656
669
  console.log("RETURN validate operationFilterMainId ==>", operationFilterMainId);
670
+ delete operationFilterObject.filterElement.filterElements;
657
671
  console.log("RETURN validate operationFilterObject ==>", operationFilterObject);
658
672
  console.log("========= [validateOperation ::: End] =======");
659
673
 
@@ -663,7 +677,7 @@ function validateOperation(
663
677
  filterMainIdB: currentFilterMainId,
664
678
  };
665
679
 
666
- return [operationFilterMainId, operationFilterObject, operation, errorsFound];
680
+ return [operationFilterMainId, operationFilterObject, operation, errorsFound, filterElements];
667
681
 
668
682
  } catch (err) {
669
683
  throw (err)
@@ -675,6 +689,7 @@ function filterLogicalElements(
675
689
  initialLogicalElementId,
676
690
  logicalElements,
677
691
  values,
692
+ // filterElements = {},
678
693
  nextLogicalElementId = null,
679
694
  runningFilterMainId = null,
680
695
  runningFilterObject = null,
@@ -703,6 +718,8 @@ function filterLogicalElements(
703
718
  let lastNextLogicalElementId = null;
704
719
  let currentLogicalElementId = initialLogicalElementId;
705
720
 
721
+ let filterElements = {};
722
+
706
723
  if (nextLogicalElementId !== null) {
707
724
  currentLogicalElementId = nextLogicalElementId;
708
725
  }
@@ -722,9 +739,24 @@ function filterLogicalElements(
722
739
  let logicalElementType = logicalElement.logicalElementType;
723
740
  console.log('logicalElementType: ', logicalElementType);
724
741
 
742
+ if (logicalElementType === "operation") {
743
+
744
+ lastLogicalOperator = logicalElement.operation;
745
+
746
+ if (logicalElement.nextLogicalElementId === null) {
747
+ errorsObject[initialLogicalElementId] = `this operation structure must set nextLogicalElementId`;
748
+ errorsFound.push(`this logical structure logicalElementId: ${currentLogicalElementId} must set nextLogicalElementId`);
749
+ }
750
+
751
+ logicalElement = logicalElements[logicalElement.nextLogicalElementId];
752
+ logicalElementType = logicalElement.logicalElementType;
753
+
754
+ }
755
+
725
756
  if (logicalElementType === "openBracket") {
726
757
 
727
758
  let nextElementId = null;
759
+ let returnFilterElements = {};
728
760
 
729
761
  [
730
762
  currentFilterMainId,
@@ -732,12 +764,14 @@ function filterLogicalElements(
732
764
  operation,
733
765
  errorsObject,
734
766
  errorsFound,
735
- nextElementId
767
+ nextElementId,
768
+ returnFilterElements
736
769
  ] = filterLogicalElements(
737
770
  objType,
738
771
  initialLogicalElementId,
739
772
  logicalElements,
740
773
  values,
774
+ // filterElements,
741
775
  logicalElement.nextLogicalElementId
742
776
  );
743
777
  console.log('return filterLogicalElement for openBracket: ', {
@@ -745,9 +779,12 @@ function filterLogicalElements(
745
779
  currentFilterObject,
746
780
  operation,
747
781
  errorsObject, errorsFound,
748
- lastNextLogicalElementId
782
+ lastNextLogicalElementId,
783
+ returnFilterElements
749
784
  });
750
785
 
786
+ console.log("bb", bb)
787
+
751
788
  if (nextElementId !== null) {
752
789
  lastNextLogicalElementId = nextElementId;
753
790
  }
@@ -763,18 +800,6 @@ function filterLogicalElements(
763
800
  logicalElement.nextLogicalElementId
764
801
  ]
765
802
 
766
- } else if (logicalElementType === "operation") {
767
-
768
- lastLogicalOperator = logicalElement.operation;
769
-
770
- if (logicalElement.nextLogicalElementId === null) {
771
- errorsObject[initialLogicalElementId] = `this operation structure must set nextLogicalElementId`;
772
- errorsFound.push(`this logical structure logicalElementId: ${currentLogicalElementId} must set nextLogicalElementId`);
773
- }
774
-
775
- logicalElement = logicalElements[logicalElement.nextLogicalElementId];
776
- logicalElementType = logicalElement.logicalElementType;
777
-
778
803
  }
779
804
 
780
805
  console.log("check logicalElement: ", logicalElement);
@@ -909,12 +934,14 @@ function filterLogicalElements(
909
934
  operation,
910
935
  childErrorsObject,
911
936
  childErrorsFound,
912
- childNextLogicalElementId
937
+ childNextLogicalElementId,
938
+ returnFilterElements
913
939
  ] = filterLogicalElements(
914
940
  logicalElement.pathLinkType.objType,
915
941
  initialLogicalElementId,
916
942
  logicalElements,
917
943
  values,
944
+ // filterElements,
918
945
  logicalElement.childLogicalElementId
919
946
  );
920
947
  console.log('return child filterLogicalElement for child complexFilter: ', {
@@ -923,23 +950,35 @@ function filterLogicalElements(
923
950
  operation,
924
951
  childErrorsObject,
925
952
  childErrorsFound,
926
- childNextLogicalElementId
953
+ childNextLogicalElementId,
954
+ returnFilterElements
927
955
  });
928
956
  if (childErrorsFound.length > 0) {
929
957
  Object.assign(errorsObject, childErrorsObject);
930
958
  errorsFound = errorsFound.concat(childErrorsFound)
931
959
  }
932
960
 
933
- let filterElements = splitFilterElements(
934
- childFilterMainId,
935
- childFilterObject
936
- );
937
- console.log('filterElements: ', filterElements);
961
+ delete childFilterObject.filterElement.filterElements;
962
+
963
+ if (isEmpty(returnFilterElements)) {
964
+ returnFilterElements = { [childFilterMainId]: childFilterObject };
965
+ } else {
966
+ returnFilterElements[childFilterMainId] = childFilterObject;
967
+ }
968
+
969
+
970
+ // let childFilterElements = splitFilterElements(
971
+ // childFilterMainId,
972
+ // childFilterObject
973
+ // );
974
+ // console.log('childFilterElements: ', childFilterElements);
975
+
976
+ Object.assign(filterElements, returnFilterElements);
938
977
  let setRequestProperties = {};
939
978
 
940
979
  if (!isEmpty(logicalElement.requestProperties)) {
941
980
  console.log('logicalElement: ', logicalElement);
942
-
981
+ console.log("ll", ll)
943
982
  for (const [tag, requestPropertyId] of Object.entries(logicalElement.requestProperties)) {
944
983
  console.log('set requestProperties: ', { tag, requestPropertyId });
945
984
 
@@ -960,13 +999,13 @@ function filterLogicalElements(
960
999
  objType: logicalElement.objType,
961
1000
  filterElement: {
962
1001
  filterType: logicalElementType,
963
- filterElements: filterElements,
1002
+ filterElements: returnFilterElements,
964
1003
  childFilterElementId: childFilterMainId,
965
1004
  pathLinkType: logicalElement.pathLinkType,
966
1005
  requestProperties: setRequestProperties ?? {}
967
1006
  }
968
1007
  };
969
- console.log('currentFilterObject: ', currentFilterObject);
1008
+ console.log('currentFilterObject: ', currentFilterObject)
970
1009
 
971
1010
  currentFilterMainId = hash(currentFilterObject);
972
1011
  console.log('currentFilterMainId: ', currentFilterMainId);
@@ -992,7 +1031,9 @@ function filterLogicalElements(
992
1031
 
993
1032
  if (lastNextLogicalElementId !== null) {
994
1033
 
995
- [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = validateOperation(
1034
+ let validateFilterElements = {};
1035
+
1036
+ [runningFilterMainId, runningFilterObject, operation, operationErrorsFound, validateFilterElements] = validateOperation(
996
1037
  objType,
997
1038
  runningFilterMainId,
998
1039
  runningFilterObject,
@@ -1000,13 +1041,19 @@ function filterLogicalElements(
1000
1041
  currentFilterMainId,
1001
1042
  currentFilterObject
1002
1043
  );
1003
- console.log('return validateOperation for lastNextLogicalElementId == null: ', {
1044
+ console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
1004
1045
  runningFilterMainId,
1005
1046
  runningFilterObject,
1006
1047
  operation,
1007
- operationErrorsFound
1048
+ operationErrorsFound,
1049
+ validateFilterElements
1008
1050
  });
1009
1051
 
1052
+ if (currentFilterObject.objType.objectType === "productStandard") {
1053
+ console.log("ff", currentFilterObject.filterElement.filterElements)
1054
+ console.log("ff", ff)
1055
+ }
1056
+
1010
1057
  if (!isEmpty(operation)) {
1011
1058
  lastLogicalOperator = null;
1012
1059
  }
@@ -1017,24 +1064,27 @@ function filterLogicalElements(
1017
1064
  operations,
1018
1065
  nextErrorObject,
1019
1066
  nextErrorFound,
1020
- nextElementId
1067
+ nextElementId,
1068
+ returnFilterElements
1021
1069
  ] = filterLogicalElements(
1022
1070
  objType,
1023
1071
  initialLogicalElementId,
1024
1072
  logicalElements,
1025
1073
  values,
1074
+ // filterElements,
1026
1075
  lastNextLogicalElementId,
1027
1076
  runningFilterMainId,
1028
1077
  runningFilterObject,
1029
1078
  lastLogicalOperator,
1030
1079
  );
1031
- console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
1080
+ console.log('return validateOperation for lastNextLogicalElementId !== null ___1: ', {
1032
1081
  nextFilterMainId,
1033
1082
  nextFilterObject,
1034
1083
  operations,
1035
1084
  nextErrorObject,
1036
1085
  nextErrorFound,
1037
- nextElementId
1086
+ nextElementId,
1087
+ returnFilterElements
1038
1088
  });
1039
1089
 
1040
1090
  if (nextErrorFound.length > 0) {
@@ -1042,7 +1092,10 @@ function filterLogicalElements(
1042
1092
  errorsFound = errorsFound.concat(nextErrorFound);
1043
1093
  }
1044
1094
 
1095
+ Object.assign(filterElements, validateFilterElements, returnFilterElements);
1096
+
1045
1097
  if (nextElementId !== null) {
1098
+
1046
1099
  let filterErrorObject = {};
1047
1100
  let filterErrorFound = [];
1048
1101
 
@@ -1052,18 +1105,19 @@ function filterLogicalElements(
1052
1105
  operation,
1053
1106
  filterErrorObject,
1054
1107
  filterErrorFound,
1055
- nextElementId
1108
+ nextElementId,
1056
1109
  ] = filterLogicalElements(
1057
1110
  objType,
1058
1111
  initialLogicalElementId,
1059
1112
  logicalElements,
1060
1113
  values,
1114
+ // filterElements,
1061
1115
  nextElementId,
1062
1116
  nextFilterMainId,
1063
1117
  nextFilterObject,
1064
1118
  lastLogicalOperator
1065
1119
  );
1066
- console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
1120
+ console.log('return validateOperation for lastNextLogicalElementId !== null ___2: ', {
1067
1121
  runningFilterMainId,
1068
1122
  runningFilterObject,
1069
1123
  operation,
@@ -1080,19 +1134,22 @@ function filterLogicalElements(
1080
1134
  nextElementId
1081
1135
  ];
1082
1136
  } else {
1137
+
1083
1138
  return [
1084
1139
  nextFilterMainId,
1085
1140
  nextFilterObject,
1086
1141
  operation,
1087
1142
  errorsObject,
1088
1143
  errorsFound,
1089
- nextElementId
1144
+ nextElementId,
1145
+ filterElements
1090
1146
  ];
1091
1147
  }
1092
1148
 
1093
1149
  } else {
1150
+ let returnFilterElements = {};
1094
1151
 
1095
- [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = validateOperation(
1152
+ [runningFilterMainId, runningFilterObject, operation, operationErrorsFound, returnFilterElements] = validateOperation(
1096
1153
  objType,
1097
1154
  runningFilterMainId,
1098
1155
  runningFilterObject,
@@ -1104,14 +1161,15 @@ function filterLogicalElements(
1104
1161
  runningFilterMainId,
1105
1162
  runningFilterObject,
1106
1163
  operation,
1107
- operationErrorsFound
1164
+ operationErrorsFound,
1165
+ returnFilterElements
1108
1166
  });
1109
1167
 
1110
1168
  if (operationErrorsFound.length > 0) {
1111
1169
  errorsFound = errorsFound.concat(operationErrorsFound)
1112
1170
  }
1113
1171
 
1114
- return [runningFilterMainId, runningFilterObject, operation, errorsObject, errorsFound, null];
1172
+ return [runningFilterMainId, runningFilterObject, operation, errorsObject, errorsFound, null, returnFilterElements];
1115
1173
 
1116
1174
  }
1117
1175
 
@@ -1138,14 +1196,14 @@ function splitFilterElements(
1138
1196
  // || runningFilterObject.filterElement.filterType === 'traversal'
1139
1197
  // ) {}
1140
1198
 
1141
- if (runningFilterObject.logicalElementType === 'operation') {
1199
+ if (runningFilterObject.filterElement.filterType === 'operation') {
1142
1200
  console.log('-------- operation ----------');
1143
1201
 
1144
1202
  Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
1145
1203
  // delete runningFilterObject.filterElement.filterElements;
1146
1204
  filterElements[runningFilterMainId] = runningFilterObject;
1147
1205
 
1148
- } else if (runningFilterObject.logicalElementType === 'childComplexFilter') {
1206
+ } else if (runningFilterObject.filterElement.filterType === 'childComplexFilter') {
1149
1207
  console.log('-------- childComplexFilter ----------');
1150
1208
 
1151
1209
  Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
@@ -1153,28 +1211,28 @@ function splitFilterElements(
1153
1211
  filterElements[runningFilterMainId] = runningFilterObject;
1154
1212
 
1155
1213
  } else {
1156
- console.log(` -------- ${runningFilterObject.logicalElementType} ----------`);
1214
+ console.log(` -------- ${runningFilterObject.filterElement.filterType} ----------`);
1157
1215
  //'logical'| 'identifiers'|'translateIds'|'traversal'
1158
1216
  filterElements[runningFilterMainId] = runningFilterObject;
1159
1217
  };
1160
1218
 
1161
1219
  if (currentFilterObject !== null) {
1162
- if (currentFilterObject.logicalElementType === 'operation') {
1220
+ if (currentFilterObject.filterType === 'operation') {
1163
1221
  console.log('-------- operation ----------');
1164
1222
 
1165
1223
  Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
1166
1224
  // delete currentFilterObject.filterElement.filterElements;
1167
1225
  filterElements[currentFilterMainId] = currentFilterObject;
1168
1226
 
1169
- } else if (currentFilterObject.logicalElementType === 'childComplexFilter') {
1227
+ } else if (currentFilterObject.filterElement.filterType === 'childComplexFilter') {
1170
1228
  console.log('-------- childComplexFilter ----------');
1171
1229
 
1172
1230
  Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
1173
- // delete currentFilterObject.filterElement.filterElements;
1231
+ delete currentFilterObject.filterElement.filterElements;
1174
1232
  filterElements[currentFilterMainId] = currentFilterObject;
1175
1233
 
1176
1234
  } else {
1177
- console.log(` -------- ${currentFilterObject.logicalElementType} ----------`);
1235
+ console.log(` -------- ${currentFilterObject.filterElement.filterType} ----------`);
1178
1236
  //'logical'| 'identifiers'|'translateIds'|'traversal'
1179
1237
  filterElements[currentFilterMainId] = currentFilterObject;
1180
1238
  };
@@ -906,9 +906,7 @@ async function changeObjTypePath(
906
906
  };
907
907
 
908
908
  };
909
- //###################################################################################################################################################################################
910
-
911
-
909
+ // ###################################################################################################################################################################################
912
910
 
913
911
 
914
912
  function createChildComplexFilterStructure(
@@ -35,7 +35,6 @@ async function createSearchRequest(
35
35
  requiredDataLinkStepObjects,
36
36
  requiredDataLinkSteps,
37
37
  values,
38
- getSchemaFn
39
38
  ) {
40
39
  console.log('createSearchResult: ', {
41
40
  objType,
@@ -57,13 +56,14 @@ async function createSearchRequest(
57
56
 
58
57
  let requiredDataPromise = dataFieldsSharedLib.createRequiredData(
59
58
  objType,
59
+ initialLogicalElementId,
60
+ logicalElements,
60
61
  requiredDataFields,
61
62
  complexFilterCombinations,
62
63
  perParentCombinations,
63
64
  requiredDataLinkStepObjects,
64
65
  requiredDataLinkSteps,
65
66
  values,
66
- getSchemaFn
67
67
  );
68
68
 
69
69
  //* create complexFilter normalize to send backend