@izara_project/izara-shared-search-and-sort 1.0.3 → 1.0.5

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.
@@ -61,13 +61,12 @@ function validateFilterElement(
61
61
  }
62
62
 
63
63
  function createFiltersRequest(
64
- _izContext,
65
64
  objType,
66
65
  initialLogicalElementId,
67
66
  logicalElements,
68
67
  values,
69
68
  ) {
70
- _izContext.logger.debug('createFiltersRequest: ', {
69
+ console.log('createFiltersRequest: ', {
71
70
  objType,
72
71
  initialLogicalElementId,
73
72
  logicalElements,
@@ -84,12 +83,12 @@ function createFiltersRequest(
84
83
 
85
84
  //* validate combine logicalStructure
86
85
  let [validateObject, validateFilterMainId, validateFilterObject, validateErrorsObject, validateErrors] = validateCombinationStructure(
87
- _izContext,
86
+ objType,
88
87
  initialLogicalElementId,
89
88
  logicalElements,
90
89
  values
91
90
  );
92
- _izContext.logger.debug('return validateCombinationStructure: ', {
91
+ console.log('return validateCombinationStructure: ', {
93
92
  validateObject,
94
93
  validateFilterMainId,
95
94
  validateFilterObject,
@@ -118,13 +117,12 @@ function createFiltersRequest(
118
117
  operationErrorsObject,
119
118
  operationErrors
120
119
  ] = filterLogicalElements(
121
- _izContext,
122
120
  objType,
123
121
  initialLogicalElementId,
124
122
  logicalElements,
125
123
  values,
126
124
  );
127
- _izContext.logger.debug('final return filterLogicalElements: ', {
125
+ console.log('final return filterLogicalElements: ', {
128
126
  filterMainId,
129
127
  filterMainObject,
130
128
  operation,
@@ -162,7 +160,7 @@ function createFiltersRequest(
162
160
  filterMainId: filterMainId,
163
161
  filterElements: filterElements
164
162
  };
165
- _izContext.logger.debug('complexFilterRequest: ', complexFilterRequest);
163
+ console.log('complexFilterRequest: ', complexFilterRequest);
166
164
 
167
165
  // let validate = validateFilterElement(
168
166
  // complexFilterRequest.filterElements,
@@ -186,12 +184,13 @@ function createFiltersRequest(
186
184
  };
187
185
 
188
186
  function validateCombinationStructure(
189
- _izContext,
187
+ objType,
190
188
  initialLogicalElementId,
191
189
  logicalElements,
192
190
  values
193
191
  ) {
194
- _izContext.logger.debug('validateCombinationStructure: ', {
192
+ console.log('validateCombinationStructure: ', {
193
+ objType,
195
194
  initialLogicalElementId,
196
195
  logicalElements,
197
196
  values
@@ -208,12 +207,12 @@ function validateCombinationStructure(
208
207
  let lastOperation = null;
209
208
 
210
209
  for (const [logicalElementId, logicalElementObject] of Object.entries(logicalElements)) {
211
- _izContext.logger.debug('iterate logicalElements: ', { initialLogicalElementId, logicalElementId, logicalElementObject });
210
+ console.log('iterate logicalElements: ', { initialLogicalElementId, logicalElementId, logicalElementObject });
212
211
 
213
212
  if (initialLogicalElementId !== logicalElementId) {
214
213
  continue;
215
214
  };
216
- _izContext.logger.debug('----------------- start logicalElement --------------');
215
+ console.log('----------------- start logicalElement --------------');
217
216
 
218
217
  if (!logicalElementObject.hasOwnProperty("logicalElementType")) {
219
218
  errorsObject[logicalElementId] = `this logical structure is not set logicalElementType`;
@@ -231,14 +230,14 @@ function validateCombinationStructure(
231
230
  let logicalElementType = logicalElementObject.logicalElementType;
232
231
 
233
232
  if (logicalElementType === 'operation') {
234
- _izContext.logger.debug('----------------- operation --------------');
235
- _izContext.logger.debug('logicalElementObject: ', logicalElementObject);
233
+ console.log('----------------- operation --------------');
234
+ console.log('logicalElementObject: ', logicalElementObject);
236
235
 
237
236
  lastOperation = logicalElementObject.operation;
238
- _izContext.logger.debug('lastOperation: ', lastOperation);
237
+ console.log('lastOperation: ', lastOperation);
239
238
 
240
239
  if (isEmpty(lastOperation)) {
241
- _izContext.logger.debug('no operation: ', logicalElementObject.operation);
240
+ console.log('no operation: ', logicalElementObject.operation);
242
241
  errorsObject[logicalElementId] = `this logical structure is not set operation parameter`;
243
242
  errorsFound.push(`this logical structure type: operation: ${logicalElementId} is not set operation parameter`);
244
243
  break;
@@ -251,17 +250,17 @@ function validateCombinationStructure(
251
250
  };
252
251
 
253
252
  if (logicalElementType === 'openBracket') {
254
- _izContext.logger.debug('----------------- openBracket --------------');
253
+ console.log('----------------- openBracket --------------');
255
254
 
256
255
  let nextElementId = null;
257
256
 
258
257
  [validateObject, currentFilterMainId, currentFilterObject, errorsObject, errorsFound, nextElementId] = validateCombinationStructure(
259
- _izContext,
258
+ objType,
260
259
  logicalElementObject.nextLogicalElementId,
261
260
  logicalElements,
262
261
  values
263
262
  );
264
- _izContext.logger.debug('return validateCombinationStruce for openBracket: ', {
263
+ console.log('return validateCombinationStruce for openBracket: ', {
265
264
  validateObject,
266
265
  currentFilterMainId,
267
266
  currentFilterObject,
@@ -275,7 +274,7 @@ function validateCombinationStructure(
275
274
  };
276
275
 
277
276
  } else if (logicalElementType === 'closeBracket') {
278
- _izContext.logger.debug('----------------- closeBracket --------------');
277
+ console.log('----------------- closeBracket --------------');
279
278
 
280
279
  return [
281
280
  true,
@@ -287,7 +286,7 @@ function validateCombinationStructure(
287
286
  ];
288
287
 
289
288
  } else if (logicalElementType === 'logical') {
290
- _izContext.logger.debug('----------------- logical --------------');
289
+ console.log('----------------- logical --------------');
291
290
  if (!logicalElementObject.hasOwnProperty('objType')) {
292
291
  errorsObject[logicalElementId] = `this logical structure is not set objType`;
293
292
  errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
@@ -313,7 +312,7 @@ function validateCombinationStructure(
313
312
  };
314
313
 
315
314
  } else if (logicalElementType === 'childComplexFilter') {
316
- _izContext.logger.debug('----------------- childComplexFilter --------------');
315
+ console.log('----------------- childComplexFilter --------------');
317
316
  if (!logicalElementObject.hasOwnProperty('objType')) {
318
317
  errorsObject[logicalElementId] = `this logical structure is not set objType`;
319
318
  errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
@@ -333,7 +332,7 @@ function validateCombinationStructure(
333
332
  };
334
333
 
335
334
  let parantObjType = logicalElementObject.objType;
336
- _izContext.logger.debug('check parantObjType: ', {
335
+ console.log('check parantObjType: ', {
337
336
  parantObjType
338
337
  });
339
338
 
@@ -343,13 +342,13 @@ function validateCombinationStructure(
343
342
  childElementObject,
344
343
  childErrorsObject,
345
344
  childErrorsFound
346
- ] = this.validateCombinationStructure(
347
- _izContext,
345
+ ] = validateCombinationStructure(
346
+ logicalElementObject.pathLinkType.objType,
348
347
  logicalElementObject.childLogicalElementId,
349
348
  logicalElements,
350
349
  values
351
350
  );
352
- _izContext.logger.debug('return validateCombinationStruce for childComplexFilter: ', {
351
+ console.log('return validateCombinationStruce for childComplexFilter: ', {
353
352
  childValidate,
354
353
  childElementId,
355
354
  childElementObject,
@@ -370,7 +369,7 @@ function validateCombinationStructure(
370
369
  };
371
370
 
372
371
  } else if (logicalElementType === 'translateIds') {
373
- _izContext.logger.debug("----------------- translateIds --------------", logicalElementObject);
372
+ console.log("----------------- translateIds --------------", logicalElementObject);
374
373
 
375
374
  if (!logicalElementObject.hasOwnProperty('objType')) {
376
375
  errorsObject[logicalElementId] = `this logical structure is not set objType`;
@@ -401,7 +400,7 @@ function validateCombinationStructure(
401
400
  };
402
401
 
403
402
  } else if (logicalElementType === 'identifiers') {
404
- _izContext.logger.debug('----------------- identifiers --------------', logicalElementObject);
403
+ console.log('----------------- identifiers --------------', logicalElementObject);
405
404
  if (!logicalElementObject.hasOwnProperty('objType')) {
406
405
  errorsObject[logicalElementId] = `this logical structure is not set objType`;
407
406
  errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
@@ -427,7 +426,7 @@ function validateCombinationStructure(
427
426
  };
428
427
 
429
428
  } else if (logicalElementType === 'traversal') {
430
- _izContext.logger.debug('----------------- traversal --------------', logicalElementObject);
429
+ console.log('----------------- traversal --------------', logicalElementObject);
431
430
  if (!logicalElementObject.hasOwnProperty('objType')) {
432
431
  errorsObject[logicalElementId] = `this logical structure is not set objType`;
433
432
  errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
@@ -453,15 +452,15 @@ function validateCombinationStructure(
453
452
  runningFilterObject,
454
453
  operationFilterObject,
455
454
  operationErrorsFound
456
- ] = this.validateOperation(
457
- _izContext,
455
+ ] = validateOperation(
456
+ objType,
458
457
  runningFilterMainId,
459
458
  runningFilterObject,
460
459
  lastOperation,
461
460
  currentFilterMainId,
462
461
  currentFilterObject
463
462
  );
464
- _izContext.logger.debug('return validateOperation: ', {
463
+ console.log('return validateOperation: ', {
465
464
  runningFilterMainId,
466
465
  runningFilterObject,
467
466
  operationFilterObject,
@@ -490,117 +489,201 @@ function validateCombinationStructure(
490
489
 
491
490
  }
492
491
 
493
- function validateOperation(
494
- _izContext,
495
- runningFilterMainId,
496
- runningFilterObject,
497
- lastOperation,
498
- currentFilterMainId,
499
- currentFilterObject,
500
- ) {
501
- _izContext.logger.debug('validateOperation: ', {
502
- runningFilterMainId,
503
- runningFilterObject,
504
- lastOperation,
505
- currentFilterMainId,
506
- currentFilterObject,
507
- });
492
+ // function validateOperation(
493
+ // // _izContext,
494
+ // runningFilterMainId,
495
+ // runningFilterObject,
496
+ // lastOperation,
497
+ // currentFilterMainId,
498
+ // currentFilterObject,
499
+ // ) {
500
+ // console.log('validateOperation: ', {
501
+ // runningFilterMainId,
502
+ // runningFilterObject,
503
+ // lastOperation,
504
+ // currentFilterMainId,
505
+ // currentFilterObject,
506
+ // });
508
507
 
509
- let errorsObject = {};
510
- let errorsFound = [];
508
+ // let errorsObject = {};
509
+ // let errorsFound = [];
511
510
 
512
- if (!currentFilterObject) {
513
- errorsObject[currentFilterMainId] = 'cannot found current filterElement object';
514
- errorsFound.push(`${currentFilterMainId}: cannot found current filterElement object`);
515
- return [null, null, errorsObject, errorsFound];
516
- };
511
+ // if (!currentFilterObject) {
512
+ // errorsObject[currentFilterMainId] = 'cannot found current filterElement object';
513
+ // errorsFound.push(`${currentFilterMainId}: cannot found current filterElement object`);
514
+ // return [null, null, errorsObject, errorsFound];
515
+ // };
517
516
 
518
- if (!runningFilterObject) {
519
- return [currentFilterMainId, currentFilterObject, errorsObject, errorsFound];
520
- };
517
+ // if (!runningFilterObject) {
518
+ // return [currentFilterMainId, currentFilterObject, errorsObject, errorsFound];
519
+ // };
521
520
 
522
- if (!lastOperation) {
521
+ // if (!lastOperation) {
523
522
 
524
- let returnNextElementId = null;
525
- let returnNextElementObject = null;
523
+ // let returnNextElementId = null;
524
+ // let returnNextElementObject = null;
526
525
 
527
- if (runningFilterObject.logicalElementType === 'openBracket') {
528
- if (currentFilterObject.logicalElementType === 'closeBracket') {
526
+ // if (runningFilterObject.logicalElementType === 'openBracket') {
527
+ // if (currentFilterObject.logicalElementType === 'closeBracket') {
529
528
 
530
- errorsObject[currentFilterMainId] = `this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`;
531
- errorsFound.push(`${currentFilterMainId}: this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`);
529
+ // errorsObject[currentFilterMainId] = `this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`;
530
+ // errorsFound.push(`${currentFilterMainId}: this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`);
532
531
 
533
- } else {
532
+ // } else {
534
533
 
535
- runningFilterObject.nextLogicalElementId = currentFilterMainId;
536
- currentFilterObject.previousLogicalElementId = runningFilterMainId;
534
+ // runningFilterObject.nextLogicalElementId = currentFilterMainId;
535
+ // currentFilterObject.previousLogicalElementId = runningFilterMainId;
537
536
 
538
- operations = Object.assign(runningFilterObject, currentFilterObject);
537
+ // operations = Object.assign(runningFilterObject, currentFilterObject);
539
538
 
540
- _izContext.logger.debug('operations: ', operations);
541
- returnNextElementId = currentFilterMainId;
542
- returnNextElementObject = currentFilterObject;
539
+ // _izContext.logger.debug('operations: ', operations);
540
+ // returnNextElementId = currentFilterMainId;
541
+ // returnNextElementObject = currentFilterObject;
543
542
 
544
- };
543
+ // };
545
544
 
546
- } else if (runningFilterObject.logicalElementType === 'closeBracket') {
547
- if (currentFilterObject.logicalElementType === "closeBracket") {
545
+ // } else if (runningFilterObject.logicalElementType === 'closeBracket') {
546
+ // if (currentFilterObject.logicalElementType === "closeBracket") {
548
547
 
549
- runningFilterObject.nextLogicalElementId = currentFilterMainId;
550
- currentFilterObject.previousLogicalElementId = runningFilterMainId;
548
+ // runningFilterObject.nextLogicalElementId = currentFilterMainId;
549
+ // currentFilterObject.previousLogicalElementId = runningFilterMainId;
551
550
 
552
- operations = Object.assign(runningFilterObject, currentFilterObject);
553
- _izContext.logger.debug('operations: ', operations);
551
+ // operations = Object.assign(runningFilterObject, currentFilterObject);
552
+ // _izContext.logger.debug('operations: ', operations);
554
553
 
555
- returnNextElementId = currentFilterMainId;
556
- returnNextElementObject = currentFilterObject;
554
+ // returnNextElementId = currentFilterMainId;
555
+ // returnNextElementObject = currentFilterObject;
557
556
 
558
- } else {
559
- errorsObject[currentFilterMainId] = `this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`;
560
- errorsFound.push(`${currentFilterMainId}: this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`);
561
- };
557
+ // } else {
558
+ // errorsObject[currentFilterMainId] = `this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`;
559
+ // errorsFound.push(`${currentFilterMainId}: this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`);
560
+ // };
562
561
 
563
- } else {
562
+ // } else {
564
563
 
565
- if (currentFilterObject.logicalElementType === 'closeBracket') {
564
+ // if (currentFilterObject.logicalElementType === 'closeBracket') {
566
565
 
567
- runningFilterObject.nextLogicalElementId = currentFilterMainId;
568
- currentFilterObject.previousLogicalElementId = runningFilterMainId;
566
+ // runningFilterObject.nextLogicalElementId = currentFilterMainId;
567
+ // currentFilterObject.previousLogicalElementId = runningFilterMainId;
569
568
 
570
- operations = Object.assign(runningFilterObject, currentFilterObject);
571
- _izContext.logger.debug('operations: ', operations);
569
+ // operations = Object.assign(runningFilterObject, currentFilterObject);
570
+ // _izContext.logger.debug('operations: ', operations);
572
571
 
573
- returnNextElementId = currentFilterMainId;
574
- returnNextElementObject = nextLogicalElementObject;
575
- } else {
576
- errorsObject[currentFilterMainId] = `this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`;
577
- errorsFound.push(`${currentFilterMainId}: this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`);
578
- };
579
- };
572
+ // returnNextElementId = currentFilterMainId;
573
+ // returnNextElementObject = nextLogicalElementObject;
574
+ // } else {
575
+ // errorsObject[currentFilterMainId] = `this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`;
576
+ // errorsFound.push(`${currentFilterMainId}: this path has logicalElementType: ${runningFilterObject.logicalElementType} and ${currentFilterObject.logicalElementType} are error`);
577
+ // };
578
+ // };
580
579
 
581
- return [returnNextElementId, returnNextElementObject, errorsObject, errorsFound];
580
+ // return [returnNextElementId, returnNextElementObject, errorsObject, errorsFound];
582
581
 
583
- };
582
+ // };
584
583
 
585
- if (runningFilterMainId && lastOperation && currentFilterMainId) {
584
+ // if (runningFilterMainId && lastOperation && currentFilterMainId) {
586
585
 
587
- // let operationFilterObject = {
588
- // runningFilterMainId: runningFilterObject,
589
- // operation: lastOperation,
590
- // currentFilterMainId: currentFilterObject
591
- // };
592
- // // let operationFilterMainId = hash(operationFilterObject);
586
+ // // let operationFilterObject = {
587
+ // // runningFilterMainId: runningFilterObject,
588
+ // // operation: lastOperation,
589
+ // // currentFilterMainId: currentFilterObject
590
+ // // };
591
+ // // // let operationFilterMainId = hash(operationFilterObject);
593
592
 
594
- return [currentFilterMainId, currentFilterObject, errorsObject, errorsFound];
593
+ // return [currentFilterMainId, currentFilterObject, errorsObject, errorsFound];
595
594
 
596
- } else {
597
- errorsFound.push("found some error that not expect");
598
- return [null, null, errorsObject, errorsFound];
599
- };
600
- };
595
+ // } else {
596
+ // errorsFound.push("found some error that not expect");
597
+ // return [null, null, errorsObject, errorsFound];
598
+ // };
599
+ // };
600
+
601
+ function validateOperation(
602
+ objType,
603
+ runningFilterMainId,
604
+ runningFilterObject,
605
+ lastLogicalOperator,
606
+ currentFilterMainId,
607
+ currentFilterObject,
608
+ ) {
609
+ try {
610
+
611
+ console.log("[=============== Function - =============]", {
612
+ objType: objType,
613
+ runningFilterMainId: runningFilterMainId,
614
+ runningFilterObject: runningFilterObject,
615
+ lastLogicalOperator: lastLogicalOperator,
616
+ currentFilterMainId: currentFilterMainId,
617
+ currentFilterObject: currentFilterObject,
618
+ });
619
+
620
+ let errorsFound = []
621
+
622
+ // // if runningFilterMainId set we should always have runningFilterObject
623
+ // if (runningFilterMainId && !runningFilterObject) {
624
+ // _izContext.logger.debug("validateOperation expected runningFilterObject not found");
625
+ // errorsFound.push("validateOperation expected runningFilterObject not found");
626
+ // return currentFilterMainId;
627
+ // }
628
+ if (!currentFilterObject) {
629
+ console.log("validateOperation expected currentFilterObject not found");
630
+ errorsFound.push("validateOperation expected currentFilterObject not found");
631
+ return [currentFilterMainId, null, null, errorsFound];
632
+ }
633
+ // if runningFilterObject set we should always have lastLogicalOperator
634
+ if (runningFilterObject && !lastLogicalOperator) {
635
+ console.log("validateOperation expected lastLogicalOperator not found");
636
+ errorsFound.push("validateOperation expected lastLogicalOperator not found");
637
+ return [currentFilterMainId, currentFilterObject, null, errorsFound];
638
+ }
639
+
640
+ // check if is an operation, if not simply return currentFilterMainId
641
+ if (!runningFilterObject || !lastLogicalOperator) {
642
+ console.log("+++ validate no operation, R E T U R N currentFilterMainId ++");
643
+ return [currentFilterMainId, currentFilterObject, null, errorsFound];
644
+ }
645
+
646
+ let filterElements = splitFilterElements(
647
+ runningFilterMainId,
648
+ runningFilterObject,
649
+ currentFilterMainId,
650
+ currentFilterObject
651
+ );
652
+
653
+ // create new operation FilterObject
654
+ let operationFilterObject = {
655
+ objType: objType,
656
+ filterElement: {
657
+ filterType: "operation",
658
+ filterElements: filterElements,
659
+ filterElementLeft: runningFilterMainId,
660
+ filterElementRight: currentFilterMainId,
661
+ operator: lastLogicalOperator
662
+ }
663
+ }
664
+ console.log("operationFilterObject", operationFilterObject);
665
+
666
+ let operationFilterMainId = hash(operationFilterObject);
667
+ console.log("==== validate operationFilterMainId After Hash =====", operationFilterMainId);
668
+
669
+ console.log("RETURN validate operationFilterMainId ==>", operationFilterMainId);
670
+ console.log("RETURN validate operationFilterObject ==>", operationFilterObject);
671
+ console.log("========= [validateOperation ::: End] =======");
672
+
673
+ let operation = {
674
+ filterMainIdA: runningFilterMainId,
675
+ operator: lastLogicalOperator,
676
+ filterMainIdB: currentFilterMainId,
677
+ };
678
+
679
+ return [operationFilterMainId, operationFilterObject, operation, errorsFound];
680
+
681
+ } catch (err) {
682
+ throw (err)
683
+ }
684
+ }
601
685
 
602
686
  function filterLogicalElements(
603
- _izContext,
604
687
  objType,
605
688
  initialLogicalElementId,
606
689
  logicalElements,
@@ -612,7 +695,7 @@ function filterLogicalElements(
612
695
  currentFilterMainId = null,
613
696
  currentFilterObject = null
614
697
  ) {
615
- _izContext.logger.debug('filterLogicalElements: ', {
698
+ console.log('filterLogicalElements: ', {
616
699
  objType,
617
700
  initialLogicalElementId,
618
701
  logicalElements,
@@ -638,7 +721,7 @@ function filterLogicalElements(
638
721
  }
639
722
 
640
723
  let logicalElement = logicalElements[currentLogicalElementId];
641
- _izContext.logger.debug('logicalElement: ', logicalElement)
724
+ console.log('logicalElement: ', logicalElement)
642
725
 
643
726
  if (isEmpty(logicalElement)) {
644
727
  errorsObject[currentLogicalElementId] = 'this logicalElement not found';
@@ -650,7 +733,7 @@ function filterLogicalElements(
650
733
  };
651
734
 
652
735
  let logicalElementType = logicalElement.logicalElementType;
653
- _izContext.logger.debug('logicalElementType: ', logicalElementType);
736
+ console.log('logicalElementType: ', logicalElementType);
654
737
 
655
738
  if (logicalElementType === "openBracket") {
656
739
 
@@ -664,14 +747,13 @@ function filterLogicalElements(
664
747
  errorsFound,
665
748
  nextElementId
666
749
  ] = filterLogicalElements(
667
- _izContext,
668
750
  objType,
669
751
  initialLogicalElementId,
670
752
  logicalElements,
671
753
  values,
672
754
  logicalElement.nextLogicalElementId
673
755
  );
674
- _izContext.logger.debug('return filterLogicalElement for openBracket: ', {
756
+ console.log('return filterLogicalElement for openBracket: ', {
675
757
  currentFilterMainId,
676
758
  currentFilterObject,
677
759
  operation,
@@ -708,15 +790,15 @@ function filterLogicalElements(
708
790
 
709
791
  }
710
792
 
711
- _izContext.logger.debug("check logicalElement: ", logicalElement);
712
- _izContext.logger.debug("check logicalElementType: ", logicalElementType);
713
- _izContext.logger.debug("check filter main id: ", {
793
+ console.log("check logicalElement: ", logicalElement);
794
+ console.log("check logicalElementType: ", logicalElementType);
795
+ console.log("check filter main id: ", {
714
796
  runningFilterMainId,
715
797
  lastLogicalOperator,
716
798
  currentFilterMainId
717
799
  });
718
800
 
719
- _izContext.logger.debug("check filter main id: ", {
801
+ console.log("check filter main id: ", {
720
802
  runningFilterMainId,
721
803
  runningFilterObject,
722
804
  lastLogicalOperator,
@@ -726,7 +808,7 @@ function filterLogicalElements(
726
808
 
727
809
  if (logicalElementType === "logical") {
728
810
 
729
- _izContext.logger.debug('------------------ logicalElementType: logical ----------------');
811
+ console.log('------------------ logicalElementType: logical ----------------');
730
812
 
731
813
  if (!logicalElement.hasOwnProperty('objType')) {
732
814
  errorsObject[initialLogicalElementId] = `this logical structure is not set objType`;
@@ -750,7 +832,7 @@ function filterLogicalElements(
750
832
  }
751
833
 
752
834
  let value = values[logicalElement.value];
753
- _izContext.logger.debug('value: ', value);
835
+ console.log('value: ', value);
754
836
 
755
837
  if (isEmpty(value)) {
756
838
  errorsObject[currentLogicalElementId] = `value is empty`;
@@ -789,17 +871,17 @@ function filterLogicalElements(
789
871
  };
790
872
  };
791
873
  };
792
- _izContext.logger.debug('currentFilterObject: ', currentFilterObject);
874
+ console.log('currentFilterObject: ', currentFilterObject);
793
875
 
794
876
  currentFilterMainId = hash(currentFilterObject);
795
- _izContext.logger.debug('currentFilterMainId: ', currentFilterMainId);
877
+ console.log('currentFilterMainId: ', currentFilterMainId);
796
878
 
797
879
  if (logicalElement.nextLogicalElementId !== null) {
798
880
  lastNextLogicalElementId = logicalElement.nextLogicalElementId;
799
881
  }
800
882
 
801
883
  } else if (logicalElementType === "childComplexFilter") {
802
- _izContext.logger.debug('------------------ logicalElementType: childComplexFilter ----------------');
884
+ console.log('------------------ logicalElementType: childComplexFilter ----------------');
803
885
 
804
886
  if (!logicalElement.hasOwnProperty('objType')) {
805
887
  errorsObject[currentLogicalElementId] = `this logical structure is not set objType`;
@@ -842,14 +924,13 @@ function filterLogicalElements(
842
924
  childErrorsFound,
843
925
  childNextLogicalElementId
844
926
  ] = filterLogicalElements(
845
- _izContext,
846
927
  logicalElement.pathLinkType.objType,
847
928
  initialLogicalElementId,
848
929
  logicalElements,
849
930
  values,
850
931
  logicalElement.childLogicalElementId
851
932
  );
852
- _izContext.logger.debug('return child filterLogicalElement for child complexFilter: ', {
933
+ console.log('return child filterLogicalElement for child complexFilter: ', {
853
934
  childFilterMainId,
854
935
  childFilterObject,
855
936
  operation,
@@ -863,18 +944,17 @@ function filterLogicalElements(
863
944
  }
864
945
 
865
946
  let filterElements = splitFilterElements(
866
- _izContext,
867
947
  childFilterMainId,
868
948
  childFilterObject
869
949
  );
870
- _izContext.logger.debug('filterElements: ', filterElements);
950
+ console.log('filterElements: ', filterElements);
871
951
  let setRequestProperties = {};
872
952
 
873
953
  if (!isEmpty(logicalElement.requestProperties)) {
874
- _izContext.logger.debug('logicalElement: ', logicalElement);
954
+ console.log('logicalElement: ', logicalElement);
875
955
 
876
956
  for (const [tag, requestPropertyId] of Object.entries(logicalElement.requestProperties)) {
877
- _izContext.logger.debug('set requestProperties: ', { tag, requestPropertyId });
957
+ console.log('set requestProperties: ', { tag, requestPropertyId });
878
958
 
879
959
  let requestPropertyObject = values[requestPropertyId];
880
960
 
@@ -899,10 +979,10 @@ function filterLogicalElements(
899
979
  requestProperties: setRequestProperties ?? {}
900
980
  }
901
981
  };
902
- _izContext.logger.debug('currentFilterObject: ', currentFilterObject);
982
+ console.log('currentFilterObject: ', currentFilterObject);
903
983
 
904
984
  currentFilterMainId = hash(currentFilterObject);
905
- _izContext.logger.debug('currentFilterMainId: ', currentFilterMainId);
985
+ console.log('currentFilterMainId: ', currentFilterMainId);
906
986
 
907
987
  if (logicalElement.nextLogicalElementId !== null) {
908
988
  lastNextLogicalElementId = logicalElement.nextLogicalElementId;
@@ -910,13 +990,13 @@ function filterLogicalElements(
910
990
 
911
991
  } else if (logicalElementType === "traversal") {
912
992
 
913
- _izContext.logger.debug('logicalElementType: ', f);
993
+ console.log('logicalElementType: ', f);
914
994
  } else if (logicalElementType === "translateIds") {
915
995
 
916
- _izContext.logger.debug('logicalElementType: ', g);
996
+ console.log('logicalElementType: ', g);
917
997
  } else if (logicalElementType === "identifiers") {
918
998
 
919
- _izContext.logger.debug('logicalElementType: ', h);
999
+ console.log('logicalElementType: ', h);
920
1000
  }
921
1001
 
922
1002
  if (errorsFound.length > 0) {
@@ -925,8 +1005,8 @@ function filterLogicalElements(
925
1005
 
926
1006
  if (lastNextLogicalElementId !== null) {
927
1007
 
928
- [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = complexFilterShared.validateOperation(
929
- _izContext,
1008
+ // [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = complexFilterShared.validateOperation(
1009
+ [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = validateOperation(
930
1010
  objType,
931
1011
  runningFilterMainId,
932
1012
  runningFilterObject,
@@ -934,7 +1014,7 @@ function filterLogicalElements(
934
1014
  currentFilterMainId,
935
1015
  currentFilterObject
936
1016
  );
937
- _izContext.logger.debug('return validateOperation for lastNextLogicalElementId == null: ', {
1017
+ console.log('return validateOperation for lastNextLogicalElementId == null: ', {
938
1018
  runningFilterMainId,
939
1019
  runningFilterObject,
940
1020
  operation,
@@ -953,7 +1033,6 @@ function filterLogicalElements(
953
1033
  nextErrorFound,
954
1034
  nextElementId
955
1035
  ] = filterLogicalElements(
956
- _izContext,
957
1036
  objType,
958
1037
  initialLogicalElementId,
959
1038
  logicalElements,
@@ -963,7 +1042,7 @@ function filterLogicalElements(
963
1042
  runningFilterObject,
964
1043
  lastLogicalOperator,
965
1044
  );
966
- _izContext.logger.debug('return validateOperation for lastNextLogicalElementId !== null: ', {
1045
+ console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
967
1046
  nextFilterMainId,
968
1047
  nextFilterObject,
969
1048
  operations,
@@ -989,7 +1068,6 @@ function filterLogicalElements(
989
1068
  filterErrorFound,
990
1069
  nextElementId
991
1070
  ] = filterLogicalElements(
992
- _izContext,
993
1071
  objType,
994
1072
  initialLogicalElementId,
995
1073
  logicalElements,
@@ -999,7 +1077,7 @@ function filterLogicalElements(
999
1077
  nextFilterObject,
1000
1078
  lastLogicalOperator
1001
1079
  );
1002
- _izContext.logger.debug('return validateOperation for lastNextLogicalElementId !== null: ', {
1080
+ console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
1003
1081
  runningFilterMainId,
1004
1082
  runningFilterObject,
1005
1083
  operation,
@@ -1028,8 +1106,7 @@ function filterLogicalElements(
1028
1106
 
1029
1107
  } else {
1030
1108
 
1031
- [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = complexFilterShared.validateOperation(
1032
- _izContext,
1109
+ [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = validateOperation(
1033
1110
  objType,
1034
1111
  runningFilterMainId,
1035
1112
  runningFilterObject,
@@ -1037,7 +1114,7 @@ function filterLogicalElements(
1037
1114
  currentFilterMainId,
1038
1115
  currentFilterObject
1039
1116
  );
1040
- _izContext.logger.debug('return validateOperation for lastNextLogicalElementId == null: ', {
1117
+ console.log('return validateOperation for lastNextLogicalElementId == null: ', {
1041
1118
  runningFilterMainId,
1042
1119
  runningFilterObject,
1043
1120
  operation,
@@ -1054,421 +1131,13 @@ function filterLogicalElements(
1054
1131
 
1055
1132
  };
1056
1133
 
1057
-
1058
-
1059
- function combineLogicalStructure(
1060
- _izContext,
1061
- objType,
1062
- initialLogicalElementId,
1063
- logicalElements,
1064
- ) {
1065
- _izContext.logger.debug('combineLogicalStructure: ', {
1066
- objType,
1067
- initialLogicalElementId,
1068
- logicalElements,
1069
- });
1070
-
1071
- let returnInitialElementId = null;
1072
- let initialLogicalElementObject = logicalElements[initialLogicalElementId]
1073
- if (initialLogicalElementObject.logicalElementType !== 'logicalStructure') {
1074
- returnInitialElementId = initialLogicalElementId;
1075
- } else {
1076
- returnInitialElementId = logicalElements[initialLogicalElementId].initialLogicalElementId;
1077
- };
1078
- _izContext.logger.debug('returnInitialElementId', returnInitialElementId);
1079
-
1080
- let previousLogicalElementId = null;
1081
- let previousLogicalElementObject = null;
1082
-
1083
- let operationLogicalElementId = null;
1084
- let operationLogicalElementObject = null;
1085
-
1086
- let nextLogicalElementId = null;
1087
- let nextLogicalElementObject = null;
1088
-
1089
- let returnLogicalElements = {};
1090
-
1091
- let errorsObject = {};
1092
- let errorsFound = [];
1093
-
1094
- for (const [logicalElementId, logicalElementObject] of Object.entries(logicalElements)) {
1095
- _izContext.logger.debug('extract logicalELements: ', { initialLogicalElementId, logicalElementId, logicalElementObject });
1096
-
1097
- if (initialLogicalElementId !== logicalElementId) {
1098
- continue;
1099
- };
1100
-
1101
- let logicalElementType = logicalElementObject.logicalElementType;
1102
- _izContext.logger.debug('logicalElementType: ', logicalElementType);
1103
-
1104
- if (logicalElementType === 'openBracket') {
1105
- _izContext.logger.debug('----------type: openBracket ----------');
1106
- if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
1107
- errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
1108
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
1109
- };
1110
- if (!logicalElementObject.hasOwnProperty('nextLogicalElementId')) {
1111
- errorsObject[logicalElementId] = `this logical structure is not set nextLogicalElementId`;
1112
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set nextLogicalElementId`);
1113
- };
1114
-
1115
- nextLogicalElementId = logicalElementId;
1116
- nextLogicalElementObject = { [nextLogicalElementId]: logicalElementObject };
1117
- initialLogicalElementId = logicalElementObject.nextLogicalElementId;
1118
-
1119
- } else if (logicalElementType === 'logicalStructure') {
1120
- _izContext.logger.debug('----------type: logicalStructure ----------');
1121
-
1122
- if (!logicalElementObject.hasOwnProperty('objType')) {
1123
- errorsObject[logicalElementId] = `this logical structure is not set objType`;
1124
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
1125
- };
1126
- if (!logicalElementObject.hasOwnProperty('initialLogicalElementId')) {
1127
- errorsObject[logicalElementId] = `this logical structure is not set initialLogicalElementId`;
1128
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set initialLogicalElementId`);
1129
- };
1130
- if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
1131
- errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
1132
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
1133
- };
1134
- if (!logicalElementObject.hasOwnProperty('nextLogicalElementId')) {
1135
- errorsObject[logicalElementId] = `this logical structure is not set nextLogicalElementId`;
1136
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set nextLogicalElementId`);
1137
- };
1138
- if (!logicalElementObject.hasOwnProperty('logicalElements')) {
1139
- errorsObject[logicalElementId] = `this logical structure is not set logicalElements`;
1140
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set logicalElements`);
1141
- };
1142
-
1143
- nextLogicalElementId = logicalElementObject.initialLogicalElementId;
1144
- nextLogicalElementObject = logicalElementObject.logicalElements;
1145
-
1146
- if (logicalElementObject.nextLogicalElementId !== null) {
1147
- initialLogicalElementId = logicalElementObject.nextLogicalElementId;
1148
- };
1149
-
1150
- } else if (logicalElementType === 'operation') {
1151
- _izContext.logger.debug('----------type: operation ----------');
1152
- if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
1153
- errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
1154
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
1155
- };
1156
- if (!logicalElementObject.hasOwnProperty('nextLogicalElementId')) {
1157
- errorsObject[logicalElementId] = `this logical structure is not set nextLogicalElementId`;
1158
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set nextLogicalElementId`);
1159
- };
1160
- if (!logicalElementObject.hasOwnProperty('operation')) {
1161
- errorsObject[logicalElementId] = `this logical structure is not set operation`;
1162
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set operation`);
1163
- };
1164
-
1165
- operationLogicalElementId = logicalElementId;
1166
- operationLogicalElementObject = logicalElementObject;
1167
- initialLogicalElementId = logicalElementObject.nextLogicalElementId;
1168
- continue;
1169
-
1170
- } else if (logicalElementType === 'closeBracket') {
1171
- _izContext.logger.debug('----------type: closeBracket ----------');
1172
- if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
1173
- errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
1174
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
1175
- };
1176
- if (!logicalElementObject.hasOwnProperty('nextLogicalElementId')) {
1177
- errorsObject[logicalElementId] = `this logical structure is not set nextLogicalElementId`;
1178
- errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set nextLogicalElementId`);
1179
- };
1180
-
1181
- nextLogicalElementId = logicalElementId;
1182
- nextLogicalElementObject = { [nextLogicalElementId]: logicalElementObject };
1183
- initialLogicalElementId = logicalElementObject.nextLogicalElementId;
1184
-
1185
- } else {
1186
- //* error
1187
- errorsObject[logicalElementId] = `has error on logicalElementType: ${logicalElementType}`;
1188
- errorsFound.push(`has error on logicalElementType in logicalElementId: ${logicalElementId}`);
1189
- };
1190
-
1191
- if (errorsFound.length > 0) {
1192
- return [null, errorsObject, errorsFound];
1193
- };
1194
-
1195
- let operations = null;
1196
- let operationErrorObjects = {};
1197
- let operationErrors = [];
1198
-
1199
- [
1200
- previousLogicalElementId,
1201
- previousLogicalElementObject,
1202
- operations,
1203
- operationErrorObjects,
1204
- operationErrors
1205
- ] = combineOperation(
1206
- _izContext,
1207
- previousLogicalElementId,
1208
- previousLogicalElementObject,
1209
- operationLogicalElementId,
1210
- operationLogicalElementObject,
1211
- nextLogicalElementId,
1212
- nextLogicalElementObject
1213
- );
1214
- _izContext.logger.debug('return combineOperation: ', {
1215
- previousLogicalElementId,
1216
- previousLogicalElementObject,
1217
- operations,
1218
- operationErrors
1219
- });
1220
-
1221
- if (operationErrors.length > 0) {
1222
- Object.assign(errorsObject, operationErrorObjects);
1223
- };
1224
-
1225
- if (operations !== null) {
1226
- Object.assign(returnLogicalElements, operations);
1227
- operationLogicalElementId = null;
1228
- operationLogicalElementObject = null;
1229
- } else {
1230
- Object.assign(returnLogicalElements, previousLogicalElementObject);
1231
- };
1232
-
1233
- } //end iterate logicalElements
1234
-
1235
- _izContext.logger.debug('returnLogicalElements: ', { returnLogicalElements });
1236
-
1237
- let returnComplexLogicalStructure = {
1238
- objType: objType,
1239
- initialLogicalElementId: returnInitialElementId,
1240
- logicalElements: returnLogicalElements
1241
- };
1242
-
1243
- return [returnComplexLogicalStructure, errorsObject, errorsFound];
1244
-
1245
- };
1246
-
1247
- function combineOperation(
1248
- _izContext,
1249
- previousLogicalElementId,
1250
- previousLogicalElementObject,
1251
- operationLogicalElementId,
1252
- operationLogicalElementObject,
1253
- nextLogicalElementId,
1254
- nextLogicalElementObject
1255
- ) {
1256
- _izContext.logger.debug('combineOperation: ', {
1257
- previousLogicalElementId,
1258
- previousLogicalElementObject,
1259
- operationLogicalElementId,
1260
- operationLogicalElementObject,
1261
- nextLogicalElementId,
1262
- nextLogicalElementObject
1263
- });
1264
-
1265
- let errorsObject = {};
1266
- let errorsFound = []
1267
-
1268
- if (!nextLogicalElementObject) {
1269
- errorsFound.push('cannot found current filterElement object')
1270
- return [null, null, null, errorsObject, errorsFound];
1271
- };
1272
-
1273
- if (!previousLogicalElementObject) {
1274
- return [nextLogicalElementId, nextLogicalElementObject, null, errorsObject, errorsFound];
1275
- };
1276
-
1277
- if (!operationLogicalElementObject) {
1278
- _izContext.logger.debug('------------ previous & current ------------', {
1279
- previousLogicalElementId,
1280
- previousLogicalElementObject,
1281
- operationLogicalElementId,
1282
- operationLogicalElementObject,
1283
- nextLogicalElementId,
1284
- nextLogicalElementObject
1285
- });
1286
-
1287
- let operations = {};
1288
- let returnnextElementId = null;
1289
- let returnNextElementObject = null;
1290
-
1291
- if (previousLogicalElementObject[previousLogicalElementId].logicalElementType === 'openBracket') {
1292
- if (nextLogicalElementObject[nextLogicalElementId].logicalElementType === 'closeBracket') {
1293
-
1294
- if (Object.entries(previousLogicalElementObject).length <= 2) {
1295
-
1296
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = nextLogicalElementId;
1297
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
1298
-
1299
- } else {
1300
-
1301
- if (previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId === null) {
1302
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = nextLogicalElementId;
1303
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
1304
-
1305
- } else {
1306
-
1307
- let checkNextLogicalElementId = previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId;
1308
- _izContext.logger.debug('checkNextLogicalElementId:', checkNextLogicalElementId);
1309
-
1310
- for (let i = 0; i < Object.entries(previousLogicalElementObject).length; i++) {
1311
- let [logicalElementId, logicalObject] = Object.entries(previousLogicalElementObject)[i];
1312
- _izContext.logger.debug('extract logical element: ', { logicalElementId, logicalObject });
1313
-
1314
- if (logicalElementId !== checkNextLogicalElementId) {
1315
- continue;
1316
- };
1317
-
1318
- _izContext.logger.debug('------------- has next logicalElemet to continue -------------');
1319
-
1320
- if (logicalObject.nextLogicalElementId !== null) {
1321
- checkNextLogicalElementId = logicalObject.nextLogicalElementId;
1322
- continue;
1323
- } else {
1324
- previousLogicalElementObject[logicalElementId].nextLogicalElementId = nextLogicalElementId;
1325
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = logicalElementId;
1326
- };
1327
- };
1328
- };
1329
- };
1330
-
1331
- operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
1332
- _izContext.logger.debug('operations: ', operations);
1333
-
1334
- returnnextElementId = nextLogicalElementId;
1335
- returnNextElementObject = nextLogicalElementObject;
1336
-
1337
- } else {
1338
-
1339
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = nextLogicalElementId;
1340
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
1341
-
1342
- operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
1343
-
1344
- _izContext.logger.debug('operations: ', operations);
1345
- returnnextElementId = nextLogicalElementId;
1346
- returnNextElementObject = nextLogicalElementObject;
1347
-
1348
- };
1349
-
1350
- } else if (previousLogicalElementObject[previousLogicalElementId].logicalElementType === 'closeBracket') {
1351
-
1352
- if (nextLogicalElementObject[nextLogicalElementId].logicalElementType === 'closeBracket') {
1353
-
1354
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = nextLogicalElementId;
1355
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
1356
-
1357
- operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
1358
- _izContext.logger.debug('operations: ', operations);
1359
-
1360
- returnnextElementId = nextLogicalElementId;
1361
- returnNextElementObject = nextLogicalElementObject;
1362
-
1363
- } else {
1364
- errorsObject[nextLogicalElementId] = 'this path has logical structure error';
1365
- errorsFound.push(`${nextLogicalElementId}: this path has logical structure error`);
1366
- };
1367
-
1368
- } else {
1369
-
1370
- if (nextLogicalElementObject[nextLogicalElementId].logicalElementType === 'closeBracket') {
1371
-
1372
- _izContext.logger.debug('previousLogicalElementObject: ', previousLogicalElementObject);
1373
-
1374
- if (Object.entries(previousLogicalElementObject).length <= 2) {
1375
-
1376
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = nextLogicalElementId;
1377
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
1378
-
1379
- } else {
1380
-
1381
- if (previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId === null) {
1382
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = nextLogicalElementId;
1383
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
1384
-
1385
- } else {
1386
-
1387
- let checkNextLogicalElementId = previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId;
1388
- _izContext.logger.debug('checkNextLogicalElementId:', checkNextLogicalElementId);
1389
-
1390
- for (let i = 0; i < Object.entries(previousLogicalElementObject).length; i++) {
1391
- let [logicalElementId, logicalObject] = Object.entries(previousLogicalElementObject)[i];
1392
- _izContext.logger.debug('extract logical element: ', { logicalElementId, logicalObject });
1393
-
1394
- if (logicalElementId !== checkNextLogicalElementId) {
1395
- continue;
1396
- };
1397
-
1398
- _izContext.logger.debug('------------- has next logicalElemet to continue -------------');
1399
-
1400
- if (logicalObject.nextLogicalElementId !== null) {
1401
- checkNextLogicalElementId = logicalObject.nextLogicalElementId;
1402
- continue;
1403
- } else {
1404
- previousLogicalElementObject[logicalElementId].nextLogicalElementId = nextLogicalElementId;
1405
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = logicalElementId;
1406
- };
1407
- };
1408
- };
1409
- };
1410
-
1411
- operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
1412
- _izContext.logger.debug("operations: ", operations);
1413
-
1414
- returnnextElementId = nextLogicalElementId;
1415
- returnNextElementObject = nextLogicalElementObject;
1416
-
1417
- } else {
1418
- errorsObject[nextLogicalElementId] = 'this path has logical structure error';
1419
- errorsFound.push(`${nextLogicalElementId}: this path has logical structure error`);
1420
- };
1421
- };
1422
- return [returnnextElementId, returnNextElementObject, operations, errorsObject, errorsFound];
1423
- };
1424
-
1425
- if (previousLogicalElementObject && operationLogicalElementObject && nextLogicalElementObject) {
1426
- _izContext.logger.debug('------------ previous & operation & current ------------', {
1427
- previousLogicalElementId,
1428
- previousLogicalElementObject,
1429
- operationLogicalElementId,
1430
- operationLogicalElementObject,
1431
- nextLogicalElementId,
1432
- nextLogicalElementObject
1433
- });
1434
-
1435
- let operations = {};
1436
-
1437
- previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId = operationLogicalElementId;
1438
- nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = operationLogicalElementId;
1439
-
1440
- operationLogicalElementObject.previousLogicalElementId = previousLogicalElementId;
1441
- operationLogicalElementObject.nextLogicalElementId = nextLogicalElementId;
1442
-
1443
- _izContext.logger.debug('after set previous and next: ', {
1444
- previousLogicalElementObject,
1445
- operationLogicalElementObject,
1446
- nextLogicalElementObject
1447
- });
1448
-
1449
- operations = Object.assign(previousLogicalElementObject, { [operationLogicalElementId]: operationLogicalElementObject }, nextLogicalElementObject);
1450
-
1451
- return [nextLogicalElementId, nextLogicalElementObject, operations, errorsObject, errorsFound];
1452
-
1453
- } else {
1454
- errorsObject[previousLogicalElementId] = 'found error that incorrect of logical structure';
1455
- errorsObject[currentLogicalElementId] = 'found error that incorrect of logical structure';
1456
- errorsObject[operationLogicalElementId] = 'found error that incorrect of logical structure';
1457
- errorsFound.push('found error that incorrect of logical structure');
1458
-
1459
- return [null, null, null, errorsObject, errorsFound];
1460
- };
1461
-
1462
- };
1463
-
1464
1134
  function splitFilterElements(
1465
- _izContext,
1466
1135
  runningFilterMainId,
1467
1136
  runningFilterObject,
1468
1137
  currentFilterMainId = null,
1469
1138
  currentFilterObject = null
1470
1139
  ) {
1471
- _izContext.logger.debug('split FilterElements: ', {
1140
+ console.log('split FilterElements: ', {
1472
1141
  runningFilterMainId,
1473
1142
  runningFilterObject,
1474
1143
  currentFilterMainId,
@@ -1484,42 +1153,42 @@ function splitFilterElements(
1484
1153
  // ) {}
1485
1154
 
1486
1155
  if (runningFilterObject.filterElement.filterType === 'operation') {
1487
- _izContext.logger.debug('-------- operation ----------');
1156
+ console.log('-------- operation ----------');
1488
1157
 
1489
1158
  Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
1490
1159
  delete runningFilterObject.filterElement.filterElements;
1491
1160
  filterElements[runningFilterMainId] = runningFilterObject;
1492
1161
 
1493
1162
  } else if (runningFilterObject.filterElement.filterType === 'childComplexFilter') {
1494
- _izContext.logger.debug('-------- childComplexFilter ----------');
1163
+ console.log('-------- childComplexFilter ----------');
1495
1164
 
1496
1165
  Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
1497
1166
  delete runningFilterObject.filterElement.filterElements;
1498
1167
  filterElements[runningFilterMainId] = runningFilterObject;
1499
1168
 
1500
1169
  } else {
1501
- _izContext.logger.debug(` -------- ${runningFilterObject.filterElement.filterType} ----------`);
1170
+ console.log(` -------- ${runningFilterObject.filterElement.filterType} ----------`);
1502
1171
  //'logical'| 'identifiers'|'translateIds'|'traversal'
1503
1172
  filterElements[runningFilterMainId] = runningFilterObject;
1504
1173
  };
1505
1174
 
1506
1175
  if (currentFilterObject !== null) {
1507
1176
  if (currentFilterObject.filterElement.filterType === 'operation') {
1508
- _izContext.logger.debug('-------- operation ----------');
1177
+ console.log('-------- operation ----------');
1509
1178
 
1510
1179
  Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
1511
1180
  delete currentFilterObject.filterElement.filterElements;
1512
1181
  filterElements[currentFilterMainId] = currentFilterObject;
1513
1182
 
1514
1183
  } else if (currentFilterObject.filterElement.filterType === 'childComplexFilter') {
1515
- _izContext.logger.debug('-------- childComplexFilter ----------');
1184
+ console.log('-------- childComplexFilter ----------');
1516
1185
 
1517
1186
  Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
1518
1187
  delete currentFilterObject.filterElement.filterElements;
1519
1188
  filterElements[currentFilterMainId] = currentFilterObject;
1520
1189
 
1521
1190
  } else {
1522
- _izContext.logger.debug(` -------- ${currentFilterObject.filterElement.filterType} ----------`);
1191
+ console.log(` -------- ${currentFilterObject.filterElement.filterType} ----------`);
1523
1192
  //'logical'| 'identifiers'|'translateIds'|'traversal'
1524
1193
  filterElements[currentFilterMainId] = currentFilterObject;
1525
1194
  };
@@ -1535,10 +1204,6 @@ export default {
1535
1204
  createFiltersRequest,
1536
1205
  validateCombinationStructure,
1537
1206
  // validateOperation,
1538
- // filterLogicalElements,
1207
+ filterLogicalElements,
1539
1208
  // splitFilterElements,
1540
-
1541
- combineLogicalStructure,
1542
- // combineOperation,
1543
-
1544
1209
  }