@futdevpro/nts-dynamo 1.7.22 → 1.7.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@futdevpro/nts-dynamo",
3
- "version": "01.07.22",
3
+ "version": "01.07.24",
4
4
  "description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
5
5
  "scripts": {
6
6
  "prep": "npm i rimraf nodemon -g",
@@ -8,6 +8,7 @@ export enum DynamoNTS_SocketEventKey {
8
8
  subscribe = 'subscribe',
9
9
  subscriptionSuccessful = 'subscriptionSuccessful',
10
10
  unsubscribe = 'unsubscribe',
11
+ unsubscribeSuccessful = 'unsubscribeSuccessful',
11
12
  disconnect = 'disconnection',
12
13
 
13
14
  ping = 'ping',
@@ -4,7 +4,8 @@ import { dynamoNTS_globalSettings } from '../../_constants/global-settings.const
4
4
  import { DynamoNTS_SocketEventKey } from '../../_enums/http/socket-event-type.enum';
5
5
 
6
6
 
7
- export type DynamoNTS_SocketEventPreprocessTask<T = any, R = any> = (content?: T, issuer?: string) => Promise<R>;
7
+ export type DynamoNTS_SocketEventPreprocessTask<T = any, R = any> =
8
+ (content?: T, issuer?: string) => Promise<R>;
8
9
  export type DynamoNTS_SocketEventTask<T> = (content?: T, issuer?: string) => Promise<void>;
9
10
 
10
11
  /**
@@ -77,14 +78,19 @@ export class DynamoNTS_SocketEvent<T>{
77
78
  DynamoNTS_SocketEventKey.disconnect,
78
79
  ] as string[]).includes(this.eventKey)
79
80
  ) {
80
- this.logEvent = dynamoNTS_globalSettings.logMainSocketEvents || dynamoNTS_globalSettings.logAllSocketEvent;
81
+ this.logEvent = dynamoNTS_globalSettings.logMainSocketEvents ||
82
+ dynamoNTS_globalSettings.logAllSocketEvent;
81
83
  } else {
82
84
  this.logEvent = dynamoNTS_globalSettings.logAllSocketEvent;
83
85
  }
84
- this.logEventContent = set.logEventContent !== undefined ? set.logEventContent : dynamoNTS_globalSettings.logSocketEventContent;
86
+ this.logEventContent = set.logEventContent !== undefined ?
87
+ set.logEventContent : dynamoNTS_globalSettings.logSocketEventContent;
85
88
  } catch (error) {
86
89
  Dynamo_Log.error(
87
- `\nSocket Event params setup failed (${this.serviceName}): ${set.eventKey}`, error);
90
+ `\nSocket Event params setup failed (${this.serviceName}): ${set.eventKey}`,
91
+ error
92
+ );
93
+
88
94
  throw error;
89
95
  }
90
96
  }
@@ -118,15 +124,23 @@ export class DynamoNTS_SocketEvent<T>{
118
124
  await this.getPreLog(content, issuer);
119
125
  }
120
126
 
121
- await Dynamo_Array.asyncForEach(this.preProcessess, async (preProcess: DynamoNTS_SocketEventPreprocessTask<any, any>) => {
122
- content = await preProcess(content);
123
- });
127
+ await Dynamo_Array.asyncForEach(
128
+ this.preProcessess,
129
+ async (preProcess: DynamoNTS_SocketEventPreprocessTask<any, any>) => {
130
+ content = await preProcess(content);
131
+ }
132
+ );
124
133
 
125
134
  await Dynamo_Array.asyncForEach(this.tasks, async (task: DynamoNTS_SocketEventTask<T>) => {
126
135
  await task(content, issuer);
127
136
  });
128
137
  } catch (error) {
129
- Dynamo_Log.error(`Socket Event tasks failed to execute on ${this.serviceName}.... (${this.eventKey})`, error, 'content:', content);
138
+ Dynamo_Log.error(
139
+ `Socket Event tasks failed to execute on ${this.serviceName}.... (${this.eventKey})`,
140
+ error,
141
+ 'content:',
142
+ content
143
+ );
130
144
  }
131
145
  }
132
146
  }
@@ -35,6 +35,8 @@ export class DynamoNTS_ApiService {
35
35
  `\n(Internal BE to BE error)`;
36
36
 
37
37
  /**
38
+ * if the callParams.getFullResponse is set to true,
39
+ * use the Axios.AxiosResponse type as T_Response
38
40
  *
39
41
  * @param callParams
40
42
  * @param inputParams
@@ -50,7 +52,7 @@ export class DynamoNTS_ApiService {
50
52
  * you can pass data and other inputs in this section
51
53
  */
52
54
  inputParams?: DynamoNTS_ApiCallInputParams<T_Body>
53
- ): Promise<T_Response | Axios.AxiosResponse> {
55
+ ): Promise<T_Response /* | Axios.AxiosResponse */> {
54
56
  try {
55
57
  let a: T_Response;
56
58
  let url: string = callParams.baseUrl + callParams.endPoint;
@@ -109,7 +111,7 @@ export class DynamoNTS_ApiService {
109
111
  }
110
112
 
111
113
  if (callParams.getFullResponse) {
112
- return a as Axios.AxiosResponse;
114
+ return a as T_Response /* Axios.AxiosResponse */;
113
115
 
114
116
  } else {
115
117
  return a as T_Response;