@futdevpro/nts-dynamo 1.5.61 → 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.
Files changed (47) hide show
  1. package/lib/_modules/custom-data/custom-data.controller.d.ts +6 -0
  2. package/lib/_modules/custom-data/custom-data.controller.d.ts.map +1 -0
  3. package/lib/_modules/custom-data/custom-data.controller.js +56 -0
  4. package/lib/_modules/custom-data/custom-data.controller.js.map +1 -0
  5. package/lib/_modules/custom-data/custom-data.service.d.ts +6 -0
  6. package/lib/_modules/custom-data/custom-data.service.d.ts.map +1 -0
  7. package/lib/_modules/custom-data/custom-data.service.js +12 -0
  8. package/lib/_modules/custom-data/custom-data.service.js.map +1 -0
  9. package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts +4 -0
  10. package/lib/_modules/custom-data/get-custom-data-routing-module.d.ts.map +1 -0
  11. package/lib/_modules/custom-data/get-custom-data-routing-module.js +18 -0
  12. package/lib/_modules/custom-data/get-custom-data-routing-module.js.map +1 -0
  13. package/lib/_modules/custom-data/index.d.ts +5 -0
  14. package/lib/_modules/custom-data/index.d.ts.map +1 -0
  15. package/lib/_modules/custom-data/index.js +9 -0
  16. package/lib/_modules/custom-data/index.js.map +1 -0
  17. package/lib/_modules/test/get-test-routing-module.js +1 -1
  18. package/lib/_modules/test/index.d.ts +1 -2
  19. package/lib/_modules/test/index.d.ts.map +1 -1
  20. package/lib/_modules/test/index.js +1 -2
  21. package/lib/_modules/test/index.js.map +1 -1
  22. package/lib/_modules/test/test.controller.d.ts +6 -0
  23. package/lib/_modules/test/test.controller.d.ts.map +1 -0
  24. package/lib/_modules/test/test.controller.js +102 -0
  25. package/lib/_modules/test/test.controller.js.map +1 -0
  26. package/lib/_services/dynamo-nts-data.service.d.ts +3 -3
  27. package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
  28. package/lib/_services/dynamo-nts-data.service.js +7 -14
  29. package/lib/_services/dynamo-nts-data.service.js.map +1 -1
  30. package/lib/_services/dynamo-nts-db.service.d.ts +3 -3
  31. package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
  32. package/lib/_services/dynamo-nts-db.service.js.map +1 -1
  33. package/lib/_services/dynamo-nts-global.service.d.ts +4 -4
  34. package/lib/_services/dynamo-nts-global.service.d.ts.map +1 -1
  35. package/lib/_services/dynamo-nts-global.service.js.map +1 -1
  36. package/lib/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +13 -2
  38. package/src/_modules/custom-data/custom-data.controller.ts +62 -0
  39. package/src/_modules/{test → custom-data}/custom-data.service.ts +1 -1
  40. package/src/_modules/custom-data/get-custom-data-routing-module.ts +17 -0
  41. package/src/_modules/custom-data/index.ts +6 -0
  42. package/src/_modules/test/get-test-routing-module.ts +1 -1
  43. package/src/_modules/test/index.ts +1 -2
  44. package/src/_modules/test/{test-controller.ts → test.controller.ts} +4 -33
  45. package/src/_services/dynamo-nts-data.service.ts +11 -11
  46. package/src/_services/dynamo-nts-db.service.ts +7 -7
  47. package/src/_services/dynamo-nts-global.service.ts +5 -5
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+
2
+ // CUSTOM-DATA MODULE
3
+ export * from './custom-data.service';
4
+ export * from './get-custom-data-routing-module';
5
+ export * from './custom-data.controller';
6
+ export * from '@futdevpro/fsm-dynamo/custom-data-module';
@@ -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-controller';
6
+ import { TestController } from './test.controller';
7
7
 
