@izara_project/izara-shared-search-and-sort 1.0.6 → 1.0.8

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/index.js CHANGED
@@ -20,10 +20,12 @@ import SearchSortSharedLib from './src/SearchSortSharedLib.js';
20
20
  import FiltersSharedLib from './src/FiltersSharedLib.js'
21
21
  import DataFieldsSharedLib from './src/DataFieldsSharedLib.js'
22
22
  import LogicalStructureSharedLib from './src/LogicalStructureSharedLib.js';
23
+ import InitialSchemaLib from './src/InitialSchemaLib.js';
23
24
 
24
25
  export {
25
26
  SearchSortSharedLib,
26
27
  FiltersSharedLib,
27
28
  DataFieldsSharedLib,
28
- LogicalStructureSharedLib
29
+ LogicalStructureSharedLib,
30
+ InitialSchemaLib
29
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-shared-search-and-sort",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Shared Libraries frontend/backend for Search and Sort stack",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,12 +21,7 @@
21
21
  },
22
22
  "type": "module",
23
23
  "dependencies": {
24
- "@izara_project/izara-core-library-complex-filter": "^1.0.8",
25
- "@izara_project/izara-core-library-core": "^1.0.13",
26
- "@izara_project/izara-core-library-external-request": "^1.0.13",
27
- "@izara_project/izara-core-library-search-result": "^1.0.6",
28
- "@izara_project/izara-core-library-service-schemas": "^1.0.105",
29
- "@izara_project/izara-shared": "^1.0.109",
24
+ "@izara_project/izara-core-library-core": "^1.0.31",
30
25
  "@izara_project/izara-shared-service-schemas": "^1.0.35",
31
26
  "object-hash": "^3.0.0"
32
27
  }
