@futdevpro/nts-dynamo 1.5.40 → 1.5.47
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/futdevpro-nts-dynamo-01.05.41.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.42.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.43.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.44.tgz +0 -0
- package/futdevpro-nts-dynamo-01.05.45.tgz +0 -0
- package/lib/_enums/http/socket-event.enum.d.ts +2 -0
- package/lib/_enums/http/socket-event.enum.d.ts.map +1 -1
- package/lib/_enums/http/socket-event.enum.js +2 -0
- package/lib/_enums/http/socket-event.enum.js.map +1 -1
- package/lib/_models/dynamo-nts-endpoint-params.js +1 -1
- package/lib/_models/dynamo-nts-endpoint-params.js.map +1 -1
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts +16 -0
- package/lib/_models/dynamo-nts-socket-dictionary.d.ts.map +1 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js +31 -0
- package/lib/_models/dynamo-nts-socket-dictionary.js.map +1 -0
- package/lib/_models/dynamo-nts-socket-event-params.d.ts +2 -0
- package/lib/_models/dynamo-nts-socket-event-params.d.ts.map +1 -1
- package/lib/_models/dynamo-nts-socket-event-params.js +6 -5
- package/lib/_models/dynamo-nts-socket-event-params.js.map +1 -1
- package/lib/_models/index.d.ts +1 -0
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +1 -0
- package/lib/_models/index.js.map +1 -1
- package/lib/_modules/app-extended.index.d.ts +1 -0
- package/lib/_modules/app-extended.index.d.ts.map +1 -1
- package/lib/_modules/app-extended.index.js +1 -0
- package/lib/_modules/app-extended.index.js.map +1 -1
- package/lib/_modules/test/custom-data.service.d.ts +3 -3
- package/lib/_modules/test/custom-data.service.d.ts.map +1 -1
- package/lib/_modules/test/custom-data.service.js +4 -4
- package/lib/_modules/test/custom-data.service.js.map +1 -1
- package/lib/_modules/test/test-controller.js +6 -6
- package/lib/_modules/test/test-controller.js.map +1 -1
- package/lib/_modules/usage/usage-controller.js +1 -1
- package/lib/_modules/usage/usage-controller.js.map +1 -1
- package/lib/_modules/usage/usage.service.d.ts +6 -6
- package/lib/_modules/usage/usage.service.d.ts.map +1 -1
- package/lib/_modules/usage/usage.service.js +18 -10
- package/lib/_modules/usage/usage.service.js.map +1 -1
- package/lib/_services/dynamo-nts-api.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-api.service.js +19 -8
- package/lib/_services/dynamo-nts-api.service.js.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts +1 -1
- package/lib/_services/dynamo-nts-app-extended.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app-extended.js +2 -4
- package/lib/_services/dynamo-nts-app-extended.js.map +1 -1
- package/lib/_services/dynamo-nts-app.d.ts +1 -0
- package/lib/_services/dynamo-nts-app.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-app.js +4 -1
- package/lib/_services/dynamo-nts-app.js.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-auth.service.js +10 -4
- package/lib/_services/dynamo-nts-auth.service.js.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.d.ts +37 -0
- package/lib/_services/dynamo-nts-controller.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-controller.service.js +37 -0
- package/lib/_services/dynamo-nts-controller.service.js.map +1 -1
- package/lib/_services/dynamo-nts-data.service.d.ts +21 -2
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +121 -53
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db.service.d.ts +4 -4
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +148 -84
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/_services/dynamo-nts-email.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-email.service.js +20 -16
- package/lib/_services/dynamo-nts-email.service.js.map +1 -1
- package/lib/_services/dynamo-nts-global.service.d.ts +5 -5
- 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/_services/dynamo-nts-routing-module.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-routing-module.service.js +17 -11
- package/lib/_services/dynamo-nts-routing-module.service.js.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.d.ts +6 -0
- package/lib/_services/dynamo-nts-shared.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-shared.service.js +8 -0
- package/lib/_services/dynamo-nts-shared.service.js.map +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts +1 -1
- package/lib/_services/dynamo-nts-socket-service-collection.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.d.ts +6 -9
- package/lib/_services/dynamo-nts-socket.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-socket.service.js +25 -20
- package/lib/_services/dynamo-nts-socket.service.js.map +1 -1
- package/lib/_services/dynamobe-api.service.js +2 -2
- package/lib/_services/dynamobe-auth.service.js +2 -2
- package/lib/_services/dynamobe-data.service.d.ts +2 -2
- package/lib/_services/dynamobe-data.service.js +15 -15
- package/lib/_services/dynamobe-db.service.d.ts +4 -4
- package/lib/_services/dynamobe-db.service.js +28 -28
- package/lib/_services/dynamobe-email.service.js +4 -4
- package/lib/_services/dynamobe-global.service.d.ts +3 -3
- package/lib/_services/dynamobe-routing-module.service.js +3 -3
- package/lib/tsconfig.tsbuildinfo +1 -5564
- package/package.json +22 -12
- package/src/_enums/http/socket-event.enum.ts +2 -0
- package/src/_models/dynamo-nts-endpoint-params.ts +1 -1
- package/src/_models/dynamo-nts-socket-dictionary.ts +39 -0
- package/src/_models/dynamo-nts-socket-event-params.ts +8 -5
- package/src/_models/index.ts +1 -0
- package/src/_modules/app-extended.index.ts +1 -0
- package/src/_modules/test/custom-data.service.ts +4 -4
- package/src/_modules/test/test-controller.ts +7 -7
- package/src/_modules/usage/usage-controller.ts +2 -2
- package/src/_modules/usage/usage.service.ts +34 -26
- package/src/_services/dynamo-nts-api.service.ts +26 -9
- package/src/_services/dynamo-nts-app-extended.ts +9 -9
- package/src/_services/dynamo-nts-app.ts +2 -2
- package/src/_services/dynamo-nts-auth.service.ts +13 -5
- package/src/_services/dynamo-nts-controller.service.ts +37 -0
- package/src/_services/dynamo-nts-data.service.ts +123 -55
- package/src/_services/dynamo-nts-db.service.ts +181 -87
- package/src/_services/dynamo-nts-email.service.ts +21 -17
- package/src/_services/dynamo-nts-global.service.ts +12 -5
- package/src/_services/dynamo-nts-routing-module.service.ts +16 -10
- package/src/_services/dynamo-nts-shared.service.ts +9 -0
- package/src/_services/dynamo-nts-socket-service-collection.service.ts +1 -1
- package/src/_services/dynamo-nts-socket.service.ts +33 -29
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Dynamo_Metadata, DynamoNTS_DataParams, DynamoNTS_DataPropertyParams, Dynamo_Error } 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';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Basic Data Service that is connected to the relevant DBServices
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* export class UserMatchStatisticsService extends DynamoNTS_DataService<UserMatchStatistics> {
|
|
12
|
+
* constructor(
|
|
13
|
+
* set?: {
|
|
14
|
+
* data?: UserMatchStatistics,
|
|
15
|
+
* issuer?: string,
|
|
16
|
+
* }
|
|
17
|
+
* ) {
|
|
18
|
+
* super(
|
|
19
|
+
* new UserMatchStatistics(set?.data),
|
|
20
|
+
* userMatchStatisticsModelParams
|
|
21
|
+
* );
|
|
22
|
+
* this.issuer = set?.issuer;
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
8
27
|
dataDBService: DynamoNTS_DBService<T>;
|
|
9
28
|
data: T;
|
|
10
29
|
dataList: T[] = [];
|
|
@@ -38,9 +57,12 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
38
57
|
this.dataList = dataList;
|
|
39
58
|
});
|
|
40
59
|
} catch (error) {
|
|
41
|
-
throw new
|
|
42
|
-
status: 417,
|
|
43
|
-
|
|
60
|
+
throw new Dynamo_Error({
|
|
61
|
+
status: 417,
|
|
62
|
+
errorCode: 'NTS-DS0-GA0',
|
|
63
|
+
addECToUserMsg: true,
|
|
64
|
+
message: 'getAll was unsuccessful',
|
|
65
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
44
66
|
error: error
|
|
45
67
|
});
|
|
46
68
|
}
|
|
@@ -61,16 +83,21 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
61
83
|
});
|
|
62
84
|
return dataExists;
|
|
63
85
|
} else {
|
|
64
|
-
throw new
|
|
65
|
-
status: 417,
|
|
66
|
-
|
|
67
|
-
|
|
86
|
+
throw new Dynamo_Error({
|
|
87
|
+
status: 417,
|
|
88
|
+
errorCode: 'NTS-DS0-GI1',
|
|
89
|
+
addECToUserMsg: true,
|
|
90
|
+
message: `ID is missing! (maybe you wanted to use getDataByDependencyId instead...)`,
|
|
91
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
68
92
|
});
|
|
69
93
|
}
|
|
70
94
|
} catch (error) {
|
|
71
|
-
throw new
|
|
72
|
-
status: 417,
|
|
73
|
-
|
|
95
|
+
throw new Dynamo_Error({
|
|
96
|
+
status: 417,
|
|
97
|
+
errorCode: 'NTS-DS0-GI0',
|
|
98
|
+
addECToUserMsg: true,
|
|
99
|
+
message: 'getDataById was unsuccessful',
|
|
100
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
74
101
|
error: error
|
|
75
102
|
});
|
|
76
103
|
}
|
|
@@ -93,23 +120,30 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
93
120
|
});
|
|
94
121
|
return dataExists;
|
|
95
122
|
} else {
|
|
96
|
-
throw new
|
|
97
|
-
status: 417,
|
|
98
|
-
|
|
99
|
-
|
|
123
|
+
throw new Dynamo_Error({
|
|
124
|
+
status: 417,
|
|
125
|
+
errorCode: 'NTS-DS0-GD3',
|
|
126
|
+
addECToUserMsg: true,
|
|
127
|
+
message: `${this.depKey} is missing!`,
|
|
128
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
100
129
|
});
|
|
101
130
|
}
|
|
102
131
|
} else {
|
|
103
|
-
throw new
|
|
104
|
-
status: 417,
|
|
105
|
-
|
|
106
|
-
|
|
132
|
+
throw new Dynamo_Error({
|
|
133
|
+
status: 417,
|
|
134
|
+
errorCode: 'NTS-DS0-GD2',
|
|
135
|
+
addECToUserMsg: true,
|
|
136
|
+
message: 'dependencyDataIdKey is missing from service!',
|
|
137
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
107
138
|
});
|
|
108
139
|
}
|
|
109
140
|
} catch (error) {
|
|
110
|
-
throw new
|
|
111
|
-
status: 417,
|
|
112
|
-
|
|
141
|
+
throw new Dynamo_Error({
|
|
142
|
+
status: 417,
|
|
143
|
+
errorCode: 'NTS-DS0-GD0',
|
|
144
|
+
addECToUserMsg: true,
|
|
145
|
+
message: 'getDataByDependencyId was unsuccessful',
|
|
146
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
113
147
|
error: error
|
|
114
148
|
});
|
|
115
149
|
}
|
|
@@ -127,23 +161,30 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
127
161
|
this.dataList = data;
|
|
128
162
|
});
|
|
129
163
|
} else {
|
|
130
|
-
throw new
|
|
131
|
-
status: 417,
|
|
132
|
-
|
|
133
|
-
|
|
164
|
+
throw new Dynamo_Error({
|
|
165
|
+
status: 417,
|
|
166
|
+
errorCode: 'NTS-DS0-GLD3',
|
|
167
|
+
addECToUserMsg: true,
|
|
168
|
+
message: `${this.depKey} is missing!`,
|
|
169
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
134
170
|
});
|
|
135
171
|
}
|
|
136
172
|
} else {
|
|
137
|
-
throw new
|
|
138
|
-
status: 417,
|
|
139
|
-
|
|
140
|
-
|
|
173
|
+
throw new Dynamo_Error({
|
|
174
|
+
status: 417,
|
|
175
|
+
errorCode: 'NTS-DS0-GLD2',
|
|
176
|
+
addECToUserMsg: true,
|
|
177
|
+
message: 'dependencyDataIdKey is missing from service!',
|
|
178
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
141
179
|
});
|
|
142
180
|
}
|
|
143
181
|
} catch (error) {
|
|
144
|
-
throw new
|
|
182
|
+
throw new Dynamo_Error({
|
|
183
|
+
status: 417,
|
|
184
|
+
errorCode: 'NTS-DS0-GLD0',
|
|
185
|
+
addECToUserMsg: true,
|
|
145
186
|
message: 'getDataListByDependencyId was unsuccessful',
|
|
146
|
-
userMessage: `We encountered
|
|
187
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
147
188
|
error: error
|
|
148
189
|
});
|
|
149
190
|
}
|
|
@@ -171,17 +212,21 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
171
212
|
dependencyExists = !!dep;
|
|
172
213
|
});
|
|
173
214
|
if (!dependencyExists) {
|
|
174
|
-
throw new
|
|
215
|
+
throw new Dynamo_Error({
|
|
216
|
+
status: 417,
|
|
217
|
+
errorCode: 'NTS-DS0-SD1',
|
|
218
|
+
addECToUserMsg: true,
|
|
175
219
|
message: `saveData was unsuccessful: dependency data not exists (key: ${this.depKey}, id: ${this.data[this.depKey]})`,
|
|
176
|
-
userMessage: `We encountered
|
|
177
|
-
error: new Error()
|
|
220
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
178
221
|
});
|
|
179
222
|
}
|
|
180
223
|
} else {
|
|
181
|
-
throw new
|
|
224
|
+
throw new Dynamo_Error({
|
|
225
|
+
status: 417,
|
|
226
|
+
errorCode: 'NTS-DS0-SD2',
|
|
227
|
+
addECToUserMsg: true,
|
|
182
228
|
message: `saveData was unsuccessful: dependency data id missing from data (key: ${this.depKey})`,
|
|
183
|
-
userMessage: `We encountered
|
|
184
|
-
error: new Error()
|
|
229
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
185
230
|
});
|
|
186
231
|
}
|
|
187
232
|
}
|
|
@@ -202,9 +247,12 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
202
247
|
});
|
|
203
248
|
}
|
|
204
249
|
} catch (error) {
|
|
205
|
-
throw new
|
|
206
|
-
status: 417,
|
|
207
|
-
|
|
250
|
+
throw new Dynamo_Error({
|
|
251
|
+
status: 417,
|
|
252
|
+
errorCode: 'NTS-DS0-SD0',
|
|
253
|
+
addECToUserMsg: true,
|
|
254
|
+
message: `modifyData was unsuccessful (${this.dataParams.dataName})`,
|
|
255
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
208
256
|
error: error
|
|
209
257
|
});
|
|
210
258
|
}
|
|
@@ -218,12 +266,15 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
218
266
|
if (this.data._id) {
|
|
219
267
|
await this.dataDBService.deleteDataById(this.data._id);
|
|
220
268
|
} else {
|
|
221
|
-
throw new
|
|
269
|
+
throw new Dynamo_Error({ status: 417, message: 'ID is missing!' });
|
|
222
270
|
}
|
|
223
271
|
} catch (error) {
|
|
224
|
-
throw new
|
|
225
|
-
status: 417,
|
|
226
|
-
|
|
272
|
+
throw new Dynamo_Error({
|
|
273
|
+
status: 417,
|
|
274
|
+
errorCode: 'NTS-DS0-DD0',
|
|
275
|
+
addECToUserMsg: true,
|
|
276
|
+
message: 'deleteData was unsuccessful',
|
|
277
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
227
278
|
error: error
|
|
228
279
|
});
|
|
229
280
|
}
|
|
@@ -238,11 +289,23 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
238
289
|
// basic required validations
|
|
239
290
|
if ((this.dataParams.modelParams[i].required && (this.data[this.dataParams.modelParams[i].key] === null || this.data[this.dataParams.modelParams[i].key] === undefined)) ||
|
|
240
291
|
(this.dataParams.modelParams[i].index && (this.data[this.dataParams.modelParams[i].key] === null || this.data[this.dataParams.modelParams[i].key] === undefined))) {
|
|
241
|
-
throw new
|
|
292
|
+
throw new Dynamo_Error({
|
|
293
|
+
status: 422,
|
|
294
|
+
errorCode: 'NTS-DS0-VD1',
|
|
295
|
+
addECToUserMsg: true,
|
|
296
|
+
message: `${this.dataParams.modelParams[i].key} is missing! (${this.dataParams.modelParams[i].required ? 'required' : 'index'})`,
|
|
297
|
+
userMessage: `We encountered an unhandled Validation Error, please contact the responsible development team.`
|
|
298
|
+
});
|
|
242
299
|
}
|
|
243
300
|
// specific Date validation
|
|
244
301
|
if (this.dataParams.modelParams[i].type === 'Date' && !(new Date(this.data[this.dataParams.modelParams[i].key]) instanceof Date)) {
|
|
245
|
-
throw new
|
|
302
|
+
throw new Dynamo_Error({
|
|
303
|
+
status: 422,
|
|
304
|
+
errorCode: 'NTS-DS0-VD2',
|
|
305
|
+
addECToUserMsg: true,
|
|
306
|
+
message: `${this.dataParams.modelParams[i].key} is not a date!`,
|
|
307
|
+
userMessage: `We encountered an unhandled Validation Error, please contact the responsible development team.`
|
|
308
|
+
});
|
|
246
309
|
}
|
|
247
310
|
// call additional validators
|
|
248
311
|
if (this.dataParams.modelParams[i].additionalValidators) {
|
|
@@ -252,9 +315,12 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
252
315
|
}
|
|
253
316
|
}
|
|
254
317
|
} catch (error) {
|
|
255
|
-
throw new
|
|
256
|
-
status: 422,
|
|
257
|
-
|
|
318
|
+
throw new Dynamo_Error({
|
|
319
|
+
status: 422,
|
|
320
|
+
errorCode: 'NTS-DS0-VD0',
|
|
321
|
+
addECToUserMsg: true,
|
|
322
|
+
message: 'validateForSave was unsuccessful',
|
|
323
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`,
|
|
258
324
|
error: error
|
|
259
325
|
});
|
|
260
326
|
}
|
|
@@ -281,10 +347,12 @@ export class DynamoNTS_DataService<T extends Metadata> {
|
|
|
281
347
|
if (this.depDBServiceKey) {
|
|
282
348
|
return DynamoNTS_GlobalService.getDBService(this.dataParams);
|
|
283
349
|
} else {
|
|
284
|
-
throw new
|
|
285
|
-
status: 501,
|
|
286
|
-
|
|
287
|
-
|
|
350
|
+
throw new Dynamo_Error({
|
|
351
|
+
status: 501,
|
|
352
|
+
errorCode: 'NTS-DS0-GDDB0',
|
|
353
|
+
addECToUserMsg: true,
|
|
354
|
+
message: 'getDependencyDataDBService was unsuccessful, service key not setted up!',
|
|
355
|
+
userMessage: `We encountered an unhandled Data Error, please contact the responsible development team.`
|
|
288
356
|
});
|
|
289
357
|
}
|
|
290
358
|
}
|