@futdevpro/nts-dynamo 1.9.44 → 1.9.50
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/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +1 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/interfaces/global-service-settings.interface.d.ts +3 -3
- package/build/_models/interfaces/global-service-settings.interface.d.ts.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +4 -0
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/mock/data-model.mock.d.ts +2 -2
- package/build/_modules/mock/data-model.mock.d.ts.map +1 -1
- package/build/_modules/mock/data-model.mock.js +21 -21
- package/build/_modules/mock/data-model.mock.js.map +1 -1
- package/build/_modules/mock/socket-server.mock.d.ts +1 -1
- package/build/_modules/mock/socket-server.mock.d.ts.map +1 -1
- package/build/_modules/socket/_services/socket-server.service.d.ts +1 -1
- package/build/_modules/socket/_services/socket-server.service.d.ts.map +1 -1
- package/build/_modules/socket/_services/socket-server.service.spec.js +1 -1
- package/build/_modules/socket/_services/socket-server.service.spec.js.map +1 -1
- package/build/_services/base/archive-data.service.d.ts +2 -2
- package/build/_services/base/archive-data.service.d.ts.map +1 -1
- package/build/_services/base/archive-data.service.js +1 -1
- package/build/_services/base/archive-data.service.js.map +1 -1
- package/build/_services/base/data.service.d.ts +7 -7
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +63 -14
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/base/db.service.d.ts +10 -11
- package/build/_services/base/db.service.d.ts.map +1 -1
- package/build/_services/base/db.service.js +29 -16
- package/build/_services/base/db.service.js.map +1 -1
- package/build/_services/core/api.service.d.ts.map +1 -1
- package/build/_services/core/api.service.js +3 -3
- package/build/_services/core/api.service.js.map +1 -1
- package/build/_services/core/global.service.d.ts +2 -2
- package/build/_services/core/global.service.d.ts.map +1 -1
- package/build/_services/core/global.service.js +1 -1
- package/build/_services/core/global.service.js.map +1 -1
- package/build/_services/route/controller.service.d.ts.map +1 -1
- package/build/_services/route/controller.service.js.map +1 -1
- package/build/index.d.ts +3 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -5
- package/build/index.js.map +1 -1
- package/package.json +3 -3
- package/src/_collections/global-settings.const.ts +2 -1
- package/src/_models/interfaces/global-service-settings.interface.ts +3 -3
- package/src/_models/interfaces/global-settings.interface.ts +5 -0
- package/src/_modules/mock/data-model.mock.ts +23 -23
- package/src/_modules/mock/socket-server.mock.ts +5 -5
- package/src/_modules/socket/_services/socket-server.service.spec.ts +1 -1
- package/src/_modules/socket/_services/socket-server.service.ts +1 -1
- package/src/_services/base/archive-data.service.ts +8 -6
- package/src/_services/base/data.service.ts +185 -109
- package/src/_services/base/db.service.ts +99 -66
- package/src/_services/core/api.service.ts +5 -5
- package/src/_services/core/global.service.ts +16 -14
- package/src/_services/route/controller.service.ts +2 -3
- package/src/index.ts +3 -5
- package/build/_models/types/db-filter.type.d.ts +0 -97
- package/build/_models/types/db-filter.type.d.ts.map +0 -1
- package/build/_models/types/db-filter.type.js +0 -3
- package/build/_models/types/db-filter.type.js.map +0 -1
- package/src/_models/types/db-filter.type.ts +0 -108
|
@@ -4,13 +4,16 @@ import { Schema } from 'mongoose';
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
DyFM_AnyError,
|
|
7
|
-
DyFM_DataModel_Params,
|
|
7
|
+
DyFM_DataModel_Params,
|
|
8
|
+
DyFM_DataProperties,
|
|
9
|
+
DyFM_DataProperty_Params,
|
|
10
|
+
DyFM_DBFilter, DyFM_DBFilterSimple, DyFM_DBSort,
|
|
11
|
+
DyFM_Error,
|
|
8
12
|
DyFM_Error_Settings, DyFM_ErrorLevel,
|
|
9
13
|
DyFM_Log,
|
|
10
14
|
DyFM_Metadata
|
|
11
15
|
} from '@futdevpro/fsm-dynamo';
|
|
12
16
|
import { DyNTS_archiveSuffix } from '../../_collections/archive.util';
|
|
13
|
-
import { DyNTS_DBFilter, DyNTS_DBFilterSimple } from '../../_models/types/db-filter.type';
|
|
14
17
|
import { DyNTS_DBUpdate } from '../../_models/types/db-update.type';
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -35,7 +38,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
35
38
|
* schemaSettings also MUST contain specific types that differs from the listed above (Array, Date)
|
|
36
39
|
*/
|
|
37
40
|
constructor(
|
|
38
|
-
public dataParams: DyFM_DataModel_Params
|
|
41
|
+
public dataParams: DyFM_DataModel_Params<T>
|
|
39
42
|
){
|
|
40
43
|
try {
|
|
41
44
|
this.serviceName = this.constructor?.name;
|
|
@@ -348,7 +351,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
348
351
|
_deleted: new Date(),
|
|
349
352
|
_deletedBy: issuer,
|
|
350
353
|
},
|
|
351
|
-
issuer
|
|
354
|
+
/* issuer */
|
|
352
355
|
).catch(
|
|
353
356
|
(error): void => {
|
|
354
357
|
throw new DyFM_Error({
|
|
@@ -391,7 +394,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
391
394
|
__lastModified: new Date(),
|
|
392
395
|
__lastModifiedBy: issuer,
|
|
393
396
|
},
|
|
394
|
-
issuer
|
|
397
|
+
/* issuer */
|
|
395
398
|
).catch((error): void => {
|
|
396
399
|
throw new DyFM_Error({
|
|
397
400
|
...this._getDefaultErrorSettings('restoreDeletedById', error, issuer),
|
|
@@ -508,7 +511,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
508
511
|
* @returns dataList
|
|
509
512
|
*/
|
|
510
513
|
async searchData(
|
|
511
|
-
filterBy:
|
|
514
|
+
filterBy: DyFM_DBFilter<T>,
|
|
512
515
|
narrowByDependencyIds?: string[]
|
|
513
516
|
): Promise<T[]> {
|
|
514
517
|
const filter = {};
|
|
@@ -530,55 +533,63 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
530
533
|
filter[this.depDataName] = { $in: narrowByDependencyIds };
|
|
531
534
|
}
|
|
532
535
|
|
|
533
|
-
this.dataParams.properties.forEach(
|
|
534
|
-
|
|
535
|
-
(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
536
|
+
Object.values(this.dataParams.properties).forEach(
|
|
537
|
+
(modelParam: DyFM_DataProperty_Params<any>): void => {
|
|
538
|
+
if (
|
|
539
|
+
(filterBy[modelParam.key] !== null && filterBy[modelParam.key] !== undefined) ||
|
|
540
|
+
filterBy[modelParam.key + 'Range']
|
|
541
|
+
) {
|
|
542
|
+
if (modelParam.key.includes('Range') || modelParam.type.includes('[]')) {
|
|
543
|
+
// inverz search filter (for Range and Array functions)
|
|
544
|
+
if (modelParam.key.includes('Range')) {
|
|
545
|
+
const searchParamKeyWithoutRange = modelParam.key.split('Range')[0];
|
|
546
|
+
|
|
547
|
+
if (
|
|
548
|
+
filterBy[searchParamKeyWithoutRange] !== null &&
|
|
549
|
+
filterBy[searchParamKeyWithoutRange] !== undefined
|
|
550
|
+
) {
|
|
551
|
+
filter[modelParam.key] = {
|
|
552
|
+
from: { $lte: filterBy[searchParamKeyWithoutRange] },
|
|
553
|
+
to: { $gte: filterBy[searchParamKeyWithoutRange] },
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
} else {
|
|
557
|
+
if (
|
|
558
|
+
filterBy[modelParam.key] !== null &&
|
|
559
|
+
filterBy[modelParam.key] !== undefined
|
|
560
|
+
) {
|
|
561
|
+
filter[modelParam.key] = { $in: filterBy[modelParam.key] };
|
|
562
|
+
}
|
|
551
563
|
}
|
|
552
564
|
} else {
|
|
553
|
-
|
|
565
|
+
// basic search filter
|
|
566
|
+
if (filterBy[modelParam.key + 'Range']) {
|
|
567
|
+
if (
|
|
568
|
+
filterBy[modelParam.key + 'Range'].from ||
|
|
569
|
+
filterBy[modelParam.key + 'Range'].to
|
|
570
|
+
) {
|
|
571
|
+
filter[modelParam.key] = {};
|
|
572
|
+
|
|
573
|
+
if (filterBy[modelParam.key + 'Range'].from) {
|
|
574
|
+
filter[modelParam.key].$gte = filterBy[modelParam.key + 'Range'].from;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (filterBy[modelParam.key + 'Range'].to) {
|
|
578
|
+
filter[modelParam.key].$lte = filterBy[modelParam.key + 'Range'].to;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
} else if (
|
|
554
582
|
filterBy[modelParam.key] !== null &&
|
|
555
583
|
filterBy[modelParam.key] !== undefined
|
|
556
584
|
) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
} else {
|
|
561
|
-
// basic search filter
|
|
562
|
-
if (filterBy[modelParam.key + 'Range']) {
|
|
563
|
-
if (filterBy[modelParam.key + 'Range'].from || filterBy[modelParam.key + 'Range'].to) {
|
|
564
|
-
filter[modelParam.key] = {};
|
|
565
|
-
|
|
566
|
-
if (filterBy[modelParam.key + 'Range'].from) {
|
|
567
|
-
filter[modelParam.key].$gte = filterBy[modelParam.key + 'Range'].from;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
if (filterBy[modelParam.key + 'Range'].to) {
|
|
571
|
-
filter[modelParam.key].$lte = filterBy[modelParam.key + 'Range'].to;
|
|
585
|
+
if (filterBy[modelParam.key].lenght > 0) {
|
|
586
|
+
filter[modelParam.key] = { $in: filterBy[modelParam.key] };
|
|
572
587
|
}
|
|
573
588
|
}
|
|
574
|
-
} else if (filterBy[modelParam.key] !== null && filterBy[modelParam.key] !== undefined) {
|
|
575
|
-
if (filterBy[modelParam.key].lenght > 0) {
|
|
576
|
-
filter[modelParam.key] = { $in: filterBy[modelParam.key] };
|
|
577
|
-
}
|
|
578
589
|
}
|
|
579
590
|
}
|
|
580
591
|
}
|
|
581
|
-
|
|
592
|
+
);
|
|
582
593
|
|
|
583
594
|
let dataList: T[] = await this.dataModel
|
|
584
595
|
.find(filter)
|
|
@@ -592,7 +603,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
592
603
|
});
|
|
593
604
|
});
|
|
594
605
|
|
|
595
|
-
if ((filterBy as
|
|
606
|
+
if ((filterBy as DyFM_DBFilterSimple<T>)._deleted === undefined) {
|
|
596
607
|
dataList = dataList.filter((data: T): boolean => !data._deleted);
|
|
597
608
|
}
|
|
598
609
|
|
|
@@ -630,7 +641,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
630
641
|
* //
|
|
631
642
|
* @returns {T} data: T
|
|
632
643
|
*/
|
|
633
|
-
async findOne(filterBy:
|
|
644
|
+
async findOne(filterBy: DyFM_DBFilter<T>): Promise<T> {
|
|
634
645
|
const data: T = await this.dataModel
|
|
635
646
|
.findOne(filterBy)
|
|
636
647
|
.then((res): T => res as T ?? null)
|
|
@@ -673,8 +684,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
673
684
|
* //
|
|
674
685
|
* @returns {T[]} dataList: T[]
|
|
675
686
|
*/
|
|
676
|
-
async find(filterBy:
|
|
677
|
-
|
|
687
|
+
async find(filterBy: DyFM_DBFilter<T>): Promise<T[]> {
|
|
678
688
|
let dataList: T[] = await this.dataModel
|
|
679
689
|
.find(filterBy)
|
|
680
690
|
.then((res): T[] => res as T[] ?? [])
|
|
@@ -687,7 +697,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
687
697
|
});
|
|
688
698
|
});
|
|
689
699
|
|
|
690
|
-
if ((filterBy as
|
|
700
|
+
if ((filterBy as DyFM_DBFilterSimple<T>)._deleted === undefined) {
|
|
691
701
|
dataList = dataList.filter((data: T): boolean => !data._deleted);
|
|
692
702
|
}
|
|
693
703
|
|
|
@@ -728,12 +738,16 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
728
738
|
* @returns {T[]} dataList: T[]
|
|
729
739
|
*/
|
|
730
740
|
async findWithPaging(
|
|
731
|
-
filterBy:
|
|
741
|
+
filterBy: DyFM_DBFilter<T>,
|
|
732
742
|
page: number,
|
|
733
743
|
pageSize: number,
|
|
734
|
-
sort?:
|
|
744
|
+
sort?: DyFM_DBSort<T>
|
|
735
745
|
): Promise<T[]> {
|
|
736
|
-
|
|
746
|
+
if (filterBy['_deleted'] === undefined) {
|
|
747
|
+
filterBy['_deleted'] = null;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
const dataList: T[] = await this.dataModel
|
|
737
751
|
.find(filterBy)
|
|
738
752
|
.sort(sort)
|
|
739
753
|
.skip(page * pageSize)
|
|
@@ -748,9 +762,9 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
748
762
|
});
|
|
749
763
|
});
|
|
750
764
|
|
|
751
|
-
if ((filterBy as
|
|
765
|
+
/* if ((filterBy as DyFM_DBFilterSimple<T>)._deleted === undefined) {
|
|
752
766
|
dataList = dataList.filter((data: T): boolean => !data._deleted);
|
|
753
|
-
}
|
|
767
|
+
} */
|
|
754
768
|
|
|
755
769
|
return dataList.map((data: T): T => this.stringifyDataId(data, 'find'));
|
|
756
770
|
}
|
|
@@ -843,7 +857,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
843
857
|
* //
|
|
844
858
|
*/
|
|
845
859
|
async updateOne(
|
|
846
|
-
filterBy:
|
|
860
|
+
filterBy: DyFM_DBFilter<T>,
|
|
847
861
|
update: DyNTS_DBUpdate<T>,
|
|
848
862
|
issuer: string,
|
|
849
863
|
dontUpdateModified?: boolean
|
|
@@ -918,7 +932,7 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
918
932
|
* //
|
|
919
933
|
*/
|
|
920
934
|
async updateMany(
|
|
921
|
-
filterBy:
|
|
935
|
+
filterBy: DyFM_DBFilter<T>,
|
|
922
936
|
update: DyNTS_DBUpdate<T>,
|
|
923
937
|
issuer: string,
|
|
924
938
|
dontUpdateModified?: boolean
|
|
@@ -1009,23 +1023,23 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
1009
1023
|
|
|
1010
1024
|
/**
|
|
1011
1025
|
* builds mongoose schema building settings object by dynamoDataModelParamsList
|
|
1012
|
-
* @param
|
|
1026
|
+
* @param properties DynamoBEDataPropertyParams
|
|
1013
1027
|
* @returns mongoose schema object
|
|
1014
1028
|
*/
|
|
1015
|
-
private buildMongooseSchemaByModelParams(
|
|
1029
|
+
private buildMongooseSchemaByModelParams(properties?: DyFM_DataProperties<T>): any {
|
|
1016
1030
|
const schemaSettingsObj = {};
|
|
1017
1031
|
|
|
1018
|
-
if (!
|
|
1019
|
-
|
|
1032
|
+
if (!properties) {
|
|
1033
|
+
properties = this.dataParams.properties;
|
|
1020
1034
|
}
|
|
1021
1035
|
|
|
1022
|
-
|
|
1036
|
+
Object.values(properties).forEach((property: DyFM_DataProperty_Params<any>): void => {
|
|
1023
1037
|
const beType = this.getBEType(property.type);
|
|
1024
1038
|
|
|
1025
1039
|
if (
|
|
1026
1040
|
beType !== Object ||
|
|
1027
1041
|
!property?.subObjectParams ||
|
|
1028
|
-
property?.subObjectParams
|
|
1042
|
+
(property?.subObjectParams && Object.keys(property.subObjectParams).length == 0)
|
|
1029
1043
|
) {
|
|
1030
1044
|
schemaSettingsObj[property.key] = {
|
|
1031
1045
|
type: beType,
|
|
@@ -1119,9 +1133,28 @@ export class DyNTS_DBService<T extends DyFM_Metadata> {
|
|
|
1119
1133
|
* sets depDataKey
|
|
1120
1134
|
*/
|
|
1121
1135
|
private lookForDependencyDataSettings(): void {
|
|
1122
|
-
const dependencyParam: DyFM_DataProperty_Params =
|
|
1123
|
-
(
|
|
1124
|
-
|
|
1136
|
+
const dependencyParam: DyFM_DataProperty_Params<any> =
|
|
1137
|
+
Object.values(this.dataParams.properties).find(
|
|
1138
|
+
(modelParams: DyFM_DataProperty_Params<any>): boolean => modelParams.isDependencyHook
|
|
1139
|
+
);
|
|
1140
|
+
|
|
1141
|
+
if (
|
|
1142
|
+
Object.values(this.dataParams.properties).filter(
|
|
1143
|
+
(modelParams: DyFM_DataProperty_Params<any>): boolean => modelParams.isDependencyHook
|
|
1144
|
+
).length > 1
|
|
1145
|
+
) {
|
|
1146
|
+
throw new DyFM_Error({
|
|
1147
|
+
...this._getDefaultErrorSettings(
|
|
1148
|
+
'lookForDependencyDataSettings',
|
|
1149
|
+
new Error(
|
|
1150
|
+
`Multiple "isDependencyHook" found for this dataModel (${this.dataParams.dbName}) ` +
|
|
1151
|
+
`(NTS DB)` +
|
|
1152
|
+
`\nSorry, but this is not supported yet! (Donate to Dynamo to get this feature!)`
|
|
1153
|
+
)
|
|
1154
|
+
),
|
|
1155
|
+
errorCode: 'NTS-DBS-LFDD0',
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1125
1158
|
|
|
1126
1159
|
if (dependencyParam) {
|
|
1127
1160
|
this.depDataName = dependencyParam.key;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
DyFM_AnyError, DyFM_Error, DyFM_Error_Settings, DyFM_Log
|
|
2
|
+
import {
|
|
3
|
+
DyFM_AnyError, DyFM_Error, DyFM_Error_Settings, DyFM_Log
|
|
5
4
|
} from '@futdevpro/fsm-dynamo';
|
|
5
|
+
import * as Axios from 'axios';
|
|
6
6
|
|
|
7
|
+
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
7
8
|
import { DyNTS_HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
8
9
|
import { DyNTS_HttpResponseType } from '../../_enums/http/http-response-type.enum';
|
|
9
10
|
import {
|
|
10
11
|
DyNTS_ApiCall_Params
|
|
11
12
|
} from '../../_models/control-models/api-call-params.control-model';
|
|
12
|
-
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
13
13
|
|
|
14
14
|
export interface DyNTS_ApiCallInput_Params<T_Body = any> {
|
|
15
15
|
pathParams?: {
|
|
@@ -77,7 +77,7 @@ export class DyNTS_ApiService {
|
|
|
77
77
|
switch (callParams.type) {
|
|
78
78
|
case DyNTS_HttpCallType.get:
|
|
79
79
|
if (inputParams?.body) {
|
|
80
|
-
DyFM_Log.warn(
|
|
80
|
+
DyFM_Log.warn(`WARNING you cant send body in get calls (${callParams.name})`);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
a = await this.get<T_Response>(axios, url, callParams);
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { Request, Response } from 'express';
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
DyFM_Metadata, DyFM_DataModel_Params, DyFM_Log, DyFM_Error, DyFM_Array,
|
|
7
|
-
DyFM_errorFlag,
|
|
4
|
+
import {
|
|
8
5
|
DyFM_AnyError,
|
|
9
|
-
|
|
6
|
+
DyFM_Array,
|
|
7
|
+
DyFM_DataModel_Params,
|
|
8
|
+
DyFM_Error,
|
|
9
|
+
DyFM_Error_Settings,
|
|
10
|
+
DyFM_Log,
|
|
11
|
+
DyFM_Metadata
|
|
10
12
|
} from '@futdevpro/fsm-dynamo';
|
|
11
13
|
import { DyNTS_App_Params } from '../../_models/control-models/app-params.control-model';
|
|
12
14
|
|
|
13
|
-
import {
|
|
15
|
+
import {
|
|
14
16
|
DyNTS_GlobalErrorHandlerFn,
|
|
15
|
-
DyNTS_GlobalService_Settings
|
|
17
|
+
DyNTS_GlobalService_Settings
|
|
16
18
|
} from '../../_models/interfaces/global-service-settings.interface';
|
|
17
19
|
|
|
18
20
|
import { DyNTS_AuthService } from './auth.service';
|
|
@@ -21,8 +23,8 @@ import { DyNTS_DBService } from '../base/db.service';
|
|
|
21
23
|
import { DyNTS_EmailService } from './email.service';
|
|
22
24
|
import { DyNTS_Service_Collection } from './service-collection.service';
|
|
23
25
|
/* import { DyNTS_EmailServiceCollection } from './email-service-collection.service'; */
|
|
24
|
-
import { DyNTS_SingletonService } from '../base/singleton.service';
|
|
25
26
|
import { DyNTS_global_settings } from '../../_collections/global-settings.const';
|
|
27
|
+
import { DyNTS_SingletonService } from '../base/singleton.service';
|
|
26
28
|
/* import { DyNTS_archiveFlag } from '../../_collections/archive-flag.const'; */
|
|
27
29
|
import { DyNTS_getArchivedDBName } from '../../_collections/archive.util';
|
|
28
30
|
|
|
@@ -84,11 +86,11 @@ export class DyNTS_GlobalService extends DyNTS_SingletonService {
|
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
|
|
87
|
-
private static async setDBServices(dbModels?: DyFM_DataModel_Params[]): Promise<void> {
|
|
89
|
+
private static async setDBServices(dbModels?: DyFM_DataModel_Params<any>[]): Promise<void> {
|
|
88
90
|
try {
|
|
89
91
|
this.instance.dbServiceCollection = {};
|
|
90
92
|
|
|
91
|
-
dbModels?.forEach((dbModel: DyFM_DataModel_Params): void => {
|
|
93
|
+
dbModels?.forEach((dbModel: DyFM_DataModel_Params<any>): void => {
|
|
92
94
|
if (!dbModel) {
|
|
93
95
|
throw new DyFM_Error({
|
|
94
96
|
...this.getDefaultErrorSettings(
|
|
@@ -100,13 +102,13 @@ export class DyNTS_GlobalService extends DyNTS_SingletonService {
|
|
|
100
102
|
errorCode: 'NTS-GS0-SDBS2',
|
|
101
103
|
additionalContent: {
|
|
102
104
|
dbModels: dbModels,
|
|
103
|
-
dbModelNames: dbModels.map((dbModel: DyFM_DataModel_Params) => dbModel.dataName),
|
|
105
|
+
dbModelNames: dbModels.map((dbModel: DyFM_DataModel_Params<any>) => dbModel.dataName),
|
|
104
106
|
},
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
if (dbModel.addArchive) {
|
|
109
|
-
const archiveModel: DyFM_DataModel_Params = new DyFM_DataModel_Params({
|
|
111
|
+
const archiveModel: DyFM_DataModel_Params<any> = new DyFM_DataModel_Params<any>({
|
|
110
112
|
...dbModel,
|
|
111
113
|
dataName: DyNTS_getArchivedDBName(dbModel.dataName),
|
|
112
114
|
});
|
|
@@ -115,7 +117,7 @@ export class DyNTS_GlobalService extends DyNTS_SingletonService {
|
|
|
115
117
|
}
|
|
116
118
|
});
|
|
117
119
|
|
|
118
|
-
dbModels?.forEach((dbModel: DyFM_DataModel_Params): void => {
|
|
120
|
+
dbModels?.forEach((dbModel: DyFM_DataModel_Params<any>): void => {
|
|
119
121
|
if (!dbModel.constructed) {
|
|
120
122
|
throw new DyFM_Error({
|
|
121
123
|
...this.getDefaultErrorSettings(
|
|
@@ -280,7 +282,7 @@ export class DyNTS_GlobalService extends DyNTS_SingletonService {
|
|
|
280
282
|
* @returns
|
|
281
283
|
*/
|
|
282
284
|
static getDBService<T extends DyFM_Metadata>(
|
|
283
|
-
dataParams: DyFM_DataModel_Params
|
|
285
|
+
dataParams: DyFM_DataModel_Params<T>
|
|
284
286
|
): DyNTS_DBService<T> {
|
|
285
287
|
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
286
288
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
DyNTS_Endpoint_Params
|
|
3
|
+
import {
|
|
4
|
+
DyNTS_Endpoint_Params
|
|
6
5
|
} from '../../_models/control-models/endpoint-params.control-model';
|
|
7
6
|
|
|
8
7
|
import { DyNTS_SingletonService } from '../base/singleton.service';
|
package/src/index.ts
CHANGED
|
@@ -6,8 +6,8 @@ export * from './_collections/global-settings.const';
|
|
|
6
6
|
// ENUMS
|
|
7
7
|
export * from './_enums/data-model-type.enum';
|
|
8
8
|
export * from './_enums/data-service-function.enum';
|
|
9
|
-
export * from './_enums/route-security.enum';
|
|
10
9
|
export * from './_enums/predefined-data-types.enum';
|
|
10
|
+
export * from './_enums/route-security.enum';
|
|
11
11
|
|
|
12
12
|
// enums/HTTP
|
|
13
13
|
export * from './_enums/http/http-call-type.enum';
|
|
@@ -16,19 +16,18 @@ export * from './_enums/http/http-response-type.enum';
|
|
|
16
16
|
|
|
17
17
|
// MODELS (CONTROL-MODELS, INTERFACES, TYPES)
|
|
18
18
|
// models/INTERFACES
|
|
19
|
-
export * from './_models/interfaces/global-service-settings.interface';
|
|
20
19
|
export * from './_models/interfaces/certification-settings.interface';
|
|
20
|
+
export * from './_models/interfaces/global-service-settings.interface';
|
|
21
21
|
export * from './_models/interfaces/global-settings.interface';
|
|
22
22
|
export * from './_models/interfaces/routing-module-settings.interface';
|
|
23
23
|
|
|
24
24
|
// models/CONTROL MODELS
|
|
25
25
|
export * from './_models/control-models/api-call-params.control-model';
|
|
26
26
|
export * from './_models/control-models/app-params.control-model';
|
|
27
|
-
export * from './_models/control-models/http-settings.control-model';
|
|
28
27
|
export * from './_models/control-models/endpoint-params.control-model';
|
|
28
|
+
export * from './_models/control-models/http-settings.control-model';
|
|
29
29
|
|
|
30
30
|
// models/TYPES
|
|
31
|
-
export * from './_models/types/db-filter.type';
|
|
32
31
|
export * from './_models/types/db-update.type';
|
|
33
32
|
|
|
34
33
|
|
|
@@ -51,7 +50,6 @@ export * from './_services/server/app.server';
|
|
|
51
50
|
|
|
52
51
|
// services/ROUTE
|
|
53
52
|
export * from './_services/route/controller.service';
|
|
54
|
-
export * from './_services/route/controller.service';
|
|
55
53
|
export * from './_services/route/routing-module.service';
|
|
56
54
|
|
|
57
55
|
// services/SHARED
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @example
|
|
3
|
-
* // by email:
|
|
4
|
-
* { email: email }
|
|
5
|
-
* //
|
|
6
|
-
* @example
|
|
7
|
-
* // or by id that is in list:
|
|
8
|
-
* { userIds: { $in: this.userId } }
|
|
9
|
-
* //
|
|
10
|
-
* @example
|
|
11
|
-
* // or by number or Date that is Greater Than AND Less Than:
|
|
12
|
-
* { points: { $gt: 2, $lt: 14 } }
|
|
13
|
-
* // further tools (syntax matches with $gt):
|
|
14
|
-
* $eq: // Matches values that are EQual to a specified value.
|
|
15
|
-
* $gte: // Matches values that are Greater Than OR Equal to a specified value.
|
|
16
|
-
* $lte: // Matches values that are Less Than or Equal to a specified value.
|
|
17
|
-
* $ne: // Matches all values that are Not Equal to a specified value.
|
|
18
|
-
* $nin: // Matches None of the values specified IN an array.
|
|
19
|
-
* //
|
|
20
|
-
* @returns {T} data: T
|
|
21
|
-
*/
|
|
22
|
-
export type DyNTS_DBFilter<T> = DyNTS_DBFilterSimple<T> | DyNTS_DBFilterOR<T> | DyNTS_DBFilterNOR<T>;
|
|
23
|
-
/**
|
|
24
|
-
* A simple filter for a DynamoDB query.
|
|
25
|
-
*/
|
|
26
|
-
export type DyNTS_DBFilterSimple<T> = {
|
|
27
|
-
[K in keyof T]?: T[K] | DyNTS_DBFilterExpressions<T[K] | boolean>;
|
|
28
|
-
} & {
|
|
29
|
-
[path: string]: any;
|
|
30
|
-
};
|
|
31
|
-
export type DyNTS_DBFilterExpressions<T> = {
|
|
32
|
-
/**
|
|
33
|
-
* Matches values that are includes the value; This works only when T[K] is an array!
|
|
34
|
-
*/
|
|
35
|
-
$in?: any;
|
|
36
|
-
/**
|
|
37
|
-
* Matches values that are EQual to a specified value.
|
|
38
|
-
*/
|
|
39
|
-
$eq?: T;
|
|
40
|
-
/**
|
|
41
|
-
* Matches values that are Greater Than a specified value.
|
|
42
|
-
*/
|
|
43
|
-
$gt?: number | Date;
|
|
44
|
-
/**
|
|
45
|
-
* Matches values that are Greater Than OR Equal to a specified value.
|
|
46
|
-
*/
|
|
47
|
-
$gte?: number | Date;
|
|
48
|
-
/**
|
|
49
|
-
* Matches values that are Less Than a specified value.
|
|
50
|
-
*/
|
|
51
|
-
$lt?: number | Date;
|
|
52
|
-
/**
|
|
53
|
-
* Matches values that are Less Than or Equal to a specified value.
|
|
54
|
-
*/
|
|
55
|
-
$lte?: number | Date;
|
|
56
|
-
/**
|
|
57
|
-
* Matches all values that are Not Equal to a specified value.
|
|
58
|
-
*/
|
|
59
|
-
$ne?: T;
|
|
60
|
-
/**
|
|
61
|
-
* Matches None of the values specified IN an array.
|
|
62
|
-
*/
|
|
63
|
-
$nin?: T;
|
|
64
|
-
/**
|
|
65
|
-
* Inverts the effect of a query expression and returns documents that do not match the query expression.
|
|
66
|
-
*/
|
|
67
|
-
$not?: T | {
|
|
68
|
-
$regex?: RegExp | string;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Performs a regular expression on the field's value, and selects documents that match the regular expression.
|
|
72
|
-
*/
|
|
73
|
-
$exists?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Selects documents if a field is of the specified type.
|
|
76
|
-
*/
|
|
77
|
-
$type?: string;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
|
|
81
|
-
*/
|
|
82
|
-
export type DyNTS_DBFilterNOR<T> = {
|
|
83
|
-
/**
|
|
84
|
-
* Joins query clauses with a logical NOR returns all documents that fail to match both clauses.
|
|
85
|
-
*/
|
|
86
|
-
$nor: DyNTS_DBFilterSimple<T>[];
|
|
87
|
-
};
|
|
88
|
-
/**
|
|
89
|
-
* Joins query clauses with a logical AND returns all documents that match the conditions of both clauses.
|
|
90
|
-
*/
|
|
91
|
-
export type DyNTS_DBFilterOR<T> = {
|
|
92
|
-
/**
|
|
93
|
-
* Joins query clauses with a logical OR returns all documents that match the conditions of either clause.
|
|
94
|
-
*/
|
|
95
|
-
$or: DyNTS_DBFilterSimple<T>[];
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=db-filter.type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db-filter.type.d.ts","sourceRoot":"","sources":["../../../src/_models/types/db-filter.type.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAC1B,oBAAoB,CAAC,CAAC,CAAC,GACvB,gBAAgB,CAAC,CAAC,CAAC,GACnB,iBAAiB,CAAC,CAAC,CAAC,CAAC;AAEvB;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;KACnC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;CAClE,GAAG;IACF,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,CAAC,IAAI;IACzC;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;IACV;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,GAAG,CAAC,EAAE,CAAC,CAAC;IACR;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,GAAG;QACT,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;CACjC,CAAA;AAGD;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC;;OAEG;IACH,GAAG,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;CAChC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db-filter.type.js","sourceRoot":"","sources":["../../../src/_models/types/db-filter.type.ts"],"names":[],"mappings":""}
|