pg-mvc-service 2.0.76 → 2.0.78
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.
|
@@ -166,6 +166,9 @@ class RequestType extends ReqResType_1.default {
|
|
|
166
166
|
"HTTPS_21": this.ERROR_MESSAGE.INVALID_HTTPS,
|
|
167
167
|
"BASE64_21": this.ERROR_MESSAGE.INVALID_BASE64,
|
|
168
168
|
"REQUIRE_31": this.ERROR_MESSAGE.REQUIRED,
|
|
169
|
+
"NUMBER_31": this.ERROR_MESSAGE.INVALID_NUMBER,
|
|
170
|
+
"STRING_31": this.ERROR_MESSAGE.INVALID_STRING,
|
|
171
|
+
"ENUM_32": this.ERROR_MESSAGE.INVALID_ENUM,
|
|
169
172
|
"NUMBER_41": this.ERROR_MESSAGE.INVALID_NUMBER,
|
|
170
173
|
"STRING_41": this.ERROR_MESSAGE.INVALID_STRING,
|
|
171
174
|
"ENUM_41": this.ERROR_MESSAGE.INVALID_ENUM,
|
|
@@ -201,7 +204,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
201
204
|
"BASE64_91": this.ERROR_MESSAGE.INVALID_BASE64,
|
|
202
205
|
};
|
|
203
206
|
let errorMessage = list[code];
|
|
204
|
-
if (code === "ENUM_41" || code === "ENUM_42") {
|
|
207
|
+
if (code === "ENUM_32" || code === "ENUM_41" || code === "ENUM_42") {
|
|
205
208
|
const property = this.getProperty(keys);
|
|
206
209
|
errorMessage = errorMessage.replace('{enums}', Object.keys((_a = property.enums) !== null && _a !== void 0 ? _a : '').join(','));
|
|
207
210
|
}
|
|
@@ -323,6 +326,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
323
326
|
switch (typeof mapValue) {
|
|
324
327
|
case 'boolean':
|
|
325
328
|
mapData[mapKey] = mapValue;
|
|
329
|
+
break;
|
|
326
330
|
case 'number':
|
|
327
331
|
if (mapValue !== 0 && mapValue !== 1) {
|
|
328
332
|
this.throwInputError("MAP_03", [key], mapValue);
|
|
@@ -450,7 +454,33 @@ class RequestType extends ReqResType_1.default {
|
|
|
450
454
|
break;
|
|
451
455
|
case 'enum':
|
|
452
456
|
case 'enum?':
|
|
457
|
+
const toEnumValue = [];
|
|
453
458
|
for (const value of values) {
|
|
459
|
+
switch (property.item.enumType) {
|
|
460
|
+
case 'number':
|
|
461
|
+
case 'number?':
|
|
462
|
+
if (this.isNumber(value) === false) {
|
|
463
|
+
this.throwInputError("NUMBER_31", keys, value);
|
|
464
|
+
}
|
|
465
|
+
toEnumValue.push(Number(value));
|
|
466
|
+
break;
|
|
467
|
+
case 'string':
|
|
468
|
+
case 'string?':
|
|
469
|
+
switch (typeof value) {
|
|
470
|
+
case 'number':
|
|
471
|
+
toEnumValue.push(value.toString());
|
|
472
|
+
break;
|
|
473
|
+
case 'string':
|
|
474
|
+
toEnumValue.push(value);
|
|
475
|
+
break;
|
|
476
|
+
default:
|
|
477
|
+
this.throwInputError("STRING_31", keys, value);
|
|
478
|
+
}
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
if (Object.keys(property.item.enums).includes(value.toString()) === false) {
|
|
482
|
+
this.throwInputError("ENUM_32", keys, value);
|
|
483
|
+
}
|
|
454
484
|
this.setEnum([...keys, i], value);
|
|
455
485
|
}
|
|
456
486
|
break;
|
|
@@ -481,6 +511,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
481
511
|
switch (typeof mapValue) {
|
|
482
512
|
case 'boolean':
|
|
483
513
|
mapData[mapKey] = mapValue;
|
|
514
|
+
break;
|
|
484
515
|
case 'number':
|
|
485
516
|
if (mapValue !== 0 && mapValue !== 1) {
|
|
486
517
|
this.throwInputError("MAP_33", keys, mapValue);
|
|
@@ -611,6 +642,7 @@ class RequestType extends ReqResType_1.default {
|
|
|
611
642
|
switch (typeof mapValue) {
|
|
612
643
|
case 'boolean':
|
|
613
644
|
mapData[mapKey] = mapValue;
|
|
645
|
+
break;
|
|
614
646
|
case 'number':
|
|
615
647
|
if (mapValue !== 0 && mapValue !== 1) {
|
|
616
648
|
this.throwInputError("MAP_13", keys, mapValue);
|
package/package.json
CHANGED
|
@@ -146,7 +146,7 @@ export class RequestType extends ReqResType {
|
|
|
146
146
|
"NUMBER_21" | "BOOL_21" | "BOOL_22" | "BOOL_23" | "STRING_21" | "UUID_21" | "MAIL_21" | "DATE_21" | "DATE_22" |
|
|
147
147
|
"TIME_21" | "DATETIME_21" | "DATETIME_22" | "HTTPS_21" | "BASE64_21" |
|
|
148
148
|
"REQUIRE_31" |
|
|
149
|
-
"ENUM_41" | "ENUM_42" | "NUMBER_41" | "STRING_41" |
|
|
149
|
+
"ENUM_32" | "NUMBER_31" | "STRING_31" | "ENUM_41" | "ENUM_42" | "NUMBER_41" | "STRING_41" |
|
|
150
150
|
"MAP_01" | "MAP_02" | "MAP_03" | "MAP_04" | "MAP_05" | "MAP_11" | "MAP_12" | "MAP_13" | "MAP_14" | "MAP_15" |
|
|
151
151
|
"MAP_31" | "MAP_32" | "MAP_33" | "MAP_34" | "MAP_35" |
|
|
152
152
|
"NUMBER_91" | "BOOL_91" | "BOOL_92" | "BOOL_93" | "STRING_91" | "UUID_91" | "MAIL_91" | "DATE_91" | "DATE_92" |
|
|
@@ -177,6 +177,9 @@ export class RequestType extends ReqResType {
|
|
|
177
177
|
"HTTPS_21": this.ERROR_MESSAGE.INVALID_HTTPS,
|
|
178
178
|
"BASE64_21": this.ERROR_MESSAGE.INVALID_BASE64,
|
|
179
179
|
"REQUIRE_31": this.ERROR_MESSAGE.REQUIRED,
|
|
180
|
+
"NUMBER_31": this.ERROR_MESSAGE.INVALID_NUMBER,
|
|
181
|
+
"STRING_31": this.ERROR_MESSAGE.INVALID_STRING,
|
|
182
|
+
"ENUM_32": this.ERROR_MESSAGE.INVALID_ENUM,
|
|
180
183
|
"NUMBER_41": this.ERROR_MESSAGE.INVALID_NUMBER,
|
|
181
184
|
"STRING_41": this.ERROR_MESSAGE.INVALID_STRING,
|
|
182
185
|
"ENUM_41": this.ERROR_MESSAGE.INVALID_ENUM,
|
|
@@ -213,7 +216,7 @@ export class RequestType extends ReqResType {
|
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
let errorMessage = list[code];
|
|
216
|
-
if (code === "ENUM_41" || code === "ENUM_42") {
|
|
219
|
+
if (code === "ENUM_32" || code === "ENUM_41" || code === "ENUM_42") {
|
|
217
220
|
const property = this.getProperty(keys) as EnumType;
|
|
218
221
|
errorMessage = errorMessage.replace('{enums}', Object.keys(property.enums ?? '').join(','));
|
|
219
222
|
}
|
|
@@ -334,6 +337,7 @@ export class RequestType extends ReqResType {
|
|
|
334
337
|
switch (typeof mapValue) {
|
|
335
338
|
case 'boolean':
|
|
336
339
|
mapData[mapKey] = mapValue;
|
|
340
|
+
break;
|
|
337
341
|
case 'number':
|
|
338
342
|
if (mapValue !== 0 && mapValue !== 1) {
|
|
339
343
|
this.throwInputError("MAP_03", [key], mapValue);
|
|
@@ -470,7 +474,34 @@ export class RequestType extends ReqResType {
|
|
|
470
474
|
break;
|
|
471
475
|
case 'enum':
|
|
472
476
|
case 'enum?':
|
|
473
|
-
|
|
477
|
+
const toEnumValue = [];
|
|
478
|
+
for (const value of values) {
|
|
479
|
+
switch (property.item.enumType) {
|
|
480
|
+
case 'number':
|
|
481
|
+
case 'number?':
|
|
482
|
+
if (this.isNumber(value) === false) {
|
|
483
|
+
this.throwInputError("NUMBER_31", keys, value);
|
|
484
|
+
}
|
|
485
|
+
toEnumValue.push(Number(value));
|
|
486
|
+
break;
|
|
487
|
+
case 'string':
|
|
488
|
+
case 'string?':
|
|
489
|
+
switch (typeof value) {
|
|
490
|
+
case 'number':
|
|
491
|
+
toEnumValue.push(value.toString());
|
|
492
|
+
break;
|
|
493
|
+
case 'string':
|
|
494
|
+
toEnumValue.push(value);
|
|
495
|
+
break;
|
|
496
|
+
default:
|
|
497
|
+
this.throwInputError("STRING_31", keys, value);
|
|
498
|
+
}
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (Object.keys(property.item.enums).includes(value.toString()) === false) {
|
|
503
|
+
this.throwInputError("ENUM_32", keys, value);
|
|
504
|
+
}
|
|
474
505
|
this.setEnum([...keys, i], value);
|
|
475
506
|
}
|
|
476
507
|
break;
|
|
@@ -501,6 +532,7 @@ export class RequestType extends ReqResType {
|
|
|
501
532
|
switch (typeof mapValue) {
|
|
502
533
|
case 'boolean':
|
|
503
534
|
mapData[mapKey] = mapValue;
|
|
535
|
+
break;
|
|
504
536
|
case 'number':
|
|
505
537
|
if (mapValue !== 0 && mapValue !== 1) {
|
|
506
538
|
this.throwInputError("MAP_33", keys, mapValue);
|
|
@@ -635,6 +667,7 @@ export class RequestType extends ReqResType {
|
|
|
635
667
|
switch (typeof mapValue) {
|
|
636
668
|
case 'boolean':
|
|
637
669
|
mapData[mapKey] = mapValue;
|
|
670
|
+
break;
|
|
638
671
|
case 'number':
|
|
639
672
|
if (mapValue !== 0 && mapValue !== 1) {
|
|
640
673
|
this.throwInputError("MAP_13", keys, mapValue);
|