@@ -35,6 +35,7 @@ async function createRequiredData(
35
35
  requiredDataLinkStepObjects,
36
36
  requiredDataLinkSteps,
37
37
  values,
38
+ getSchemaFn
38
39
  ) {
39
40
  console.log('createRequiredData: ', {
40
41
  objType,
@@ -43,6 +44,7 @@ async function createRequiredData(
43
44
  perParentCombinations,
44
45
  requiredDataLinkStepObjects,
45
46
  values,
47
+ getSchemaFn
46
48
  });
47
49
 
48
50
  let errorsObject = {};
@@ -83,12 +85,9 @@ async function createRequiredData(
83
85
  linkPathErrorsFound
84
86
  });
85
87
 
86
- if (linkPathErrorsFound.length > 0) {
88
+ if (linkPathErrorsFound.length > 0 || fieldName === null) {
87
89
  Object.assign(errorsObject, linkPathErrorObject);
88
90
  errorsFound = errorsFound.concat(linkPathErrorsFound);
89
- };
90
-
91
- if (fieldName === null) {
92
91
  return {
93
92
  requiredDataHash: null,
94
93
  requiredDataObject: requiredDataObject,
@@ -114,6 +113,8 @@ async function createRequiredData(
114
113
  Object.assign(linkPathObjects, returnValue.sortFieldLinkPathObjects.linkPathObjects);
115
114
  }
116
115
 
116
+ console.log('returnValue.linkStepObjects: ', returnValue.linkStepObjects);
117
+
117
118
  let pathObject = {
118
119
  initialObjType: objType,
119
120
  linkSteps: returnValue.linkSteps
@@ -128,16 +129,17 @@ async function createRequiredData(
128
129
  linkPathObjectId: pathId
129
130
  };
130
131
 
131
- Object.assign(linkPathObjects, { [pathId]: pathObject });
132
-
133
132
  let requiredFieldNameObject = {
134
- fieldName: fieldName,
135
- linkPathObjects: linkPathObjects,
136
- linkPathSteps: linkPathSteps
133
+ // fieldName: fieldName,
134
+ fieldName: setObject,
135
+ linkPathObjects: {
136
+ [pathId]: pathObject
137
+ },
138
+ linkPathSteps: returnValue.linkStepObjects
137
139
  };
138
140
 
139
141
  if (returnValue.hasOwnProperty('complexFilterCombinations')) {
140
- requiredFieldNameObject.complexFilterCombinations = returnValue.complexFilterCombinations;
142
+ // requiredFieldNameObject.complexFilterCombinations = returnValue.complexFilterCombinations;
141
143
  Object.assign(setComplexFilterCombinations, returnValue.complexFilterCombinations);
142
144
 
143
145
  setObject.complexFilterCombinationIds = []
@@ -149,12 +151,12 @@ async function createRequiredData(
149
151
  };
150
152
 
151
153
  if (returnValue.hasOwnProperty('perParentCombinations')) {
152
- requiredFieldNameObject.perParentCombinations = returnValue.perParentCombinations;
154
+ // requiredFieldNameObject.perParentCombinations = returnValue.perParentCombinations;
153
155
  Object.assign(setPerParentCombinations, returnValue.perParentCombinations);
154
156
  };
155
157
 
156
158
  if (returnValue.hasOwnProperty('filterElements')) {
157
- requiredFieldNameObject.filterElements = returnValue.filterElements;
159
+ // requiredFieldNameObject.filterElements = returnValue.filterElements;
158
160
  Object.assign(setFilterElementsLink, returnValue.filterElements);
159
161
  };
160
162
  console.log('requiredFieldNameObject: ', requiredFieldNameObject);
@@ -171,6 +173,8 @@ async function createRequiredData(
171
173
  requiredDataObject[requiredDataFieldNameId] = setObject;
172
174
  };
173
175
 
176
+ Object.assign(linkPathObjects, { [pathId]: pathObject });
177
+
174
178
  } else {
175
179
  console.log("------- requiredData has only fieldName ---------");
176
180
 
@@ -287,17 +291,6 @@ async function createLinkPath(
287
291
  });
288
292
  let fieldName = null;
289
293
  let returnValue = {}; //* must return only linkPath params
290
- // let linkPathSteps = [];
291
- // let linkPathStepObjects = {};
292
- // let filterElementsLink = {};
293
- // let perParentCombination = {};
294
-
295
- // let errorsObject = {}
296
- // let errorsFound = [];
297
-
298
- // let childLinkStep = null
299
- // let childLinkErrorObject = {};
300
- // let childLinkErrors = []
301
294
 
302
295
  let linkStepId = linkSteps[index];
303
296
  console.log('linkStepId: ', linkStepId);
@@ -348,6 +341,10 @@ async function createLinkPath(
348
341
  index
349
342
  });
350
343
 
344
+ if (errorsFound.length > 0) {
345
+ return [null, null, errorsObject, errorsFound]
346
+ }
347
+
351
348
  console.log('linkStep', linkStep);
352
349
 
353
350
  let [conditions, conditionErrObject, conditionErrFound] = await conditionsPromise;
@@ -355,6 +352,8 @@ async function createLinkPath(
355
352
  if (conditionErrFound.length > 0) {
356
353
  Object.assign(errorsObject, conditionErrObject);
357
354
  errorsFound = errorsFound.concat(conditionErrFound);
355
+
356
+ return [null, null, errorsObject, errorsFound]
358
357
  };
359
358
 
360
359
  if (!isEmpty(returnValue)) {
@@ -405,15 +404,37 @@ async function createLinkPath(
405
404
  if (conditions.hasOwnProperty("setFilterCombinations") && !isEmpty(conditions.setFilterCombinations)) {
406
405
 
407
406
  if (conditions.setFilterCombinations.hasOwnProperty('filterElements')) {
408
- Object.assign(returnValue["filterElements"], conditions.setFilterCombinations.filterElements.filterElements);
407
+
408
+ if (returnValue.hasOwnProperty("filterElements")) {
409
+ Object.assign(returnValue["filterElements"], conditions.setFilterCombinations.filterElements.filterElements);
410
+ } else {
411
+ returnValue.filterElements = {};
412
+ Object.assign(returnValue["filterElements"], conditions.setFilterCombinations.filterElements.filterElements);
413
+ }
414
+
409
415
  }
410
416
 
411
417
  if (conditions.setFilterCombinations.hasOwnProperty('perParentCombinations')) {
412
- Object.assign(returnValue["perParentCombinations"], conditions.setFilterCombinations.perParentCombinations);
418
+
419
+ if (returnValue.hasOwnProperty("perParentCombinations")) {
420
+ Object.assign(returnValue["perParentCombinations"], conditions.setFilterCombinations.perParentCombinations);
421
+ } else {
422
+ returnValue.perParentCombinations = {};
423
+ Object.assign(returnValue["perParentCombinations"], conditions.setFilterCombinations.perParentCombinations);
424
+ }
425
+
413
426
  };
414
427
 
415
428
  if (conditions.setFilterCombinations.hasOwnProperty('complexFilterCombinations')) {
416
- Object.assign(returnValue['complexFilterCombinations'], conditions.setFilterCombinations.complexFilterCombinations);
429
+
430
+ if (returnValue.hasOwnProperty("complexFilterCombinations")) {
431
+ Object.assign(returnValue['complexFilterCombinations'], conditions.setFilterCombinations.complexFilterCombinations);
432
+ } else {
433
+ returnValue.complexFilterCombinations = {};
434
+ Object.assign(returnValue["complexFilterCombinations"], conditions.setFilterCombinations.complexFilterCombinations);
435
+ }
436
+
437
+
417
438
  };
418
439
  }
419
440
 
@@ -423,6 +444,7 @@ async function createLinkPath(
423
444
  //* error
424
445
  errorsObject[linkStepId] = `has linkPathObject but no data`;
425
446
  errorsFound.push(`${linkStepId} no data in linkPathObject`)
447
+ return [null, null, errorsObject, errorsFound]
426
448
  }
427
449
  }
428
450
 
@@ -530,7 +552,8 @@ async function createLinkPath(
530
552
  } else {
531
553
  //* error
532
554
  errorsObject[linkStepId] = `has linkPathObject but no data`;
533
- errorsFound.push(`${linkStepId} no data in linkPathObject`)
555
+ errorsFound.push(`${linkStepId} no data in linkPathObject`);
556
+ return [null, null, errorsObject, errorsFound]
534
557
  }
535
558
  }
536
559
 
@@ -552,6 +575,16 @@ async function createLinkPath(
552
575
  };
553
576
  };
554
577
 
578
+ if (conditions.hasOwnProperty("comparison")) {
579
+ if (conditions.hasOwnProperty("comparisonSortField")) {
580
+ if (conditions.hasOwnProperty("comparisonValue")) {
581
+ linkStepObject.comparison = conditions.comparison;
582
+ linkStepObject.comparisonSortField = conditions.comparisonSortField;
583
+ linkStepObject.comparisonValue = conditions.comparisonValue;
584
+ }
585
+ }
586
+ }
587
+
555
588
  console.log('linkStepObject', linkStepObject);
556
589
  let linkStepId = hash(linkStepObject);
557
590
  console.log('linkStepId', linkStepId);
@@ -613,7 +646,8 @@ async function checkConditionsLink(
613
646
 
614
647
  if (filterErrorsFound.length > 0) {
615
648
  Object.assign(errorsObject, filterErrorsObject)
616
- errorsFound = errorsFound.concat(filterErrorsFound)
649
+ errorsFound = errorsFound.concat(filterErrorsFound);
650
+ return [null, errorsObject, errorsFound]
617
651
  };
618
652
  conditionLinkObject.filterElements = complexFilterRequest.filterElements;
619
653
  console.log('conditionLinkObject in condition link: ', conditionLinkObject);
@@ -622,7 +656,9 @@ async function checkConditionsLink(
622
656
  if (linkStepObject.hasOwnProperty('aggregate')) {
623
657
  console.log('------------ has aggregate ------------');
624
658
  if (!linkStepObject.hasOwnProperty('sortFields')) {
659
+ errorsObject[objType.objectType] = 'if has aggregate need to has sortFields, too';
625
660
  errorsFound.push('if has aggregate need to has sortFields, too');
661
+ return [null, errorsObject, errorsFound]
626
662
  };
627
663
  conditionLinkObject.aggregate = linkStepObject.aggregate;
628
664
  conditionLinkObject.sortFields = [];
@@ -670,6 +706,12 @@ async function checkConditionsLink(
670
706
  linkErrorsFound
671
707
  });
672
708
 
709
+ if (linkErrorsFound > 0) {
710
+ Object.assign(errorsObject, linkErrorsObject);
711
+ errorsFound = errorsFound.concat(linkErrorsFound);
712
+ return [null, errorsObject, errorsFound]
713
+ }
714
+
673
715
  if (!isEmpty(childLinkStep)) {
674
716
 
675
717
  //* create linkPathObject from child
@@ -755,7 +797,9 @@ async function checkConditionsLink(
755
797
 
756
798
  } else {
757
799
  if (linkStepObject.hasOwnProperty('combine')) {
758
- errorsFound.push('this link set combine must set aggregate and sortFields, too');
800
+ errorsObject[objType.objectType] = 'must set aggregate and sortFields';
801
+ errorsFound = errorsFound.concat('must set aggregate and sortFields')
802
+ return [null, errorsObject, errorsFound]
759
803
  }
760
804
  };
761
805
 
@@ -880,6 +924,10 @@ async function checkConditionsLink(
880
924
  };
881
925
  };
882
926
 
927
+ if (errorsFound.length > 0) {
928
+ return [null, errorsObject, errorsFound]
929
+ }
930
+
883
931
  console.log('perParentCombinations: ', {
884
932
  perParentCombinationIds,
885
933
  perParentCombinationObjects,
@@ -897,6 +945,22 @@ async function checkConditionsLink(
897
945
  };
898
946
  console.log('conditionLinkObject: ', conditionLinkObject);
899
947
  }
948
+
949
+ if (linkStepObject.hasOwnProperty("comparison")) {
950
+ console.log('------------ link has comparison ------------');
951
+
952
+ if (!linkStepObject.hasOwnProperty("comparisonSortField") || !linkStepObject.hasOwnProperty("comparisonValue")) {
953
+ errorsObject[objType.objectType] = 'no comparisonSortField | comparisonValue';
954
+ errorsFound.push(`${objType.objectType}: no comparisonSortField | comparisonValue`);
955
+ return [null, errorsObject, errorsFound]
956
+ }
957
+
958
+ conditionLinkObject.comparison = linkStepObject.comparison;
959
+ conditionLinkObject.comparisonSortField = linkStepObject.comparisonSortField;
960
+ conditionLinkObject.comparisonValue = values[linkStepObject.comparisonValue].value;
961
+
962
+ }
963
+
900
964
  console.log('conditionLinkObject', conditionLinkObject);
901
965
  return [conditionLinkObject, errorsObject, errorsFound];
902
966
  }
@@ -1152,43 +1152,43 @@ function splitFilterElements(
1152
1152
  // || runningFilterObject.filterElement.filterType === 'traversal'
1153
1153
  // ) {}
1154
1154
 
1155
- if (runningFilterObject.filterElement.filterType === 'operation') {
1155
+ if (runningFilterObject.logicalElementType === 'operation') {
1156
1156
  console.log('-------- operation ----------');
1157
1157
 
1158
1158
  Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
1159
- delete runningFilterObject.filterElement.filterElements;
1159
+ // delete runningFilterObject.filterElement.filterElements;
1160
1160
  filterElements[runningFilterMainId] = runningFilterObject;
1161
1161
 
1162
- } else if (runningFilterObject.filterElement.filterType === 'childComplexFilter') {
1162
+ } else if (runningFilterObject.logicalElementType === 'childComplexFilter') {
1163
1163
  console.log('-------- childComplexFilter ----------');
1164
1164
 
1165
1165
  Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
1166
- delete runningFilterObject.filterElement.filterElements;
1166
+ // delete runningFilterObject.filterElement.filterElements;
1167
1167
  filterElements[runningFilterMainId] = runningFilterObject;
1168
1168
 
1169
1169
  } else {
1170
- console.log(` -------- ${runningFilterObject.filterElement.filterType} ----------`);
1170
+ console.log(` -------- ${runningFilterObject.logicalElementType} ----------`);
1171
1171
  //'logical'| 'identifiers'|'translateIds'|'traversal'
1172
1172
  filterElements[runningFilterMainId] = runningFilterObject;
1173
1173
  };
1174
1174
 
1175
1175
  if (currentFilterObject !== null) {
1176
- if (currentFilterObject.filterElement.filterType === 'operation') {
1176
+ if (currentFilterObject.logicalElementType === 'operation') {
1177
1177
  console.log('-------- operation ----------');
1178
1178
 
1179
1179
  Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
1180
- delete currentFilterObject.filterElement.filterElements;
1180
+ // delete currentFilterObject.filterElement.filterElements;
1181
1181
  filterElements[currentFilterMainId] = currentFilterObject;
1182
1182
 
1183
- } else if (currentFilterObject.filterElement.filterType === 'childComplexFilter') {
1183
+ } else if (currentFilterObject.logicalElementType === 'childComplexFilter') {
1184
1184
  console.log('-------- childComplexFilter ----------');
1185
1185
 
1186
1186
  Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
1187
- delete currentFilterObject.filterElement.filterElements;
1187
+ // delete currentFilterObject.filterElement.filterElements;
1188
1188
  filterElements[currentFilterMainId] = currentFilterObject;
1189
1189
 
1190
1190
  } else {
1191
- console.log(` -------- ${currentFilterObject.filterElement.filterType} ----------`);
1191
+ console.log(` -------- ${currentFilterObject.logicalElementType} ----------`);
1192
1192
  //'logical'| 'identifiers'|'translateIds'|'traversal'
1193
1193
  filterElements[currentFilterMainId] = currentFilterObject;
1194
1194
  };
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright (C) 2025 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ import LogicalStructureSharedLib from './LogicalStructureSharedLib.js';
20
+
21
+ function initSchemaFn(getObjSchemaS3WithoutHierarchy, getObjectRelationship) { //getObjectLinks
22
+ return LogicalStructureSharedLib.initSchemaFn(getObjSchemaS3WithoutHierarchy, getObjectRelationship);
23
+ }
24
+
25
+ export default {
26
+ initSchemaFn
27
+ }
@@ -22,9 +22,19 @@ import { objectHash as hash } from '@izara_project/izara-shared-core'; //const
22
22
  import lodash from 'lodash';
23
23
  const { isEmpty } = lodash;
24
24
  import { v4 as uuidV4 } from 'uuid'; //const { v4: uuidv4 } = require('uuid');
25
- import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
25
+ // import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
26
26
  const MAX_ITER = 4;
27
27
 
28
+ let getObjectSchema = {};
29
+
30
+ function initSchemaFn(getObjSchemaS3WithoutHierarchy, getObjectRelationship) { //getObjectLinks
31
+ getObjectSchema = {
32
+ getObjSchemaS3WithoutHierarchy,
33
+ getObjectRelationship: getObjectRelationship // getObjectRelationship: getObjectLinks
34
+ }
35
+
36
+ return getObjectSchema;
37
+ }
28
38
 
29
39
  function combineLogicalStructure(
30
40
  objType,
@@ -593,6 +603,7 @@ async function changeObjTypePath(
593
603
  requiredObjType,
594
604
  filtersStructure,
595
605
  path = null,
606
+ PATHCONSTANCES = null
596
607
  ) {
597
608
  try {
598
609
  console.log('----- function validateSearchTypeFilterType -----', {
@@ -733,28 +744,33 @@ async function changeObjTypePath(
733
744
 
734
745
  //* delete level of objType
735
746
  let checkChild = false;
736
- for (const objType of PATHCONSTANCES.objTypes) {
737
- if (checkObjType(objType, childLogicalElement.objType) === true) {
738
- if (!childLogicalElement.hasOwnProperty('childLogicalElementId')) {
739
-
740
- // let childSchema = await getObjectSchema.getObjSchemaS3(
741
- let childSchema = await getObjectSchema.getObjSchemaS3WithoutHierarchy(
742
- {}, //_izContext maybe delete
743
- childLogicalElement.objType
744
- );
745
- console.log('childSchema: ', childSchema);
746
-
747
- if (childSchema.hasOwnProperty('extendObjType')) {
748
- if (checkObjType(requiredObjType, childSchema.extendObjType) === true) {
749
- checkChild = false;
750
- break;
747
+
748
+ if (PATHCONSTANCES != null) {
749
+
750
+ for (const objType of PATHCONSTANCES.objTypes) {
751
+ if (checkObjType(objType, childLogicalElement.objType) === true) {
752
+ if (!childLogicalElement.hasOwnProperty('childLogicalElementId')) {
753
+
754
+ // let childSchema = await getObjectSchema.getObjSchemaS3WithCache(
755
+ let childSchema = await getObjectSchema.getObjSchemaS3WithoutHierarchyV2(
756
+ childLogicalElement.objType
757
+ );
758
+ console.log('childSchema: ', childSchema);
759
+
760
+ if (childSchema.hasOwnProperty('extendObjType')) {
761
+ if (checkObjType(requiredObjType, childSchema.extendObjType) === true) {
762
+ checkChild = false;
763
+ break;
764
+ };
751
765
  };
752
766
  };
767
+ checkChild = true;
768
+ break;
753
769
  };
754
- checkChild = true;
755
- break;
756
770
  };
757
- };
771
+ } else {
772
+ checkChild = true;
773
+ }
758
774
 
759
775
  if (checkChild) {
760
776
 
@@ -888,13 +904,16 @@ async function changeObjTypePath(
888
904
  return [filterLogicalStructure, errorsObject, errorsFound];
889
905
 
890
906
  } catch (err) {
891
- _izContext.logger.error('error ValidateSearchTypeFilterType: ', err)
907
+ console.log('error ValidateSearchTypeFilterType: ', err)
892
908
  throw (err);
893
909
  };
894
910
 
895
911
  };
896
912
  //###################################################################################################################################################################################
897
913
 
914
+
915
+
916
+
898
917
  function createChildComplexFilterStructure(
899
918
  logicalElements,
900
919
  previousLogicalElementId,
@@ -1141,6 +1160,8 @@ async function recursiveFindObjTypeTypePathToAnotherObjType(
1141
1160
 
1142
1161
 
1143
1162
  export default {
1163
+ initSchemaFn,
1164
+
1144
1165
  combineLogicalStructure,
1145
1166
  // combineOperation,
1146
1167
  // combineLogicalElements,
@@ -23,7 +23,7 @@ import lodash from 'lodash';
23
23
  const { isEmpty } = lodash;
24
24
  import filtersSharedLib from './FiltersSharedLib.js'; //const filtersSharedLib = require('./FiltersSharedLib');
25
25
  import dataFieldsSharedLib from './DataFieldsSharedLib.js';
26
-
26
+ import LogicalStructureSharedLib from './LogicalStructureSharedLib.js';
27
27
 
28
28
  async function createSearchRequest(
29
29
  objType,
@@ -34,7 +34,8 @@ async function createSearchRequest(
34
34
  perParentCombinations,
35
35
  requiredDataLinkStepObjects,
36
36
  requiredDataLinkSteps,
37
- values
37
+ values,
38
+ getSchemaFn
38
39
  ) {
39
40
  console.log('createSearchResult: ', {
40
41
  objType,
@@ -53,6 +54,7 @@ async function createSearchRequest(
53
54
  let errorsObject = {};
54
55
  let errorsFound = [];
55
56
 
57
+
56
58
  let requiredDataPromise = dataFieldsSharedLib.createRequiredData(
57
59
  objType,
58
60
  requiredDataFields,
@@ -61,6 +63,7 @@ async function createSearchRequest(
61
63
  requiredDataLinkStepObjects,
62
64
  requiredDataLinkSteps,
63
65
  values,
66
+ getSchemaFn
64
67
  );
65
68
 
66
69
  //* create complexFilter normalize to send backend
@@ -88,6 +91,8 @@ async function createSearchRequest(
88
91
  Object.assign(errorsObject, complexErrorsObject);
89
92
  }
90
93
 
94
+ filterElements = complexFilterRequest.filterElements;
95
+
91
96
  // let requiredData = dataFieldsSharedLib.createRequiredData(
92
97
  // objType,
93
98
  // requiredDataFields,
@@ -100,18 +105,16 @@ async function createSearchRequest(
100
105
  let requiredData = await requiredDataPromise;
101
106
  console.log('return create requiredData: ', requiredData);
102
107
 
103
- if (requiredData.status === 'invalid' || requiredData.errorsFound.length > 0) {
104
- Object.assign(errorsObject, requiredData.errorsObject)
105
- errorsFound.push('requiredData cannot create');
106
- errorsFound = errorsFound.concat(requiredData.errorsFound);
107
- }
108
+ // if (requiredData.status === 'invalid' || requiredData.errorsFound.length > 0) {
109
+ // Object.assign(errorsObject, requiredData.errorsObject)
110
+ // errorsFound.push('requiredData cannot create');
111
+ // errorsFound = errorsFound.concat(requiredData.errorsFound);
112
+ // }
108
113
 
109
114
  if (errorsFound.length > 0) {
110
115
  return [null, 'invalid', errorsObject, errorsFound]
111
116
  }
112
117
 
113
- filterElements = complexFilterRequest.filterElements;
114
-
115
118
  if (!isEmpty(requiredData.perParentCombinations)) {
116
119
  for (const filterObject of Object.values(requiredData.perParentCombinations)) {
117
120
  Object.assign(filterElements, filterObject.filterElements);
@@ -162,7 +165,7 @@ async function createSortRequest(
162
165
  requiredDataLinkStepObjects,
163
166
  requiredDataLinkSteps,
164
167
  sortFields,
165
- values
168
+ values,
166
169
  ) {
167
170
  console.log('createSortResult: ', {
168
171
  objType,
@@ -227,7 +230,7 @@ async function createSortRequest(
227
230
  });
228
231
 
229
232
  if (errorsFound.length > 0) {
230
- return [null, 'invalid', errorsObject, errorsFound]
233
+ return [null, null, 'invalid', errorsObject, errorsFound]
231
234
  }
232
235
 
233
236
  let searchResultId = searchResultRequest.searchResultId;