@futdevpro/nts-dynamo 1.5.62 → 1.5.64
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/lib/_modules/custom-data/custom-data.controller.d.ts +6 -0
- package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -0
- package/lib/_modules/custom-data/custom-data.controller.js +56 -0
- package/lib/_modules/custom-data/custom-data.controller.js.map +1 -0
- package/lib/_modules/custom-data/custom-data.service.d.ts +6 -0
- package/lib/_modules/custom-data/custom-data.service.d.ts.map +1 -0
- package/lib/_modules/custom-data/custom-data.service.js +12 -0
- package/lib/_modules/custom-data/custom-data.service.js.map +1 -0
- package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +4 -0
- package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts.map +1 -0
- package/lib/_modules/custom-data/get-custom-data-routing-module.js +18 -0
- package/lib/_modules/custom-data/get-custom-data-routing-module.js.map +1 -0
- package/lib/_modules/custom-data/index.d.ts +5 -0
- package/lib/_modules/custom-data/index.d.ts.map +1 -0
- package/lib/_modules/custom-data/index.js +9 -0
- package/lib/_modules/custom-data/index.js.map +1 -0
- package/lib/_modules/test/get-test-routing-module.js +1 -1
- package/lib/_modules/test/index.d.ts +1 -2
- package/lib/_modules/test/index.d.ts.map +1 -1
- package/lib/_modules/test/index.js +1 -2
- package/lib/_modules/test/index.js.map +1 -1
- package/lib/_modules/test/test.controller.d.ts +6 -0
- package/lib/_modules/test/test.controller.d.ts.map +1 -0
- package/lib/_modules/test/test.controller.js +102 -0
- package/lib/_modules/test/test.controller.js.map +1 -0
- package/lib/_services/dynamo-nts-data.service.d.ts +3 -3
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db.service.d.ts +3 -3
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +4 -4
- package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-global.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -2
- package/src/_modules/custom-data/custom-data.controller.ts +62 -0
- package/src/_modules/{test → custom-data}/custom-data.service.ts +1 -1
- package/src/_modules/custom-data/get-custom-data-routing-module.ts +17 -0
- package/src/_modules/custom-data/index.ts +6 -0
- package/src/_modules/test/get-test-routing-module.ts +1 -1
- package/src/_modules/test/index.ts +1 -2
- package/src/_modules/test/{test-controller.ts → test.controller.ts} +4 -33
- package/src/_services/dynamo-nts-data.service.ts +4 -4
- package/src/_services/dynamo-nts-db.service.ts +7 -7
- package/src/_services/dynamo-nts-global.service.ts +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { customDataModelParams, Dynamo_CustomData } from '@futdevpro/fsm-dynamo/custom-data-module';
|
|
5
5
|
import { DynamoNTS_DataService } from '../../_services/dynamo-nts-data.service';
|
|
6
6
|
|
|
7
7
|
export class Dynamo_CustomDataService extends DynamoNTS_DataService<Dynamo_CustomData> {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { customDataModuleSettings } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DynamoNTS_RouteSecurity } from '../../_enums/dynamo-nts-route-security.enum';
|
|
4
|
+
import { DynamoNTS_RoutingModuleSettings } from '../../_models/dynamo-nts-routing-module-settings';
|
|
5
|
+
import { DynamoNTS_RoutingModule } from '../../_services/dynamo-nts-routing-module.service';
|
|
6
|
+
import { CustomDataController } from './custom-data.controller';
|
|
7
|
+
|
|
8
|
+
export function getCustomDataRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
|
|
9
|
+
const set: DynamoNTS_RoutingModuleSettings = {
|
|
10
|
+
route: customDataModuleSettings.mainRoute,
|
|
11
|
+
controllers: [ CustomDataController.getInstance() ]
|
|
12
|
+
}
|
|
13
|
+
if (securityOverride) {
|
|
14
|
+
set.securityOverride = securityOverride;
|
|
15
|
+
}
|
|
16
|
+
return new DynamoNTS_RoutingModule(set);
|
|
17
|
+
}
|
|
@@ -3,7 +3,7 @@ import { testModuleSettings } from '@futdevpro/fsm-dynamo/test-module';
|
|
|
3
3
|
import { DynamoNTS_RouteSecurity } from '../../_enums/dynamo-nts-route-security.enum';
|
|
4
4
|
import { DynamoNTS_RoutingModuleSettings } from '../../_models/dynamo-nts-routing-module-settings';
|
|
5
5
|
import { DynamoNTS_RoutingModule } from '../../_services/dynamo-nts-routing-module.service';
|
|
6
|
-
import { TestController } from './test
|
|
6
|
+
import { TestController } from './test.controller';
|
|
7
7
|
|
|
8
8
|
export function getTestRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
|
|
9
9
|
const set: DynamoNTS_RoutingModuleSettings = {
|
|
@@ -4,7 +4,6 @@ import { testModuleSettings } from '@futdevpro/fsm-dynamo/test-module';
|
|
|
4
4
|
import { HttpCallType } from '../../_enums/http/http-call-type.enum';
|
|
5
5
|
import { DynamoNTS_EndpointParams } from '../../_models/dynamo-nts-endpoint-params';
|
|
6
6
|
import { DynamoNTS_Controller } from '../../_services/dynamo-nts-controller.service';
|
|
7
|
-
import { Dynamo_CustomDataService } from './custom-data.service';
|
|
8
7
|
|
|
9
8
|
export class TestController extends DynamoNTS_Controller {
|
|
10
9
|
|
|
@@ -90,43 +89,15 @@ export class TestController extends DynamoNTS_Controller {
|
|
|
90
89
|
]
|
|
91
90
|
}),
|
|
92
91
|
|
|
93
|
-
// CUSTOM DATA
|
|
94
92
|
new DynamoNTS_EndpointParams({
|
|
95
|
-
name: '
|
|
93
|
+
name: 'getServerStatus',
|
|
96
94
|
type: HttpCallType.get,
|
|
97
|
-
endpoint: testModuleSettings.endPoints.
|
|
95
|
+
endpoint: testModuleSettings.endPoints.getServerStatus,
|
|
98
96
|
tasks: [
|
|
99
97
|
async (req: Request, res: Response) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
await customDataService.getDataById();
|
|
103
|
-
|
|
104
|
-
res.send({
|
|
105
|
-
url: req.url,
|
|
106
|
-
result: 'get custom call was successful!',
|
|
107
|
-
response: customDataService.data,
|
|
108
|
-
request: `.../custom/get/${req.params.customId}`
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
new DynamoNTS_EndpointParams({
|
|
115
|
-
name: 'modifyCustomData',
|
|
116
|
-
type: HttpCallType.post,
|
|
117
|
-
endpoint: testModuleSettings.endPoints.modifyCustomData,
|
|
118
|
-
tasks: [
|
|
119
|
-
async (req: Request, res: Response, issuer: string) => {
|
|
120
|
-
const customDataService = new Dynamo_CustomDataService(req.body, issuer);
|
|
121
|
-
|
|
122
|
-
await customDataService.saveData();
|
|
123
|
-
|
|
98
|
+
|
|
124
99
|
res.send({
|
|
125
|
-
|
|
126
|
-
result: 'post custom call was successful!',
|
|
127
|
-
response: customDataService.data,
|
|
128
|
-
warning: 'keep in mind that this is a playground DB, and it will be cleared out from time to time',
|
|
129
|
-
request: req.body
|
|
100
|
+
status: 'ready'
|
|
130
101
|
});
|
|
131
102
|
}
|
|
132
103
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Dynamo_Metadata,
|
|
2
|
+
import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_DataPropertyParams, Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
3
3
|
|
|
4
4
|
import { DynamoNTS_DBService } from './dynamo-nts-db.service';
|
|
5
5
|
import { DynamoNTS_GlobalService } from './dynamo-nts-global.service';
|
|
@@ -33,7 +33,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
33
33
|
depDBServiceKey?: string;
|
|
34
34
|
private depDataDBService: DynamoNTS_DBService<any>;
|
|
35
35
|
|
|
36
|
-
dataParams:
|
|
36
|
+
dataParams: Dynamo_DataParams;
|
|
37
37
|
|
|
38
38
|
defaultErrorUserMsg =
|
|
39
39
|
`We encountered an unhandled Data Error, ` +
|
|
@@ -50,7 +50,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
50
50
|
/**
|
|
51
51
|
* DB data prams will be used to connect to usable dbService on GlobalService
|
|
52
52
|
*/
|
|
53
|
-
dataParams:
|
|
53
|
+
dataParams: Dynamo_DataParams,
|
|
54
54
|
/**
|
|
55
55
|
* Initial set for issuer to be able to follow the issuer's activity
|
|
56
56
|
*/
|
|
@@ -641,7 +641,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
641
641
|
* setting up dependency dataHook by DynamoBEDataModelParams
|
|
642
642
|
*/
|
|
643
643
|
private lookForDependencyDataSettings(): void {
|
|
644
|
-
const dependencyParam:
|
|
644
|
+
const dependencyParam: Dynamo_DataPropertyParams = this.dataParams.modelParams.find((modelParams: Dynamo_DataPropertyParams) => modelParams.isDependencyHook);
|
|
645
645
|
if (dependencyParam) {
|
|
646
646
|
this.depKey = dependencyParam.key;
|
|
647
647
|
if (dependencyParam.dependencyDataName) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import * as mongoose from 'mongoose';
|
|
3
3
|
import { Schema } from 'mongoose';
|
|
4
|
-
import { Dynamo_Metadata,
|
|
4
|
+
import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_DataPropertyParams, Dynamo_Error } from '@futdevpro/fsm-dynamo';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
@@ -22,7 +22,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
22
22
|
* schemaSettings also MUST contain specific types that differs from the listed above (Array, Date)
|
|
23
23
|
*/
|
|
24
24
|
constructor(
|
|
25
|
-
public dataParams:
|
|
25
|
+
public dataParams: Dynamo_DataParams
|
|
26
26
|
){
|
|
27
27
|
this.lookForDependencyDataSettings();
|
|
28
28
|
}
|
|
@@ -357,7 +357,7 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
357
357
|
filter[this.depDataName] = { $in: narrowByDependencyIds };
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
await this.dataParams.modelParams.forEach((modelParam:
|
|
360
|
+
await this.dataParams.modelParams.forEach((modelParam: Dynamo_DataPropertyParams) => {
|
|
361
361
|
if (
|
|
362
362
|
(searchBy[modelParam.key] !== null && searchBy[modelParam.key] !== undefined) ||
|
|
363
363
|
searchBy[modelParam.key + 'Range']
|
|
@@ -924,14 +924,14 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
924
924
|
* @param params DynamoBEDataPropertyParams
|
|
925
925
|
* @returns mongoose schema object
|
|
926
926
|
*/
|
|
927
|
-
private buildMongooseSchemaByModelParams(params?:
|
|
927
|
+
private buildMongooseSchemaByModelParams(params?: Dynamo_DataPropertyParams[]): any {
|
|
928
928
|
const schemaSettingsObj = {};
|
|
929
929
|
|
|
930
930
|
if (!params) {
|
|
931
931
|
params = this.dataParams.modelParams;
|
|
932
932
|
}
|
|
933
933
|
|
|
934
|
-
params.forEach((property:
|
|
934
|
+
params.forEach((property: Dynamo_DataPropertyParams) => {
|
|
935
935
|
const beType = this.getBEType(property.type);
|
|
936
936
|
if (beType !== Object || !property?.subObjectParams || property?.subObjectParams?.length == 0) {
|
|
937
937
|
schemaSettingsObj[property.key] = {
|
|
@@ -1001,8 +1001,8 @@ export class DynamoNTS_DBService<T extends Dynamo_Metadata> {
|
|
|
1001
1001
|
* sets depDataKey
|
|
1002
1002
|
*/
|
|
1003
1003
|
private lookForDependencyDataSettings(): void {
|
|
1004
|
-
const dependencyParam:
|
|
1005
|
-
(modelParams:
|
|
1004
|
+
const dependencyParam: Dynamo_DataPropertyParams = this.dataParams.modelParams.find(
|
|
1005
|
+
(modelParams: Dynamo_DataPropertyParams) => modelParams.isDependencyHook);
|
|
1006
1006
|
if (dependencyParam) {
|
|
1007
1007
|
this.depDataName = dependencyParam.key;
|
|
1008
1008
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { Dynamo_Metadata,
|
|
3
|
+
import { Dynamo_Metadata, Dynamo_DataParams, Dynamo_Log } from '@futdevpro/fsm-dynamo';
|
|
4
4
|
|
|
5
5
|
import { DynamoNTS_AuthService } from './dynamo-nts-auth.service';
|
|
6
6
|
import { DynamoNTS_DBServiceCollection } from './dynamo-nts-db-service-collection.service';
|
|
@@ -35,7 +35,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
35
35
|
/**
|
|
36
36
|
* You need to setup your Own Auth Service extending the DynamoBEAuthService class
|
|
37
37
|
*/
|
|
38
|
-
authService
|
|
38
|
+
authService?: DynamoNTS_AuthService,
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* You can setup your Own Email Service extending the DynamoBEEmailServiceCollection class
|
|
@@ -45,14 +45,14 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
45
45
|
/**
|
|
46
46
|
* you can setup data tables by passing a DynamoBEDataParams list at this point
|
|
47
47
|
*/
|
|
48
|
-
dbModels:
|
|
48
|
+
dbModels: Dynamo_DataParams[],
|
|
49
49
|
}
|
|
50
50
|
): void {
|
|
51
51
|
this.getInstance();
|
|
52
52
|
|
|
53
53
|
try {
|
|
54
54
|
this.instance.dbServiceCollection = new DynamoNTS_DBServiceCollection();
|
|
55
|
-
set.dbModels.forEach((dbModel:
|
|
55
|
+
set.dbModels.forEach((dbModel: Dynamo_DataParams) => {
|
|
56
56
|
try {
|
|
57
57
|
this.instance.dbServiceCollection[dbModel.dataName] = new DynamoNTS_DBService(dbModel);
|
|
58
58
|
} catch (error) {
|
|
@@ -102,7 +102,7 @@ export class DynamoNTS_GlobalService extends DynamoNTS_SingletonService {
|
|
|
102
102
|
* @param dataParams
|
|
103
103
|
* @returns
|
|
104
104
|
*/
|
|
105
|
-
static getDBService<T extends Dynamo_Metadata>(dataParams:
|
|
105
|
+
static getDBService<T extends Dynamo_Metadata>(dataParams: Dynamo_DataParams): DynamoNTS_DBService<T> {
|
|
106
106
|
return this.getDBServiceByKey<T>(dataParams.dataName);
|
|
107
107
|
}
|
|
108
108
|
|