@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/src/FiltersSharedLib.js
CHANGED
|
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
"use strict";
|
|
19
19
|
|
|
20
20
|
import { objectHash as hash } from '@izara_project/izara-shared-core'; //const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
|
-
import
|
|
21
|
+
import lodash from 'lodash';
|
|
22
|
+
const { isEmpty } = lodash;
|
|
22
23
|
import complexFilterShared from '@izara_project/izara-core-library-complex-filter';
|
|
23
24
|
|
|
24
25
|
function validateFilterElement(
|
|
@@ -60,13 +61,12 @@ function validateFilterElement(
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
function createFiltersRequest(
|
|
63
|
-
_izContext,
|
|
64
64
|
objType,
|
|
65
65
|
initialLogicalElementId,
|
|
66
66
|
logicalElements,
|
|
67
67
|
values,
|
|
68
68
|
) {
|
|
69
|
-
|
|
69
|
+
console.log('createFiltersRequest: ', {
|
|
70
70
|
objType,
|
|
71
71
|
initialLogicalElementId,
|
|
72
72
|
logicalElements,
|
|
@@ -83,12 +83,12 @@ function createFiltersRequest(
|
|
|
83
83
|
|
|
84
84
|
//* validate combine logicalStructure
|
|
85
85
|
let [validateObject, validateFilterMainId, validateFilterObject, validateErrorsObject, validateErrors] = validateCombinationStructure(
|
|
86
|
-
|
|
86
|
+
objType,
|
|
87
87
|
initialLogicalElementId,
|
|
88
88
|
logicalElements,
|
|
89
89
|
values
|
|
90
90
|
);
|
|
91
|
-
|
|
91
|
+
console.log('return validateCombinationStructure: ', {
|
|
92
92
|
validateObject,
|
|
93
93
|
validateFilterMainId,
|
|
94
94
|
validateFilterObject,
|
|
@@ -117,13 +117,12 @@ function createFiltersRequest(
|
|
|
117
117
|
operationErrorsObject,
|
|
118
118
|
operationErrors
|
|
119
119
|
] = filterLogicalElements(
|
|
120
|
-
_izContext,
|
|
121
120
|
objType,
|
|
122
121
|
initialLogicalElementId,
|
|
123
122
|
logicalElements,
|
|
124
123
|
values,
|
|
125
124
|
);
|
|
126
|
-
|
|
125
|
+
console.log('final return filterLogicalElements: ', {
|
|
127
126
|
filterMainId,
|
|
128
127
|
filterMainObject,
|
|
129
128
|
operation,
|
|
@@ -161,7 +160,7 @@ function createFiltersRequest(
|
|
|
161
160
|
filterMainId: filterMainId,
|
|
162
161
|
filterElements: filterElements
|
|
163
162
|
};
|
|
164
|
-
|
|
163
|
+
console.log('complexFilterRequest: ', complexFilterRequest);
|
|
165
164
|
|
|
166
165
|
// let validate = validateFilterElement(
|
|
167
166
|
// complexFilterRequest.filterElements,
|
|
@@ -185,12 +184,13 @@ function createFiltersRequest(
|
|
|
185
184
|
};
|
|
186
185
|
|
|
187
186
|
function validateCombinationStructure(
|
|
188
|
-
|
|
187
|
+
objType,
|
|
189
188
|
initialLogicalElementId,
|
|
190
189
|
logicalElements,
|
|
191
190
|
values
|
|
192
191
|
) {
|
|
193
|
-
|
|
192
|
+
console.log('validateCombinationStructure: ', {
|
|
193
|
+
objType,
|
|
194
194
|
initialLogicalElementId,
|
|
195
195
|
logicalElements,
|
|
196
196
|
values
|
|
@@ -207,12 +207,12 @@ function validateCombinationStructure(
|
|
|
207
207
|
let lastOperation = null;
|
|
208
208
|
|
|
209
209
|
for (const [logicalElementId, logicalElementObject] of Object.entries(logicalElements)) {
|
|
210
|
-
|
|
210
|
+
console.log('iterate logicalElements: ', { initialLogicalElementId, logicalElementId, logicalElementObject });
|
|
211
211
|
|
|
212
212
|
if (initialLogicalElementId !== logicalElementId) {
|
|
213
213
|
continue;
|
|
214
214
|
};
|
|
215
|
-
|
|
215
|
+
console.log('----------------- start logicalElement --------------');
|
|
216
216
|
|
|
217
217
|
if (!logicalElementObject.hasOwnProperty("logicalElementType")) {
|
|
218
218
|
errorsObject[logicalElementId] = `this logical structure is not set logicalElementType`;
|
|
@@ -230,14 +230,14 @@ function validateCombinationStructure(
|
|
|
230
230
|
let logicalElementType = logicalElementObject.logicalElementType;
|
|
231
231
|
|
|
232
232
|
if (logicalElementType === 'operation') {
|
|
233
|
-
|
|
234
|
-
|
|
233
|
+
console.log('----------------- operation --------------');
|
|
234
|
+
console.log('logicalElementObject: ', logicalElementObject);
|
|
235
235
|
|
|
236
236
|
lastOperation = logicalElementObject.operation;
|
|
237
|
-
|
|
237
|
+
console.log('lastOperation: ', lastOperation);
|
|
238
238
|
|
|
239
239
|
if (isEmpty(lastOperation)) {
|
|
240
|
-
|
|
240
|
+
console.log('no operation: ', logicalElementObject.operation);
|
|
241
241
|
errorsObject[logicalElementId] = `this logical structure is not set operation parameter`;
|
|
242
242
|
errorsFound.push(`this logical structure type: operation: ${logicalElementId} is not set operation parameter`);
|
|
243
243
|
break;
|
|
@@ -250,17 +250,17 @@ function validateCombinationStructure(
|
|
|
250
250
|
};
|
|
251
251
|
|
|
252
252
|
if (logicalElementType === 'openBracket') {
|
|
253
|
-
|
|
253
|
+
console.log('----------------- openBracket --------------');
|
|
254
254
|
|
|
255
255
|
let nextElementId = null;
|
|
256
256
|
|
|
257
257
|
[validateObject, currentFilterMainId, currentFilterObject, errorsObject, errorsFound, nextElementId] = validateCombinationStructure(
|
|
258
|
-
|
|
258
|
+
objType,
|
|
259
259
|
logicalElementObject.nextLogicalElementId,
|
|
260
260
|
logicalElements,
|
|
261
261
|
values
|
|
262
262
|
);
|
|
263
|
-
|
|
263
|
+
console.log('return validateCombinationStruce for openBracket: ', {
|
|
264
264
|
validateObject,
|
|
265
265
|
currentFilterMainId,
|
|
266
266
|
currentFilterObject,
|
|
@@ -274,7 +274,7 @@ function validateCombinationStructure(
|
|
|
274
274
|
};
|
|
275
275
|
|
|
276
276
|
} else if (logicalElementType === 'closeBracket') {
|
|
277
|
-
|
|
277
|
+
console.log('----------------- closeBracket --------------');
|
|
278
278
|
|
|
279
279
|
return [
|
|
280
280
|
true,
|
|
@@ -286,7 +286,7 @@ function validateCombinationStructure(
|
|
|
286
286
|
];
|
|
287
287
|
|
|
288
288
|
} else if (logicalElementType === 'logical') {
|
|
289
|
-
|
|
289
|
+
console.log('----------------- logical --------------');
|
|
290
290
|
if (!logicalElementObject.hasOwnProperty('objType')) {
|
|
291
291
|
errorsObject[logicalElementId] = `this logical structure is not set objType`;
|
|
292
292
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
|
|
@@ -312,7 +312,7 @@ function validateCombinationStructure(
|
|
|
312
312
|
};
|
|
313
313
|
|
|
314
314
|
} else if (logicalElementType === 'childComplexFilter') {
|
|
315
|
-
|
|
315
|
+
console.log('----------------- childComplexFilter --------------');
|
|
316
316
|
if (!logicalElementObject.hasOwnProperty('objType')) {
|
|
317
317
|
errorsObject[logicalElementId] = `this logical structure is not set objType`;
|
|
318
318
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
|
|
@@ -332,7 +332,7 @@ function validateCombinationStructure(
|
|
|
332
332
|
};
|
|
333
333
|
|
|
334
334
|
let parantObjType = logicalElementObject.objType;
|
|
335
|
-
|
|
335
|
+
console.log('check parantObjType: ', {
|
|
336
336
|
parantObjType
|
|
337
337
|
});
|
|
338
338
|
|
|
@@ -342,13 +342,13 @@ function validateCombinationStructure(
|
|
|
342
342
|
childElementObject,
|
|
343
343
|
childErrorsObject,
|
|
344
344
|
childErrorsFound
|
|
345
|
-
] =
|
|
346
|
-
|
|
345
|
+
] = validateCombinationStructure(
|
|
346
|
+
logicalElementObject.pathLinkType.objType,
|
|
347
347
|
logicalElementObject.childLogicalElementId,
|
|
348
348
|
logicalElements,
|
|
349
349
|
values
|
|
350
350
|
);
|
|
351
|
-
|
|
351
|
+
console.log('return validateCombinationStruce for childComplexFilter: ', {
|
|
352
352
|
childValidate,
|
|
353
353
|
childElementId,
|
|
354
354
|
childElementObject,
|
|
@@ -369,7 +369,7 @@ function validateCombinationStructure(
|
|
|
369
369
|
};
|
|
370
370
|
|
|
371
371
|
} else if (logicalElementType === 'translateIds') {
|
|
372
|
-
|
|
372
|
+
console.log("----------------- translateIds --------------", logicalElementObject);
|
|
373
373
|
|
|
374
374
|
if (!logicalElementObject.hasOwnProperty('objType')) {
|
|
375
375
|
errorsObject[logicalElementId] = `this logical structure is not set objType`;
|
|
@@ -400,7 +400,7 @@ function validateCombinationStructure(
|
|
|
400
400
|
};
|
|
401
401
|
|
|
402
402
|
} else if (logicalElementType === 'identifiers') {
|
|
403
|
-
|
|
403
|
+
console.log('----------------- identifiers --------------', logicalElementObject);
|
|
404
404
|
if (!logicalElementObject.hasOwnProperty('objType')) {
|
|
405
405
|
errorsObject[logicalElementId] = `this logical structure is not set objType`;
|
|
406
406
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
|
|
@@ -426,7 +426,7 @@ function validateCombinationStructure(
|
|
|
426
426
|
};
|
|
427
427
|
|
|
428
428
|
} else if (logicalElementType === 'traversal') {
|
|
429
|
-
|
|
429
|
+
console.log('----------------- traversal --------------', logicalElementObject);
|
|
430
430
|
if (!logicalElementObject.hasOwnProperty('objType')) {
|
|
431
431
|
errorsObject[logicalElementId] = `this logical structure is not set objType`;
|
|
432
432
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set objType`);
|
|
@@ -452,15 +452,15 @@ function validateCombinationStructure(
|
|
|
452
452
|
runningFilterObject,
|
|
453
453
|
operationFilterObject,
|
|
454
454
|
operationErrorsFound
|
|
455
|
-
] =
|
|
456
|
-
|
|
455
|
+
] = validateOperation(
|
|
456
|
+
objType,
|
|
457
457
|
runningFilterMainId,
|
|
458
458
|
runningFilterObject,
|
|
459
459
|
lastOperation,
|
|
460
460
|
currentFilterMainId,
|
|
461
461
|
currentFilterObject
|
|
462
462
|
);
|
|
463
|
-
|
|
463
|
+
console.log('return validateOperation: ', {
|
|
464
464
|
runningFilterMainId,
|
|
465
465
|
runningFilterObject,
|
|
466
466
|
operationFilterObject,
|
|
@@ -489,117 +489,201 @@ function validateCombinationStructure(
|
|
|
489
489
|
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
function validateOperation(
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
) {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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
|
+
// });
|
|
507
507
|
|
|
508
|
-
|
|
509
|
-
|
|
508
|
+
// let errorsObject = {};
|
|
509
|
+
// let errorsFound = [];
|
|
510
510
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
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
|
+
// };
|
|
516
516
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
517
|
+
// if (!runningFilterObject) {
|
|
518
|
+
// return [currentFilterMainId, currentFilterObject, errorsObject, errorsFound];
|
|
519
|
+
// };
|
|
520
520
|
|
|
521
|
-
|
|
521
|
+
// if (!lastOperation) {
|
|
522
522
|
|
|
523
|
-
|
|
524
|
-
|
|
523
|
+
// let returnNextElementId = null;
|
|
524
|
+
// let returnNextElementObject = null;
|
|
525
525
|
|
|
526
|
-
|
|
527
|
-
|
|
526
|
+
// if (runningFilterObject.logicalElementType === 'openBracket') {
|
|
527
|
+
// if (currentFilterObject.logicalElementType === 'closeBracket') {
|
|
528
528
|
|
|
529
|
-
|
|
530
|
-
|
|
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`);
|
|
531
531
|
|
|
532
|
-
|
|
532
|
+
// } else {
|
|
533
533
|
|
|
534
|
-
|
|
535
|
-
|
|
534
|
+
// runningFilterObject.nextLogicalElementId = currentFilterMainId;
|
|
535
|
+
// currentFilterObject.previousLogicalElementId = runningFilterMainId;
|
|
536
536
|
|
|
537
|
-
|
|
537
|
+
// operations = Object.assign(runningFilterObject, currentFilterObject);
|
|
538
538
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
// _izContext.logger.debug('operations: ', operations);
|
|
540
|
+
// returnNextElementId = currentFilterMainId;
|
|
541
|
+
// returnNextElementObject = currentFilterObject;
|
|
542
542
|
|
|
543
|
-
|
|
543
|
+
// };
|
|
544
544
|
|
|
545
|
-
|
|
546
|
-
|
|
545
|
+
// } else if (runningFilterObject.logicalElementType === 'closeBracket') {
|
|
546
|
+
// if (currentFilterObject.logicalElementType === "closeBracket") {
|
|
547
547
|
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
// runningFilterObject.nextLogicalElementId = currentFilterMainId;
|
|
549
|
+
// currentFilterObject.previousLogicalElementId = runningFilterMainId;
|
|
550
550
|
|
|
551
|
-
|
|
552
|
-
|
|
551
|
+
// operations = Object.assign(runningFilterObject, currentFilterObject);
|
|
552
|
+
// _izContext.logger.debug('operations: ', operations);
|
|
553
553
|
|
|
554
|
-
|
|
555
|
-
|
|
554
|
+
// returnNextElementId = currentFilterMainId;
|
|
555
|
+
// returnNextElementObject = currentFilterObject;
|
|
556
556
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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
|
+
// };
|
|
561
561
|
|
|
562
|
-
|
|
562
|
+
// } else {
|
|
563
563
|
|
|
564
|
-
|
|
564
|
+
// if (currentFilterObject.logicalElementType === 'closeBracket') {
|
|
565
565
|
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
// runningFilterObject.nextLogicalElementId = currentFilterMainId;
|
|
567
|
+
// currentFilterObject.previousLogicalElementId = runningFilterMainId;
|
|
568
568
|
|
|
569
|
-
|
|
570
|
-
|
|
569
|
+
// operations = Object.assign(runningFilterObject, currentFilterObject);
|
|
570
|
+
// _izContext.logger.debug('operations: ', operations);
|
|
571
571
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
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
|
+
// };
|
|
579
579
|
|
|
580
|
-
|
|
580
|
+
// return [returnNextElementId, returnNextElementObject, errorsObject, errorsFound];
|
|
581
581
|
|
|
582
|
-
|
|
582
|
+
// };
|
|
583
583
|
|
|
584
|
-
|
|
584
|
+
// if (runningFilterMainId && lastOperation && currentFilterMainId) {
|
|
585
585
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
586
|
+
// // let operationFilterObject = {
|
|
587
|
+
// // runningFilterMainId: runningFilterObject,
|
|
588
|
+
// // operation: lastOperation,
|
|
589
|
+
// // currentFilterMainId: currentFilterObject
|
|
590
|
+
// // };
|
|
591
|
+
// // // let operationFilterMainId = hash(operationFilterObject);
|
|
592
592
|
|
|
593
|
-
|
|
593
|
+
// return [currentFilterMainId, currentFilterObject, errorsObject, errorsFound];
|
|
594
594
|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
};
|
|
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
|
+
}
|
|
600
685
|
|
|
601
686
|
function filterLogicalElements(
|
|
602
|
-
_izContext,
|
|
603
687
|
objType,
|
|
604
688
|
initialLogicalElementId,
|
|
605
689
|
logicalElements,
|
|
@@ -611,7 +695,7 @@ function filterLogicalElements(
|
|
|
611
695
|
currentFilterMainId = null,
|
|
612
696
|
currentFilterObject = null
|
|
613
697
|
) {
|
|
614
|
-
|
|
698
|
+
console.log('filterLogicalElements: ', {
|
|
615
699
|
objType,
|
|
616
700
|
initialLogicalElementId,
|
|
617
701
|
logicalElements,
|
|
@@ -637,7 +721,7 @@ function filterLogicalElements(
|
|
|
637
721
|
}
|
|
638
722
|
|
|
639
723
|
let logicalElement = logicalElements[currentLogicalElementId];
|
|
640
|
-
|
|
724
|
+
console.log('logicalElement: ', logicalElement)
|
|
641
725
|
|
|
642
726
|
if (isEmpty(logicalElement)) {
|
|
643
727
|
errorsObject[currentLogicalElementId] = 'this logicalElement not found';
|
|
@@ -649,7 +733,7 @@ function filterLogicalElements(
|
|
|
649
733
|
};
|
|
650
734
|
|
|
651
735
|
let logicalElementType = logicalElement.logicalElementType;
|
|
652
|
-
|
|
736
|
+
console.log('logicalElementType: ', logicalElementType);
|
|
653
737
|
|
|
654
738
|
if (logicalElementType === "openBracket") {
|
|
655
739
|
|
|
@@ -663,14 +747,13 @@ function filterLogicalElements(
|
|
|
663
747
|
errorsFound,
|
|
664
748
|
nextElementId
|
|
665
749
|
] = filterLogicalElements(
|
|
666
|
-
_izContext,
|
|
667
750
|
objType,
|
|
668
751
|
initialLogicalElementId,
|
|
669
752
|
logicalElements,
|
|
670
753
|
values,
|
|
671
754
|
logicalElement.nextLogicalElementId
|
|
672
755
|
);
|
|
673
|
-
|
|
756
|
+
console.log('return filterLogicalElement for openBracket: ', {
|
|
674
757
|
currentFilterMainId,
|
|
675
758
|
currentFilterObject,
|
|
676
759
|
operation,
|
|
@@ -707,15 +790,15 @@ function filterLogicalElements(
|
|
|
707
790
|
|
|
708
791
|
}
|
|
709
792
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
793
|
+
console.log("check logicalElement: ", logicalElement);
|
|
794
|
+
console.log("check logicalElementType: ", logicalElementType);
|
|
795
|
+
console.log("check filter main id: ", {
|
|
713
796
|
runningFilterMainId,
|
|
714
797
|
lastLogicalOperator,
|
|
715
798
|
currentFilterMainId
|
|
716
799
|
});
|
|
717
800
|
|
|
718
|
-
|
|
801
|
+
console.log("check filter main id: ", {
|
|
719
802
|
runningFilterMainId,
|
|
720
803
|
runningFilterObject,
|
|
721
804
|
lastLogicalOperator,
|
|
@@ -725,7 +808,7 @@ function filterLogicalElements(
|
|
|
725
808
|
|
|
726
809
|
if (logicalElementType === "logical") {
|
|
727
810
|
|
|
728
|
-
|
|
811
|
+
console.log('------------------ logicalElementType: logical ----------------');
|
|
729
812
|
|
|
730
813
|
if (!logicalElement.hasOwnProperty('objType')) {
|
|
731
814
|
errorsObject[initialLogicalElementId] = `this logical structure is not set objType`;
|
|
@@ -749,7 +832,7 @@ function filterLogicalElements(
|
|
|
749
832
|
}
|
|
750
833
|
|
|
751
834
|
let value = values[logicalElement.value];
|
|
752
|
-
|
|
835
|
+
console.log('value: ', value);
|
|
753
836
|
|
|
754
837
|
if (isEmpty(value)) {
|
|
755
838
|
errorsObject[currentLogicalElementId] = `value is empty`;
|
|
@@ -788,17 +871,17 @@ function filterLogicalElements(
|
|
|
788
871
|
};
|
|
789
872
|
};
|
|
790
873
|
};
|
|
791
|
-
|
|
874
|
+
console.log('currentFilterObject: ', currentFilterObject);
|
|
792
875
|
|
|
793
876
|
currentFilterMainId = hash(currentFilterObject);
|
|
794
|
-
|
|
877
|
+
console.log('currentFilterMainId: ', currentFilterMainId);
|
|
795
878
|
|
|
796
879
|
if (logicalElement.nextLogicalElementId !== null) {
|
|
797
880
|
lastNextLogicalElementId = logicalElement.nextLogicalElementId;
|
|
798
881
|
}
|
|
799
882
|
|
|
800
883
|
} else if (logicalElementType === "childComplexFilter") {
|
|
801
|
-
|
|
884
|
+
console.log('------------------ logicalElementType: childComplexFilter ----------------');
|
|
802
885
|
|
|
803
886
|
if (!logicalElement.hasOwnProperty('objType')) {
|
|
804
887
|
errorsObject[currentLogicalElementId] = `this logical structure is not set objType`;
|
|
@@ -841,14 +924,13 @@ function filterLogicalElements(
|
|
|
841
924
|
childErrorsFound,
|
|
842
925
|
childNextLogicalElementId
|
|
843
926
|
] = filterLogicalElements(
|
|
844
|
-
_izContext,
|
|
845
927
|
logicalElement.pathLinkType.objType,
|
|
846
928
|
initialLogicalElementId,
|
|
847
929
|
logicalElements,
|
|
848
930
|
values,
|
|
849
931
|
logicalElement.childLogicalElementId
|
|
850
932
|
);
|
|
851
|
-
|
|
933
|
+
console.log('return child filterLogicalElement for child complexFilter: ', {
|
|
852
934
|
childFilterMainId,
|
|
853
935
|
childFilterObject,
|
|
854
936
|
operation,
|
|
@@ -862,18 +944,17 @@ function filterLogicalElements(
|
|
|
862
944
|
}
|
|
863
945
|
|
|
864
946
|
let filterElements = splitFilterElements(
|
|
865
|
-
_izContext,
|
|
866
947
|
childFilterMainId,
|
|
867
948
|
childFilterObject
|
|
868
949
|
);
|
|
869
|
-
|
|
950
|
+
console.log('filterElements: ', filterElements);
|
|
870
951
|
let setRequestProperties = {};
|
|
871
952
|
|
|
872
953
|
if (!isEmpty(logicalElement.requestProperties)) {
|
|
873
|
-
|
|
954
|
+
console.log('logicalElement: ', logicalElement);
|
|
874
955
|
|
|
875
956
|
for (const [tag, requestPropertyId] of Object.entries(logicalElement.requestProperties)) {
|
|
876
|
-
|
|
957
|
+
console.log('set requestProperties: ', { tag, requestPropertyId });
|
|
877
958
|
|
|
878
959
|
let requestPropertyObject = values[requestPropertyId];
|
|
879
960
|
|
|
@@ -898,10 +979,10 @@ function filterLogicalElements(
|
|
|
898
979
|
requestProperties: setRequestProperties ?? {}
|
|
899
980
|
}
|
|
900
981
|
};
|
|
901
|
-
|
|
982
|
+
console.log('currentFilterObject: ', currentFilterObject);
|
|
902
983
|
|
|
903
984
|
currentFilterMainId = hash(currentFilterObject);
|
|
904
|
-
|
|
985
|
+
console.log('currentFilterMainId: ', currentFilterMainId);
|
|
905
986
|
|
|
906
987
|
if (logicalElement.nextLogicalElementId !== null) {
|
|
907
988
|
lastNextLogicalElementId = logicalElement.nextLogicalElementId;
|
|
@@ -909,13 +990,13 @@ function filterLogicalElements(
|
|
|
909
990
|
|
|
910
991
|
} else if (logicalElementType === "traversal") {
|
|
911
992
|
|
|
912
|
-
|
|
993
|
+
console.log('logicalElementType: ', f);
|
|
913
994
|
} else if (logicalElementType === "translateIds") {
|
|
914
995
|
|
|
915
|
-
|
|
996
|
+
console.log('logicalElementType: ', g);
|
|
916
997
|
} else if (logicalElementType === "identifiers") {
|
|
917
998
|
|
|
918
|
-
|
|
999
|
+
console.log('logicalElementType: ', h);
|
|
919
1000
|
}
|
|
920
1001
|
|
|
921
1002
|
if (errorsFound.length > 0) {
|
|
@@ -924,8 +1005,8 @@ function filterLogicalElements(
|
|
|
924
1005
|
|
|
925
1006
|
if (lastNextLogicalElementId !== null) {
|
|
926
1007
|
|
|
927
|
-
[runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = complexFilterShared.validateOperation(
|
|
928
|
-
|
|
1008
|
+
// [runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = complexFilterShared.validateOperation(
|
|
1009
|
+
[runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = validateOperation(
|
|
929
1010
|
objType,
|
|
930
1011
|
runningFilterMainId,
|
|
931
1012
|
runningFilterObject,
|
|
@@ -933,7 +1014,7 @@ function filterLogicalElements(
|
|
|
933
1014
|
currentFilterMainId,
|
|
934
1015
|
currentFilterObject
|
|
935
1016
|
);
|
|
936
|
-
|
|
1017
|
+
console.log('return validateOperation for lastNextLogicalElementId == null: ', {
|
|
937
1018
|
runningFilterMainId,
|
|
938
1019
|
runningFilterObject,
|
|
939
1020
|
operation,
|
|
@@ -952,7 +1033,6 @@ function filterLogicalElements(
|
|
|
952
1033
|
nextErrorFound,
|
|
953
1034
|
nextElementId
|
|
954
1035
|
] = filterLogicalElements(
|
|
955
|
-
_izContext,
|
|
956
1036
|
objType,
|
|
957
1037
|
initialLogicalElementId,
|
|
958
1038
|
logicalElements,
|
|
@@ -962,7 +1042,7 @@ function filterLogicalElements(
|
|
|
962
1042
|
runningFilterObject,
|
|
963
1043
|
lastLogicalOperator,
|
|
964
1044
|
);
|
|
965
|
-
|
|
1045
|
+
console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
|
|
966
1046
|
nextFilterMainId,
|
|
967
1047
|
nextFilterObject,
|
|
968
1048
|
operations,
|
|
@@ -988,7 +1068,6 @@ function filterLogicalElements(
|
|
|
988
1068
|
filterErrorFound,
|
|
989
1069
|
nextElementId
|
|
990
1070
|
] = filterLogicalElements(
|
|
991
|
-
_izContext,
|
|
992
1071
|
objType,
|
|
993
1072
|
initialLogicalElementId,
|
|
994
1073
|
logicalElements,
|
|
@@ -998,7 +1077,7 @@ function filterLogicalElements(
|
|
|
998
1077
|
nextFilterObject,
|
|
999
1078
|
lastLogicalOperator
|
|
1000
1079
|
);
|
|
1001
|
-
|
|
1080
|
+
console.log('return validateOperation for lastNextLogicalElementId !== null: ', {
|
|
1002
1081
|
runningFilterMainId,
|
|
1003
1082
|
runningFilterObject,
|
|
1004
1083
|
operation,
|
|
@@ -1027,8 +1106,7 @@ function filterLogicalElements(
|
|
|
1027
1106
|
|
|
1028
1107
|
} else {
|
|
1029
1108
|
|
|
1030
|
-
[runningFilterMainId, runningFilterObject, operation, operationErrorsFound] =
|
|
1031
|
-
_izContext,
|
|
1109
|
+
[runningFilterMainId, runningFilterObject, operation, operationErrorsFound] = validateOperation(
|
|
1032
1110
|
objType,
|
|
1033
1111
|
runningFilterMainId,
|
|
1034
1112
|
runningFilterObject,
|
|
@@ -1036,7 +1114,7 @@ function filterLogicalElements(
|
|
|
1036
1114
|
currentFilterMainId,
|
|
1037
1115
|
currentFilterObject
|
|
1038
1116
|
);
|
|
1039
|
-
|
|
1117
|
+
console.log('return validateOperation for lastNextLogicalElementId == null: ', {
|
|
1040
1118
|
runningFilterMainId,
|
|
1041
1119
|
runningFilterObject,
|
|
1042
1120
|
operation,
|
|
@@ -1056,12 +1134,11 @@ function filterLogicalElements(
|
|
|
1056
1134
|
|
|
1057
1135
|
|
|
1058
1136
|
function combineLogicalStructure(
|
|
1059
|
-
_izContext,
|
|
1060
1137
|
objType,
|
|
1061
1138
|
initialLogicalElementId,
|
|
1062
1139
|
logicalElements,
|
|
1063
1140
|
) {
|
|
1064
|
-
|
|
1141
|
+
console.log('combineLogicalStructure: ', {
|
|
1065
1142
|
objType,
|
|
1066
1143
|
initialLogicalElementId,
|
|
1067
1144
|
logicalElements,
|
|
@@ -1074,7 +1151,7 @@ function combineLogicalStructure(
|
|
|
1074
1151
|
} else {
|
|
1075
1152
|
returnInitialElementId = logicalElements[initialLogicalElementId].initialLogicalElementId;
|
|
1076
1153
|
};
|
|
1077
|
-
|
|
1154
|
+
console.log('returnInitialElementId', returnInitialElementId);
|
|
1078
1155
|
|
|
1079
1156
|
let previousLogicalElementId = null;
|
|
1080
1157
|
let previousLogicalElementObject = null;
|
|
@@ -1091,17 +1168,17 @@ function combineLogicalStructure(
|
|
|
1091
1168
|
let errorsFound = [];
|
|
1092
1169
|
|
|
1093
1170
|
for (const [logicalElementId, logicalElementObject] of Object.entries(logicalElements)) {
|
|
1094
|
-
|
|
1171
|
+
console.log('extract logicalELements: ', { initialLogicalElementId, logicalElementId, logicalElementObject });
|
|
1095
1172
|
|
|
1096
1173
|
if (initialLogicalElementId !== logicalElementId) {
|
|
1097
1174
|
continue;
|
|
1098
1175
|
};
|
|
1099
1176
|
|
|
1100
1177
|
let logicalElementType = logicalElementObject.logicalElementType;
|
|
1101
|
-
|
|
1178
|
+
console.log('logicalElementType: ', logicalElementType);
|
|
1102
1179
|
|
|
1103
1180
|
if (logicalElementType === 'openBracket') {
|
|
1104
|
-
|
|
1181
|
+
console.log('----------type: openBracket ----------');
|
|
1105
1182
|
if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
|
|
1106
1183
|
errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
|
|
1107
1184
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
|
|
@@ -1116,7 +1193,7 @@ function combineLogicalStructure(
|
|
|
1116
1193
|
initialLogicalElementId = logicalElementObject.nextLogicalElementId;
|
|
1117
1194
|
|
|
1118
1195
|
} else if (logicalElementType === 'logicalStructure') {
|
|
1119
|
-
|
|
1196
|
+
console.log('----------type: logicalStructure ----------');
|
|
1120
1197
|
|
|
1121
1198
|
if (!logicalElementObject.hasOwnProperty('objType')) {
|
|
1122
1199
|
errorsObject[logicalElementId] = `this logical structure is not set objType`;
|
|
@@ -1147,7 +1224,7 @@ function combineLogicalStructure(
|
|
|
1147
1224
|
};
|
|
1148
1225
|
|
|
1149
1226
|
} else if (logicalElementType === 'operation') {
|
|
1150
|
-
|
|
1227
|
+
console.log('----------type: operation ----------');
|
|
1151
1228
|
if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
|
|
1152
1229
|
errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
|
|
1153
1230
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
|
|
@@ -1167,7 +1244,7 @@ function combineLogicalStructure(
|
|
|
1167
1244
|
continue;
|
|
1168
1245
|
|
|
1169
1246
|
} else if (logicalElementType === 'closeBracket') {
|
|
1170
|
-
|
|
1247
|
+
console.log('----------type: closeBracket ----------');
|
|
1171
1248
|
if (!logicalElementObject.hasOwnProperty('previousLogicalElementId')) {
|
|
1172
1249
|
errorsObject[logicalElementId] = `this logical structure is not set previousLogicalElementId`;
|
|
1173
1250
|
errorsFound.push(`this logical structure logicalElementId: ${logicalElementId} is not set previousLogicalElementId`);
|
|
@@ -1202,7 +1279,6 @@ function combineLogicalStructure(
|
|
|
1202
1279
|
operationErrorObjects,
|
|
1203
1280
|
operationErrors
|
|
1204
1281
|
] = combineOperation(
|
|
1205
|
-
_izContext,
|
|
1206
1282
|
previousLogicalElementId,
|
|
1207
1283
|
previousLogicalElementObject,
|
|
1208
1284
|
operationLogicalElementId,
|
|
@@ -1210,7 +1286,7 @@ function combineLogicalStructure(
|
|
|
1210
1286
|
nextLogicalElementId,
|
|
1211
1287
|
nextLogicalElementObject
|
|
1212
1288
|
);
|
|
1213
|
-
|
|
1289
|
+
console.log('return combineOperation: ', {
|
|
1214
1290
|
previousLogicalElementId,
|
|
1215
1291
|
previousLogicalElementObject,
|
|
1216
1292
|
operations,
|
|
@@ -1231,7 +1307,7 @@ function combineLogicalStructure(
|
|
|
1231
1307
|
|
|
1232
1308
|
} //end iterate logicalElements
|
|
1233
1309
|
|
|
1234
|
-
|
|
1310
|
+
console.log('returnLogicalElements: ', { returnLogicalElements });
|
|
1235
1311
|
|
|
1236
1312
|
let returnComplexLogicalStructure = {
|
|
1237
1313
|
objType: objType,
|
|
@@ -1244,7 +1320,6 @@ function combineLogicalStructure(
|
|
|
1244
1320
|
};
|
|
1245
1321
|
|
|
1246
1322
|
function combineOperation(
|
|
1247
|
-
_izContext,
|
|
1248
1323
|
previousLogicalElementId,
|
|
1249
1324
|
previousLogicalElementObject,
|
|
1250
1325
|
operationLogicalElementId,
|
|
@@ -1252,7 +1327,7 @@ function combineOperation(
|
|
|
1252
1327
|
nextLogicalElementId,
|
|
1253
1328
|
nextLogicalElementObject
|
|
1254
1329
|
) {
|
|
1255
|
-
|
|
1330
|
+
console.log('combineOperation: ', {
|
|
1256
1331
|
previousLogicalElementId,
|
|
1257
1332
|
previousLogicalElementObject,
|
|
1258
1333
|
operationLogicalElementId,
|
|
@@ -1274,7 +1349,7 @@ function combineOperation(
|
|
|
1274
1349
|
};
|
|
1275
1350
|
|
|
1276
1351
|
if (!operationLogicalElementObject) {
|
|
1277
|
-
|
|
1352
|
+
console.log('------------ previous & current ------------', {
|
|
1278
1353
|
previousLogicalElementId,
|
|
1279
1354
|
previousLogicalElementObject,
|
|
1280
1355
|
operationLogicalElementId,
|
|
@@ -1304,17 +1379,17 @@ function combineOperation(
|
|
|
1304
1379
|
} else {
|
|
1305
1380
|
|
|
1306
1381
|
let checkNextLogicalElementId = previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId;
|
|
1307
|
-
|
|
1382
|
+
console.log('checkNextLogicalElementId:', checkNextLogicalElementId);
|
|
1308
1383
|
|
|
1309
1384
|
for (let i = 0; i < Object.entries(previousLogicalElementObject).length; i++) {
|
|
1310
1385
|
let [logicalElementId, logicalObject] = Object.entries(previousLogicalElementObject)[i];
|
|
1311
|
-
|
|
1386
|
+
console.log('extract logical element: ', { logicalElementId, logicalObject });
|
|
1312
1387
|
|
|
1313
1388
|
if (logicalElementId !== checkNextLogicalElementId) {
|
|
1314
1389
|
continue;
|
|
1315
1390
|
};
|
|
1316
1391
|
|
|
1317
|
-
|
|
1392
|
+
console.log('------------- has next logicalElemet to continue -------------');
|
|
1318
1393
|
|
|
1319
1394
|
if (logicalObject.nextLogicalElementId !== null) {
|
|
1320
1395
|
checkNextLogicalElementId = logicalObject.nextLogicalElementId;
|
|
@@ -1328,7 +1403,7 @@ function combineOperation(
|
|
|
1328
1403
|
};
|
|
1329
1404
|
|
|
1330
1405
|
operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
|
|
1331
|
-
|
|
1406
|
+
console.log('operations: ', operations);
|
|
1332
1407
|
|
|
1333
1408
|
returnnextElementId = nextLogicalElementId;
|
|
1334
1409
|
returnNextElementObject = nextLogicalElementObject;
|
|
@@ -1340,7 +1415,7 @@ function combineOperation(
|
|
|
1340
1415
|
|
|
1341
1416
|
operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
|
|
1342
1417
|
|
|
1343
|
-
|
|
1418
|
+
console.log('operations: ', operations);
|
|
1344
1419
|
returnnextElementId = nextLogicalElementId;
|
|
1345
1420
|
returnNextElementObject = nextLogicalElementObject;
|
|
1346
1421
|
|
|
@@ -1354,7 +1429,7 @@ function combineOperation(
|
|
|
1354
1429
|
nextLogicalElementObject[nextLogicalElementId].previousLogicalElementId = previousLogicalElementId;
|
|
1355
1430
|
|
|
1356
1431
|
operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
|
|
1357
|
-
|
|
1432
|
+
console.log('operations: ', operations);
|
|
1358
1433
|
|
|
1359
1434
|
returnnextElementId = nextLogicalElementId;
|
|
1360
1435
|
returnNextElementObject = nextLogicalElementObject;
|
|
@@ -1368,7 +1443,7 @@ function combineOperation(
|
|
|
1368
1443
|
|
|
1369
1444
|
if (nextLogicalElementObject[nextLogicalElementId].logicalElementType === 'closeBracket') {
|
|
1370
1445
|
|
|
1371
|
-
|
|
1446
|
+
console.log('previousLogicalElementObject: ', previousLogicalElementObject);
|
|
1372
1447
|
|
|
1373
1448
|
if (Object.entries(previousLogicalElementObject).length <= 2) {
|
|
1374
1449
|
|
|
@@ -1384,17 +1459,17 @@ function combineOperation(
|
|
|
1384
1459
|
} else {
|
|
1385
1460
|
|
|
1386
1461
|
let checkNextLogicalElementId = previousLogicalElementObject[previousLogicalElementId].nextLogicalElementId;
|
|
1387
|
-
|
|
1462
|
+
console.log('checkNextLogicalElementId:', checkNextLogicalElementId);
|
|
1388
1463
|
|
|
1389
1464
|
for (let i = 0; i < Object.entries(previousLogicalElementObject).length; i++) {
|
|
1390
1465
|
let [logicalElementId, logicalObject] = Object.entries(previousLogicalElementObject)[i];
|
|
1391
|
-
|
|
1466
|
+
console.log('extract logical element: ', { logicalElementId, logicalObject });
|
|
1392
1467
|
|
|
1393
1468
|
if (logicalElementId !== checkNextLogicalElementId) {
|
|
1394
1469
|
continue;
|
|
1395
1470
|
};
|
|
1396
1471
|
|
|
1397
|
-
|
|
1472
|
+
console.log('------------- has next logicalElemet to continue -------------');
|
|
1398
1473
|
|
|
1399
1474
|
if (logicalObject.nextLogicalElementId !== null) {
|
|
1400
1475
|
checkNextLogicalElementId = logicalObject.nextLogicalElementId;
|
|
@@ -1408,7 +1483,7 @@ function combineOperation(
|
|
|
1408
1483
|
};
|
|
1409
1484
|
|
|
1410
1485
|
operations = Object.assign(previousLogicalElementObject, nextLogicalElementObject);
|
|
1411
|
-
|
|
1486
|
+
console.log("operations: ", operations);
|
|
1412
1487
|
|
|
1413
1488
|
returnnextElementId = nextLogicalElementId;
|
|
1414
1489
|
returnNextElementObject = nextLogicalElementObject;
|
|
@@ -1422,7 +1497,7 @@ function combineOperation(
|
|
|
1422
1497
|
};
|
|
1423
1498
|
|
|
1424
1499
|
if (previousLogicalElementObject && operationLogicalElementObject && nextLogicalElementObject) {
|
|
1425
|
-
|
|
1500
|
+
console.log('------------ previous & operation & current ------------', {
|
|
1426
1501
|
previousLogicalElementId,
|
|
1427
1502
|
previousLogicalElementObject,
|
|
1428
1503
|
operationLogicalElementId,
|
|
@@ -1439,7 +1514,7 @@ function combineOperation(
|
|
|
1439
1514
|
operationLogicalElementObject.previousLogicalElementId = previousLogicalElementId;
|
|
1440
1515
|
operationLogicalElementObject.nextLogicalElementId = nextLogicalElementId;
|
|
1441
1516
|
|
|
1442
|
-
|
|
1517
|
+
console.log('after set previous and next: ', {
|
|
1443
1518
|
previousLogicalElementObject,
|
|
1444
1519
|
operationLogicalElementObject,
|
|
1445
1520
|
nextLogicalElementObject
|
|
@@ -1461,13 +1536,12 @@ function combineOperation(
|
|
|
1461
1536
|
};
|
|
1462
1537
|
|
|
1463
1538
|
function splitFilterElements(
|
|
1464
|
-
_izContext,
|
|
1465
1539
|
runningFilterMainId,
|
|
1466
1540
|
runningFilterObject,
|
|
1467
1541
|
currentFilterMainId = null,
|
|
1468
1542
|
currentFilterObject = null
|
|
1469
1543
|
) {
|
|
1470
|
-
|
|
1544
|
+
console.log('split FilterElements: ', {
|
|
1471
1545
|
runningFilterMainId,
|
|
1472
1546
|
runningFilterObject,
|
|
1473
1547
|
currentFilterMainId,
|
|
@@ -1483,42 +1557,42 @@ function splitFilterElements(
|
|
|
1483
1557
|
// ) {}
|
|
1484
1558
|
|
|
1485
1559
|
if (runningFilterObject.filterElement.filterType === 'operation') {
|
|
1486
|
-
|
|
1560
|
+
console.log('-------- operation ----------');
|
|
1487
1561
|
|
|
1488
1562
|
Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
|
|
1489
1563
|
delete runningFilterObject.filterElement.filterElements;
|
|
1490
1564
|
filterElements[runningFilterMainId] = runningFilterObject;
|
|
1491
1565
|
|
|
1492
1566
|
} else if (runningFilterObject.filterElement.filterType === 'childComplexFilter') {
|
|
1493
|
-
|
|
1567
|
+
console.log('-------- childComplexFilter ----------');
|
|
1494
1568
|
|
|
1495
1569
|
Object.assign(filterElements, runningFilterObject.filterElement.filterElements);
|
|
1496
1570
|
delete runningFilterObject.filterElement.filterElements;
|
|
1497
1571
|
filterElements[runningFilterMainId] = runningFilterObject;
|
|
1498
1572
|
|
|
1499
1573
|
} else {
|
|
1500
|
-
|
|
1574
|
+
console.log(` -------- ${runningFilterObject.filterElement.filterType} ----------`);
|
|
1501
1575
|
//'logical'| 'identifiers'|'translateIds'|'traversal'
|
|
1502
1576
|
filterElements[runningFilterMainId] = runningFilterObject;
|
|
1503
1577
|
};
|
|
1504
1578
|
|
|
1505
1579
|
if (currentFilterObject !== null) {
|
|
1506
1580
|
if (currentFilterObject.filterElement.filterType === 'operation') {
|
|
1507
|
-
|
|
1581
|
+
console.log('-------- operation ----------');
|
|
1508
1582
|
|
|
1509
1583
|
Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
|
|
1510
1584
|
delete currentFilterObject.filterElement.filterElements;
|
|
1511
1585
|
filterElements[currentFilterMainId] = currentFilterObject;
|
|
1512
1586
|
|
|
1513
1587
|
} else if (currentFilterObject.filterElement.filterType === 'childComplexFilter') {
|
|
1514
|
-
|
|
1588
|
+
console.log('-------- childComplexFilter ----------');
|
|
1515
1589
|
|
|
1516
1590
|
Object.assign(filterElements, currentFilterObject.filterElement.filterElements);
|
|
1517
1591
|
delete currentFilterObject.filterElement.filterElements;
|
|
1518
1592
|
filterElements[currentFilterMainId] = currentFilterObject;
|
|
1519
1593
|
|
|
1520
1594
|
} else {
|
|
1521
|
-
|
|
1595
|
+
console.log(` -------- ${currentFilterObject.filterElement.filterType} ----------`);
|
|
1522
1596
|
//'logical'| 'identifiers'|'translateIds'|'traversal'
|
|
1523
1597
|
filterElements[currentFilterMainId] = currentFilterObject;
|
|
1524
1598
|
};
|
|
@@ -1534,7 +1608,7 @@ export default {
|
|
|
1534
1608
|
createFiltersRequest,
|
|
1535
1609
|
validateCombinationStructure,
|
|
1536
1610
|
// validateOperation,
|
|
1537
|
-
|
|
1611
|
+
filterLogicalElements,
|
|
1538
1612
|
// splitFilterElements,
|
|
1539
1613
|
|
|
1540
1614
|
combineLogicalStructure,
|