@izara_project/izara-shared-search-and-sort 1.0.2 → 1.0.4
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 +3 -3
- package/package.json +1 -1
- package/src/DataFieldsSharedLib.js +121 -93
- package/src/FiltersSharedLib.js +259 -185
- package/src/SearchSortSharedLib.js +27 -30
package/index.js
CHANGED
|
@@ -16,9 +16,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
import SearchSortSharedLib from './src/SearchSortSharedLib';
|
|
20
|
-
import FiltersSharedLib from './src/FiltersSharedLib'
|
|
21
|
-
import DataFieldsSharedLib from './src/DataFieldsSharedLib'
|
|
19
|
+
import SearchSortSharedLib from './src/SearchSortSharedLib.js';
|
|
20
|
+
import FiltersSharedLib from './src/FiltersSharedLib.js'
|
|
21
|
+
import DataFieldsSharedLib from './src/DataFieldsSharedLib.js'
|
|
22
22
|
|
|
23
23
|
export {
|
|
24
24
|
SearchSortSharedLib,
|
package/package.json
CHANGED
|
@@ -23,11 +23,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
23
23
|
// export default [...]
|
|
24
24
|
|
|
25
25
|
import { objectHash as hash } from '@izara_project/izara-shared-core'; //const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
26
|
-
import
|
|
27
|
-
|
|
26
|
+
import lodash from 'lodash';
|
|
27
|
+
const { isEmpty } = lodash;
|
|
28
|
+
import filtersSharedLib from './FiltersSharedLib.js'; //const filtersSharedLib = require('./FiltersSharedLib');
|
|
28
29
|
|
|
29
30
|
async function createRequiredData(
|
|
30
|
-
_izContext,
|
|
31
31
|
objType,
|
|
32
32
|
requiredDataFields,
|
|
33
33
|
complexFilterCombinations,
|
|
@@ -36,7 +36,7 @@ async function createRequiredData(
|
|
|
36
36
|
requiredDataLinkSteps,
|
|
37
37
|
values,
|
|
38
38
|
) {
|
|
39
|
-
|
|
39
|
+
console.log('createRequiredData: ', {
|
|
40
40
|
objType,
|
|
41
41
|
requiredDataFields,
|
|
42
42
|
complexFilterCombinations,
|
|
@@ -56,18 +56,17 @@ async function createRequiredData(
|
|
|
56
56
|
let setComplexFilterCombinations = {};
|
|
57
57
|
let setFilterElementsLink = {}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
console.log('--------------- start requiredData fields ---------------')
|
|
60
60
|
for (const requiredDataFieldId of requiredDataFields) {
|
|
61
|
-
|
|
61
|
+
console.log('extract requiredDataFields: ', requiredDataFieldId);
|
|
62
62
|
|
|
63
63
|
let requiredDataLinkObject = requiredDataLinkStepObjects[requiredDataFieldId];
|
|
64
|
-
|
|
64
|
+
console.log('requiredDataLinkObject: ', requiredDataLinkObject);
|
|
65
65
|
|
|
66
66
|
let linkSteps = requiredDataLinkObject.linkSteps;
|
|
67
|
-
|
|
67
|
+
console.log('initial data: ', { linkSteps });
|
|
68
68
|
|
|
69
69
|
let [fieldName, returnValue, linkPathErrorObject, linkPathErrorsFound] = await createLinkPath(
|
|
70
|
-
_izContext,
|
|
71
70
|
linkSteps,
|
|
72
71
|
requiredDataLinkStepObjects,
|
|
73
72
|
requiredDataLinkSteps,
|
|
@@ -77,7 +76,7 @@ async function createRequiredData(
|
|
|
77
76
|
errorsObject,
|
|
78
77
|
errorsFound
|
|
79
78
|
);
|
|
80
|
-
|
|
79
|
+
console.log('return createLinkPath: ', {
|
|
81
80
|
fieldName,
|
|
82
81
|
returnValue,
|
|
83
82
|
linkPathErrorObject,
|
|
@@ -119,10 +118,10 @@ async function createRequiredData(
|
|
|
119
118
|
initialObjType: objType,
|
|
120
119
|
linkSteps: returnValue.linkSteps
|
|
121
120
|
};
|
|
122
|
-
|
|
121
|
+
console.log('pathObject: ', pathObject);
|
|
123
122
|
|
|
124
123
|
let pathId = hash(pathObject);
|
|
125
|
-
|
|
124
|
+
console.log('pathId: ', pathId);
|
|
126
125
|
|
|
127
126
|
let setObject = {
|
|
128
127
|
fieldName: fieldName,
|
|
@@ -158,10 +157,10 @@ async function createRequiredData(
|
|
|
158
157
|
requiredFieldNameObject.filterElements = returnValue.filterElements;
|
|
159
158
|
Object.assign(setFilterElementsLink, returnValue.filterElements);
|
|
160
159
|
};
|
|
161
|
-
|
|
160
|
+
console.log('requiredFieldNameObject: ', requiredFieldNameObject);
|
|
162
161
|
|
|
163
162
|
let requiredDataFieldNameId = hash(requiredFieldNameObject);
|
|
164
|
-
|
|
163
|
+
console.log('requiredDataFieldNameId: ', requiredDataFieldNameId);
|
|
165
164
|
|
|
166
165
|
if (isEmpty(requiredDataObject)) {
|
|
167
166
|
requiredDataObject = {
|
|
@@ -173,15 +172,15 @@ async function createRequiredData(
|
|
|
173
172
|
};
|
|
174
173
|
|
|
175
174
|
} else {
|
|
176
|
-
|
|
175
|
+
console.log("------- requiredData has only fieldName ---------");
|
|
177
176
|
|
|
178
177
|
let requiredFieldNameObject = {
|
|
179
178
|
fieldName: fieldName
|
|
180
179
|
};
|
|
181
|
-
|
|
180
|
+
console.log("requiredFieldNameObject: ", requiredFieldNameObject);
|
|
182
181
|
|
|
183
182
|
let requiredDataFieldNameId = hash(requiredFieldNameObject);
|
|
184
|
-
|
|
183
|
+
console.log("requiredDataFieldNameId: ", requiredDataFieldNameId);
|
|
185
184
|
|
|
186
185
|
if (isEmpty(requiredDataObject)) {
|
|
187
186
|
|
|
@@ -193,7 +192,7 @@ async function createRequiredData(
|
|
|
193
192
|
requiredDataObject[requiredDataFieldNameId] = requiredFieldNameObject;
|
|
194
193
|
};
|
|
195
194
|
}
|
|
196
|
-
|
|
195
|
+
console.log("before return linkPath: ", { requiredDataObject, linkPathObjects, linkPathSteps });
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
let requiredObject = {};
|
|
@@ -219,11 +218,11 @@ async function createRequiredData(
|
|
|
219
218
|
if (!isEmpty(setFilterElementsLink)) {
|
|
220
219
|
requiredObject.filterElements = setFilterElementsLink;
|
|
221
220
|
};
|
|
222
|
-
|
|
221
|
+
console.log('requiredObject: ', requiredObject);
|
|
223
222
|
|
|
224
223
|
if (!isEmpty(requiredObject)) {
|
|
225
224
|
requiredDataHash = hash(requiredObject);
|
|
226
|
-
|
|
225
|
+
console.log('requiredDataHash: ', requiredDataHash);
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
let status = 'valid"';
|
|
@@ -231,7 +230,7 @@ async function createRequiredData(
|
|
|
231
230
|
status = 'invalid';
|
|
232
231
|
};
|
|
233
232
|
|
|
234
|
-
|
|
233
|
+
console.log('return : ', {
|
|
235
234
|
requiredDataHash: requiredDataHash,
|
|
236
235
|
requiredDataObjects: requiredDataObject,
|
|
237
236
|
linkPathObjects: linkPathObjects,
|
|
@@ -261,7 +260,6 @@ async function createRequiredData(
|
|
|
261
260
|
|
|
262
261
|
|
|
263
262
|
async function createLinkPath(
|
|
264
|
-
_izContext,
|
|
265
263
|
linkSteps,
|
|
266
264
|
requiredDataLinkStepObjects,
|
|
267
265
|
requiredDataLinkSteps,
|
|
@@ -274,7 +272,7 @@ async function createLinkPath(
|
|
|
274
272
|
previousLinkId = null,
|
|
275
273
|
previousLink = null
|
|
276
274
|
) {
|
|
277
|
-
|
|
275
|
+
console.log('create LinkPath: ', {
|
|
278
276
|
linkSteps,
|
|
279
277
|
requiredDataLinkStepObjects,
|
|
280
278
|
requiredDataLinkSteps,
|
|
@@ -302,24 +300,23 @@ async function createLinkPath(
|
|
|
302
300
|
// let childLinkErrors = []
|
|
303
301
|
|
|
304
302
|
let linkStepId = linkSteps[index];
|
|
305
|
-
|
|
303
|
+
console.log('linkStepId: ', linkStepId);
|
|
306
304
|
|
|
307
305
|
let linkStep = requiredDataLinkSteps[linkStepId];
|
|
308
|
-
|
|
306
|
+
console.log('linkStep: ', linkStep);
|
|
309
307
|
|
|
310
308
|
if (index + 1 === linkSteps.length) {
|
|
311
309
|
// last link that has only fieldName
|
|
312
|
-
|
|
310
|
+
console.log('---------- is final link ----------', { index, linkStep });
|
|
313
311
|
|
|
314
312
|
return [linkStep.fieldName, returnValue, errorsObject, errorsFound]
|
|
315
313
|
|
|
316
314
|
} else {
|
|
317
315
|
// has nextLink
|
|
318
|
-
|
|
316
|
+
console.log('---------- is next link ----------', { index, linkStep });
|
|
319
317
|
|
|
320
318
|
let conditionsPromise = checkConditionsLink(
|
|
321
319
|
// let [conditions, conditionErrObject, conditionErrFound] = await this.checkConditionsLink(
|
|
322
|
-
_izContext,
|
|
323
320
|
linkStep.pathLinkType.objType,
|
|
324
321
|
linkStep,
|
|
325
322
|
perParentCombinations,
|
|
@@ -333,7 +330,6 @@ async function createLinkPath(
|
|
|
333
330
|
);
|
|
334
331
|
|
|
335
332
|
[fieldName, returnValue, errorsObject, errorsFound] = await createLinkPath(
|
|
336
|
-
_izContext,
|
|
337
333
|
linkSteps,
|
|
338
334
|
requiredDataLinkStepObjects,
|
|
339
335
|
requiredDataLinkSteps,
|
|
@@ -344,7 +340,7 @@ async function createLinkPath(
|
|
|
344
340
|
errorsFound,
|
|
345
341
|
index + 1
|
|
346
342
|
)
|
|
347
|
-
|
|
343
|
+
console.log('createLinkPath in link', {
|
|
348
344
|
fieldName,
|
|
349
345
|
returnValue,
|
|
350
346
|
errorsObject,
|
|
@@ -352,7 +348,7 @@ async function createLinkPath(
|
|
|
352
348
|
index
|
|
353
349
|
});
|
|
354
350
|
|
|
355
|
-
|
|
351
|
+
console.log('linkStep', linkStep);
|
|
356
352
|
|
|
357
353
|
let [conditions, conditionErrObject, conditionErrFound] = await conditionsPromise;
|
|
358
354
|
|
|
@@ -362,7 +358,7 @@ async function createLinkPath(
|
|
|
362
358
|
};
|
|
363
359
|
|
|
364
360
|
if (!isEmpty(returnValue)) {
|
|
365
|
-
|
|
361
|
+
console.log('----------------- has returnValue ---------------------', { index, fieldName, returnValue, conditions })
|
|
366
362
|
|
|
367
363
|
let linkStepObject = {
|
|
368
364
|
pathLinkType: linkStep.pathLinkType
|
|
@@ -421,7 +417,7 @@ async function createLinkPath(
|
|
|
421
417
|
};
|
|
422
418
|
}
|
|
423
419
|
|
|
424
|
-
|
|
420
|
+
console.log('returnValue', returnValue);
|
|
425
421
|
|
|
426
422
|
} else {
|
|
427
423
|
//* error
|
|
@@ -456,16 +452,16 @@ async function createLinkPath(
|
|
|
456
452
|
};
|
|
457
453
|
};
|
|
458
454
|
|
|
459
|
-
|
|
455
|
+
console.log('linkStepObject', linkStepObject);
|
|
460
456
|
let linkStepId = hash(linkStepObject);
|
|
461
|
-
|
|
457
|
+
console.log('linkStepId', linkStepId);
|
|
462
458
|
|
|
463
459
|
returnValue['linkSteps'].unshift(linkStepId);
|
|
464
460
|
returnValue['linkStepObjects'] = Object.assign({ [linkStepId]: linkStepObject }, returnValue['linkStepObjects']);
|
|
465
|
-
|
|
461
|
+
console.log('returnValue', returnValue);
|
|
466
462
|
|
|
467
463
|
} else {
|
|
468
|
-
|
|
464
|
+
console.log('----------------- no returnValue ---------------------', { index, fieldName, conditions })
|
|
469
465
|
//returnValue: { linkSteps, linkStepsObjects, perParent, combinations, sortFieldLinkStepObjects }
|
|
470
466
|
//sortFieldLinkStepObjects from in sortField in link
|
|
471
467
|
|
|
@@ -556,15 +552,15 @@ async function createLinkPath(
|
|
|
556
552
|
};
|
|
557
553
|
};
|
|
558
554
|
|
|
559
|
-
|
|
555
|
+
console.log('linkStepObject', linkStepObject);
|
|
560
556
|
let linkStepId = hash(linkStepObject);
|
|
561
|
-
|
|
557
|
+
console.log('linkStepId', linkStepId);
|
|
562
558
|
|
|
563
559
|
returnValue.linkSteps = [linkStepId];
|
|
564
560
|
returnValue.linkStepObjects = {
|
|
565
561
|
[linkStepId]: linkStepObject
|
|
566
562
|
};
|
|
567
|
-
|
|
563
|
+
console.log('returnValue', returnValue);
|
|
568
564
|
}
|
|
569
565
|
}
|
|
570
566
|
return [fieldName, returnValue, errorsObject, errorsFound]
|
|
@@ -572,7 +568,6 @@ async function createLinkPath(
|
|
|
572
568
|
|
|
573
569
|
|
|
574
570
|
async function checkConditionsLink(
|
|
575
|
-
_izContext,
|
|
576
571
|
objType,
|
|
577
572
|
linkStepObject,
|
|
578
573
|
perParentCombinations,
|
|
@@ -584,7 +579,7 @@ async function checkConditionsLink(
|
|
|
584
579
|
errorsObject,
|
|
585
580
|
errorsFound
|
|
586
581
|
) {
|
|
587
|
-
|
|
582
|
+
console.log('checkConditionsLink:', {
|
|
588
583
|
objType,
|
|
589
584
|
linkStepObject,
|
|
590
585
|
perParentCombinations,
|
|
@@ -601,16 +596,15 @@ async function checkConditionsLink(
|
|
|
601
596
|
let conditionLinkObject = {}
|
|
602
597
|
|
|
603
598
|
if (linkStepObject.hasOwnProperty('filterElements')) {
|
|
604
|
-
|
|
599
|
+
console.log('------------ has filterElements ------------');
|
|
605
600
|
|
|
606
|
-
let [complexFilterRequest, status, filterErrorsObject, filterErrorsFound] = filtersSharedLib.
|
|
607
|
-
_izContext,
|
|
601
|
+
let [complexFilterRequest, status, filterErrorsObject, filterErrorsFound] = filtersSharedLib.createFiltersRequest(
|
|
608
602
|
linkStepObject.filterElements.objType,
|
|
609
603
|
linkStepObject.filterElements.initialLogicalElementId,
|
|
610
604
|
linkStepObject.filterElements.logicalElements,
|
|
611
605
|
values
|
|
612
606
|
);
|
|
613
|
-
|
|
607
|
+
console.log('return complexFilter for filterElements: ', {
|
|
614
608
|
complexFilterRequest,
|
|
615
609
|
status,
|
|
616
610
|
filterErrorsObject,
|
|
@@ -622,11 +616,11 @@ async function checkConditionsLink(
|
|
|
622
616
|
errorsFound = errorsFound.concat(filterErrorsFound)
|
|
623
617
|
};
|
|
624
618
|
conditionLinkObject.filterElements = complexFilterRequest.filterElements;
|
|
625
|
-
|
|
619
|
+
console.log('conditionLinkObject in condition link: ', conditionLinkObject);
|
|
626
620
|
}
|
|
627
621
|
|
|
628
622
|
if (linkStepObject.hasOwnProperty('aggregate')) {
|
|
629
|
-
|
|
623
|
+
console.log('------------ has aggregate ------------');
|
|
630
624
|
if (!linkStepObject.hasOwnProperty('sortFields')) {
|
|
631
625
|
errorsFound.push('if has aggregate need to has sortFields, too');
|
|
632
626
|
};
|
|
@@ -648,19 +642,18 @@ async function checkConditionsLink(
|
|
|
648
642
|
let setPerParentCombinations = {};
|
|
649
643
|
let setFilterElements = {};
|
|
650
644
|
|
|
651
|
-
|
|
645
|
+
console.log('linkStepObject.sortFields', linkStepObject.sortFields);
|
|
652
646
|
|
|
653
647
|
for (const sortField of linkStepObject.sortFields) {
|
|
654
|
-
|
|
655
|
-
|
|
648
|
+
console.log('sortField: ', sortField);
|
|
649
|
+
console.log('requiredDataLinkSteps: ', requiredDataLinkSteps);
|
|
656
650
|
let requiredDataLinkStepSortField = requiredDataLinkStepObjects[sortField.requiredDataLinkStepObjectId];
|
|
657
|
-
|
|
651
|
+
console.log('requiredDataLinkStepSortField: ', requiredDataLinkStepSortField);
|
|
658
652
|
|
|
659
|
-
|
|
653
|
+
console.log(' requiredDataLinkStepSortField.linkSteps: ', requiredDataLinkStepSortField.linkSteps);
|
|
660
654
|
|
|
661
655
|
//* make all linkPath in here and send out to combine allLinkPath
|
|
662
656
|
let [fieldName, childLinkStep, linkErrorsObject, linkErrorsFound] = await createLinkPath(
|
|
663
|
-
_izContext,
|
|
664
657
|
requiredDataLinkStepSortField.linkSteps,
|
|
665
658
|
requiredDataLinkStepObjects,
|
|
666
659
|
requiredDataLinkSteps,
|
|
@@ -670,7 +663,7 @@ async function checkConditionsLink(
|
|
|
670
663
|
errorsObject,
|
|
671
664
|
errorsFound
|
|
672
665
|
);
|
|
673
|
-
|
|
666
|
+
console.log(' cratelinkPath in checkCondition for sortField: ', {
|
|
674
667
|
fieldName,
|
|
675
668
|
childLinkStep,
|
|
676
669
|
linkErrorsObject,
|
|
@@ -684,12 +677,12 @@ async function checkConditionsLink(
|
|
|
684
677
|
initialObjType: objType,
|
|
685
678
|
linkSteps: childLinkStep.linkSteps
|
|
686
679
|
};
|
|
687
|
-
|
|
680
|
+
console.log('pathObject: ', pathObject);
|
|
688
681
|
|
|
689
682
|
let pathId = hash(pathObject);
|
|
690
|
-
|
|
683
|
+
console.log('pathId: ', pathId);
|
|
691
684
|
|
|
692
|
-
|
|
685
|
+
console.log('linkPathObjects xxxxxx: ', linkPathObjects);
|
|
693
686
|
|
|
694
687
|
Object.assign(linkPathObjects, { [pathId]: pathObject });
|
|
695
688
|
|
|
@@ -735,7 +728,7 @@ async function checkConditionsLink(
|
|
|
735
728
|
fieldName: fieldName,
|
|
736
729
|
dataType: sortField.dataType
|
|
737
730
|
});
|
|
738
|
-
|
|
731
|
+
console.log('sortFieldObjects: ', sortFieldObjects);
|
|
739
732
|
|
|
740
733
|
};
|
|
741
734
|
|
|
@@ -758,7 +751,7 @@ async function checkConditionsLink(
|
|
|
758
751
|
};
|
|
759
752
|
};
|
|
760
753
|
|
|
761
|
-
|
|
754
|
+
console.log('conditionLinkObject: ', conditionLinkObject);
|
|
762
755
|
|
|
763
756
|
} else {
|
|
764
757
|
if (linkStepObject.hasOwnProperty('combine')) {
|
|
@@ -767,7 +760,7 @@ async function checkConditionsLink(
|
|
|
767
760
|
};
|
|
768
761
|
|
|
769
762
|
if (linkStepObject.hasOwnProperty('requestProperties')) {
|
|
770
|
-
|
|
763
|
+
console.log('------------ link has requestProperties ------------');
|
|
771
764
|
|
|
772
765
|
let perParentCombinationIds = [];
|
|
773
766
|
let perParentCombinationObjects = {}
|
|
@@ -775,27 +768,26 @@ async function checkConditionsLink(
|
|
|
775
768
|
let applyCombinations = [];
|
|
776
769
|
|
|
777
770
|
for (const [tag, requestPropertyId] of Object.entries(linkStepObject.requestProperties)) {
|
|
778
|
-
|
|
771
|
+
console.log('extract requestProperties', { tag, requestPropertyId });
|
|
779
772
|
let requestPropertyObject = values[requestPropertyId];
|
|
780
|
-
|
|
773
|
+
console.log('extract requestProperties', requestPropertyObject);
|
|
781
774
|
|
|
782
775
|
|
|
783
776
|
if (requestPropertyObject.hasOwnProperty('valueSource')) {
|
|
784
777
|
|
|
785
778
|
if (requestPropertyObject.valueSource === 'perParentCombination') {
|
|
786
|
-
|
|
779
|
+
console.log('------------- perParentCombinations -------------');
|
|
787
780
|
|
|
788
781
|
let perParentCombinationObject = perParentCombinations[requestPropertyObject.perParentCombinationId];
|
|
789
|
-
|
|
782
|
+
console.log('perParentCombinationObject', perParentCombinationObject);
|
|
790
783
|
|
|
791
|
-
let [complexFilterRequest, status, perParentErrorsObject, perParentErrorsFound] = filtersSharedLib.
|
|
792
|
-
_izContext,
|
|
784
|
+
let [complexFilterRequest, status, perParentErrorsObject, perParentErrorsFound] = filtersSharedLib.createFiltersRequest(
|
|
793
785
|
perParentCombinationObject.objType,
|
|
794
786
|
perParentCombinationObject.initialLogicalElementId,
|
|
795
787
|
perParentCombinationObject.logicalElements,
|
|
796
788
|
values,
|
|
797
789
|
);
|
|
798
|
-
|
|
790
|
+
console.log('return complexFilter for perParentCombinations: ', {
|
|
799
791
|
complexFilterRequest,
|
|
800
792
|
status,
|
|
801
793
|
perParentErrorsObject,
|
|
@@ -819,25 +811,24 @@ async function checkConditionsLink(
|
|
|
819
811
|
filterElements: complexFilterRequest.filterElements
|
|
820
812
|
}
|
|
821
813
|
});
|
|
822
|
-
|
|
814
|
+
console.log('set perParentCombinations: ', { perParentCombinationIds, perParentCombinationObjects });
|
|
823
815
|
|
|
824
816
|
} else if (requestPropertyObject.valueSource === 'complexFilterCombination') {
|
|
825
|
-
|
|
817
|
+
console.log('------------- complexFilterCombination will set applyCombinations -------------', complexFilterCombinations);
|
|
826
818
|
|
|
827
819
|
let complexFilterCombinationId = requestPropertyObject.complexFilterCombinationId;
|
|
828
|
-
|
|
820
|
+
console.log('complexFilterCombinationId: ', complexFilterCombinationId);
|
|
829
821
|
|
|
830
822
|
let complexFilterCombinationObject = complexFilterCombinations[complexFilterCombinationId];
|
|
831
|
-
|
|
823
|
+
console.log('complexFilterCombinationObject: ', complexFilterCombinationObject);
|
|
832
824
|
|
|
833
|
-
let [complexFilterRequest, status, complexFilterErrorsObject, complexFilterErrorsFound] = filtersSharedLib.
|
|
834
|
-
_izContext,
|
|
825
|
+
let [complexFilterRequest, status, complexFilterErrorsObject, complexFilterErrorsFound] = filtersSharedLib.createFiltersRequest(
|
|
835
826
|
complexFilterCombinationObject.objType,
|
|
836
827
|
complexFilterCombinationObject.initialLogicalElementId,
|
|
837
828
|
complexFilterCombinationObject.logicalElements,
|
|
838
829
|
values
|
|
839
830
|
);
|
|
840
|
-
|
|
831
|
+
console.log('return complexFilter for complexFilterCombinations: ', {
|
|
841
832
|
complexFilterRequest,
|
|
842
833
|
status,
|
|
843
834
|
complexFilterErrorsObject,
|
|
@@ -857,7 +848,7 @@ async function checkConditionsLink(
|
|
|
857
848
|
filterMainId: complexFilterRequest.filterMainId,
|
|
858
849
|
// identifiersFieldName: requestPropertyObject.identifierFieldName
|
|
859
850
|
});
|
|
860
|
-
|
|
851
|
+
console.log('applyCombinations: ', applyCombinations);
|
|
861
852
|
|
|
862
853
|
Object.assign(complexFilterCombinationObjects, {
|
|
863
854
|
[complexFilterRequest.filterMainId]: {
|
|
@@ -889,7 +880,7 @@ async function checkConditionsLink(
|
|
|
889
880
|
};
|
|
890
881
|
};
|
|
891
882
|
|
|
892
|
-
|
|
883
|
+
console.log('perParentCombinations: ', {
|
|
893
884
|
perParentCombinationIds,
|
|
894
885
|
perParentCombinationObjects,
|
|
895
886
|
applyCombinations
|
|
@@ -904,15 +895,14 @@ async function checkConditionsLink(
|
|
|
904
895
|
conditionLinkObject.applyCombinations = applyCombinations
|
|
905
896
|
conditionLinkObject.complexFilterCombinationObjects = complexFilterCombinationObjects;
|
|
906
897
|
};
|
|
907
|
-
|
|
898
|
+
console.log('conditionLinkObject: ', conditionLinkObject);
|
|
908
899
|
}
|
|
909
|
-
|
|
900
|
+
console.log('conditionLinkObject', conditionLinkObject);
|
|
910
901
|
return [conditionLinkObject, errorsObject, errorsFound];
|
|
911
902
|
}
|
|
912
903
|
|
|
913
904
|
|
|
914
905
|
function checkConditionsLinkStep(
|
|
915
|
-
_izContext,
|
|
916
906
|
multipleIdentifiers,
|
|
917
907
|
linkConfig,
|
|
918
908
|
combine
|
|
@@ -934,7 +924,7 @@ function checkConditionsLinkStep(
|
|
|
934
924
|
}
|
|
935
925
|
|
|
936
926
|
let requestProperties = false;
|
|
937
|
-
if (linkConfig.hasOwnProperty('requestProperties')) {
|
|
927
|
+
if (linkConfig.hasOwnProperty('requestProperties') && !isEmpty(linkConfig.requestProperties)) {
|
|
938
928
|
requestProperties = true;
|
|
939
929
|
}
|
|
940
930
|
if (multipleIdentifiers) {
|
|
@@ -983,44 +973,82 @@ function checkConditionsLinkStep(
|
|
|
983
973
|
|
|
984
974
|
|
|
985
975
|
function checkMultipleIdentifers(
|
|
986
|
-
_izContext,
|
|
987
976
|
linkConfig = {},
|
|
988
|
-
|
|
989
|
-
comparison = false,
|
|
990
|
-
combine = false,
|
|
991
|
-
applyCombinations = false,
|
|
977
|
+
conditions = {},
|
|
992
978
|
multipleIdentifiers = false,
|
|
979
|
+
//
|
|
993
980
|
) {
|
|
981
|
+
// conditions: {
|
|
982
|
+
// aggregate ,
|
|
983
|
+
// comparison,
|
|
984
|
+
// combine ,
|
|
985
|
+
// applyCombinations ,
|
|
986
|
+
// multipleIdentifiers,
|
|
987
|
+
// }
|
|
988
|
+
|
|
994
989
|
let manyIdentifiers = null;
|
|
990
|
+
|
|
995
991
|
if (!isEmpty(linkConfig)) {
|
|
992
|
+
|
|
996
993
|
let toMany = false;
|
|
997
994
|
if (linkConfig.other.linkType === 'many') {
|
|
998
995
|
toMany = true;
|
|
999
996
|
};
|
|
1000
997
|
|
|
1001
998
|
if (multipleIdentifiers) {
|
|
999
|
+
|
|
1002
1000
|
if (toMany || !toMany) {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
if (aggregate) {
|
|
1007
|
-
|
|
1001
|
+
|
|
1002
|
+
if (conditions.hasOwnProperty("combine") && conditions.combine === true) {
|
|
1003
|
+
|
|
1004
|
+
if (conditions.hasOwnProperty("aggregate")) {
|
|
1005
|
+
if (conditions.aggregate === true) {
|
|
1006
|
+
manyIdentifiers = false;
|
|
1007
|
+
}
|
|
1008
1008
|
}
|
|
1009
|
+
|
|
1010
|
+
} else {
|
|
1011
|
+
manyIdentifiers = true;
|
|
1009
1012
|
}
|
|
1010
1013
|
}
|
|
1014
|
+
|
|
1011
1015
|
} else {
|
|
1016
|
+
|
|
1012
1017
|
if (toMany) {
|
|
1013
|
-
|
|
1018
|
+
|
|
1019
|
+
if (conditions.hasOwnProperty("aggregate") && conditions.aggregate === true) {
|
|
1014
1020
|
manyIdentifiers = false;
|
|
1015
1021
|
} else {
|
|
1016
1022
|
manyIdentifiers = true;
|
|
1017
1023
|
}
|
|
1024
|
+
|
|
1018
1025
|
} else {
|
|
1019
|
-
|
|
1026
|
+
|
|
1027
|
+
if (isEmpty(conditions)) {
|
|
1028
|
+
|
|
1020
1029
|
manyIdentifiers = false;
|
|
1030
|
+
|
|
1031
|
+
} else {
|
|
1032
|
+
|
|
1033
|
+
if (conditions.hasOwnProperty("applyCombinations") && conditions.applyCombinations === true) {
|
|
1034
|
+
manyIdentifiers = true;
|
|
1035
|
+
} else {
|
|
1036
|
+
|
|
1037
|
+
if ((conditions.hasOwnProperty("aggregate") && conditions.aggregate === true)
|
|
1038
|
+
|| (conditions.hasOwnProperty("combine") && conditions.combine === true)
|
|
1039
|
+
|| (conditions.hasOwnProperty("comparison") && conditions.comparison === true)
|
|
1040
|
+
) {
|
|
1041
|
+
manyIdentifiers = null;
|
|
1042
|
+
} else {
|
|
1043
|
+
manyIdentifiers = false;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1021
1046
|
}
|
|
1022
1047
|
}
|
|
1023
1048
|
}
|
|
1049
|
+
|
|
1050
|
+
} else {
|
|
1051
|
+
manyIdentifiers = false
|
|
1024
1052
|
}
|
|
1025
1053
|
return manyIdentifiers
|
|
1026
1054
|
}
|