av6-core 1.5.1 → 1.5.3
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/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +11 -7
- package/dist/index.mjs +11 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -328,6 +328,7 @@ interface ColValue {
|
|
|
328
328
|
interface NewFixedSearchRequest extends NewSearchRequest {
|
|
329
329
|
fixedSearch?: Record<string, ColValue>;
|
|
330
330
|
fixedNotSearch?: Record<string, ColValue>;
|
|
331
|
+
logic?: LogicNode;
|
|
331
332
|
}
|
|
332
333
|
interface NewFixedSearchRequestService<T extends DynamicShortCode> extends NewFixedSearchRequest {
|
|
333
334
|
shortCodeData: T;
|
|
@@ -355,8 +356,9 @@ interface DropdownRequest {
|
|
|
355
356
|
shortCode: string;
|
|
356
357
|
searchColumns: string[];
|
|
357
358
|
searchText?: string;
|
|
358
|
-
fixedSearch?:
|
|
359
|
-
fixedNotSearch?:
|
|
359
|
+
fixedSearch?: FixedMap;
|
|
360
|
+
fixedNotSearch?: FixedMap;
|
|
361
|
+
logic: LogicNode;
|
|
360
362
|
sortBy?: string;
|
|
361
363
|
sortDir?: "ASC" | "DESC";
|
|
362
364
|
selectColumns?: Record<string, string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -328,6 +328,7 @@ interface ColValue {
|
|
|
328
328
|
interface NewFixedSearchRequest extends NewSearchRequest {
|
|
329
329
|
fixedSearch?: Record<string, ColValue>;
|
|
330
330
|
fixedNotSearch?: Record<string, ColValue>;
|
|
331
|
+
logic?: LogicNode;
|
|
331
332
|
}
|
|
332
333
|
interface NewFixedSearchRequestService<T extends DynamicShortCode> extends NewFixedSearchRequest {
|
|
333
334
|
shortCodeData: T;
|
|
@@ -355,8 +356,9 @@ interface DropdownRequest {
|
|
|
355
356
|
shortCode: string;
|
|
356
357
|
searchColumns: string[];
|
|
357
358
|
searchText?: string;
|
|
358
|
-
fixedSearch?:
|
|
359
|
-
fixedNotSearch?:
|
|
359
|
+
fixedSearch?: FixedMap;
|
|
360
|
+
fixedNotSearch?: FixedMap;
|
|
361
|
+
logic: LogicNode;
|
|
360
362
|
sortBy?: string;
|
|
361
363
|
sortDir?: "ASC" | "DESC";
|
|
362
364
|
selectColumns?: Record<string, string>;
|
package/dist/index.js
CHANGED
|
@@ -462,15 +462,17 @@ var commonRepository = (serviceDeps) => {
|
|
|
462
462
|
shortCodeData,
|
|
463
463
|
fixedSearch,
|
|
464
464
|
fixedNotSearch,
|
|
465
|
+
logic,
|
|
465
466
|
sortBy,
|
|
466
467
|
sortDir,
|
|
467
468
|
selectColumns
|
|
468
469
|
}) {
|
|
469
470
|
logger.info("entering::commonSearch::repository");
|
|
470
471
|
const tableName = shortCodeData.tableName;
|
|
471
|
-
const rootCondition = await this.
|
|
472
|
+
const rootCondition = await this.generateRootConditionV2({
|
|
472
473
|
fixedSearch,
|
|
473
|
-
fixedNotSearch
|
|
474
|
+
fixedNotSearch,
|
|
475
|
+
logic
|
|
474
476
|
});
|
|
475
477
|
const customWhereClause = { ...rootCondition };
|
|
476
478
|
const whereClause = {};
|
|
@@ -658,13 +660,15 @@ var commonRepository = (serviceDeps) => {
|
|
|
658
660
|
// now [{ col: string, type: string }, ...]
|
|
659
661
|
fixedSearch,
|
|
660
662
|
// now { [fieldName]: { type: string, value: any[] } }
|
|
661
|
-
fixedNotSearch
|
|
663
|
+
fixedNotSearch,
|
|
662
664
|
// same structure
|
|
665
|
+
logic
|
|
663
666
|
}) {
|
|
664
667
|
logger.info("entering::fixedSearch::repository");
|
|
665
668
|
const rootCondition = await this.generateRootConditionV2({
|
|
666
669
|
fixedSearch,
|
|
667
|
-
fixedNotSearch
|
|
670
|
+
fixedNotSearch,
|
|
671
|
+
logic
|
|
668
672
|
});
|
|
669
673
|
let searchOR;
|
|
670
674
|
if (searchText && searchColumns && searchColumns.length > 0) {
|
|
@@ -694,9 +698,9 @@ var commonRepository = (serviceDeps) => {
|
|
|
694
698
|
}
|
|
695
699
|
searchOR = transformData(searchOR);
|
|
696
700
|
}
|
|
697
|
-
|
|
698
|
-
if (searchOR
|
|
699
|
-
whereClause
|
|
701
|
+
let whereClause = rootCondition;
|
|
702
|
+
if (searchOR?.length) {
|
|
703
|
+
whereClause = smartAndMerge(whereClause, { OR: searchOR });
|
|
700
704
|
}
|
|
701
705
|
const orderByClause = {};
|
|
702
706
|
if (sortBy && sortDir) {
|
package/dist/index.mjs
CHANGED
|
@@ -412,15 +412,17 @@ var commonRepository = (serviceDeps) => {
|
|
|
412
412
|
shortCodeData,
|
|
413
413
|
fixedSearch,
|
|
414
414
|
fixedNotSearch,
|
|
415
|
+
logic,
|
|
415
416
|
sortBy,
|
|
416
417
|
sortDir,
|
|
417
418
|
selectColumns
|
|
418
419
|
}) {
|
|
419
420
|
logger.info("entering::commonSearch::repository");
|
|
420
421
|
const tableName = shortCodeData.tableName;
|
|
421
|
-
const rootCondition = await this.
|
|
422
|
+
const rootCondition = await this.generateRootConditionV2({
|
|
422
423
|
fixedSearch,
|
|
423
|
-
fixedNotSearch
|
|
424
|
+
fixedNotSearch,
|
|
425
|
+
logic
|
|
424
426
|
});
|
|
425
427
|
const customWhereClause = { ...rootCondition };
|
|
426
428
|
const whereClause = {};
|
|
@@ -608,13 +610,15 @@ var commonRepository = (serviceDeps) => {
|
|
|
608
610
|
// now [{ col: string, type: string }, ...]
|
|
609
611
|
fixedSearch,
|
|
610
612
|
// now { [fieldName]: { type: string, value: any[] } }
|
|
611
|
-
fixedNotSearch
|
|
613
|
+
fixedNotSearch,
|
|
612
614
|
// same structure
|
|
615
|
+
logic
|
|
613
616
|
}) {
|
|
614
617
|
logger.info("entering::fixedSearch::repository");
|
|
615
618
|
const rootCondition = await this.generateRootConditionV2({
|
|
616
619
|
fixedSearch,
|
|
617
|
-
fixedNotSearch
|
|
620
|
+
fixedNotSearch,
|
|
621
|
+
logic
|
|
618
622
|
});
|
|
619
623
|
let searchOR;
|
|
620
624
|
if (searchText && searchColumns && searchColumns.length > 0) {
|
|
@@ -644,9 +648,9 @@ var commonRepository = (serviceDeps) => {
|
|
|
644
648
|
}
|
|
645
649
|
searchOR = transformData(searchOR);
|
|
646
650
|
}
|
|
647
|
-
|
|
648
|
-
if (searchOR
|
|
649
|
-
whereClause
|
|
651
|
+
let whereClause = rootCondition;
|
|
652
|
+
if (searchOR?.length) {
|
|
653
|
+
whereClause = smartAndMerge(whereClause, { OR: searchOR });
|
|
650
654
|
}
|
|
651
655
|
const orderByClause = {};
|
|
652
656
|
if (sortBy && sortDir) {
|