koatty_validation 1.3.1 → 1.3.4
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/.rollup.config.js +62 -62
- package/CHANGELOG.md +73 -69
- package/LICENSE +29 -29
- package/README.md +116 -116
- package/dist/LICENSE +29 -29
- package/dist/README.md +116 -116
- package/dist/index.d.ts +1 -1
- package/dist/index.js +58 -131
- package/dist/index.mjs +58 -131
- package/dist/package.json +91 -89
- package/package.json +91 -89
- package/.vscode/launch.json +0 -81
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @Author: richen
|
|
3
|
-
* @Date: 2024-
|
|
3
|
+
* @Date: 2024-10-31 17:02:42
|
|
4
4
|
* @License: BSD (3-Clause)
|
|
5
5
|
* @Copyright (c) - <richenlin(at)gmail.com>
|
|
6
6
|
* @HomePage: https://koatty.org/
|
|
7
7
|
*/
|
|
8
|
+
import { validate, isEmail, isIP, isPhoneNumber, isURL, isHash, equals, notEquals, contains, isIn, isNotIn, registerDecorator, isDate, length } from 'class-validator';
|
|
8
9
|
import * as helper from 'koatty_lib';
|
|
9
|
-
import 'reflect-metadata';
|
|
10
10
|
import { getOriginMetadata, IOCContainer } from 'koatty_container';
|
|
11
|
-
import
|
|
11
|
+
import 'reflect-metadata';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @ author: richen
|
|
@@ -183,6 +183,7 @@ function convertParamsType(param, type) {
|
|
|
183
183
|
default: //any
|
|
184
184
|
return param;
|
|
185
185
|
}
|
|
186
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
186
187
|
}
|
|
187
188
|
catch (err) {
|
|
188
189
|
return param;
|
|
@@ -332,7 +333,7 @@ function plateNumber(value) {
|
|
|
332
333
|
* @Usage:
|
|
333
334
|
* @Author: richen
|
|
334
335
|
* @Date: 2021-11-25 10:47:04
|
|
335
|
-
* @LastEditTime: 2024-
|
|
336
|
+
* @LastEditTime: 2024-10-31 16:57:28
|
|
336
337
|
*/
|
|
337
338
|
// constant
|
|
338
339
|
const PARAM_TYPE_KEY = 'PARAM_TYPE_KEY';
|
|
@@ -391,20 +392,10 @@ class ValidateClass {
|
|
|
391
392
|
* @memberof ValidateClass
|
|
392
393
|
*/
|
|
393
394
|
async valid(Clazz, data, convert = false) {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
else {
|
|
399
|
-
obj = plainToClass(Clazz, data, convert);
|
|
400
|
-
}
|
|
401
|
-
let errors = [];
|
|
402
|
-
if (convert) {
|
|
403
|
-
errors = await validate(obj);
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
errors = await validate(obj, { skipMissingProperties: true });
|
|
407
|
-
}
|
|
395
|
+
const obj = data instanceof Clazz ? data : plainToClass(Clazz, data, convert);
|
|
396
|
+
const errors = convert
|
|
397
|
+
? await validate(obj)
|
|
398
|
+
: await validate(obj, { skipMissingProperties: true });
|
|
408
399
|
if (errors.length > 0) {
|
|
409
400
|
throw new Error(Object.values(errors[0].constraints)[0]);
|
|
410
401
|
}
|
|
@@ -577,71 +568,7 @@ const ValidFuncs = {
|
|
|
577
568
|
* @param {(string | ValidOtpions)} [options]
|
|
578
569
|
* @returns {*}
|
|
579
570
|
*/
|
|
580
|
-
const FunctionValidator = {
|
|
581
|
-
IsNotEmpty: function (value, options) {
|
|
582
|
-
throw new Error("Function not implemented.");
|
|
583
|
-
},
|
|
584
|
-
IsDate: function (value, options) {
|
|
585
|
-
throw new Error("Function not implemented.");
|
|
586
|
-
},
|
|
587
|
-
IsEmail: function (value, options) {
|
|
588
|
-
throw new Error("Function not implemented.");
|
|
589
|
-
},
|
|
590
|
-
IsIP: function (value, options) {
|
|
591
|
-
throw new Error("Function not implemented.");
|
|
592
|
-
},
|
|
593
|
-
IsPhoneNumber: function (value, options) {
|
|
594
|
-
throw new Error("Function not implemented.");
|
|
595
|
-
},
|
|
596
|
-
IsUrl: function (value, options) {
|
|
597
|
-
throw new Error("Function not implemented.");
|
|
598
|
-
},
|
|
599
|
-
IsHash: function (value, options) {
|
|
600
|
-
throw new Error("Function not implemented.");
|
|
601
|
-
},
|
|
602
|
-
IsCnName: function (value, options) {
|
|
603
|
-
throw new Error("Function not implemented.");
|
|
604
|
-
},
|
|
605
|
-
IsIdNumber: function (value, options) {
|
|
606
|
-
throw new Error("Function not implemented.");
|
|
607
|
-
},
|
|
608
|
-
IsZipCode: function (value, options) {
|
|
609
|
-
throw new Error("Function not implemented.");
|
|
610
|
-
},
|
|
611
|
-
IsMobile: function (value, options) {
|
|
612
|
-
throw new Error("Function not implemented.");
|
|
613
|
-
},
|
|
614
|
-
IsPlateNumber: function (value, options) {
|
|
615
|
-
throw new Error("Function not implemented.");
|
|
616
|
-
},
|
|
617
|
-
Equals: function (value, options) {
|
|
618
|
-
throw new Error("Function not implemented.");
|
|
619
|
-
},
|
|
620
|
-
NotEquals: function (value, options) {
|
|
621
|
-
throw new Error("Function not implemented.");
|
|
622
|
-
},
|
|
623
|
-
Contains: function (value, options) {
|
|
624
|
-
throw new Error("Function not implemented.");
|
|
625
|
-
},
|
|
626
|
-
IsIn: function (value, options) {
|
|
627
|
-
throw new Error("Function not implemented.");
|
|
628
|
-
},
|
|
629
|
-
IsNotIn: function (value, options) {
|
|
630
|
-
throw new Error("Function not implemented.");
|
|
631
|
-
},
|
|
632
|
-
Gt: function (value, options) {
|
|
633
|
-
throw new Error("Function not implemented.");
|
|
634
|
-
},
|
|
635
|
-
Lt: function (value, options) {
|
|
636
|
-
throw new Error("Function not implemented.");
|
|
637
|
-
},
|
|
638
|
-
Gte: function (value, options) {
|
|
639
|
-
throw new Error("Function not implemented.");
|
|
640
|
-
},
|
|
641
|
-
Lte: function (value, options) {
|
|
642
|
-
throw new Error("Function not implemented.");
|
|
643
|
-
}
|
|
644
|
-
};
|
|
571
|
+
const FunctionValidator = {};
|
|
645
572
|
Object.keys(ValidFuncs).forEach((key) => {
|
|
646
573
|
FunctionValidator[key] = (value, options) => {
|
|
647
574
|
if (helper.isString(options)) {
|
|
@@ -658,7 +585,7 @@ Object.keys(ValidFuncs).forEach((key) => {
|
|
|
658
585
|
* @Usage:
|
|
659
586
|
* @Author: richen
|
|
660
587
|
* @Date: 2021-11-25 10:46:57
|
|
661
|
-
* @LastEditTime: 2024-
|
|
588
|
+
* @LastEditTime: 2024-10-31 16:49:26
|
|
662
589
|
*/
|
|
663
590
|
/**
|
|
664
591
|
* Validation parameter's type and values.
|
|
@@ -701,7 +628,7 @@ function Valid(rule, options) {
|
|
|
701
628
|
* @returns {MethodDecorator}
|
|
702
629
|
*/
|
|
703
630
|
function Validated() {
|
|
704
|
-
return (target, propertyKey,
|
|
631
|
+
return (target, propertyKey, _descriptor) => {
|
|
705
632
|
//
|
|
706
633
|
IOCContainer.savePropertyData(PARAM_CHECK_KEY, {
|
|
707
634
|
dtoCheck: 1
|
|
@@ -773,10 +700,10 @@ function IsCnName(validationOptions) {
|
|
|
773
700
|
propertyName,
|
|
774
701
|
options: validationOptions,
|
|
775
702
|
validator: {
|
|
776
|
-
validate(value,
|
|
703
|
+
validate(value, _args) {
|
|
777
704
|
return cnName(value);
|
|
778
705
|
},
|
|
779
|
-
defaultMessage(
|
|
706
|
+
defaultMessage(_args) {
|
|
780
707
|
return "invalid parameter ($property).";
|
|
781
708
|
}
|
|
782
709
|
}
|
|
@@ -800,10 +727,10 @@ function IsIdNumber(validationOptions) {
|
|
|
800
727
|
propertyName,
|
|
801
728
|
options: validationOptions,
|
|
802
729
|
validator: {
|
|
803
|
-
validate(value,
|
|
730
|
+
validate(value, _args) {
|
|
804
731
|
return idNumber(value);
|
|
805
732
|
},
|
|
806
|
-
defaultMessage(
|
|
733
|
+
defaultMessage(_args) {
|
|
807
734
|
return "invalid parameter ($property).";
|
|
808
735
|
}
|
|
809
736
|
}
|
|
@@ -827,10 +754,10 @@ function IsZipCode(validationOptions) {
|
|
|
827
754
|
propertyName,
|
|
828
755
|
options: validationOptions,
|
|
829
756
|
validator: {
|
|
830
|
-
validate(value,
|
|
757
|
+
validate(value, _args) {
|
|
831
758
|
return zipCode(value);
|
|
832
759
|
},
|
|
833
|
-
defaultMessage(
|
|
760
|
+
defaultMessage(_args) {
|
|
834
761
|
return "invalid parameter ($property).";
|
|
835
762
|
}
|
|
836
763
|
}
|
|
@@ -854,10 +781,10 @@ function IsMobile(validationOptions) {
|
|
|
854
781
|
propertyName,
|
|
855
782
|
options: validationOptions,
|
|
856
783
|
validator: {
|
|
857
|
-
validate(value,
|
|
784
|
+
validate(value, _args) {
|
|
858
785
|
return mobile(value);
|
|
859
786
|
},
|
|
860
|
-
defaultMessage(
|
|
787
|
+
defaultMessage(_args) {
|
|
861
788
|
return "invalid parameter ($property).";
|
|
862
789
|
}
|
|
863
790
|
}
|
|
@@ -881,10 +808,10 @@ function IsPlateNumber(validationOptions) {
|
|
|
881
808
|
propertyName,
|
|
882
809
|
options: validationOptions,
|
|
883
810
|
validator: {
|
|
884
|
-
validate(value,
|
|
811
|
+
validate(value, _args) {
|
|
885
812
|
return plateNumber(value);
|
|
886
813
|
},
|
|
887
|
-
defaultMessage(
|
|
814
|
+
defaultMessage(_args) {
|
|
888
815
|
return "invalid parameter ($property).";
|
|
889
816
|
}
|
|
890
817
|
}
|
|
@@ -907,10 +834,10 @@ function IsNotEmpty(validationOptions) {
|
|
|
907
834
|
propertyName,
|
|
908
835
|
options: validationOptions,
|
|
909
836
|
validator: {
|
|
910
|
-
validate(value,
|
|
837
|
+
validate(value, _args) {
|
|
911
838
|
return !helper.isEmpty(value);
|
|
912
839
|
},
|
|
913
|
-
defaultMessage(
|
|
840
|
+
defaultMessage(_args) {
|
|
914
841
|
return "invalid parameter ($property).";
|
|
915
842
|
}
|
|
916
843
|
}
|
|
@@ -934,10 +861,10 @@ function Equals(comparison, validationOptions) {
|
|
|
934
861
|
propertyName,
|
|
935
862
|
options: validationOptions,
|
|
936
863
|
validator: {
|
|
937
|
-
validate(value,
|
|
864
|
+
validate(value, _args) {
|
|
938
865
|
return equals(value, comparison);
|
|
939
866
|
},
|
|
940
|
-
defaultMessage(
|
|
867
|
+
defaultMessage(_args) {
|
|
941
868
|
return `invalid parameter, ($property) must be equals ${comparison}.`;
|
|
942
869
|
}
|
|
943
870
|
}
|
|
@@ -961,10 +888,10 @@ function NotEquals(comparison, validationOptions) {
|
|
|
961
888
|
propertyName,
|
|
962
889
|
options: validationOptions,
|
|
963
890
|
validator: {
|
|
964
|
-
validate(value,
|
|
891
|
+
validate(value, _args) {
|
|
965
892
|
return notEquals(value, comparison);
|
|
966
893
|
},
|
|
967
|
-
defaultMessage(
|
|
894
|
+
defaultMessage(_args) {
|
|
968
895
|
return `invalid parameter, ($property) must be not equals ${comparison}.`;
|
|
969
896
|
}
|
|
970
897
|
}
|
|
@@ -988,11 +915,11 @@ function Contains(seed, validationOptions) {
|
|
|
988
915
|
propertyName,
|
|
989
916
|
options: validationOptions,
|
|
990
917
|
validator: {
|
|
991
|
-
validate(value,
|
|
918
|
+
validate(value, _args) {
|
|
992
919
|
return contains(value, seed);
|
|
993
920
|
// return typeof value === "string" && (value.indexOf(seed) > -1);
|
|
994
921
|
},
|
|
995
|
-
defaultMessage(
|
|
922
|
+
defaultMessage(_args) {
|
|
996
923
|
return `invalid parameter, ($property) must be contains ${seed}.`;
|
|
997
924
|
}
|
|
998
925
|
}
|
|
@@ -1016,10 +943,10 @@ function IsIn(possibleValues, validationOptions) {
|
|
|
1016
943
|
propertyName,
|
|
1017
944
|
options: validationOptions,
|
|
1018
945
|
validator: {
|
|
1019
|
-
validate(value,
|
|
946
|
+
validate(value, _args) {
|
|
1020
947
|
return isIn(value, possibleValues);
|
|
1021
948
|
},
|
|
1022
|
-
defaultMessage(
|
|
949
|
+
defaultMessage(_args) {
|
|
1023
950
|
return `invalid parameter ($property).`;
|
|
1024
951
|
}
|
|
1025
952
|
}
|
|
@@ -1043,10 +970,10 @@ function IsNotIn(possibleValues, validationOptions) {
|
|
|
1043
970
|
propertyName,
|
|
1044
971
|
options: validationOptions,
|
|
1045
972
|
validator: {
|
|
1046
|
-
validate(value,
|
|
973
|
+
validate(value, _args) {
|
|
1047
974
|
return isNotIn(value, possibleValues);
|
|
1048
975
|
},
|
|
1049
|
-
defaultMessage(
|
|
976
|
+
defaultMessage(_args) {
|
|
1050
977
|
return `invalid parameter ($property).`;
|
|
1051
978
|
}
|
|
1052
979
|
}
|
|
@@ -1069,10 +996,10 @@ function IsDate(validationOptions) {
|
|
|
1069
996
|
propertyName,
|
|
1070
997
|
options: validationOptions,
|
|
1071
998
|
validator: {
|
|
1072
|
-
validate(value,
|
|
999
|
+
validate(value, _args) {
|
|
1073
1000
|
return isDate(value);
|
|
1074
1001
|
},
|
|
1075
|
-
defaultMessage(
|
|
1002
|
+
defaultMessage(_args) {
|
|
1076
1003
|
return `invalid parameter ($property).`;
|
|
1077
1004
|
}
|
|
1078
1005
|
}
|
|
@@ -1096,10 +1023,10 @@ function Gt(min, validationOptions) {
|
|
|
1096
1023
|
propertyName,
|
|
1097
1024
|
options: validationOptions,
|
|
1098
1025
|
validator: {
|
|
1099
|
-
validate(value,
|
|
1026
|
+
validate(value, _args) {
|
|
1100
1027
|
return helper.toNumber(value) > min;
|
|
1101
1028
|
},
|
|
1102
|
-
defaultMessage(
|
|
1029
|
+
defaultMessage(_args) {
|
|
1103
1030
|
return `invalid parameter ($property).`;
|
|
1104
1031
|
}
|
|
1105
1032
|
}
|
|
@@ -1123,10 +1050,10 @@ function Lt(max, validationOptions) {
|
|
|
1123
1050
|
propertyName,
|
|
1124
1051
|
options: validationOptions,
|
|
1125
1052
|
validator: {
|
|
1126
|
-
validate(value,
|
|
1053
|
+
validate(value, _args) {
|
|
1127
1054
|
return helper.toNumber(value) < max;
|
|
1128
1055
|
},
|
|
1129
|
-
defaultMessage(
|
|
1056
|
+
defaultMessage(_args) {
|
|
1130
1057
|
return `invalid parameter ($property).`;
|
|
1131
1058
|
}
|
|
1132
1059
|
}
|
|
@@ -1150,10 +1077,10 @@ function Gte(min, validationOptions) {
|
|
|
1150
1077
|
propertyName,
|
|
1151
1078
|
options: validationOptions,
|
|
1152
1079
|
validator: {
|
|
1153
|
-
validate(value,
|
|
1080
|
+
validate(value, _args) {
|
|
1154
1081
|
return helper.toNumber(value) >= min;
|
|
1155
1082
|
},
|
|
1156
|
-
defaultMessage(
|
|
1083
|
+
defaultMessage(_args) {
|
|
1157
1084
|
return `invalid parameter ($property).`;
|
|
1158
1085
|
}
|
|
1159
1086
|
}
|
|
@@ -1177,10 +1104,10 @@ function Lte(max, validationOptions) {
|
|
|
1177
1104
|
propertyName,
|
|
1178
1105
|
options: validationOptions,
|
|
1179
1106
|
validator: {
|
|
1180
|
-
validate(value,
|
|
1107
|
+
validate(value, _args) {
|
|
1181
1108
|
return helper.toNumber(value) <= max;
|
|
1182
1109
|
},
|
|
1183
|
-
defaultMessage(
|
|
1110
|
+
defaultMessage(_args) {
|
|
1184
1111
|
return `invalid parameter ($property).`;
|
|
1185
1112
|
}
|
|
1186
1113
|
}
|
|
@@ -1206,10 +1133,10 @@ function Length(min, max, validationOptions) {
|
|
|
1206
1133
|
propertyName,
|
|
1207
1134
|
options: validationOptions,
|
|
1208
1135
|
validator: {
|
|
1209
|
-
validate(value,
|
|
1136
|
+
validate(value, _args) {
|
|
1210
1137
|
return length(value, min, max);
|
|
1211
1138
|
},
|
|
1212
|
-
defaultMessage(
|
|
1139
|
+
defaultMessage(_args) {
|
|
1213
1140
|
return `invalid parameter ($property).`;
|
|
1214
1141
|
}
|
|
1215
1142
|
}
|
|
@@ -1233,10 +1160,10 @@ function IsEmail(options, validationOptions) {
|
|
|
1233
1160
|
propertyName,
|
|
1234
1161
|
options: validationOptions,
|
|
1235
1162
|
validator: {
|
|
1236
|
-
validate(value,
|
|
1163
|
+
validate(value, _args) {
|
|
1237
1164
|
return isEmail(value);
|
|
1238
1165
|
},
|
|
1239
|
-
defaultMessage(
|
|
1166
|
+
defaultMessage(_args) {
|
|
1240
1167
|
return `invalid parameter ($property).`;
|
|
1241
1168
|
}
|
|
1242
1169
|
}
|
|
@@ -1260,10 +1187,10 @@ function IsIP(version, validationOptions) {
|
|
|
1260
1187
|
propertyName,
|
|
1261
1188
|
options: validationOptions,
|
|
1262
1189
|
validator: {
|
|
1263
|
-
validate(value,
|
|
1190
|
+
validate(value, _args) {
|
|
1264
1191
|
return isIP(value, version);
|
|
1265
1192
|
},
|
|
1266
|
-
defaultMessage(
|
|
1193
|
+
defaultMessage(_args) {
|
|
1267
1194
|
return `invalid parameter ($property).`;
|
|
1268
1195
|
}
|
|
1269
1196
|
}
|
|
@@ -1290,10 +1217,10 @@ function IsPhoneNumber(region, validationOptions) {
|
|
|
1290
1217
|
propertyName,
|
|
1291
1218
|
options: validationOptions,
|
|
1292
1219
|
validator: {
|
|
1293
|
-
validate(value,
|
|
1220
|
+
validate(value, _args) {
|
|
1294
1221
|
return isPhoneNumber(value, region);
|
|
1295
1222
|
},
|
|
1296
|
-
defaultMessage(
|
|
1223
|
+
defaultMessage(_args) {
|
|
1297
1224
|
return `invalid parameter ($property).`;
|
|
1298
1225
|
}
|
|
1299
1226
|
}
|
|
@@ -1317,10 +1244,10 @@ function IsUrl(options, validationOptions) {
|
|
|
1317
1244
|
propertyName,
|
|
1318
1245
|
options: validationOptions,
|
|
1319
1246
|
validator: {
|
|
1320
|
-
validate(value,
|
|
1247
|
+
validate(value, _args) {
|
|
1321
1248
|
return isURL(value, options);
|
|
1322
1249
|
},
|
|
1323
|
-
defaultMessage(
|
|
1250
|
+
defaultMessage(_args) {
|
|
1324
1251
|
return `invalid parameter ($property).`;
|
|
1325
1252
|
}
|
|
1326
1253
|
}
|
|
@@ -1345,10 +1272,10 @@ function IsHash(algorithm, validationOptions) {
|
|
|
1345
1272
|
propertyName,
|
|
1346
1273
|
options: validationOptions,
|
|
1347
1274
|
validator: {
|
|
1348
|
-
validate(value,
|
|
1275
|
+
validate(value, _args) {
|
|
1349
1276
|
return isHash(value, algorithm);
|
|
1350
1277
|
},
|
|
1351
|
-
defaultMessage(
|
|
1278
|
+
defaultMessage(_args) {
|
|
1352
1279
|
return `invalid parameter, ($property) must be is an ${algorithm} Hash string.`;
|
|
1353
1280
|
}
|
|
1354
1281
|
}
|
|
@@ -1370,10 +1297,10 @@ function CheckFunc(func, validationOptions) {
|
|
|
1370
1297
|
propertyName,
|
|
1371
1298
|
options: validationOptions,
|
|
1372
1299
|
validator: {
|
|
1373
|
-
validate(value,
|
|
1300
|
+
validate(value, _args) {
|
|
1374
1301
|
return func(value);
|
|
1375
1302
|
},
|
|
1376
|
-
defaultMessage(
|
|
1303
|
+
defaultMessage(_args) {
|
|
1377
1304
|
return `invalid parameter ($property).`;
|
|
1378
1305
|
}
|
|
1379
1306
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,89 +1,91 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "koatty_validation",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "Validation Util for Koatty and ThinkORM.",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
-
"build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
|
|
8
|
-
"build:js": "del-cli --force dist && npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
9
|
-
"build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
|
|
10
|
-
"build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
|
|
11
|
-
"eslint": "eslint --ext .ts,.js ./",
|
|
12
|
-
"lock": "npm i --package-lock-only",
|
|
13
|
-
"prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
|
|
14
|
-
"prerelease": "npm test && npm run build",
|
|
15
|
-
"release": "standard-version",
|
|
16
|
-
"release:pre": "npm run release -- --prerelease",
|
|
17
|
-
"release:major": "npm run release -- --release-as major",
|
|
18
|
-
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
-
"test": "npm run eslint && jest --passWithNoTests"
|
|
20
|
-
},
|
|
21
|
-
"main": "./dist/index.js",
|
|
22
|
-
"exports": {
|
|
23
|
-
"require": "./dist/index.js",
|
|
24
|
-
"import": "./dist/index.mjs"
|
|
25
|
-
},
|
|
26
|
-
"repository": {
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/koatty/koatty_validation.git"
|
|
29
|
-
},
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">10.0.0"
|
|
32
|
-
},
|
|
33
|
-
"author": {
|
|
34
|
-
"name": "richenlin",
|
|
35
|
-
"email": "richenlin@gmail.com"
|
|
36
|
-
},
|
|
37
|
-
"license": "BSD-3-Clause",
|
|
38
|
-
"bugs": {
|
|
39
|
-
"url": "https://github.com/koatty/koatty_validation/issues"
|
|
40
|
-
},
|
|
41
|
-
"homepage": "https://github.com/koatty/koatty_validation",
|
|
42
|
-
"maintainers": [
|
|
43
|
-
{
|
|
44
|
-
"name": "richenlin",
|
|
45
|
-
"email": "richenlin@gmail.com"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@commitlint/cli": "^
|
|
50
|
-
"@commitlint/config-conventional": "^
|
|
51
|
-
"@microsoft/api-documenter": "^7.x.x",
|
|
52
|
-
"@microsoft/api-extractor": "^7.x.x",
|
|
53
|
-
"@rollup/plugin-
|
|
54
|
-
"@
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/
|
|
58
|
-
"@
|
|
59
|
-
"@typescript-eslint/
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"eslint
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"jest
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"rollup
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"ts-
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "koatty_validation",
|
|
3
|
+
"version": "1.3.4",
|
|
4
|
+
"description": "Validation Util for Koatty and ThinkORM.",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "npm run build:js && npm run build:dts && npm run build:doc && npm run build:cp",
|
|
7
|
+
"build:cp": "node scripts/postBuild && copyfiles package.json LICENSE README.md dist/",
|
|
8
|
+
"build:js": "del-cli --force dist && npx rollup --bundleConfigAsCjs -c .rollup.config.js",
|
|
9
|
+
"build:doc": "del-cli --force docs/api && npx api-documenter markdown --input temp --output docs/api",
|
|
10
|
+
"build:dts": "del-cli --force temp && npx tsc && npx api-extractor run --local --verbose",
|
|
11
|
+
"eslint": "eslint --ext .ts,.js ./",
|
|
12
|
+
"lock": "npm i --package-lock-only",
|
|
13
|
+
"prepublishOnly": "npm test && npm run build && git push --follow-tags origin",
|
|
14
|
+
"prerelease": "npm test && npm run build",
|
|
15
|
+
"release": "standard-version",
|
|
16
|
+
"release:pre": "npm run release -- --prerelease",
|
|
17
|
+
"release:major": "npm run release -- --release-as major",
|
|
18
|
+
"release:minor": "npm run release -- --release-as minor",
|
|
19
|
+
"test": "npm run eslint && jest --passWithNoTests"
|
|
20
|
+
},
|
|
21
|
+
"main": "./dist/index.js",
|
|
22
|
+
"exports": {
|
|
23
|
+
"require": "./dist/index.js",
|
|
24
|
+
"import": "./dist/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/koatty/koatty_validation.git"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">10.0.0"
|
|
32
|
+
},
|
|
33
|
+
"author": {
|
|
34
|
+
"name": "richenlin",
|
|
35
|
+
"email": "richenlin@gmail.com"
|
|
36
|
+
},
|
|
37
|
+
"license": "BSD-3-Clause",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/koatty/koatty_validation/issues"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://github.com/koatty/koatty_validation",
|
|
42
|
+
"maintainers": [
|
|
43
|
+
{
|
|
44
|
+
"name": "richenlin",
|
|
45
|
+
"email": "richenlin@gmail.com"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@commitlint/cli": "^19.x.x",
|
|
50
|
+
"@commitlint/config-conventional": "^19.x.x",
|
|
51
|
+
"@microsoft/api-documenter": "^7.x.x",
|
|
52
|
+
"@microsoft/api-extractor": "^7.x.x",
|
|
53
|
+
"@rollup/plugin-commonjs": "^28.0.1",
|
|
54
|
+
"@rollup/plugin-json": "^6.x.x",
|
|
55
|
+
"@types/jest": "^29.x.x",
|
|
56
|
+
"@types/koa": "^2.x.x",
|
|
57
|
+
"@types/node": "^22.x.x",
|
|
58
|
+
"@types/validator": "^13.x.x",
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^8.x.x",
|
|
60
|
+
"@typescript-eslint/parser": "^8.x.x",
|
|
61
|
+
"conventional-changelog-cli": "^5.x.x",
|
|
62
|
+
"copyfiles": "^2.x.x",
|
|
63
|
+
"del-cli": "^6.x.x",
|
|
64
|
+
"eslint": "^8.57.x",
|
|
65
|
+
"eslint-plugin-jest": "^28.x.x",
|
|
66
|
+
"husky": "^4.x.x",
|
|
67
|
+
"jest": "^29.x.x",
|
|
68
|
+
"jest-html-reporters": "^3.x.x",
|
|
69
|
+
"libphonenumber-js": "^1.x.x",
|
|
70
|
+
"reflect-metadata": "^0.x.x",
|
|
71
|
+
"rollup": "^4.x.x",
|
|
72
|
+
"rollup-plugin-typescript2": "^0.x.x",
|
|
73
|
+
"standard-version": "^9.x.x",
|
|
74
|
+
"ts-jest": "^29.x.x",
|
|
75
|
+
"ts-node": "^10.x.x",
|
|
76
|
+
"tslib": "^2.x.x",
|
|
77
|
+
"typescript": "^5.x.x"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"class-validator": "^0.14.1",
|
|
81
|
+
"koatty_container": "^1.x.x",
|
|
82
|
+
"koatty_lib": "^1.x.x",
|
|
83
|
+
"koatty_logger": "^2.x.x",
|
|
84
|
+
"koatty_validation": "file:"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"koatty_container": "^1.x.x",
|
|
88
|
+
"koatty_lib": "^1.x.x",
|
|
89
|
+
"koatty_logger": "^2.x.x"
|
|
90
|
+
}
|
|
91
|
+
}
|