@izara_project/izara-shared-search-and-sort 1.0.10 → 1.0.11
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 +1 -1
- package/src/DataFieldsSharedLib.js +201 -132
- package/src/FiltersSharedLib.js +357 -651
- package/src/LogicalStructureSharedLib.js +159 -474
- package/src/SearchSortSharedLib.js +63 -35
package/package.json
CHANGED
|
@@ -37,7 +37,7 @@ async function createRequiredData(
|
|
|
37
37
|
perParentCombinations,
|
|
38
38
|
requiredDataLinkStepObjects,
|
|
39
39
|
requiredDataLinkSteps,
|
|
40
|
-
|
|
40
|
+
valueUserTags,
|
|
41
41
|
) {
|
|
42
42
|
console.log('createRequiredData: ', {
|
|
43
43
|
objType,
|
|
@@ -48,7 +48,7 @@ async function createRequiredData(
|
|
|
48
48
|
perParentCombinations,
|
|
49
49
|
requiredDataLinkStepObjects,
|
|
50
50
|
requiredDataLinkSteps,
|
|
51
|
-
|
|
51
|
+
valueUserTags,
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
let errorsObject = {};
|
|
@@ -79,7 +79,7 @@ async function createRequiredData(
|
|
|
79
79
|
requiredDataLinkSteps,
|
|
80
80
|
perParentCombinations,
|
|
81
81
|
complexFilterCombinations,
|
|
82
|
-
|
|
82
|
+
valueUserTags,
|
|
83
83
|
{
|
|
84
84
|
objType: objType,
|
|
85
85
|
initialLogicalElementId: initialLogicalElementId,
|
|
@@ -98,7 +98,14 @@ async function createRequiredData(
|
|
|
98
98
|
|
|
99
99
|
if (linkPathErrorsFound.length > 0 || fieldName === null) {
|
|
100
100
|
Object.assign(errorsObject, linkPathErrorObject);
|
|
101
|
-
|
|
101
|
+
|
|
102
|
+
for (const linkPathErr of linkPathErrorsFound) {
|
|
103
|
+
if (!errorsFound.includes(linkPathErr)) {
|
|
104
|
+
errorsFound.push(linkPathErr);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// errorsFound = errorsFound.concat(linkPathErrorsFound);
|
|
102
109
|
return {
|
|
103
110
|
requiredDataHash: null,
|
|
104
111
|
requiredDataObject: requiredDataObject,
|
|
@@ -141,7 +148,6 @@ async function createRequiredData(
|
|
|
141
148
|
};
|
|
142
149
|
|
|
143
150
|
if (returnValue.hasOwnProperty('complexFilterCombinations')) {
|
|
144
|
-
// requiredFieldNameObject.complexFilterCombinations = returnValue.complexFilterCombinations;
|
|
145
151
|
Object.assign(setComplexFilterCombinations, returnValue.complexFilterCombinations);
|
|
146
152
|
|
|
147
153
|
setObject.complexFilterCombinationIds = []
|
|
@@ -193,7 +199,6 @@ async function createRequiredData(
|
|
|
193
199
|
fieldName: {
|
|
194
200
|
fieldName: fieldName
|
|
195
201
|
},
|
|
196
|
-
//* don hash
|
|
197
202
|
linkPathObjects: {},
|
|
198
203
|
linkPathSteps: {}
|
|
199
204
|
};
|
|
@@ -227,17 +232,17 @@ async function createRequiredData(
|
|
|
227
232
|
};
|
|
228
233
|
};
|
|
229
234
|
|
|
230
|
-
if (!isEmpty(setComplexFilterCombinations)) {
|
|
231
|
-
|
|
232
|
-
};
|
|
235
|
+
// if (!isEmpty(setComplexFilterCombinations)) {
|
|
236
|
+
// requiredObject.complexFilterCombinations = setComplexFilterCombinations;
|
|
237
|
+
// };
|
|
233
238
|
|
|
234
|
-
if (!isEmpty(setPerParentCombinations)) {
|
|
235
|
-
|
|
236
|
-
};
|
|
239
|
+
// if (!isEmpty(setPerParentCombinations)) {
|
|
240
|
+
// requiredObject.perParentCombinations = setPerParentCombinations;
|
|
241
|
+
// };
|
|
237
242
|
|
|
238
|
-
if (!isEmpty(setFilterElementsLink)) {
|
|
239
|
-
|
|
240
|
-
};
|
|
243
|
+
// if (!isEmpty(setFilterElementsLink)) {
|
|
244
|
+
// requiredObject.filterElements = setFilterElementsLink;
|
|
245
|
+
// };
|
|
241
246
|
console.log('requiredObject: ', requiredObject);
|
|
242
247
|
|
|
243
248
|
if (!isEmpty(requiredObject)) {
|
|
@@ -286,14 +291,12 @@ async function createLinkPath(
|
|
|
286
291
|
requiredDataLinkSteps,
|
|
287
292
|
perParentCombinations,
|
|
288
293
|
complexFilterCombinations,
|
|
289
|
-
|
|
294
|
+
valueUserTags,
|
|
290
295
|
filtersStructure,
|
|
291
296
|
path,
|
|
292
297
|
errorsObject,
|
|
293
298
|
errorsFound,
|
|
294
|
-
index = 0
|
|
295
|
-
previousLinkId = null,
|
|
296
|
-
previousLink = null
|
|
299
|
+
index = 0
|
|
297
300
|
) {
|
|
298
301
|
console.log('create LinkPath: ', {
|
|
299
302
|
linkSteps,
|
|
@@ -301,14 +304,12 @@ async function createLinkPath(
|
|
|
301
304
|
requiredDataLinkSteps,
|
|
302
305
|
perParentCombinations,
|
|
303
306
|
complexFilterCombinations,
|
|
304
|
-
|
|
307
|
+
valueUserTags,
|
|
305
308
|
filtersStructure,
|
|
306
309
|
path,
|
|
307
310
|
errorsObject,
|
|
308
311
|
errorsFound,
|
|
309
|
-
index
|
|
310
|
-
previousLinkId,
|
|
311
|
-
previousLink
|
|
312
|
+
index
|
|
312
313
|
});
|
|
313
314
|
let fieldName = null;
|
|
314
315
|
let returnValue = {}; //* must return only linkPath params
|
|
@@ -351,13 +352,13 @@ async function createLinkPath(
|
|
|
351
352
|
// console.log('---------- is next link ----------', hhhh);
|
|
352
353
|
}
|
|
353
354
|
|
|
354
|
-
let conditionsPromise = checkConditionsLink(
|
|
355
|
-
|
|
355
|
+
// let conditionsPromise = checkConditionsLink(
|
|
356
|
+
let [conditions, conditionErrObject, conditionErrFound] = await checkConditionsLink(
|
|
356
357
|
linkStep.pathLinkType.objType,
|
|
357
358
|
linkStep,
|
|
358
359
|
perParentCombinations,
|
|
359
360
|
complexFilterCombinations,
|
|
360
|
-
|
|
361
|
+
valueUserTags,
|
|
361
362
|
filtersStructure,
|
|
362
363
|
linkSteps,
|
|
363
364
|
requiredDataLinkStepObjects,
|
|
@@ -366,11 +367,11 @@ async function createLinkPath(
|
|
|
366
367
|
errorsObject,
|
|
367
368
|
errorsFound
|
|
368
369
|
);
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
370
|
+
console.log('checkConditionsLink in link', {
|
|
371
|
+
conditions,
|
|
372
|
+
conditionErrObject,
|
|
373
|
+
conditionErrFound
|
|
374
|
+
});
|
|
374
375
|
|
|
375
376
|
[fieldName, returnValue, errorsObject, errorsFound, sortObj] = await createLinkPath(
|
|
376
377
|
linkStep.pathLinkType.objType,
|
|
@@ -379,7 +380,7 @@ async function createLinkPath(
|
|
|
379
380
|
requiredDataLinkSteps,
|
|
380
381
|
perParentCombinations,
|
|
381
382
|
complexFilterCombinations,
|
|
382
|
-
|
|
383
|
+
valueUserTags,
|
|
383
384
|
filtersStructure,
|
|
384
385
|
path,
|
|
385
386
|
errorsObject,
|
|
@@ -394,21 +395,25 @@ async function createLinkPath(
|
|
|
394
395
|
index
|
|
395
396
|
});
|
|
396
397
|
|
|
397
|
-
if (errorsFound.length > 0) {
|
|
398
|
-
return [null, null, errorsObject, errorsFound]
|
|
399
|
-
}
|
|
400
|
-
|
|
401
398
|
console.log('linkStep', linkStep);
|
|
402
399
|
|
|
403
|
-
let [conditions, conditionErrObject, conditionErrFound] = await conditionsPromise;
|
|
404
|
-
|
|
400
|
+
// let [conditions, conditionErrObject, conditionErrFound] = await conditionsPromise;
|
|
405
401
|
if (conditionErrFound.length > 0) {
|
|
406
402
|
Object.assign(errorsObject, conditionErrObject);
|
|
407
|
-
errorsFound = errorsFound.concat(conditionErrFound);
|
|
408
403
|
|
|
409
|
-
|
|
404
|
+
for (const conditionErr of conditionErrFound) {
|
|
405
|
+
if (!errorsFound.includes(conditionErr)) {
|
|
406
|
+
errorsFound.push(conditionErr);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
// errorsFound = errorsFound.concat(conditionErrFound);
|
|
410
|
+
// return [null, null, errorsObject, errorsFound]
|
|
410
411
|
};
|
|
411
412
|
|
|
413
|
+
if (errorsFound.length > 0) {
|
|
414
|
+
return [null, null, errorsObject, errorsFound];
|
|
415
|
+
}
|
|
416
|
+
|
|
412
417
|
if (!isEmpty(returnValue)) {
|
|
413
418
|
console.log('----------------- has returnValue ---------------------', { index, fieldName, returnValue, conditions })
|
|
414
419
|
|
|
@@ -417,13 +422,13 @@ async function createLinkPath(
|
|
|
417
422
|
}
|
|
418
423
|
|
|
419
424
|
if (conditions.hasOwnProperty('filterElements')) {
|
|
420
|
-
for (const filterElementId of Object.
|
|
425
|
+
for (const [filterElementId, filterElements] of Object.entries(conditions.filterElements)) {
|
|
421
426
|
linkStepObject.filterElementId = filterElementId;
|
|
422
427
|
|
|
423
428
|
if (returnValue.hasOwnProperty('filterElements')) {
|
|
424
|
-
Object.assign(returnValue['filterElements'],
|
|
429
|
+
Object.assign(returnValue['filterElements'], filterElements);
|
|
425
430
|
} else {
|
|
426
|
-
returnValue.filterElements = conditions.filterElements;
|
|
431
|
+
returnValue.filterElements = filterElements;// conditions.filterElements;
|
|
427
432
|
}
|
|
428
433
|
}
|
|
429
434
|
}
|
|
@@ -442,7 +447,7 @@ async function createLinkPath(
|
|
|
442
447
|
if (conditions.hasOwnProperty('linkPathObjects')) {
|
|
443
448
|
if (conditions.hasOwnProperty('linkStepObjects')) {
|
|
444
449
|
|
|
445
|
-
linkStepObject.
|
|
450
|
+
linkStepObject.requiredDataObjects = conditions.requiredDataFields;
|
|
446
451
|
|
|
447
452
|
if (returnValue.hasOwnProperty("sortFieldLinkPathObjects")) {
|
|
448
453
|
Object.assign(returnValue.sortFieldLinkPathObjects["linkPathObjects"], conditions.linkPathObjects);
|
|
@@ -527,6 +532,19 @@ async function createLinkPath(
|
|
|
527
532
|
};
|
|
528
533
|
};
|
|
529
534
|
|
|
535
|
+
if (conditions.hasOwnProperty("comparison")) {
|
|
536
|
+
if (conditions.hasOwnProperty("comparisonSortField")) {
|
|
537
|
+
if (conditions.hasOwnProperty("comparisonValue")) {
|
|
538
|
+
if (conditions.hasOwnProperty('comparisonSortDataType')) {
|
|
539
|
+
linkStepObject.comparison = conditions.comparison;
|
|
540
|
+
linkStepObject.comparisonSortField = conditions.comparisonSortField;
|
|
541
|
+
linkStepObject.comparisonSortDataType = conditions.comparisonSortDataType;
|
|
542
|
+
linkStepObject.comparisonValue = conditions.comparisonValue;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
530
548
|
console.log('linkStepObject', linkStepObject);
|
|
531
549
|
let linkStepId = hash(linkStepObject);
|
|
532
550
|
console.log('linkStepId', linkStepId);
|
|
@@ -545,9 +563,9 @@ async function createLinkPath(
|
|
|
545
563
|
};
|
|
546
564
|
|
|
547
565
|
if (conditions.hasOwnProperty('filterElements')) {
|
|
548
|
-
for (const filterElementId of Object.
|
|
566
|
+
for (const [filterElementId, filterElements] of Object.entries(conditions.filterElements)) {
|
|
549
567
|
linkStepObject.filterElementId = filterElementId;
|
|
550
|
-
returnValue.filterElements =
|
|
568
|
+
returnValue.filterElements = filterElements;
|
|
551
569
|
};
|
|
552
570
|
};
|
|
553
571
|
|
|
@@ -565,7 +583,7 @@ async function createLinkPath(
|
|
|
565
583
|
if (conditions.hasOwnProperty('linkPathObjects')) {
|
|
566
584
|
if (conditions.hasOwnProperty('linkStepObjects')) {
|
|
567
585
|
|
|
568
|
-
linkStepObject.
|
|
586
|
+
linkStepObject.requiredDataObjects = conditions.requiredDataFields;
|
|
569
587
|
|
|
570
588
|
if (returnValue.hasOwnProperty("sortFieldLinkPathObjects")) {
|
|
571
589
|
Object.assign(returnValue.sortFieldLinkPathObjects["linkPathObjects"], conditions.linkPathObjects);
|
|
@@ -590,15 +608,32 @@ async function createLinkPath(
|
|
|
590
608
|
if (conditions.hasOwnProperty("setFilterCombinations") && !isEmpty(conditions.setFilterCombinations)) {
|
|
591
609
|
|
|
592
610
|
if (conditions.setFilterCombinations.hasOwnProperty('filterElements')) {
|
|
593
|
-
|
|
611
|
+
if (returnValue.hasOwnProperty("filterElements")) {
|
|
612
|
+
Object.assign(returnValue["filterElements"], conditions.setFilterCombinations.filterElements);
|
|
613
|
+
} else {
|
|
614
|
+
returnValue.filterElements = {}
|
|
615
|
+
Object.assign(returnValue["filterElements"], conditions.setFilterCombinations.filterElements);
|
|
616
|
+
}
|
|
594
617
|
}
|
|
595
618
|
|
|
596
619
|
if (conditions.setFilterCombinations.hasOwnProperty('perParentCombinations')) {
|
|
597
|
-
Object.assign(returnValue["perParentCombinations"], conditions.perParentCombinations);
|
|
620
|
+
// Object.assign(returnValue["perParentCombinations"], conditions.perParentCombinations);
|
|
621
|
+
if (returnValue.hasOwnProperty("perParentCombinations")) {
|
|
622
|
+
Object.assign(returnValue["perParentCombinations"], conditions.setFilterCombinations.perParentCombinations);
|
|
623
|
+
} else {
|
|
624
|
+
returnValue.perParentCombinations = {}
|
|
625
|
+
Object.assign(returnValue["perParentCombinations"], conditions.setFilterCombinations.perParentCombinations);
|
|
626
|
+
}
|
|
598
627
|
};
|
|
599
628
|
|
|
600
629
|
if (conditions.setFilterCombinations.hasOwnProperty('complexFilterCombinations')) {
|
|
601
|
-
Object.assign(returnValue['complexFilterCombinations'], conditions.complexFilterCombinations);
|
|
630
|
+
// Object.assign(returnValue['complexFilterCombinations'], conditions.complexFilterCombinations);
|
|
631
|
+
if (returnValue.hasOwnProperty("complexFilterCombinations")) {
|
|
632
|
+
Object.assign(returnValue["complexFilterCombinations"], conditions.setFilterCombinations.complexFilterCombinations);
|
|
633
|
+
} else {
|
|
634
|
+
returnValue.complexFilterCombinations = {}
|
|
635
|
+
Object.assign(returnValue["complexFilterCombinations"], conditions.setFilterCombinations.complexFilterCombinations);
|
|
636
|
+
}
|
|
602
637
|
};
|
|
603
638
|
}
|
|
604
639
|
|
|
@@ -628,12 +663,16 @@ async function createLinkPath(
|
|
|
628
663
|
};
|
|
629
664
|
};
|
|
630
665
|
|
|
666
|
+
|
|
631
667
|
if (conditions.hasOwnProperty("comparison")) {
|
|
632
668
|
if (conditions.hasOwnProperty("comparisonSortField")) {
|
|
633
669
|
if (conditions.hasOwnProperty("comparisonValue")) {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
670
|
+
if (conditions.hasOwnProperty('comparisonSortDataType')) {
|
|
671
|
+
linkStepObject.comparison = conditions.comparison;
|
|
672
|
+
linkStepObject.comparisonSortField = conditions.comparisonSortField;
|
|
673
|
+
linkStepObject.comparisonSortDataType = conditions.comparisonSortDataType;
|
|
674
|
+
linkStepObject.comparisonValue = conditions.comparisonValue;
|
|
675
|
+
}
|
|
637
676
|
}
|
|
638
677
|
}
|
|
639
678
|
}
|
|
@@ -658,7 +697,7 @@ async function checkConditionsLink(
|
|
|
658
697
|
linkStepObject,
|
|
659
698
|
perParentCombinations,
|
|
660
699
|
complexFilterCombinations,
|
|
661
|
-
|
|
700
|
+
valueUserTags,
|
|
662
701
|
filtersStructure,
|
|
663
702
|
linkSteps,
|
|
664
703
|
requiredDataLinkStepObjects,
|
|
@@ -672,7 +711,7 @@ async function checkConditionsLink(
|
|
|
672
711
|
linkStepObject,
|
|
673
712
|
perParentCombinations,
|
|
674
713
|
complexFilterCombinations,
|
|
675
|
-
|
|
714
|
+
valueUserTags,
|
|
676
715
|
filtersStructure,
|
|
677
716
|
linkSteps,
|
|
678
717
|
requiredDataLinkStepObjects,
|
|
@@ -684,7 +723,8 @@ async function checkConditionsLink(
|
|
|
684
723
|
|
|
685
724
|
|
|
686
725
|
let conditionLinkObject = {};
|
|
687
|
-
let
|
|
726
|
+
let addFilterMainRequest = null;
|
|
727
|
+
let filterElements = null;
|
|
688
728
|
|
|
689
729
|
if (linkStepObject.hasOwnProperty("addFilterMain") && linkStepObject.addFilterMain === true) {
|
|
690
730
|
|
|
@@ -707,7 +747,25 @@ async function checkConditionsLink(
|
|
|
707
747
|
Object.assign(errorsObject, filterErrorObject);
|
|
708
748
|
errorsFound = errorsFound.concat('filterErrorFound');
|
|
709
749
|
} else {
|
|
710
|
-
|
|
750
|
+
|
|
751
|
+
let [complexFilterRequest, status, filterErrorsObject, filterErrorsFound] = filtersSharedLib.createFiltersRequest(
|
|
752
|
+
filterStructureCurrent.objType,
|
|
753
|
+
filterStructureCurrent.initialLogicalElementId,
|
|
754
|
+
filterStructureCurrent.logicalElements,
|
|
755
|
+
valueUserTags
|
|
756
|
+
);
|
|
757
|
+
console.log('return complexFilter for filterElements: ', {
|
|
758
|
+
complexFilterRequest,
|
|
759
|
+
status,
|
|
760
|
+
filterErrorsObject,
|
|
761
|
+
filterErrorsFound
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
if (filterErrorsFound.length > 0) {
|
|
765
|
+
Object.assign(errorsObject, filterErrorsObject)
|
|
766
|
+
errorsFound = errorsFound.concat(filterErrorsFound)
|
|
767
|
+
};
|
|
768
|
+
addFilterMainRequest = complexFilterRequest;
|
|
711
769
|
}
|
|
712
770
|
|
|
713
771
|
}
|
|
@@ -715,35 +773,19 @@ async function checkConditionsLink(
|
|
|
715
773
|
if (linkStepObject.hasOwnProperty('filterElements')) {
|
|
716
774
|
console.log('------------ has filterElements ------------');
|
|
717
775
|
|
|
718
|
-
let filters = {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
errorsObject[linkStepObject.filterElements.objType.objectType] = 'this linkStep has error when combine filterMain in link';
|
|
723
|
-
errorsFound.push(`${linkStepObject.filterElements.objType.objectType}: this linkStep has error when combine filterMain in link`);
|
|
724
|
-
return [null, errorsObject, errorsFound];
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
filters = filtersSharedLib.combineLogicalElements(
|
|
728
|
-
filterMainRequest,
|
|
729
|
-
linkStepObject.filterElements
|
|
730
|
-
);
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
} else {
|
|
734
|
-
filters = {
|
|
735
|
-
objType: linkStepObject.filterElements.objType,
|
|
736
|
-
initialLogicalElementId: linkStepObject.filterElements.initialLogicalElementId,
|
|
737
|
-
logicalElements: linkStepObject.filterElements.logicalElements,
|
|
738
|
-
}
|
|
776
|
+
let filters = {
|
|
777
|
+
objType: linkStepObject.filterElements.objType,
|
|
778
|
+
initialLogicalElementId: linkStepObject.filterElements.initialLogicalElementId,
|
|
779
|
+
logicalElements: linkStepObject.filterElements.logicalElements,
|
|
739
780
|
}
|
|
781
|
+
|
|
740
782
|
console.log('filters: ', filters);
|
|
741
783
|
|
|
742
784
|
let [complexFilterRequest, status, filterErrorsObject, filterErrorsFound] = filtersSharedLib.createFiltersRequest(
|
|
743
785
|
filters.objType,
|
|
744
786
|
filters.initialLogicalElementId,
|
|
745
787
|
filters.logicalElements,
|
|
746
|
-
|
|
788
|
+
valueUserTags
|
|
747
789
|
);
|
|
748
790
|
console.log('return complexFilter for filterElements: ', {
|
|
749
791
|
complexFilterRequest,
|
|
@@ -757,36 +799,55 @@ async function checkConditionsLink(
|
|
|
757
799
|
errorsFound = errorsFound.concat(filterErrorsFound)
|
|
758
800
|
};
|
|
759
801
|
|
|
760
|
-
|
|
761
|
-
|
|
802
|
+
filterElements = complexFilterRequest;
|
|
803
|
+
}
|
|
762
804
|
|
|
805
|
+
if (!conditionLinkObject.hasOwnProperty("filterElements")) {
|
|
806
|
+
conditionLinkObject.filterElements = {};
|
|
763
807
|
}
|
|
764
808
|
|
|
809
|
+
if (addFilterMainRequest !== null) {
|
|
810
|
+
if (filterElements !== null) {
|
|
765
811
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
812
|
+
let combineLogicalElements = Object.assign(addFilterMainRequest.filterElements, filterElements.filterElements);
|
|
813
|
+
console.log('combineLogicalElements: ', combineLogicalElements);
|
|
814
|
+
|
|
815
|
+
// create new operation FilterObject
|
|
816
|
+
let operationFilterObject = {
|
|
817
|
+
objType: objType,
|
|
818
|
+
filterElement: {
|
|
819
|
+
filterType: "operation",
|
|
820
|
+
filterElements: combineLogicalElements,
|
|
821
|
+
filterElementLeft: addFilterMainRequest.filterMainId,
|
|
822
|
+
filterElementRight: filterElements.filterMainId,
|
|
823
|
+
operator: "AND"
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
console.log("operationFilterObject", operationFilterObject);
|
|
827
|
+
|
|
828
|
+
let operationFilterMainId = hash(operationFilterObject);
|
|
829
|
+
console.log("==== validate operationFilterMainId After Hash =====", operationFilterMainId);
|
|
830
|
+
|
|
831
|
+
delete operationFilterObject.filterElement.filterElements;
|
|
832
|
+
|
|
833
|
+
combineLogicalElements = Object.assign(combineLogicalElements, { [operationFilterMainId]: operationFilterObject });
|
|
834
|
+
|
|
835
|
+
conditionLinkObject.filterElements = {
|
|
836
|
+
[operationFilterMainId]: combineLogicalElements
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
} else {
|
|
840
|
+
conditionLinkObject.filterElements = {
|
|
841
|
+
[addFilterMainRequest.filterMainId]: addFilterMainRequest.filterElements
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
} else {
|
|
845
|
+
if (filterElements !== null) {
|
|
846
|
+
conditionLinkObject.filterElements = {
|
|
847
|
+
[filterElements.filterMainId]: filterElements.filterElements
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
}
|
|
790
851
|
|
|
791
852
|
if (linkStepObject.hasOwnProperty('aggregate')) {
|
|
792
853
|
console.log('------------ has aggregate ------------');
|
|
@@ -834,7 +895,7 @@ async function checkConditionsLink(
|
|
|
834
895
|
requiredDataLinkSteps,
|
|
835
896
|
perParentCombinations,
|
|
836
897
|
complexFilterCombinations,
|
|
837
|
-
|
|
898
|
+
valueUserTags,
|
|
838
899
|
filtersStructure,
|
|
839
900
|
[],
|
|
840
901
|
errorsObject,
|
|
@@ -899,7 +960,6 @@ async function checkConditionsLink(
|
|
|
899
960
|
requiredDataFields.push({
|
|
900
961
|
fieldName: fieldName,
|
|
901
962
|
linkPathObjectId: pathId,
|
|
902
|
-
// dataType: sortField.dataType
|
|
903
963
|
});
|
|
904
964
|
|
|
905
965
|
} else {
|
|
@@ -908,15 +968,33 @@ async function checkConditionsLink(
|
|
|
908
968
|
});
|
|
909
969
|
};
|
|
910
970
|
|
|
971
|
+
if (!sortField.hasOwnProperty("dataType")) {
|
|
972
|
+
errorsFound.push(`${objType.objectType}: this sortField of linkStep is not set dataType`);
|
|
973
|
+
errorsObject = {
|
|
974
|
+
[objType.objectType]: 'this sortField of linkStep is not set dataType'
|
|
975
|
+
};
|
|
976
|
+
return [null, errorsObject, errorsFound]
|
|
977
|
+
}
|
|
978
|
+
|
|
911
979
|
let sortObject = {
|
|
912
980
|
fieldName: fieldName,
|
|
913
|
-
|
|
981
|
+
dataType: sortField.dataType
|
|
914
982
|
}
|
|
915
983
|
|
|
916
|
-
if (
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
984
|
+
if (sortField.dataType === "array") {
|
|
985
|
+
|
|
986
|
+
if (isEmpty(sortField.sortByValueUserTags)) {
|
|
987
|
+
errorsFound.push(`${objType.objectType}: sortField has sortByValueUserTags is empty`);
|
|
988
|
+
errorsObject = {
|
|
989
|
+
[objType.objectType]: 'sortField has sortByValueUserTags is empty'
|
|
990
|
+
}
|
|
991
|
+
return [null, errorsObject, errorsFound]
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
sortObject.values = [];
|
|
995
|
+
let sortArrays = sortField.sortByValueUserTags;
|
|
996
|
+
for (let sort of sortArrays) {
|
|
997
|
+
sortObject.values.push(valueUserTags[sort].value);
|
|
920
998
|
}
|
|
921
999
|
}
|
|
922
1000
|
|
|
@@ -964,7 +1042,7 @@ async function checkConditionsLink(
|
|
|
964
1042
|
|
|
965
1043
|
for (const [tag, requestPropertyId] of Object.entries(linkStepObject.requestProperties)) {
|
|
966
1044
|
console.log('extract requestProperties', { tag, requestPropertyId });
|
|
967
|
-
let requestPropertyObject =
|
|
1045
|
+
let requestPropertyObject = valueUserTags[requestPropertyId];
|
|
968
1046
|
console.log('extract requestProperties', requestPropertyObject);
|
|
969
1047
|
|
|
970
1048
|
|
|
@@ -980,7 +1058,7 @@ async function checkConditionsLink(
|
|
|
980
1058
|
perParentCombinationObject.objType,
|
|
981
1059
|
perParentCombinationObject.initialLogicalElementId,
|
|
982
1060
|
perParentCombinationObject.logicalElements,
|
|
983
|
-
|
|
1061
|
+
valueUserTags,
|
|
984
1062
|
);
|
|
985
1063
|
console.log('return complexFilter for perParentCombinations: ', {
|
|
986
1064
|
complexFilterRequest,
|
|
@@ -1021,7 +1099,7 @@ async function checkConditionsLink(
|
|
|
1021
1099
|
complexFilterCombinationObject.objType,
|
|
1022
1100
|
complexFilterCombinationObject.initialLogicalElementId,
|
|
1023
1101
|
complexFilterCombinationObject.logicalElements,
|
|
1024
|
-
|
|
1102
|
+
valueUserTags
|
|
1025
1103
|
);
|
|
1026
1104
|
console.log('return complexFilter for complexFilterCombinations: ', {
|
|
1027
1105
|
complexFilterRequest,
|
|
@@ -1041,7 +1119,6 @@ async function checkConditionsLink(
|
|
|
1041
1119
|
applyCombinations.push({
|
|
1042
1120
|
tag: tag,
|
|
1043
1121
|
filterMainId: complexFilterRequest.filterMainId,
|
|
1044
|
-
// identifiersFieldName: requestPropertyObject.identifierFieldName
|
|
1045
1122
|
});
|
|
1046
1123
|
console.log('applyCombinations: ', applyCombinations);
|
|
1047
1124
|
|
|
@@ -1052,7 +1129,6 @@ async function checkConditionsLink(
|
|
|
1052
1129
|
filterElements: complexFilterRequest.filterElements
|
|
1053
1130
|
}
|
|
1054
1131
|
});
|
|
1055
|
-
// Object.assign(perParentCombinationObjects, complexFilterRequest.filterElements);
|
|
1056
1132
|
};
|
|
1057
1133
|
|
|
1058
1134
|
} else {
|
|
@@ -1060,15 +1136,15 @@ async function checkConditionsLink(
|
|
|
1060
1136
|
if (isEmpty(conditionLinkObject)) {
|
|
1061
1137
|
conditionLinkObject = {
|
|
1062
1138
|
requestProperties: {
|
|
1063
|
-
[tag]:
|
|
1139
|
+
[tag]: valueUserTags[requestPropertyId].value
|
|
1064
1140
|
}
|
|
1065
1141
|
};
|
|
1066
1142
|
} else {
|
|
1067
1143
|
if (conditionLinkObject.hasOwnProperty('requestProperties')) {
|
|
1068
|
-
conditionLinkObject.requestProperties[tag] =
|
|
1144
|
+
conditionLinkObject.requestProperties[tag] = valueUserTags[requestPropertyId].value;
|
|
1069
1145
|
} else {
|
|
1070
1146
|
conditionLinkObject['requestProperties'] = {
|
|
1071
|
-
[tag]:
|
|
1147
|
+
[tag]: valueUserTags[requestPropertyId].value
|
|
1072
1148
|
};
|
|
1073
1149
|
};
|
|
1074
1150
|
};
|
|
@@ -1100,15 +1176,16 @@ async function checkConditionsLink(
|
|
|
1100
1176
|
if (linkStepObject.hasOwnProperty("comparison")) {
|
|
1101
1177
|
console.log('------------ link has comparison ------------');
|
|
1102
1178
|
|
|
1103
|
-
if (!linkStepObject.hasOwnProperty(
|
|
1104
|
-
errorsObject[objType.objectType] = 'no comparisonSortField | comparisonValue';
|
|
1105
|
-
errorsFound.push(`${objType.objectType}: no comparisonSortField | comparisonValue`);
|
|
1179
|
+
if (!linkStepObject.hasOwnProperty('comparisonSortField') || !linkStepObject.hasOwnProperty('comparisonValue') || !linkStepObject.hasOwnProperty('comparisonSortDataType')) {
|
|
1180
|
+
errorsObject[objType.objectType] = 'no comparisonSortField | comparisonValue | comparisonSortDataType';
|
|
1181
|
+
errorsFound.push(`${objType.objectType}: no comparisonSortField | comparisonValue | comparisonSortDataType`);
|
|
1106
1182
|
return [null, errorsObject, errorsFound]
|
|
1107
1183
|
}
|
|
1108
1184
|
|
|
1109
1185
|
conditionLinkObject.comparison = linkStepObject.comparison;
|
|
1110
1186
|
conditionLinkObject.comparisonSortField = linkStepObject.comparisonSortField;
|
|
1111
|
-
conditionLinkObject.
|
|
1187
|
+
conditionLinkObject.comparisonSortDataType = linkStepObject.comparisonSortDataType;
|
|
1188
|
+
conditionLinkObject.comparisonValue = valueUserTags[linkStepObject.comparisonValue].value;
|
|
1112
1189
|
|
|
1113
1190
|
}
|
|
1114
1191
|
|
|
@@ -1191,15 +1268,7 @@ function checkMultipleIdentifers(
|
|
|
1191
1268
|
linkConfig = {},
|
|
1192
1269
|
conditions = {},
|
|
1193
1270
|
multipleIdentifiers = false,
|
|
1194
|
-
//
|
|
1195
1271
|
) {
|
|
1196
|
-
// conditions: {
|
|
1197
|
-
// aggregate ,
|
|
1198
|
-
// comparison,
|
|
1199
|
-
// combine ,
|
|
1200
|
-
// applyCombinations ,
|
|
1201
|
-
// multipleIdentifiers,
|
|
1202
|
-
// }
|
|
1203
1272
|
|
|
1204
1273
|
let manyIdentifiers = null;
|
|
1205
1274
|
|