@mondart/nestjs-common-module-core 3.2.14 → 3.2.16
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/dist/decorators/validations/default/array-max-size.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/array-max-size.decorator.js +2 -1
- package/dist/decorators/validations/default/array-max-size.decorator.js.map +1 -1
- package/dist/decorators/validations/default/array-min-size.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/array-min-size.decorator.js +2 -1
- package/dist/decorators/validations/default/array-min-size.decorator.js.map +1 -1
- package/dist/decorators/validations/default/constraints-message.d.ts +4 -0
- package/dist/decorators/validations/default/constraints-message.d.ts.map +1 -0
- package/dist/decorators/validations/default/constraints-message.js +6 -0
- package/dist/decorators/validations/default/constraints-message.js.map +1 -0
- package/dist/decorators/validations/default/is-enum.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/is-enum.decorator.js +5 -1
- package/dist/decorators/validations/default/is-enum.decorator.js.map +1 -1
- package/dist/decorators/validations/default/max-length.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/max-length.decorator.js +2 -1
- package/dist/decorators/validations/default/max-length.decorator.js.map +1 -1
- package/dist/decorators/validations/default/max.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/max.decorator.js +2 -1
- package/dist/decorators/validations/default/max.decorator.js.map +1 -1
- package/dist/decorators/validations/default/min-length.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/min-length.decorator.js +2 -1
- package/dist/decorators/validations/default/min-length.decorator.js.map +1 -1
- package/dist/decorators/validations/default/min.decorator.d.ts.map +1 -1
- package/dist/decorators/validations/default/min.decorator.js +2 -1
- package/dist/decorators/validations/default/min.decorator.js.map +1 -1
- package/dist/decorators/validations/index.d.ts +2 -0
- package/dist/decorators/validations/index.d.ts.map +1 -1
- package/dist/decorators/validations/index.js +2 -0
- package/dist/decorators/validations/index.js.map +1 -1
- package/dist/decorators/validations/sanitize-by.decorator.d.ts +4 -0
- package/dist/decorators/validations/sanitize-by.decorator.d.ts.map +1 -0
- package/dist/decorators/validations/sanitize-by.decorator.js +11 -0
- package/dist/decorators/validations/sanitize-by.decorator.js.map +1 -0
- package/dist/decorators/validations/sanitize-text.decorator.d.ts +2 -0
- package/dist/decorators/validations/sanitize-text.decorator.d.ts.map +1 -0
- package/dist/decorators/validations/sanitize-text.decorator.js +9 -0
- package/dist/decorators/validations/sanitize-text.decorator.js.map +1 -0
- package/dist/helpers/html-sanitizer.helper.d.ts +1 -0
- package/dist/helpers/html-sanitizer.helper.d.ts.map +1 -1
- package/dist/helpers/html-sanitizer.helper.js +21 -0
- package/dist/helpers/html-sanitizer.helper.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-max-size.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-max-size.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"array-max-size.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-max-size.decorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAM9D"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ArrayMaxSize = ArrayMaxSize;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function ArrayMaxSize(length) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
9
|
(0, class_validator_1.ArrayMaxSize)(length, {
|
|
9
|
-
message: enums_1.ValidationMessageKey.ARRAY_MAX_SIZE,
|
|
10
|
+
message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.ARRAY_MAX_SIZE),
|
|
10
11
|
})(target, propertyKey);
|
|
11
12
|
};
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-max-size.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-max-size.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"array-max-size.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-max-size.decorator.ts"],"names":[],"mappings":";;AAIA,oCAMC;AAVD,qDAA+D;AAC/D,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,YAAY,CAAC,MAAc;IACzC,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,8BAAY,EAAC,MAAM,EAAE;YACnB,OAAO,EAAE,IAAA,wCAAkB,EAAC,4BAAoB,CAAC,cAAc,CAAC;SACjE,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-min-size.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-min-size.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"array-min-size.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-min-size.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAIzB,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,iBAAiB,GAC1B,iBAAiB,CAOnB"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ArrayMinSize = ArrayMinSize;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function ArrayMinSize(length, options) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
9
|
(0, class_validator_1.ArrayMinSize)(length, {
|
|
9
|
-
message: enums_1.ValidationMessageKey.ARRAY_MIN_SIZE,
|
|
10
|
+
message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.ARRAY_MIN_SIZE),
|
|
10
11
|
...options,
|
|
11
12
|
})(target, propertyKey);
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array-min-size.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-min-size.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"array-min-size.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/array-min-size.decorator.ts"],"names":[],"mappings":";;AAOA,oCAUC;AAjBD,qDAGyB;AACzB,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,YAAY,CAC1B,MAAc,EACd,OAA2B;IAE3B,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,8BAAY,EAAC,MAAM,EAAE;YACnB,OAAO,EAAE,IAAA,wCAAkB,EAAC,4BAAoB,CAAC,cAAc,CAAC;YAChE,GAAG,OAAO;SACX,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ValidationArguments } from 'class-validator';
|
|
2
|
+
import { ValidationMessageKey } from '../../../enums';
|
|
3
|
+
export declare const constraintsMessage: (key: ValidationMessageKey, pick?: (args: ValidationArguments) => any[]) => (args: ValidationArguments) => string;
|
|
4
|
+
//# sourceMappingURL=constraints-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints-message.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/constraints-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,eAAO,MAAM,kBAAkB,GAE3B,KAAK,oBAAoB,EACzB,QAAQ,MAAM,mBAAmB,UAAqB,MAEvD,MAAM,mBAAmB,KAAG,MAC4B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constraintsMessage = void 0;
|
|
4
|
+
const constraintsMessage = (key, pick = (args) => args.constraints) => (args) => `${key}|${JSON.stringify({ constraints: pick(args) })}`;
|
|
5
|
+
exports.constraintsMessage = constraintsMessage;
|
|
6
|
+
//# sourceMappingURL=constraints-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constraints-message.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/constraints-message.ts"],"names":[],"mappings":";;;AAIO,MAAM,kBAAkB,GAC7B,CACE,GAAyB,EACzB,OAAO,CAAC,IAAyB,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EACtD,EAAE,CACJ,CAAC,IAAyB,EAAU,EAAE,CACpC,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AAN/C,QAAA,kBAAkB,sBAM6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-enum.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/is-enum.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"is-enum.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/is-enum.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAItE,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,iBAAiB,GAC1B,iBAAiB,CAenB"}
|
|
@@ -3,10 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IsEnum = IsEnum;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function IsEnum(value, options) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
9
|
(0, class_validator_1.IsEnum)(value, {
|
|
9
|
-
message: enums_1.ValidationMessageKey.ENUM,
|
|
10
|
+
message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.ENUM, ({ constraints }) => {
|
|
11
|
+
const allowed = constraints[1].join(', ');
|
|
12
|
+
return [allowed, allowed];
|
|
13
|
+
}),
|
|
10
14
|
...options,
|
|
11
15
|
})(target, propertyKey);
|
|
12
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-enum.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/is-enum.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"is-enum.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/is-enum.decorator.ts"],"names":[],"mappings":";;AAIA,wBAkBC;AAtBD,qDAAsE;AACtE,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,MAAM,CACpB,KAAa,EACb,OAA2B;IAE3B,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,wBAAM,EAAC,KAAK,EAAE;YAGZ,OAAO,EAAE,IAAA,wCAAkB,EACzB,4BAAoB,CAAC,IAAI,EACzB,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;gBAClB,MAAM,OAAO,GAAI,WAAW,CAAC,CAAC,CAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC5B,CAAC,CACF;YACD,GAAG,OAAO;SACX,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-length.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max-length.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"max-length.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max-length.decorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAM3D"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MaxLength = MaxLength;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function MaxLength(length) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
9
|
(0, class_validator_1.MaxLength)(length, {
|
|
9
|
-
message: enums_1.ValidationMessageKey.MAX_LENGTH,
|
|
10
|
+
message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.MAX_LENGTH),
|
|
10
11
|
})(target, propertyKey);
|
|
11
12
|
};
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max-length.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max-length.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"max-length.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max-length.decorator.ts"],"names":[],"mappings":";;AAIA,8BAMC;AAVD,qDAAyD;AACzD,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,SAAS,CAAC,MAAc;IACtC,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,2BAAS,EAAC,MAAM,EAAE;YAChB,OAAO,EAAE,IAAA,wCAAkB,EAAC,4BAAoB,CAAC,UAAU,CAAC;SAC7D,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"max.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max.decorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,GAAG,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3B,iBAAiB,CAUnB"}
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Max = Max;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function Max(value, options) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
|
-
(0, class_validator_1.Max)(value, Object.assign({ message: enums_1.ValidationMessageKey.MAX }, options))(target, propertyKey);
|
|
9
|
+
(0, class_validator_1.Max)(value, Object.assign({ message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.MAX) }, options))(target, propertyKey);
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=max.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"max.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"max.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/max.decorator.ts"],"names":[],"mappings":";;AAIA,kBAaC;AAjBD,qDAA6C;AAC7C,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,GAAG,CACjB,KAAa,EACb,OAA4B;IAE5B,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,qBAAG,EACD,KAAK,EACL,MAAM,CAAC,MAAM,CACX,EAAE,OAAO,EAAE,IAAA,wCAAkB,EAAC,4BAAoB,CAAC,GAAG,CAAC,EAAE,EACzD,OAAO,CACR,CACF,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"min-length.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min-length.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"min-length.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min-length.decorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAM3D"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.MinLength = MinLength;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function MinLength(length) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
9
|
(0, class_validator_1.MinLength)(length, {
|
|
9
|
-
message: enums_1.ValidationMessageKey.MIN_LENGTH,
|
|
10
|
+
message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.MIN_LENGTH),
|
|
10
11
|
})(target, propertyKey);
|
|
11
12
|
};
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"min-length.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min-length.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"min-length.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min-length.decorator.ts"],"names":[],"mappings":";;AAIA,8BAMC;AAVD,qDAAyD;AACzD,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,SAAS,CAAC,MAAc;IACtC,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,2BAAS,EAAC,MAAM,EAAE;YAChB,OAAO,EAAE,IAAA,wCAAkB,EAAC,4BAAoB,CAAC,UAAU,CAAC;SAC7D,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"min.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min.decorator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"min.decorator.d.ts","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min.decorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,GAAG,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3B,iBAAiB,CAUnB"}
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Min = Min;
|
|
4
4
|
const class_validator_1 = require("class-validator");
|
|
5
5
|
const enums_1 = require("../../../enums");
|
|
6
|
+
const constraints_message_1 = require("./constraints-message");
|
|
6
7
|
function Min(value, options) {
|
|
7
8
|
return function (target, propertyKey) {
|
|
8
|
-
(0, class_validator_1.Min)(value, Object.assign({ message: enums_1.ValidationMessageKey.MIN }, options))(target, propertyKey);
|
|
9
|
+
(0, class_validator_1.Min)(value, Object.assign({ message: (0, constraints_message_1.constraintsMessage)(enums_1.ValidationMessageKey.MIN) }, options))(target, propertyKey);
|
|
9
10
|
};
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=min.decorator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"min.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min.decorator.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"min.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/validations/default/min.decorator.ts"],"names":[],"mappings":";;AAIA,kBAaC;AAjBD,qDAA6C;AAC7C,0CAAsD;AACtD,+DAA2D;AAE3D,SAAgB,GAAG,CACjB,KAAa,EACb,OAA4B;IAE5B,OAAO,UAAU,MAAW,EAAE,WAA4B;QACxD,IAAA,qBAAG,EACD,KAAK,EACL,MAAM,CAAC,MAAM,CACX,EAAE,OAAO,EAAE,IAAA,wCAAkB,EAAC,4BAAoB,CAAC,GAAG,CAAC,EAAE,EACzD,OAAO,CACR,CACF,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -4,4 +4,6 @@ export * from './is-not-empty-string.decorator';
|
|
|
4
4
|
export * from './is-one-of-property.decorator';
|
|
5
5
|
export * from './depend-on-property.decorator';
|
|
6
6
|
export * from './sanitize-html.decorator';
|
|
7
|
+
export * from './sanitize-text.decorator';
|
|
8
|
+
export * from './sanitize-by.decorator';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/validations/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decorators/validations/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC"}
|
|
@@ -20,4 +20,6 @@ __exportStar(require("./is-not-empty-string.decorator"), exports);
|
|
|
20
20
|
__exportStar(require("./is-one-of-property.decorator"), exports);
|
|
21
21
|
__exportStar(require("./depend-on-property.decorator"), exports);
|
|
22
22
|
__exportStar(require("./sanitize-html.decorator"), exports);
|
|
23
|
+
__exportStar(require("./sanitize-text.decorator"), exports);
|
|
24
|
+
__exportStar(require("./sanitize-by.decorator"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/validations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,kEAAgD;AAChD,iEAA+C;AAC/C,iEAA+C;AAC/C,4DAA0C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/decorators/validations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,kEAAgD;AAChD,iEAA+C;AAC/C,iEAA+C;AAC/C,4DAA0C;AAC1C,4DAA0C;AAC1C,0DAAwC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IOptions } from 'sanitize-html';
|
|
2
|
+
export type SanitizeMode = 'html' | 'text';
|
|
3
|
+
export declare function SanitizeBy(mode: (obj: Record<string, any>) => SanitizeMode, htmlOptions?: IOptions): PropertyDecorator;
|
|
4
|
+
//# sourceMappingURL=sanitize-by.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-by.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validations/sanitize-by.decorator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAO3C,wBAAgB,UAAU,CACxB,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,YAAY,EAChD,WAAW,CAAC,EAAE,QAAQ,GACrB,iBAAiB,CAQnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SanitizeBy = SanitizeBy;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
const helpers_1 = require("../../helpers");
|
|
6
|
+
function SanitizeBy(mode, htmlOptions) {
|
|
7
|
+
return (0, class_transformer_1.Transform)(({ value, obj }) => mode(obj ?? {}) === 'text'
|
|
8
|
+
? (0, helpers_1.sanitizeText)(value)
|
|
9
|
+
: (0, helpers_1.sanitizeHtml)(value, htmlOptions), { toClassOnly: true });
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=sanitize-by.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-by.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validations/sanitize-by.decorator.ts"],"names":[],"mappings":";;AAWA,gCAWC;AAtBD,yDAA8C;AAE9C,2CAA2D;AAS3D,SAAgB,UAAU,CACxB,IAAgD,EAChD,WAAsB;IAEtB,OAAO,IAAA,6BAAS,EACd,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CACjB,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,MAAM;QACxB,CAAC,CAAC,IAAA,sBAAY,EAAC,KAAK,CAAC;QACrB,CAAC,CAAC,IAAA,sBAAY,EAAC,KAAK,EAAE,WAAW,CAAC,EACtC,EAAE,WAAW,EAAE,IAAI,EAAE,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-text.decorator.d.ts","sourceRoot":"","sources":["../../../src/decorators/validations/sanitize-text.decorator.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,iBAAiB,CAEhD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SanitizeText = SanitizeText;
|
|
4
|
+
const class_transformer_1 = require("class-transformer");
|
|
5
|
+
const helpers_1 = require("../../helpers");
|
|
6
|
+
function SanitizeText() {
|
|
7
|
+
return (0, class_transformer_1.Transform)(({ value }) => (0, helpers_1.sanitizeText)(value), { toClassOnly: true });
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=sanitize-text.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize-text.decorator.js","sourceRoot":"","sources":["../../../src/decorators/validations/sanitize-text.decorator.ts"],"names":[],"mappings":";;AAIA,oCAEC;AAND,yDAA8C;AAC9C,2CAA6C;AAG7C,SAAgB,YAAY;IAC1B,OAAO,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,KAAK,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-sanitizer.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/html-sanitizer.helper.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,eAAe,CAAC;AAE5C,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,GACjC,OAAO,CAsBT"}
|
|
1
|
+
{"version":3,"file":"html-sanitizer.helper.d.ts","sourceRoot":"","sources":["../../src/helpers/html-sanitizer.helper.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,eAAe,CAAC;AAE5C,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,eAAe,CAAC,QAAQ,GACjC,OAAO,CAsBT;AAmBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAapD"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.sanitizeHtml = sanitizeHtml;
|
|
7
|
+
exports.sanitizeText = sanitizeText;
|
|
7
8
|
const sanitize_html_1 = __importDefault(require("sanitize-html"));
|
|
8
9
|
function sanitizeHtml(value, options) {
|
|
9
10
|
if (typeof value !== 'string')
|
|
@@ -28,4 +29,24 @@ function sanitizeHtml(value, options) {
|
|
|
28
29
|
...options,
|
|
29
30
|
}).trim();
|
|
30
31
|
}
|
|
32
|
+
const TEXT_ENTITIES = {
|
|
33
|
+
'&': '&',
|
|
34
|
+
'<': '<',
|
|
35
|
+
'>': '>',
|
|
36
|
+
'"': '"',
|
|
37
|
+
''': "'",
|
|
38
|
+
};
|
|
39
|
+
const decodeTextEntities = (text) => text.replace(/&(?:amp|lt|gt|quot|#39);/g, (entity) => TEXT_ENTITIES[entity]);
|
|
40
|
+
function sanitizeText(value) {
|
|
41
|
+
if (typeof value !== 'string')
|
|
42
|
+
return value;
|
|
43
|
+
let text = value;
|
|
44
|
+
for (let pass = 0; pass < 5; pass++) {
|
|
45
|
+
const next = decodeTextEntities((0, sanitize_html_1.default)(text, { allowedTags: [], allowedAttributes: {} }));
|
|
46
|
+
if (next === text)
|
|
47
|
+
break;
|
|
48
|
+
text = next;
|
|
49
|
+
}
|
|
50
|
+
return text.trim();
|
|
51
|
+
}
|
|
31
52
|
//# sourceMappingURL=html-sanitizer.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-sanitizer.helper.js","sourceRoot":"","sources":["../../src/helpers/html-sanitizer.helper.ts"],"names":[],"mappings":";;;;;AAEA,oCAyBC;
|
|
1
|
+
{"version":3,"file":"html-sanitizer.helper.js","sourceRoot":"","sources":["../../src/helpers/html-sanitizer.helper.ts"],"names":[],"mappings":";;;;;AAEA,oCAyBC;AAmBD,oCAaC;AA3DD,kEAA4C;AAE5C,SAAgB,YAAY,CAC1B,KAAc,EACd,OAAkC;IAElC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5C,OAAO,IAAA,uBAAe,EAAC,KAAK,EAAE;QAC5B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;QACzE,iBAAiB,EAAE;YACjB,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC;SACtC;QACD,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;QAC3C,qBAAqB,EAAE,KAAK;QAC5B,mBAAmB,EAAE,IAAI;QACzB,aAAa,EAAE;YACb,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;gBACzB,OAAO,EAAE,GAAG;gBACZ,OAAO,EAAE;oBACP,GAAG,OAAO;oBACV,GAAG,EAAE,8BAA8B;iBACpC;aACF,CAAC;SACH;QACD,GAAG,OAAO;KACX,CAAC,CAAC,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,aAAa,GAA2B;IAC5C,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,QAAQ,EAAE,GAAG;IACb,OAAO,EAAE,GAAG;CACb,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAU,EAAE,CAClD,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAQ/E,SAAgB,YAAY,CAAC,KAAc;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5C,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,kBAAkB,CAC7B,IAAA,uBAAe,EAAC,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,CAAC,CAClE,CAAC;QACF,IAAI,IAAI,KAAK,IAAI;YAAE,MAAM;QACzB,IAAI,GAAG,IAAI,CAAC;IACd,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;AACrB,CAAC"}
|