@futdevpro/nts-dynamo 1.5.54 → 1.5.55
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/_services/dynamo-nts-data.service.d.ts +2 -2
- package/lib/_services/dynamo-nts-data.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-data.service.js +190 -146
- package/lib/_services/dynamo-nts-data.service.js.map +1 -1
- package/lib/_services/dynamo-nts-db.service.d.ts.map +1 -1
- package/lib/_services/dynamo-nts-db.service.js +132 -83
- package/lib/_services/dynamo-nts-db.service.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_services/dynamo-nts-data.service.ts +191 -131
- package/src/_services/dynamo-nts-db.service.ts +122 -83
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Dynamo_Metadata, DynamoNTS_DataParams, DynamoNTS_DataPropertyParams, Dynamo_Error } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import { Dynamo_Metadata, DynamoNTS_DataParams, DynamoNTS_DataPropertyParams, Dynamo_Error, Dynamo_Shared } 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';
|
|
@@ -54,16 +54,21 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
54
54
|
/**
|
|
55
55
|
* returns all data from database to service dataList
|
|
56
56
|
*/
|
|
57
|
-
async getAll(): Promise<
|
|
57
|
+
async getAll(dontSetToService?: boolean): Promise<T[]> {
|
|
58
58
|
try {
|
|
59
|
-
|
|
59
|
+
const dataListExists: T[] = await this.dataDBService.getAll().catch(error => {
|
|
60
60
|
if (error?.errorCodes?.includes('NTS-DBS-GA1')) {
|
|
61
|
-
|
|
61
|
+
Dynamo_Shared.logWarning(`getAll ${this.dataParams.dataName} didn't found any.`);
|
|
62
62
|
return [];
|
|
63
63
|
} else {
|
|
64
64
|
throw error;
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
|
+
if (!dontSetToService) {
|
|
68
|
+
this.dataList = dataListExists;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return dataListExists;
|
|
67
72
|
} catch (error) {
|
|
68
73
|
throw new Dynamo_Error({
|
|
69
74
|
status: 417,
|
|
@@ -93,20 +98,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
93
98
|
*/
|
|
94
99
|
async getDataById(id?: string, dontSetToService?: boolean): Promise<T> {
|
|
95
100
|
try {
|
|
96
|
-
if (id
|
|
97
|
-
let dataExists: T = await this.dataDBService.getDataById(id ? id : this.data._id).catch(error => {
|
|
98
|
-
if (error?.errorCodes?.includes('NTS-DBS-GI1')) {
|
|
99
|
-
console.error(error);
|
|
100
|
-
return null;
|
|
101
|
-
} else {
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
if (!dontSetToService) {
|
|
106
|
-
this.data = dataExists;
|
|
107
|
-
}
|
|
108
|
-
return dataExists;
|
|
109
|
-
} else {
|
|
101
|
+
if (!id && !this.data._id) {
|
|
110
102
|
throw new Dynamo_Error({
|
|
111
103
|
status: 417,
|
|
112
104
|
errorCode: 'NTS-DS0-GI1',
|
|
@@ -115,15 +107,33 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
115
107
|
userMessage: this.defaultErrorUserMsg
|
|
116
108
|
});
|
|
117
109
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
110
|
+
|
|
111
|
+
const dataExists: T = await this.dataDBService.getDataById(id ?? this.data._id).catch(error => {
|
|
112
|
+
if (error?.errorCodes?.includes('NTS-DBS-GI1')) {
|
|
113
|
+
Dynamo_Shared.logWarning(`getDataById ${this.dataParams.dataName} (${id ?? this.data._id}) didn't found any.`);
|
|
114
|
+
return null;
|
|
115
|
+
} else {
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
126
118
|
});
|
|
119
|
+
if (!dontSetToService) {
|
|
120
|
+
this.data = dataExists;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return dataExists;
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (error?.errorCode == 'NTS-DS0-GI1') {
|
|
126
|
+
throw error;
|
|
127
|
+
} else {
|
|
128
|
+
throw new Dynamo_Error({
|
|
129
|
+
status: 417,
|
|
130
|
+
errorCode: 'NTS-DS0-GI0',
|
|
131
|
+
addECToUserMsg: true,
|
|
132
|
+
message: `getDataById was unsuccessful (${this.dataParams.dataName})`,
|
|
133
|
+
userMessage: this.defaultErrorUserMsg,
|
|
134
|
+
error: error
|
|
135
|
+
});
|
|
136
|
+
}
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
|
|
@@ -133,47 +143,52 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
133
143
|
*/
|
|
134
144
|
async getDataByDependencyId(dependencyId?: string, dontSetToService?: boolean): Promise<T> {
|
|
135
145
|
try {
|
|
136
|
-
if (this.depKey) {
|
|
137
|
-
if (dependencyId || this.data[this.depKey]) {
|
|
138
|
-
let dataExists: T = await this.dataDBService.getDataByDependencyId(dependencyId ? dependencyId : this.data[this.depKey]).catch(error => {
|
|
139
|
-
if (error?.errorCodes?.includes('NTS-DBS-GD2')) {
|
|
140
|
-
console.error(error);
|
|
141
|
-
return null;
|
|
142
|
-
} else {
|
|
143
|
-
throw error;
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
if (!dontSetToService && dataExists) {
|
|
147
|
-
this.data = dataExists;
|
|
148
|
-
}
|
|
149
|
-
return dataExists;
|
|
150
|
-
} else {
|
|
151
|
-
throw new Dynamo_Error({
|
|
152
|
-
status: 417,
|
|
153
|
-
errorCode: 'NTS-DS0-GD3',
|
|
154
|
-
addECToUserMsg: true,
|
|
155
|
-
message: `${this.depKey} is missing! (${this.dataParams.dataName})`,
|
|
156
|
-
userMessage: this.defaultErrorUserMsg
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
} else {
|
|
146
|
+
if (!this.depKey) {
|
|
160
147
|
throw new Dynamo_Error({
|
|
161
148
|
status: 417,
|
|
162
|
-
errorCode: 'NTS-DS0-
|
|
149
|
+
errorCode: 'NTS-DS0-GD1',
|
|
163
150
|
addECToUserMsg: true,
|
|
164
151
|
message: `'dependencyDataIdKey is missing from service! (${this.dataParams.dataName})`,
|
|
165
152
|
userMessage: this.defaultErrorUserMsg
|
|
166
153
|
});
|
|
167
154
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
155
|
+
|
|
156
|
+
if (!dependencyId && !this.data[this.depKey]) {
|
|
157
|
+
throw new Dynamo_Error({
|
|
158
|
+
status: 417,
|
|
159
|
+
errorCode: 'NTS-DS0-GD2',
|
|
160
|
+
addECToUserMsg: true,
|
|
161
|
+
message: `${this.depKey} is missing! (${this.dataParams.dataName})`,
|
|
162
|
+
userMessage: this.defaultErrorUserMsg
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const dataExists: T = await this.dataDBService.getDataByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
|
|
167
|
+
if (error?.errorCodes?.includes('NTS-DBS-GD2')) {
|
|
168
|
+
Dynamo_Shared.logWarning(`getDataByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
|
|
169
|
+
return null;
|
|
170
|
+
} else {
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
176
173
|
});
|
|
174
|
+
if (!dontSetToService) {
|
|
175
|
+
this.data = dataExists;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return dataExists;
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (['NTS-DS0-GD1', 'NTS-DS0-GD2'].includes(error?.errorCode)) {
|
|
181
|
+
throw error;
|
|
182
|
+
} else {
|
|
183
|
+
throw new Dynamo_Error({
|
|
184
|
+
status: 417,
|
|
185
|
+
errorCode: 'NTS-DS0-GD0',
|
|
186
|
+
addECToUserMsg: true,
|
|
187
|
+
message: `getDataByDependencyId was unsuccessful (${this.dataParams.dataName})`,
|
|
188
|
+
userMessage: this.defaultErrorUserMsg,
|
|
189
|
+
error: error
|
|
190
|
+
});
|
|
191
|
+
}
|
|
177
192
|
}
|
|
178
193
|
}
|
|
179
194
|
|
|
@@ -181,45 +196,54 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
181
196
|
* returns dataList from database by dependencyId to the service
|
|
182
197
|
* @param dependencyId
|
|
183
198
|
*/
|
|
184
|
-
async getDataListByDependencyId(dependencyId?: string): Promise<
|
|
199
|
+
async getDataListByDependencyId(dependencyId?: string, dontSetToService?: boolean): Promise<T[]> {
|
|
185
200
|
try {
|
|
186
|
-
if (this.depKey) {
|
|
187
|
-
if (dependencyId || this.data[this.depKey]) {
|
|
188
|
-
this.dataList = await this.dataDBService.getDataListByDependencyId(dependencyId ? dependencyId : this.data[this.depKey]).catch(error => {
|
|
189
|
-
if (error?.errorCodes?.includes('NTS-DBS-GLD2')) {
|
|
190
|
-
console.error(error);
|
|
191
|
-
return [];
|
|
192
|
-
} else {
|
|
193
|
-
throw error;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
} else {
|
|
197
|
-
throw new Dynamo_Error({
|
|
198
|
-
status: 417,
|
|
199
|
-
errorCode: 'NTS-DS0-GLD3',
|
|
200
|
-
addECToUserMsg: true,
|
|
201
|
-
message: `${this.depKey} is missing (${this.dataParams.dataName})`,
|
|
202
|
-
userMessage: this.defaultErrorUserMsg
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
} else {
|
|
201
|
+
if (!this.depKey) {
|
|
206
202
|
throw new Dynamo_Error({
|
|
207
203
|
status: 417,
|
|
208
|
-
errorCode: 'NTS-DS0-
|
|
204
|
+
errorCode: 'NTS-DS0-GLD1',
|
|
209
205
|
addECToUserMsg: true,
|
|
210
206
|
message: `dependencyDataIdKey is missing from service! (${this.dataParams.dataName})`,
|
|
211
207
|
userMessage: this.defaultErrorUserMsg
|
|
212
208
|
});
|
|
213
209
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
210
|
+
|
|
211
|
+
if (!dependencyId && !this.data[this.depKey]) {
|
|
212
|
+
throw new Dynamo_Error({
|
|
213
|
+
status: 417,
|
|
214
|
+
errorCode: 'NTS-DS0-GLD2',
|
|
215
|
+
addECToUserMsg: true,
|
|
216
|
+
message: `${this.depKey} is missing (${this.dataParams.dataName})`,
|
|
217
|
+
userMessage: this.defaultErrorUserMsg
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const dataListExists: T[] = await this.dataDBService.getDataListByDependencyId(dependencyId ?? this.data[this.depKey]).catch(error => {
|
|
222
|
+
if (error?.errorCodes?.includes('NTS-DBS-GLD2')) {
|
|
223
|
+
Dynamo_Shared.logWarning(`getDataListByDependencyId ${this.dataParams.dataName} (${this.depKey}: ${dependencyId ?? this.data[this.depKey]}) didn't found any.`);
|
|
224
|
+
return [];
|
|
225
|
+
} else {
|
|
226
|
+
throw error;
|
|
227
|
+
}
|
|
222
228
|
});
|
|
229
|
+
if (!dontSetToService) {
|
|
230
|
+
this.dataList = dataListExists;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return dataListExists;
|
|
234
|
+
} catch (error) {
|
|
235
|
+
if (['NTS-DS0-GLD1', 'NTS-DS0-GLD2'].includes(error?.errorCode)) {
|
|
236
|
+
throw error;
|
|
237
|
+
} else {
|
|
238
|
+
throw new Dynamo_Error({
|
|
239
|
+
status: 417,
|
|
240
|
+
errorCode: 'NTS-DS0-GLD0',
|
|
241
|
+
addECToUserMsg: true,
|
|
242
|
+
message: `getDataListByDependencyId was unsuccessful (${this.dataParams.dataName})`,
|
|
243
|
+
userMessage: this.defaultErrorUserMsg,
|
|
244
|
+
error: error
|
|
245
|
+
});
|
|
246
|
+
}
|
|
223
247
|
}
|
|
224
248
|
}
|
|
225
249
|
|
|
@@ -257,7 +281,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
257
281
|
try {
|
|
258
282
|
const dataExists: T = await this.dataDBService.findOne(findBy).catch(error => {
|
|
259
283
|
if (error?.errorCodes?.includes('NTS-DBS-FO1')) {
|
|
260
|
-
|
|
284
|
+
Dynamo_Shared.logWarning(`findData ${this.dataParams.dataName} didn't found any.`);
|
|
261
285
|
return null;
|
|
262
286
|
} else {
|
|
263
287
|
throw error;
|
|
@@ -266,6 +290,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
266
290
|
if (!dontSetToService) {
|
|
267
291
|
this.data = dataExists;
|
|
268
292
|
}
|
|
293
|
+
|
|
269
294
|
return dataExists;
|
|
270
295
|
} catch (error) {
|
|
271
296
|
throw new Dynamo_Error({
|
|
@@ -313,7 +338,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
313
338
|
try {
|
|
314
339
|
const dataListExists: T[] = await this.dataDBService.find(findBy).catch(error => {
|
|
315
340
|
if (error?.errorCodes?.includes('NTS-DBS-F1')) {
|
|
316
|
-
|
|
341
|
+
Dynamo_Shared.logWarning(`findDatas ${this.dataParams.dataName} didn't found any.`);
|
|
317
342
|
return [];
|
|
318
343
|
} else {
|
|
319
344
|
throw error;
|
|
@@ -322,6 +347,7 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
322
347
|
if (!dontSetToService) {
|
|
323
348
|
this.dataList = dataListExists;
|
|
324
349
|
}
|
|
350
|
+
|
|
325
351
|
return dataListExists;
|
|
326
352
|
} catch (error) {
|
|
327
353
|
throw new Dynamo_Error({
|
|
@@ -409,14 +435,18 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
409
435
|
});
|
|
410
436
|
}
|
|
411
437
|
} catch (error) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
438
|
+
if (error?.errorCode == 'NTS-DS0-UD1') {
|
|
439
|
+
throw error;
|
|
440
|
+
} else {
|
|
441
|
+
throw new Dynamo_Error({
|
|
442
|
+
status: 417,
|
|
443
|
+
errorCode: 'NTS-DS0-UD0',
|
|
444
|
+
addECToUserMsg: true,
|
|
445
|
+
message: `updateData was unsuccessful (${this.dataParams.dataName})`,
|
|
446
|
+
userMessage: this.defaultErrorUserMsg,
|
|
447
|
+
error: error
|
|
448
|
+
});
|
|
449
|
+
}
|
|
420
450
|
}
|
|
421
451
|
}
|
|
422
452
|
|
|
@@ -452,15 +482,21 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
452
482
|
});
|
|
453
483
|
}
|
|
454
484
|
|
|
455
|
-
|
|
485
|
+
/* const dependencyExists = */
|
|
486
|
+
await this.getDependencyDataDBService().getDataById(this.data[this.depKey]).catch(error => {
|
|
456
487
|
if (error?.errorCodes?.includes('NTS-DBS-GI1')) {
|
|
457
|
-
|
|
458
|
-
|
|
488
|
+
throw new Dynamo_Error({
|
|
489
|
+
status: 417,
|
|
490
|
+
errorCode: 'NTS-DS0-SD2',
|
|
491
|
+
addECToUserMsg: true,
|
|
492
|
+
message: `saveData was unsuccessful: dependency data not exists (key: ${this.depKey}, id: ${this.data[this.depKey]})`,
|
|
493
|
+
userMessage: this.defaultErrorUserMsg
|
|
494
|
+
});
|
|
459
495
|
} else {
|
|
460
496
|
throw error;
|
|
461
497
|
}
|
|
462
498
|
});
|
|
463
|
-
if (!dependencyExists) {
|
|
499
|
+
/* if (!dependencyExists) {
|
|
464
500
|
throw new Dynamo_Error({
|
|
465
501
|
status: 417,
|
|
466
502
|
errorCode: 'NTS-DS0-SD2',
|
|
@@ -468,8 +504,9 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
468
504
|
message: `saveData was unsuccessful: dependency data not exists (key: ${this.depKey}, id: ${this.data[this.depKey]})`,
|
|
469
505
|
userMessage: this.defaultErrorUserMsg
|
|
470
506
|
});
|
|
471
|
-
}
|
|
507
|
+
} */
|
|
472
508
|
}
|
|
509
|
+
|
|
473
510
|
// if data not exists create new data
|
|
474
511
|
this.data = await this.dataDBService.createData(this.data, this.issuer);
|
|
475
512
|
}
|
|
@@ -478,14 +515,18 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
478
515
|
this.data = await this.dataDBService.createData(this.data, this.issuer);
|
|
479
516
|
}
|
|
480
517
|
} catch (error) {
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
518
|
+
if (['NTS-DS0-SD1', 'NTS-DS0-SD2'].includes(error?.errorCode)) {
|
|
519
|
+
throw error;
|
|
520
|
+
} else {
|
|
521
|
+
throw new Dynamo_Error({
|
|
522
|
+
status: 417,
|
|
523
|
+
errorCode: 'NTS-DS0-SD0',
|
|
524
|
+
addECToUserMsg: true,
|
|
525
|
+
message: `modifyData was unsuccessful (${this.dataParams.dataName})`,
|
|
526
|
+
userMessage: this.defaultErrorUserMsg,
|
|
527
|
+
error: error
|
|
528
|
+
});
|
|
529
|
+
}
|
|
489
530
|
}
|
|
490
531
|
}
|
|
491
532
|
|
|
@@ -506,14 +547,18 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
506
547
|
|
|
507
548
|
await this.dataDBService.deleteDataById(this.data._id);
|
|
508
549
|
} catch (error) {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
550
|
+
if (error?.errorCode == 'NTS-DS0-DD1') {
|
|
551
|
+
throw error;
|
|
552
|
+
} else {
|
|
553
|
+
throw new Dynamo_Error({
|
|
554
|
+
status: 417,
|
|
555
|
+
errorCode: 'NTS-DS0-DD0',
|
|
556
|
+
addECToUserMsg: true,
|
|
557
|
+
message: `deleteData was unsuccessful (${this.dataParams.dataName})`,
|
|
558
|
+
userMessage: this.defaultErrorUserMsg,
|
|
559
|
+
error: error
|
|
560
|
+
});
|
|
561
|
+
}
|
|
517
562
|
}
|
|
518
563
|
}
|
|
519
564
|
|
|
@@ -524,8 +569,17 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
524
569
|
try {
|
|
525
570
|
for (let i = 0; i < this.dataParams.modelParams.length; i++) {
|
|
526
571
|
// basic required validations
|
|
527
|
-
if ((this.dataParams.modelParams[i].required &&
|
|
528
|
-
(this.
|
|
572
|
+
if ((this.dataParams.modelParams[i].required &&
|
|
573
|
+
(this.data[this.dataParams.modelParams[i].key] === null ||
|
|
574
|
+
this.data[this.dataParams.modelParams[i].key] === undefined
|
|
575
|
+
)
|
|
576
|
+
) ||
|
|
577
|
+
(this.dataParams.modelParams[i].index &&
|
|
578
|
+
(this.data[this.dataParams.modelParams[i].key] === null ||
|
|
579
|
+
this.data[this.dataParams.modelParams[i].key] === undefined
|
|
580
|
+
)
|
|
581
|
+
)
|
|
582
|
+
) {
|
|
529
583
|
throw new Dynamo_Error({
|
|
530
584
|
status: 422,
|
|
531
585
|
errorCode: 'NTS-DS0-VD1',
|
|
@@ -536,7 +590,9 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
536
590
|
}
|
|
537
591
|
|
|
538
592
|
// specific Date validation
|
|
539
|
-
if (this.dataParams.modelParams[i].type === 'Date' &&
|
|
593
|
+
if (this.dataParams.modelParams[i].type === 'Date' &&
|
|
594
|
+
!(new Date(this.data[this.dataParams.modelParams[i].key]) instanceof Date)
|
|
595
|
+
) {
|
|
540
596
|
throw new Dynamo_Error({
|
|
541
597
|
status: 422,
|
|
542
598
|
errorCode: 'NTS-DS0-VD2',
|
|
@@ -554,14 +610,18 @@ export class DynamoNTS_DataService<T extends Dynamo_Metadata> {
|
|
|
554
610
|
}
|
|
555
611
|
}
|
|
556
612
|
} catch (error) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
613
|
+
if (['NTS-DS0-VD1', 'NTS-DS0-VD2'].includes(error?.errorCode)) {
|
|
614
|
+
throw error;
|
|
615
|
+
} else {
|
|
616
|
+
throw new Dynamo_Error({
|
|
617
|
+
status: 422,
|
|
618
|
+
errorCode: 'NTS-DS0-VD0',
|
|
619
|
+
addECToUserMsg: true,
|
|
620
|
+
message: `validateForSave was unsuccessful (${this.dataParams.dataName})`,
|
|
621
|
+
userMessage: this.defaultErrorUserMsg,
|
|
622
|
+
error: error
|
|
623
|
+
});
|
|
624
|
+
}
|
|
565
625
|
}
|
|
566
626
|
}
|
|
567
627
|
|