8
8
  export function getTestRoutingModule(securityOverride?: DynamoNTS_RouteSecurity): DynamoNTS_RoutingModule {
9
9
  const set: DynamoNTS_RoutingModuleSettings = {
@@ -1,6 +1,5 @@
1
1
 
2
2
  // TEST MODULE
3
- export * from './test-controller';
4
- export * from './custom-data.service';
3
+ export * from './test.controller';
5
4
  export * from './get-test-routing-module';
6
5
  export * from '@futdevpro/fsm-dynamo/test-module';
@@ -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: 'getCustomData',
93
+ name: 'getServerStatus',
96
94
  type: HttpCallType.get,
97
- endpoint: testModuleSettings.endPoints.getCustomData,
95
+ endpoint: testModuleSettings.endPoints.getServerStatus,
98
96
  tasks: [
99
97
  async (req: Request, res: Response) => {
100
- const customDataService = new Dynamo_CustomDataService({ _id: req.params.customId });
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
- url: req.url,
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, DynamoNTS_DataParams, DynamoNTS_DataPropertyParams, Dynamo_Error, Dynamo_Log } from '@futdevpro/fsm-dynamo';
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: DynamoNTS_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: DynamoNTS_DataParams,
53
+ dataParams: Dynamo_DataParams,
54
54
  /**
55
55
  * Initial set for issuer to be able to follow the issuer's activity
56
56
  */
@@ -69,7 +69,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
69
69
  async getAll(dontSetToService?: boolean): Promise<T[]> {
70
70
  try {
71
71
  const dataListExists: T[] = await this.dataDBService.getAll().catch(error => {
72
- if (error?.errorCodes?.includes('NTS-DBS-GA1')) {
72
+ if (error?.errorCode === 'NTS-DBS-GA1') {
73
73
  Dynamo_Log.logWarning(`getAll ${this.dataParams.dataName} didn't found any.`);
74
74
  return [];
75
75
  } else {
@@ -121,7 +121,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
121
121
  }
122
122
 
123
123
  const dataExists: T = await this.dataDBService.getDataById(id ?? this.data._id).catch(error => {
124
- if (error?.errorCodes?.includes('NTS-DBS-GI1')) {
124
+ if (error?.errorCode == 'NTS-DBS-GI1') {
125
125
  Dynamo_Log.logWarning(`getDataById ${this.dataParams.dataName} (${id ?? this.data._id}) didn't found any.`);
126
126
  return null;
127
127
  } else {
@@ -176,7 +176,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
176
176
  }
177
177
 
178
178
  const dataExists: T = await this.dataDBService.getDataByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
179
- if (error?.errorCodes?.includes('NTS-DBS-GD2')) {
179
+ if (error?.errorCode === 'NTS-DBS-GD2') {
180
180
  Dynamo_Log.logWarning(`getDataByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
181
181
  return null;
182
182
  } else {
@@ -231,7 +231,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
231
231
  }
232
232
 
233
233
  const dataListExists: T[] = await this.dataDBService.getDataListByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
234
- if (error?.errorCodes?.includes('NTS-DBS-GLD2')) {
234
+ if (error?.errorCode === 'NTS-DBS-GLD2') {
235
235
  Dynamo_Log.logWarning(`getDataListByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
236
236
  return [];
237
237
  } else {
@@ -292,7 +292,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
292
292
  async findData(findBy: any, dontSetToService?: boolean): Promise<T> {
293
293
  try {
294
294
  const dataExists: T = await this.dataDBService.findOne(findBy).catch(error => {
295
- if (error?.errorCodes?.includes('NTS-DBS-FO1')) {
295
+ if (error?.errorCode === 'NTS-DBS-FO1') {
296
296
  Dynamo_Log.logWarning(`findData ${this.dataParams.dataName} didn't found any.`);
297
297
  return null;
298
298
  } else {
@@ -349,7 +349,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
349
349
  async findDatas(findBy: any, dontSetToService?: boolean): Promise<T[]> {
350
350
  try {
351
351
  const dataListExists: T[] = await this.dataDBService.find(findBy).catch(error => {
352
- if (error?.errorCodes?.includes('NTS-DBS-F1')) {
352
+ if (error?.errorCode === 'NTS-DBS-F1') {
353
353
  Dynamo_Log.logWarning(`findDatas ${this.dataParams.dataName} didn't found any.`);
354
354
  return [];
355
355
  } else {
@@ -496,7 +496,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
496
496
 
497
497
  /* const dependencyExists = */
498
498
  await this.getDependencyDataDBService().getDataById(this.data[this.depKey]).catch(error => {
499
- if (error?.errorCodes?.includes('NTS-DBS-GI1')) {
499
+ if (error?.errorCode === 'NTS-DBS-GI1') {
500
500
  throw new Dynamo_Error({
501
501
  status: 417,
502
502
  errorCode: 'NTS-DS0-SD2',
@@ -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: DynamoNTS_DataPropertyParams = this.dataParams.modelParams.find((modelParams: DynamoNTS_DataPropertyParams) => modelParams.isDependencyHook);
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, DynamoNTS_DataParams, DynamoNTS_DataPropertyParams, Dynamo_Error } from '@futdevpro/fsm-dynamo';
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: DynamoNTS_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: DynamoNTS_DataPropertyParams) => {
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?: DynamoNTS_DataPropertyParams[]): any {
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: DynamoNTS_DataPropertyParams) => {
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: DynamoNTS_DataPropertyParams = this.dataParams.modelParams.find(
1005
- (modelParams: DynamoNTS_DataPropertyParams) => modelParams.isDependencyHook);
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, DynamoNTS_DataParams, Dynamo_Log } from '@futdevpro/fsm-dynamo';
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: DynamoNTS_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: DynamoNTS_DataParams[],
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: DynamoNTS_DataParams) => {
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: DynamoNTS_DataParams): DynamoNTS_DBService<T> {
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