@nathapp/nestjs-common 1.0.1-rc.9 → 1.0.2
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/README.md +12 -16
- package/dist/config/index.d.ts +4 -1
- package/dist/config/index.js +7 -1
- package/dist/config/index.js.map +1 -0
- package/dist/config/server-security.config.d.ts +19 -0
- package/dist/config/server-security.config.js +74 -0
- package/dist/config/server-security.config.js.map +1 -0
- package/dist/config/utils/joi-util.js +1 -0
- package/dist/config/utils/joi-util.js.map +1 -0
- package/dist/config/utils/validate-util.d.ts +1 -0
- package/dist/config/utils/validate-util.js +3 -2
- package/dist/config/utils/validate-util.js.map +1 -0
- package/dist/constant/common-constant.d.ts +1 -0
- package/dist/constant/common-constant.js +5 -0
- package/dist/constant/common-constant.js.map +1 -0
- package/dist/constant/index.d.ts +2 -0
- package/dist/constant/index.js +6 -0
- package/dist/constant/index.js.map +1 -0
- package/dist/decorator/client-info.decorator.d.ts +10 -1
- package/dist/decorator/client-info.decorator.js +7 -6
- package/dist/decorator/client-info.decorator.js.map +1 -0
- package/dist/decorator/index.d.ts +2 -2
- package/dist/decorator/index.js +3 -2
- package/dist/decorator/index.js.map +1 -0
- package/dist/decorator/real-ip.decorator.js +3 -2
- package/dist/decorator/real-ip.decorator.js.map +1 -0
- package/dist/exception/app-exception-code.enum.d.ts +7 -2
- package/dist/exception/app-exception-code.enum.js +8 -2
- package/dist/exception/app-exception-code.enum.js.map +1 -0
- package/dist/exception/app-exception.filter.js +3 -2
- package/dist/exception/app-exception.filter.js.map +1 -0
- package/dist/exception/app.exception.d.ts +3 -1
- package/dist/exception/app.exception.js +7 -2
- package/dist/exception/app.exception.js.map +1 -0
- package/dist/exception/captcha.exception.d.ts +4 -0
- package/dist/exception/captcha.exception.js +12 -0
- package/dist/exception/captcha.exception.js.map +1 -0
- package/dist/exception/default-i18n-validation-exception.filter.d.ts +11 -0
- package/dist/exception/default-i18n-validation-exception.filter.js +43 -0
- package/dist/exception/default-i18n-validation-exception.filter.js.map +1 -0
- package/dist/exception/global-exception.filter.d.ts +18 -0
- package/dist/exception/global-exception.filter.js +65 -5
- package/dist/exception/global-exception.filter.js.map +1 -0
- package/dist/exception/i18n-validation-exception.filter.d.ts +13 -0
- package/dist/exception/i18n-validation-exception.filter.js +88 -0
- package/dist/exception/i18n-validation-exception.filter.js.map +1 -0
- package/dist/exception/index.d.ts +6 -1
- package/dist/exception/index.js +14 -1
- package/dist/exception/index.js.map +1 -0
- package/dist/exception/micro-service.exception.d.ts +6 -0
- package/dist/exception/micro-service.exception.js +16 -0
- package/dist/exception/micro-service.exception.js.map +1 -0
- package/dist/exception/two-factor.exception.d.ts +7 -0
- package/dist/exception/two-factor.exception.js +18 -0
- package/dist/exception/two-factor.exception.js.map +1 -0
- package/dist/exception/user-not-found.exception.js +1 -0
- package/dist/exception/user-not-found.exception.js.map +1 -0
- package/dist/http/index.d.ts +3 -0
- package/dist/http/index.js +3 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/request.d.ts +3 -0
- package/dist/http/request.js +3 -0
- package/dist/http/request.js.map +1 -0
- package/dist/http/response.d.ts +3 -0
- package/dist/http/response.js +3 -0
- package/dist/http/response.js.map +1 -0
- package/dist/i18n/i18n-core.module.js +4 -2
- package/dist/i18n/i18n-core.module.js.map +1 -0
- package/dist/i18n/i18n.constants.js +1 -0
- package/dist/i18n/i18n.constants.js.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -0
- package/dist/interceptor/index.d.ts +2 -0
- package/dist/interceptor/index.js +6 -0
- package/dist/interceptor/index.js.map +1 -0
- package/dist/interceptor/serializable.interceptor.d.ts +19 -0
- package/dist/interceptor/serializable.interceptor.js +106 -0
- package/dist/interceptor/serializable.interceptor.js.map +1 -0
- package/dist/ip/index.d.ts +2 -0
- package/dist/ip/index.js +7 -0
- package/dist/ip/index.js.map +1 -0
- package/dist/ip/is.d.ts +17 -0
- package/dist/ip/is.js +37 -0
- package/dist/ip/is.js.map +1 -0
- package/dist/ip/request-ip.d.ts +8 -0
- package/dist/ip/request-ip.js +180 -0
- package/dist/ip/request-ip.js.map +1 -0
- package/dist/logging/empty-logger.d.ts +8 -0
- package/dist/logging/empty-logger.js +12 -0
- package/dist/logging/empty-logger.js.map +1 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.js +8 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger-utils.d.ts +2 -0
- package/dist/logging/logger-utils.js +11 -0
- package/dist/logging/logger-utils.js.map +1 -0
- package/dist/middleware/index.d.ts +4 -1
- package/dist/middleware/index.js +12 -1
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/json-body.middleware.js +3 -2
- package/dist/middleware/json-body.middleware.js.map +1 -0
- package/dist/middleware/log.provider.d.ts +34 -0
- package/dist/middleware/log.provider.js +143 -0
- package/dist/middleware/log.provider.js.map +1 -0
- package/dist/middleware/logger-option.factory.d.ts +15 -0
- package/dist/middleware/logger-option.factory.js +63 -0
- package/dist/middleware/logger-option.factory.js.map +1 -0
- package/dist/middleware/logger.middleware.d.ts +8 -0
- package/dist/middleware/logger.middleware.js +92 -0
- package/dist/middleware/logger.middleware.js.map +1 -0
- package/dist/middleware/raw-body.middleware.js +3 -2
- package/dist/middleware/raw-body.middleware.js.map +1 -0
- package/dist/module/configurable-module-cls.interface.d.ts +5 -0
- package/dist/module/configurable-module-cls.interface.js +3 -0
- package/dist/module/configurable-module-cls.interface.js.map +1 -0
- package/dist/module/configurable-module-host.interface.d.ts +5 -0
- package/dist/module/configurable-module-host.interface.js +3 -0
- package/dist/module/configurable-module-host.interface.js.map +1 -0
- package/dist/module/configurable-module.builder.d.ts +26 -0
- package/dist/module/configurable-module.builder.js +191 -0
- package/dist/module/configurable-module.builder.js.map +1 -0
- package/dist/module/index.d.ts +5 -0
- package/dist/module/index.js +10 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/module.interface.d.ts +8 -0
- package/dist/module/module.interface.js +8 -0
- package/dist/module/module.interface.js.map +1 -0
- package/dist/serialize/index.d.ts +4 -2
- package/dist/serialize/index.js +21 -3
- package/dist/serialize/index.js.map +1 -0
- package/dist/serialize/json-response.d.ts +1 -1
- package/dist/serialize/json-response.js +2 -1
- package/dist/serialize/json-response.js.map +1 -0
- package/dist/serialize/localize.string.d.ts +6 -0
- package/dist/serialize/localize.string.js +35 -1
- package/dist/serialize/localize.string.js.map +1 -0
- package/dist/serialize/serializable.d.ts +2 -0
- package/dist/serialize/serializable.js +7 -0
- package/dist/serialize/serializable.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/package-utils.d.ts +2 -0
- package/dist/utils/package-utils.js +18 -0
- package/dist/utils/package-utils.js.map +1 -0
- package/dist/validation/i18n-validation.constraint.d.ts +9 -0
- package/dist/validation/i18n-validation.constraint.js +13 -0
- package/dist/validation/i18n-validation.constraint.js.map +1 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +20 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/match.constraint.d.ts +8 -0
- package/dist/validation/match.constraint.js +39 -0
- package/dist/validation/match.constraint.js.map +1 -0
- package/dist/validation/validation.d.ts +28 -0
- package/dist/validation/validation.js +77 -0
- package/dist/validation/validation.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +16 -5
- package/package.json +25 -23
- package/.eslintrc.js +0 -24
- package/lib/config/README.md +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/module/index.ts"],"names":[],"mappings":";;;AAEA,+EAA+J;AAK7J,0GALO,uDAAyB,OAKP;AACzB,wGANoE,qDAAuB,OAMpE;AACvB,yGAP6F,sDAAwB,OAO7F;AAN1B,yDAAkF;AAUhF,uGAVO,yCAAsB,OAUP"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleMetadata, Type } from "@nestjs/common";
|
|
2
|
+
export interface ProviderAsyncOptions<T = any> extends Pick<ModuleMetadata, 'imports'> {
|
|
3
|
+
useExisting?: Type<T>;
|
|
4
|
+
useClass?: Type<T>;
|
|
5
|
+
useFactory?: (...args: any[]) => T | Promise<T>;
|
|
6
|
+
inject?: any[];
|
|
7
|
+
}
|
|
8
|
+
export declare const isProviderAsyncOptions: (options: any) => options is ProviderAsyncOptions;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isProviderAsyncOptions = void 0;
|
|
4
|
+
const isProviderAsyncOptions = (options) => {
|
|
5
|
+
return 'useExisting' in options || 'useClass' in options || 'useFactory' in options;
|
|
6
|
+
};
|
|
7
|
+
exports.isProviderAsyncOptions = isProviderAsyncOptions;
|
|
8
|
+
//# sourceMappingURL=module.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.interface.js","sourceRoot":"","sources":["../../lib/module/module.interface.ts"],"names":[],"mappings":";;;AAWO,MAAM,sBAAsB,GAAG,CAAC,OAAY,EAAmC,EAAE;IACtF,OAAO,aAAa,IAAI,OAAO,IAAI,UAAU,IAAI,OAAO,IAAI,YAAY,IAAI,OAAO,CAAC;AACtF,CAAC,CAAA;AAFY,QAAA,sBAAsB,0BAElC"}
|
package/dist/serialize/index.js
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "
|
|
17
|
+
exports.Serializable = exports.JsonResponse = void 0;
|
|
18
|
+
const json_response_1 = require("./json-response");
|
|
19
|
+
Object.defineProperty(exports, "JsonResponse", { enumerable: true, get: function () { return json_response_1.JsonResponse; } });
|
|
20
|
+
const serializable_1 = require("./serializable");
|
|
21
|
+
Object.defineProperty(exports, "Serializable", { enumerable: true, get: function () { return serializable_1.Serializable; } });
|
|
22
|
+
__exportStar(require("./localize.string"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/serialize/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAA+C;AAGtC,6FAHA,4BAAY,OAGA;AAFrB,iDAA8C;AAEvB,6FAFd,2BAAY,OAEc;AACnC,oDAAmC"}
|
|
@@ -5,6 +5,6 @@ export declare class JsonResponse<T> extends JResponse {
|
|
|
5
5
|
data: T;
|
|
6
6
|
message?: string;
|
|
7
7
|
constructor(ret: number, data: any, message?: string);
|
|
8
|
-
static Ok<T>(data?: T, cls?: ClassConstructor<T>): JsonResponse<T>;
|
|
8
|
+
static Ok<T>(data?: T | T[], cls?: ClassConstructor<T>): JsonResponse<T | T[]>;
|
|
9
9
|
static Error<T>(errcode: number, message: string): JsonResponse<T>;
|
|
10
10
|
}
|
|
@@ -18,7 +18,7 @@ class JsonResponse extends common_1.JsonResponse {
|
|
|
18
18
|
else {
|
|
19
19
|
responseData = data;
|
|
20
20
|
}
|
|
21
|
-
const response = new JsonResponse(0, responseData,
|
|
21
|
+
const response = new JsonResponse(0, responseData, undefined);
|
|
22
22
|
return response;
|
|
23
23
|
}
|
|
24
24
|
static Error(errcode, message) {
|
|
@@ -28,3 +28,4 @@ class JsonResponse extends common_1.JsonResponse {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.JsonResponse = JsonResponse;
|
|
31
|
+
//# sourceMappingURL=json-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-response.js","sourceRoot":"","sources":["../../lib/serialize/json-response.ts"],"names":[],"mappings":";;;AAAA,yDAAsE;AACtE,4CAA4D;AAK5D,MAAa,YAAgB,SAAQ,qBAAS;IAQ5C,YAAY,GAAW,EAAE,IAAS,EAAE,OAAgB;QAClD,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAGM,MAAM,CAAC,EAAE,CAAI,IAAc,EAAE,GAAyB;QAC3D,IAAI,YAAY,CAAC;QAEjB,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;YAChB,YAAY,GAAG,IAAA,mCAAe,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAI,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;QACjE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAI,OAAe,EAAE,OAAe;QACrD,MAAM,QAAQ,GAAG,IAAI,YAAY,CAAI,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC,IAAI,CAAC;QACrB,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAjCD,oCAiCC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export declare class LocaleString {
|
|
2
2
|
[key: string]: string;
|
|
3
3
|
}
|
|
4
|
+
export declare class LocaleObject<T = any> {
|
|
5
|
+
[key: string]: T;
|
|
6
|
+
}
|
|
7
|
+
export declare const remapLocaleObject: <S, T>(source: LocaleObject<S>, map: (source: S) => T) => LocaleObject<T>;
|
|
8
|
+
export declare const parseLocaleString: (source: string, defaultValue?: string, defaultLocale?: string) => LocaleString;
|
|
9
|
+
export declare const parseLocaleObject: <T>(source: string, defaultValue?: T, defaultLocale?: string) => LocaleObject<T>;
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LocaleString = void 0;
|
|
3
|
+
exports.parseLocaleObject = exports.parseLocaleString = exports.remapLocaleObject = exports.LocaleObject = exports.LocaleString = void 0;
|
|
4
4
|
class LocaleString {
|
|
5
5
|
}
|
|
6
6
|
exports.LocaleString = LocaleString;
|
|
7
|
+
class LocaleObject {
|
|
8
|
+
}
|
|
9
|
+
exports.LocaleObject = LocaleObject;
|
|
10
|
+
const remapLocaleObject = (source, map) => {
|
|
11
|
+
const result = new LocaleObject();
|
|
12
|
+
Object.keys(source).forEach((key) => {
|
|
13
|
+
result[key] = map(source[key]);
|
|
14
|
+
});
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
exports.remapLocaleObject = remapLocaleObject;
|
|
18
|
+
const parseLocaleString = (source, defaultValue = '', defaultLocale = 'en_US') => {
|
|
19
|
+
let result = new LocaleString();
|
|
20
|
+
try {
|
|
21
|
+
result = JSON.parse(source);
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
result[defaultLocale] = defaultValue;
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
exports.parseLocaleString = parseLocaleString;
|
|
29
|
+
const parseLocaleObject = (source, defaultValue = {}, defaultLocale = 'en_US') => {
|
|
30
|
+
let result = new LocaleObject();
|
|
31
|
+
try {
|
|
32
|
+
result = JSON.parse(source);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
result[defaultLocale] = defaultValue;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
exports.parseLocaleObject = parseLocaleObject;
|
|
40
|
+
//# sourceMappingURL=localize.string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localize.string.js","sourceRoot":"","sources":["../../lib/serialize/localize.string.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAY;CAExB;AAFD,oCAEC;AAED,MAAa,YAAY;CAExB;AAFD,oCAEC;AAEM,MAAM,iBAAiB,GAAG,CAC/B,MAAuB,EACvB,GAAqB,EACJ,EAAE;IACnB,MAAM,MAAM,GAAG,IAAI,YAAY,EAAK,CAAC;IACrC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QAClC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAVW,QAAA,iBAAiB,qBAU5B;AAKK,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,eAAuB,EAAE,EAAE,aAAa,GAAG,OAAO,EAAgB,EAAE;IACpH,IAAI,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA;AAXY,QAAA,iBAAiB,qBAW7B;AAKM,MAAM,iBAAiB,GAAG,CAAI,MAAc,EAAE,eAAkB,EAAO,EAAE,aAAa,GAAG,OAAO,EAAmB,EAAE;IAC1H,IAAI,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;IAEhC,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,EAAE,CAAC;QACT,MAAM,CAAC,aAAa,CAAC,GAAG,YAAY,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAA;AAXY,QAAA,iBAAiB,qBAW7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable.js","sourceRoot":"","sources":["../../lib/serialize/serializable.ts"],"names":[],"mappings":";;;AAKA,MAAsB,YAAY;CAEjC;AAFD,oCAEC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadPackage = exports.isPackageInstalled = void 0;
|
|
4
|
+
const package_utils_1 = require("./package-utils");
|
|
5
|
+
Object.defineProperty(exports, "isPackageInstalled", { enumerable: true, get: function () { return package_utils_1.isPackageInstalled; } });
|
|
6
|
+
Object.defineProperty(exports, "loadPackage", { enumerable: true, get: function () { return package_utils_1.loadPackage; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":";;;AAAA,mDAAkE;AAGhE,mGAHO,kCAAkB,OAGP;AAClB,4FAJ2B,2BAAW,OAI3B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadPackage = exports.isPackageInstalled = void 0;
|
|
4
|
+
const isPackageInstalled = (packageName) => {
|
|
5
|
+
try {
|
|
6
|
+
require.resolve(packageName);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.isPackageInstalled = isPackageInstalled;
|
|
14
|
+
const loadPackage = (packageName) => {
|
|
15
|
+
return require(packageName);
|
|
16
|
+
};
|
|
17
|
+
exports.loadPackage = loadPackage;
|
|
18
|
+
//# sourceMappingURL=package-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-utils.js","sourceRoot":"","sources":["../../lib/utils/package-utils.ts"],"names":[],"mappings":";;;AAAO,MAAM,kBAAkB,GAAG,CAAC,WAAmB,EAAC,EAAE;IACvD,IAAI,CAAC;QACH,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAM,CAAC,EAAE,CAAC;QACV,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAA;AAPY,QAAA,kBAAkB,sBAO9B;AAEM,MAAM,WAAW,GAAG,CAAC,WAAmB,EAAE,EAAE;IACjD,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC;AAC9B,CAAC,CAAA;AAFY,QAAA,WAAW,eAEvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValidationArguments, ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
+
import { I18nService } from 'nestjs-i18n';
|
|
3
|
+
export declare abstract class BaseI18nValidatorConstraint implements ValidatorConstraintInterface {
|
|
4
|
+
private readonly i18nService;
|
|
5
|
+
constructor(i18nService: I18nService);
|
|
6
|
+
abstract validate(value: any, args: ValidationArguments): Promise<boolean> | boolean;
|
|
7
|
+
abstract defaultMessage?(validationArguments?: ValidationArguments): string;
|
|
8
|
+
translate(key: string, args?: any, prefix?: string): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseI18nValidatorConstraint = void 0;
|
|
4
|
+
class BaseI18nValidatorConstraint {
|
|
5
|
+
constructor(i18nService) {
|
|
6
|
+
this.i18nService = i18nService;
|
|
7
|
+
}
|
|
8
|
+
translate(key, args, prefix = 'exception') {
|
|
9
|
+
return this.i18nService.t(`${prefix}.${key}`, args);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.BaseI18nValidatorConstraint = BaseI18nValidatorConstraint;
|
|
13
|
+
//# sourceMappingURL=i18n-validation.constraint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n-validation.constraint.js","sourceRoot":"","sources":["../../lib/validation/i18n-validation.constraint.ts"],"names":[],"mappings":";;;AAMA,MAAsB,2BAA2B;IAG/C,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAMzD,SAAS,CAAC,GAAW,EAAE,IAAU,EAAE,MAAM,GAAG,WAAW;QACrD,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAZD,kEAYC"}
|
package/dist/validation/index.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./match.constraint"), exports);
|
|
18
|
+
__exportStar(require("./i18n-validation.constraint"), exports);
|
|
19
|
+
__exportStar(require("./validation"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/validation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+DAA6C;AAC7C,+CAA6B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ValidationArguments, ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
|
|
2
|
+
import { I18nValidationOptions } from './validation';
|
|
3
|
+
export declare const MatchWithI18n: <T>(property: keyof T, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => (object: any, propertyName: string) => void;
|
|
4
|
+
export declare const Match: <T>(property: keyof T, options?: ValidationOptions) => (object: any, propertyName: string) => void;
|
|
5
|
+
export declare class MatchConstraint implements ValidatorConstraintInterface {
|
|
6
|
+
validate(value: any, args?: ValidationArguments): boolean;
|
|
7
|
+
defaultMessage(args?: ValidationArguments): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MatchConstraint = exports.Match = exports.MatchWithI18n = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
const validation_1 = require("./validation");
|
|
12
|
+
const MatchWithI18n = (property, validationOptions, args, key = 'match', prefix = 'validation') => {
|
|
13
|
+
return (0, exports.Match)(property, (0, validation_1.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
14
|
+
};
|
|
15
|
+
exports.MatchWithI18n = MatchWithI18n;
|
|
16
|
+
const Match = (property, options) => (object, propertyName) => (0, class_validator_1.registerDecorator)({
|
|
17
|
+
target: object.constructor,
|
|
18
|
+
propertyName,
|
|
19
|
+
options,
|
|
20
|
+
constraints: [property],
|
|
21
|
+
validator: MatchConstraint,
|
|
22
|
+
});
|
|
23
|
+
exports.Match = Match;
|
|
24
|
+
let MatchConstraint = class MatchConstraint {
|
|
25
|
+
validate(value, args) {
|
|
26
|
+
const [propertyNameToCompare] = (args === null || args === void 0 ? void 0 : args.constraints) || [];
|
|
27
|
+
const propertyValue = (args === null || args === void 0 ? void 0 : args.object)[propertyNameToCompare];
|
|
28
|
+
return (0, class_validator_1.equals)(value, propertyValue);
|
|
29
|
+
}
|
|
30
|
+
defaultMessage(args) {
|
|
31
|
+
const [propertyNameToCompare] = (args === null || args === void 0 ? void 0 : args.constraints) || [];
|
|
32
|
+
return `${args === null || args === void 0 ? void 0 : args.property} does not match with ${propertyNameToCompare}`;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.MatchConstraint = MatchConstraint;
|
|
36
|
+
exports.MatchConstraint = MatchConstraint = __decorate([
|
|
37
|
+
(0, class_validator_1.ValidatorConstraint)({ name: 'Match' })
|
|
38
|
+
], MatchConstraint);
|
|
39
|
+
//# sourceMappingURL=match.constraint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.constraint.js","sourceRoot":"","sources":["../../lib/validation/match.constraint.ts"],"names":[],"mappings":";;;;;;;;;AACA,qDAOyB;AACzB,6CAAmF;AAE5E,MAAM,aAAa,GAAG,CAAI,QAAiB,EAAE,iBAAyC,EAC3F,IAAU,EACV,GAAG,GAAG,OAAO,EACb,MAAM,GAAG,YAAY,EAAG,EAAE;IAE1B,OAAO,IAAA,aAAK,EAAC,QAAQ,EAAE,IAAA,yCAA4B,EAAC,iBAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AAC7F,CAAC,CAAA;AANY,QAAA,aAAa,iBAMzB;AAEM,MAAM,KAAK,GAChB,CAAI,QAAiB,EAAE,OAA2B,EAAE,EAAE,CACpD,CAAC,MAAW,EAAE,YAAoB,EAAE,EAAE,CACpC,IAAA,mCAAiB,EAAC;IAChB,MAAM,EAAE,MAAM,CAAC,WAAW;IAC1B,YAAY;IACZ,OAAO;IACP,WAAW,EAAE,CAAC,QAAQ,CAAC;IACvB,SAAS,EAAE,eAAe;CAC3B,CAAC,CAAC;AATI,QAAA,KAAK,SAST;AAGF,IAAM,eAAe,GAArB,MAAM,eAAe;IAC1B,QAAQ,CAAC,KAAU,EAAE,IAA0B;QAC7C,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,KAAI,EAAE,CAAC;QACxD,MAAM,aAAa,GAAG,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAc,CAAA,CAAC,qBAAqB,CAAC,CAAC;QACnE,OAAO,IAAA,wBAAM,EAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACtC,CAAC;IAED,cAAc,CAAC,IAA0B;QACvC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,KAAI,EAAE,CAAC;QAExD,OAAO,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,wBAAwB,qBAAqB,EAAE,CAAC;IAC1E,CAAC;CACF,CAAA;AAZY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,qCAAmB,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;GAC1B,eAAe,CAY3B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IsStrongPasswordOptions, ValidationOptions } from 'class-validator';
|
|
2
|
+
import { IsEmailOptions, IsFQDNOptions } from 'validator';
|
|
3
|
+
export type I18nValidationOptions = Omit<ValidationOptions, 'message'>;
|
|
4
|
+
export declare const resolveI18nValidationOptions: (options: I18nValidationOptions, key: string, prefix: string, args?: any) => {
|
|
5
|
+
each?: boolean;
|
|
6
|
+
groups?: string[];
|
|
7
|
+
always?: boolean;
|
|
8
|
+
context?: any;
|
|
9
|
+
message: (a: import("class-validator").ValidationArguments) => string;
|
|
10
|
+
};
|
|
11
|
+
export declare const resolveI18nValidationMessage: (key: string, prefix: string, args?: any) => (a: import("class-validator").ValidationArguments) => string;
|
|
12
|
+
export declare const IsNotEmptyWithI18n: (validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
13
|
+
export declare const IsStringWithI18n: (validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
14
|
+
export declare const IsBooleanWithI18n: (validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
15
|
+
export declare const IsEmailWithI18n: (options?: IsEmailOptions, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
16
|
+
export declare const MinWithI18n: (minValue: number, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
17
|
+
export declare const MaxWithI18n: (maxValue: number, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
18
|
+
export declare const LengthWithI18n: (minValue: number, maxValue?: number, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
19
|
+
export declare const MinLengthWithI18n: (minLength: number, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
20
|
+
export declare const MaxLengthWithI18n: (maxLength: number, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
21
|
+
export declare const IsIntWithI18n: (validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
22
|
+
export declare const ContainsWithI18n: (seed: string, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
23
|
+
export declare const IsFQDNWithI18n: (options?: IsFQDNOptions, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
24
|
+
export declare const IsDateWithI18n: (validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
25
|
+
export declare const IsNotEmptyObjectWithI18n: (options?: {
|
|
26
|
+
nullable?: boolean;
|
|
27
|
+
}, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
28
|
+
export declare const IsStrongPasswordWithI18n: (options?: IsStrongPasswordOptions, validationOptions?: I18nValidationOptions, args?: any, key?: string, prefix?: string) => PropertyDecorator;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IsStrongPasswordWithI18n = exports.IsNotEmptyObjectWithI18n = exports.IsDateWithI18n = exports.IsFQDNWithI18n = exports.ContainsWithI18n = exports.IsIntWithI18n = exports.MaxLengthWithI18n = exports.MinLengthWithI18n = exports.LengthWithI18n = exports.MaxWithI18n = exports.MinWithI18n = exports.IsEmailWithI18n = exports.IsBooleanWithI18n = exports.IsStringWithI18n = exports.IsNotEmptyWithI18n = exports.resolveI18nValidationMessage = exports.resolveI18nValidationOptions = void 0;
|
|
4
|
+
const class_validator_1 = require("class-validator");
|
|
5
|
+
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
6
|
+
const resolveI18nValidationOptions = (options, key, prefix, args) => {
|
|
7
|
+
return {
|
|
8
|
+
message: (0, exports.resolveI18nValidationMessage)(key, prefix, args),
|
|
9
|
+
...options,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.resolveI18nValidationOptions = resolveI18nValidationOptions;
|
|
13
|
+
const resolveI18nValidationMessage = (key, prefix, args) => {
|
|
14
|
+
return (0, nestjs_i18n_1.i18nValidationMessage)(`${prefix}.${key}`, args);
|
|
15
|
+
};
|
|
16
|
+
exports.resolveI18nValidationMessage = resolveI18nValidationMessage;
|
|
17
|
+
const IsNotEmptyWithI18n = (validationOptions, args, key = 'isNotEmpty', prefix = 'validation') => {
|
|
18
|
+
return (0, class_validator_1.IsNotEmpty)((0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
19
|
+
};
|
|
20
|
+
exports.IsNotEmptyWithI18n = IsNotEmptyWithI18n;
|
|
21
|
+
const IsStringWithI18n = (validationOptions, args, key = 'isString', prefix = 'validation') => {
|
|
22
|
+
return (0, class_validator_1.IsString)((0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
23
|
+
};
|
|
24
|
+
exports.IsStringWithI18n = IsStringWithI18n;
|
|
25
|
+
const IsBooleanWithI18n = (validationOptions, args, key = 'isBoolean', prefix = 'validation') => {
|
|
26
|
+
return (0, class_validator_1.IsBoolean)((0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
27
|
+
};
|
|
28
|
+
exports.IsBooleanWithI18n = IsBooleanWithI18n;
|
|
29
|
+
const IsEmailWithI18n = (options, validationOptions, args, key = 'isEmail', prefix = 'validation') => {
|
|
30
|
+
return (0, class_validator_1.IsEmail)(options, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
31
|
+
};
|
|
32
|
+
exports.IsEmailWithI18n = IsEmailWithI18n;
|
|
33
|
+
const MinWithI18n = (minValue, validationOptions, args, key = 'min', prefix = 'validation') => {
|
|
34
|
+
return (0, class_validator_1.Min)(minValue, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
35
|
+
};
|
|
36
|
+
exports.MinWithI18n = MinWithI18n;
|
|
37
|
+
const MaxWithI18n = (maxValue, validationOptions, args, key = 'max', prefix = 'validation') => {
|
|
38
|
+
return (0, class_validator_1.Max)(maxValue, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
39
|
+
};
|
|
40
|
+
exports.MaxWithI18n = MaxWithI18n;
|
|
41
|
+
const LengthWithI18n = (minValue, maxValue, validationOptions, args, key = 'length', prefix = 'validation') => {
|
|
42
|
+
return (0, class_validator_1.Length)(minValue, maxValue, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
43
|
+
};
|
|
44
|
+
exports.LengthWithI18n = LengthWithI18n;
|
|
45
|
+
const MinLengthWithI18n = (minLength, validationOptions, args, key = 'minLength', prefix = 'validation') => {
|
|
46
|
+
return (0, class_validator_1.MinLength)(minLength, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
47
|
+
};
|
|
48
|
+
exports.MinLengthWithI18n = MinLengthWithI18n;
|
|
49
|
+
const MaxLengthWithI18n = (maxLength, validationOptions, args, key = 'maxLength', prefix = 'validation') => {
|
|
50
|
+
return (0, class_validator_1.MaxLength)(maxLength, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
51
|
+
};
|
|
52
|
+
exports.MaxLengthWithI18n = MaxLengthWithI18n;
|
|
53
|
+
const IsIntWithI18n = (validationOptions, args, key = 'isInt', prefix = 'validation') => {
|
|
54
|
+
return (0, class_validator_1.IsInt)((0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
55
|
+
};
|
|
56
|
+
exports.IsIntWithI18n = IsIntWithI18n;
|
|
57
|
+
const ContainsWithI18n = (seed, validationOptions, args, key = 'contains', prefix = 'validation') => {
|
|
58
|
+
return (0, class_validator_1.Contains)(seed, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
59
|
+
};
|
|
60
|
+
exports.ContainsWithI18n = ContainsWithI18n;
|
|
61
|
+
const IsFQDNWithI18n = (options, validationOptions, args, key = 'isFQDN', prefix = 'validation') => {
|
|
62
|
+
return (0, class_validator_1.IsFQDN)(options, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
63
|
+
};
|
|
64
|
+
exports.IsFQDNWithI18n = IsFQDNWithI18n;
|
|
65
|
+
const IsDateWithI18n = (validationOptions, args, key = 'IsDate', prefix = 'validation') => {
|
|
66
|
+
return (0, class_validator_1.IsDate)((0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
67
|
+
};
|
|
68
|
+
exports.IsDateWithI18n = IsDateWithI18n;
|
|
69
|
+
const IsNotEmptyObjectWithI18n = (options, validationOptions, args, key = 'isNotEmptyObject', prefix = 'validation') => {
|
|
70
|
+
return (0, class_validator_1.IsNotEmptyObject)(options, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
71
|
+
};
|
|
72
|
+
exports.IsNotEmptyObjectWithI18n = IsNotEmptyObjectWithI18n;
|
|
73
|
+
const IsStrongPasswordWithI18n = (options, validationOptions, args, key = 'isStrongPassword', prefix = 'validation') => {
|
|
74
|
+
return (0, class_validator_1.IsStrongPassword)(options, (0, exports.resolveI18nValidationOptions)(validationOptions, key, prefix, args));
|
|
75
|
+
};
|
|
76
|
+
exports.IsStrongPasswordWithI18n = IsStrongPasswordWithI18n;
|
|
77
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../lib/validation/validation.ts"],"names":[],"mappings":";;;AAAA,qDAAoO;AACpO,6CAAoD;AAM7C,MAAM,4BAA4B,GAAG,CAAC,OAA8B,EAAE,GAAW,EAAE,MAAc,EAAE,IAAU,EAAE,EAAE;IACtH,OAAO;QACL,OAAO,EAAE,IAAA,oCAA4B,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC;QACxD,GAAG,OAAO;KACX,CAAA;AACH,CAAC,CAAA;AALY,QAAA,4BAA4B,gCAKxC;AAEM,MAAM,4BAA4B,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,IAAU,EAAE,EAAE;IACtF,OAAO,IAAA,mCAAqB,EAAC,GAAG,MAAM,IAAI,GAAG,EAAE,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC,CAAA;AAFY,QAAA,4BAA4B,gCAExC;AAEM,MAAM,kBAAkB,GAAG,CAChC,iBAAyC,EACzC,IAAU,EACV,GAAG,GAAG,YAAY,EAClB,MAAM,GAAG,YAAY,EACrB,EAAE;IACF,OAAO,IAAA,4BAAU,EAAC,IAAA,oCAA4B,EAAC,iBAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACxF,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B;AAEK,MAAM,gBAAgB,GAAG,CAC9B,iBAAyC,EACzC,IAAU,EACV,GAAG,GAAG,UAAU,EAChB,MAAM,GAAG,YAAY,EACrB,EAAE;IACF,OAAO,IAAA,0BAAQ,EAAC,IAAA,oCAA4B,EAAC,iBAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEK,MAAM,iBAAiB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BAAiB,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvG,CAAC,CAAA;AAFY,QAAA,wBAAwB,4BAEpC"}
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from './dist';
|
package/index.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./dist"), exports);
|
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nathapp/nestjs-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "NestJs Common Library",
|
|
5
5
|
"scripts": {
|
|
6
|
+
"clean": "rimraf dist/ .turbo/",
|
|
6
7
|
"build": "rimraf dist && tsc -p tsconfig.json",
|
|
7
8
|
"precommit": "lint-staged",
|
|
8
|
-
"test": "jest",
|
|
9
|
-
"test:
|
|
10
|
-
"test:
|
|
11
|
-
"test:e2e": "jest --config ./test/jest-e2e.json",
|
|
9
|
+
"test": "jest --config ./test/jest-test.json",
|
|
10
|
+
"test:cov": "jest --config ./test/jest-test.json --coverage",
|
|
11
|
+
"test:watch": "jest --config ./test/jest-test.json --watch",
|
|
12
12
|
"lint": "eslint -c .eslintrc.js"
|
|
13
13
|
},
|
|
14
14
|
"author": "",
|
|
15
15
|
"license": "ISC",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=16"
|
|
18
|
+
},
|
|
16
19
|
"devDependencies": {
|
|
17
|
-
"@
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
"@
|
|
21
|
-
"@
|
|
22
|
-
"eslint": "
|
|
23
|
-
"
|
|
24
|
-
"eslint-plugin-prettier": "^3",
|
|
25
|
-
"prettier": "^2",
|
|
26
|
-
"typescript": "^4"
|
|
20
|
+
"@nathapp/eslint-config": "1.0.1",
|
|
21
|
+
"@nathapp/typescript-config": "1.0.1",
|
|
22
|
+
"@nestjs/throttler": "^5.0.1",
|
|
23
|
+
"@types/body-parser": "^1.19.2",
|
|
24
|
+
"@types/express": "^4.17.17",
|
|
25
|
+
"eslint": "^8.57.0",
|
|
26
|
+
"typescript": "^5"
|
|
27
27
|
},
|
|
28
28
|
"types": "./index.d.ts",
|
|
29
29
|
"main": "index.js",
|
|
@@ -31,17 +31,19 @@
|
|
|
31
31
|
"lib": "lib"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nathapp/common": "^0.1.
|
|
34
|
+
"@nathapp/common": "^0.1.14",
|
|
35
|
+
"body-parser": "^1.20.2",
|
|
35
36
|
"joi": "^17.6.0",
|
|
36
|
-
"nestjs-i18n": "^10.
|
|
37
|
-
"request-ip": "^3.2.0"
|
|
37
|
+
"nestjs-i18n": "^10.4.5"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@nestjs/
|
|
41
|
-
"@nestjs/config": "^1.0.0 || ^2.0.0 || ^3.0.0",
|
|
42
|
-
"@nestjs/core": "^8.0.0 || ^9.0.0 || ^10.0.0",
|
|
40
|
+
"@nestjs/throttler": "^5.0.0",
|
|
43
41
|
"class-transformer": "*",
|
|
44
|
-
"class-validator": "*"
|
|
45
|
-
|
|
42
|
+
"class-validator": "*"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"@nestjs/throttler": {
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
46
48
|
}
|
|
47
49
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: '@typescript-eslint/parser',
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
|
-
sourceType: 'module',
|
|
6
|
-
},
|
|
7
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
8
|
-
extends: [
|
|
9
|
-
'plugin:@typescript-eslint/recommended',
|
|
10
|
-
'plugin:prettier/recommended',
|
|
11
|
-
],
|
|
12
|
-
root: true,
|
|
13
|
-
env: {
|
|
14
|
-
node: true,
|
|
15
|
-
jest: true,
|
|
16
|
-
},
|
|
17
|
-
ignorePatterns: ['.eslintrc.js'],
|
|
18
|
-
rules: {
|
|
19
|
-
'@typescript-eslint/interface-name-prefix': 'off',
|
|
20
|
-
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
21
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
22
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
23
|
-
},
|
|
24
|
-
};
|
package/lib/config/README.md
DELETED