@nest-boot/validator 7.2.0 → 8.0.0-beta.0

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.
Files changed (46) hide show
  1. package/dist/decorators/common/array-length.decorator.js +12 -15
  2. package/dist/decorators/common/array-length.decorator.js.map +1 -1
  3. package/dist/decorators/index.d.ts +14 -14
  4. package/dist/decorators/index.js +14 -30
  5. package/dist/decorators/index.js.map +1 -1
  6. package/dist/decorators/number/is-greater-than-or-equal.decorator.js +3 -6
  7. package/dist/decorators/number/is-greater-than-or-equal.decorator.js.map +1 -1
  8. package/dist/decorators/number/is-greater-than.decorator.js +3 -6
  9. package/dist/decorators/number/is-greater-than.decorator.js.map +1 -1
  10. package/dist/decorators/number/is-less-than-or-equal.decorator.js +3 -6
  11. package/dist/decorators/number/is-less-than-or-equal.decorator.js.map +1 -1
  12. package/dist/decorators/number/is-less-than.decorator.js +3 -6
  13. package/dist/decorators/number/is-less-than.decorator.js.map +1 -1
  14. package/dist/decorators/number/max.decorator.js +5 -8
  15. package/dist/decorators/number/max.decorator.js.map +1 -1
  16. package/dist/decorators/number/min.decorator.js +5 -8
  17. package/dist/decorators/number/min.decorator.js.map +1 -1
  18. package/dist/decorators/number/validate-compare-number.decorator.js +9 -13
  19. package/dist/decorators/number/validate-compare-number.decorator.js.map +1 -1
  20. package/dist/decorators/string/is-domain.decorator.js +5 -8
  21. package/dist/decorators/string/is-domain.decorator.js.map +1 -1
  22. package/dist/decorators/string/is-email.decorator.d.ts +1 -1
  23. package/dist/decorators/string/is-email.decorator.js +12 -18
  24. package/dist/decorators/string/is-email.decorator.js.map +1 -1
  25. package/dist/decorators/string/is-number-string.decorator.d.ts +1 -1
  26. package/dist/decorators/string/is-number-string.decorator.js +12 -18
  27. package/dist/decorators/string/is-number-string.decorator.js.map +1 -1
  28. package/dist/decorators/string/is-timezone.decorator.js +7 -13
  29. package/dist/decorators/string/is-timezone.decorator.js.map +1 -1
  30. package/dist/decorators/string/is-url.decorator.d.ts +1 -1
  31. package/dist/decorators/string/is-url.decorator.js +12 -18
  32. package/dist/decorators/string/is-url.decorator.js.map +1 -1
  33. package/dist/decorators/string/length.decorator.js +12 -18
  34. package/dist/decorators/string/length.decorator.js.map +1 -1
  35. package/dist/decorators/type-check/is-date.decorator.js +8 -13
  36. package/dist/decorators/type-check/is-date.decorator.js.map +1 -1
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +5 -22
  39. package/dist/index.js.map +1 -1
  40. package/dist/utils/build-i18n-message.js +4 -7
  41. package/dist/utils/build-i18n-message.js.map +1 -1
  42. package/dist/utils/index.d.ts +1 -1
  43. package/dist/utils/index.js +1 -17
  44. package/dist/utils/index.js.map +1 -1
  45. package/package.json +14 -19
  46. package/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,34 +1,28 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IS_URL = void 0;
7
- exports.isURL = isURL;
8
- exports.IsUrl = IsUrl;
9
- const class_validator_1 = require("class-validator");
10
- const isURL_1 = __importDefault(require("validator/lib/isURL"));
11
- const utils_1 = require("../../utils");
1
+ import { createRequire } from "node:module";
2
+ import { ValidateBy } from "class-validator";
3
+ import { buildI18nMessage } from "../../utils/index.js";
4
+ const require = createRequire(import.meta.url);
5
+ const isUrlValidator = require("validator/lib/isURL.js");
12
6
  /** Validation name constant for the IsUrl validator. */
13
- exports.IS_URL = "isUrl";
7
+ export const IS_URL = "isUrl";
14
8
  /**
15
9
  * Checks if the string is an url.
16
10
  * If given value is not a string, then it returns false.
17
11
  */
18
- function isURL(value, options) {
19
- return typeof value === "string" && (0, isURL_1.default)(value, options);
12
+ export function isURL(value, options) {
13
+ return typeof value === "string" && isUrlValidator(value, options);
20
14
  }
21
15
  /**
22
16
  * Checks if the string is an url.
23
17
  * If given value is not a string, then it returns false.
24
18
  */
25
- function IsUrl(options, validationOptions) {
26
- return (0, class_validator_1.ValidateBy)({
27
- name: exports.IS_URL,
19
+ export function IsUrl(options, validationOptions) {
20
+ return ValidateBy({
21
+ name: IS_URL,
28
22
  constraints: [options],
29
23
  validator: {
30
24
  validate: (value, args) => typeof args !== "undefined" && isURL(value, args.constraints[0]),
31
- defaultMessage: (0, utils_1.buildI18nMessage)(() => "is-url"),
25
+ defaultMessage: buildI18nMessage(() => "is-url"),
32
26
  },
33
27
  }, validationOptions);
34
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-url.decorator.js","sourceRoot":"","sources":["../../../src/decorators/string/is-url.decorator.ts"],"names":[],"mappings":";;;;;;AAaA,sBAEC;AAMD,sBAgBC;AArCD,qDAAqE;AAErE,gEAAiD;AAEjD,uCAA+C;AAE/C,wDAAwD;AAC3C,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B;;;GAGG;AACH,SAAgB,KAAK,CAAC,KAAa,EAAE,OAAsB;IACzD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,eAAc,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,SAAgB,KAAK,CACnB,OAAsB,EACtB,iBAAqC;IAErC,OAAO,IAAA,4BAAU,EACf;QACE,IAAI,EAAE,cAAM;QACZ,WAAW,EAAE,CAAC,OAAO,CAAC;QACtB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CACjC,OAAO,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAClE,cAAc,EAAE,IAAA,wBAAgB,EAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;SACjD;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"is-url.decorator.js","sourceRoot":"","sources":["../../../src/decorators/string/is-url.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,cAAc,GAAG,OAAO,CAAC,wBAAwB,CAG3C,CAAC;AAEb,wDAAwD;AACxD,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;AAE9B;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,OAAsB;IACzD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACrE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,KAAK,CACnB,OAAsB,EACtB,iBAAqC;IAErC,OAAO,UAAU,CACf;QACE,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,CAAC,OAAO,CAAC;QACtB,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAW,EAAE,CACjC,OAAO,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAClE,cAAc,EAAE,gBAAgB,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC;SACjD;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
@@ -1,35 +1,29 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IS_LENGTH = void 0;
7
- exports.length = length;
8
- exports.Length = Length;
9
- const class_validator_1 = require("class-validator");
10
- const isLength_1 = __importDefault(require("validator/lib/isLength"));
11
- const build_i18n_message_1 = require("../../utils/build-i18n-message");
1
+ import { createRequire } from "node:module";
2
+ import { ValidateBy } from "class-validator";
3
+ import { buildI18nMessage } from "../../utils/build-i18n-message.js";
4
+ const require = createRequire(import.meta.url);
5
+ const isLengthValidator = require("validator/lib/isLength.js");
12
6
  /** Validation name constant for the Length validator. */
13
- exports.IS_LENGTH = "isLength";
7
+ export const IS_LENGTH = "isLength";
14
8
  /**
15
9
  * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
16
10
  * If given value is not a string, then it returns false.
17
11
  */
18
- function length(value, min, max) {
19
- return typeof value === "string" && (0, isLength_1.default)(value, { min, max });
12
+ export function length(value, min, max) {
13
+ return typeof value === "string" && isLengthValidator(value, { min, max });
20
14
  }
21
15
  /**
22
16
  * Checks if the string's length falls in a range. Note: this function takes into account surrogate pairs.
23
17
  * If given value is not a string, then it returns false.
24
18
  */
25
- function Length(min, max, validationOptions) {
26
- return (0, class_validator_1.ValidateBy)({
27
- name: exports.IS_LENGTH,
19
+ export function Length(min, max, validationOptions) {
20
+ return ValidateBy({
21
+ name: IS_LENGTH,
28
22
  constraints: [min, max],
29
23
  validator: {
30
24
  validate: (value, args) => typeof args !== "undefined" &&
31
25
  length(value, args.constraints[0], args.constraints[1]),
32
- defaultMessage: (0, build_i18n_message_1.buildI18nMessage)((args) => {
26
+ defaultMessage: buildI18nMessage((args) => {
33
27
  if (typeof args !== "undefined") {
34
28
  const isMinLength = args.constraints[0] !== null && args.constraints[0] !== undefined;
35
29
  const isMaxLength = args.constraints[1] !== null && args.constraints[1] !== undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"length.decorator.js","sourceRoot":"","sources":["../../../src/decorators/string/length.decorator.ts"],"names":[],"mappings":";;;;;;AAYA,wBAEC;AAMD,wBAmCC;AAvDD,qDAAqE;AACrE,sEAAuD;AAEvD,uEAAkE;AAElE,yDAAyD;AAC5C,QAAA,SAAS,GAAG,UAAU,CAAC;AAEpC;;;GAGG;AACH,SAAgB,MAAM,CAAC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BACpE,MAAM,WAAW,GACf,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC;oBAEpE,IACE,WAAW;wBACX,CAAC,WAAW;wBACZ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EACvC,CAAC;wBACD,OAAO,YAAY,CAAC;oBACtB,CAAC;gBACH,CAAC;gBAED,OAAO,gBAAgB,CAAC;YAC1B,CAAC,CAAC;SACH;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
@@ -1,27 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IS_DATE = void 0;
4
- exports.isDate = isDate;
5
- exports.IsDate = IsDate;
6
- const class_validator_1 = require("class-validator");
7
- const utils_1 = require("../../utils");
1
+ import { ValidateBy } from "class-validator";
2
+ import { buildI18nMessage } from "../../utils/index.js";
8
3
  /** Validation name constant for the IsDate validator. */
9
- exports.IS_DATE = "isDate";
4
+ export const IS_DATE = "isDate";
10
5
  /**
11
6
  * Checks if a given value is a date.
12
7
  */
13
- function isDate(value) {
8
+ export function isDate(value) {
14
9
  return value instanceof Date && !Number.isNaN(value.getTime());
15
10
  }
16
11
  /**
17
12
  * Checks if a value is a date.
18
13
  */
19
- function IsDate(validationOptions) {
20
- return (0, class_validator_1.ValidateBy)({
21
- name: exports.IS_DATE,
14
+ export function IsDate(validationOptions) {
15
+ return ValidateBy({
16
+ name: IS_DATE,
22
17
  validator: {
23
18
  validate: (value) => isDate(value),
24
- defaultMessage: (0, utils_1.buildI18nMessage)(() => "is-date"),
19
+ defaultMessage: buildI18nMessage(() => "is-date"),
25
20
  },
26
21
  }, validationOptions);
27
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"is-date.decorator.js","sourceRoot":"","sources":["../../../src/decorators/type-check/is-date.decorator.ts"],"names":[],"mappings":";;;AAUA,wBAEC;AAKD,wBAaC;AA9BD,qDAAqE;AAErE,uCAA+C;AAE/C,yDAAyD;AAC5C,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC;;GAEG;AACH,SAAgB,MAAM,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CACpB,iBAAqC;IAErC,OAAO,IAAA,4BAAU,EACf;QACE,IAAI,EAAE,eAAO;QACb,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3C,cAAc,EAAE,IAAA,wBAAgB,EAAC,GAAG,EAAE,CAAC,SAAS,CAAC;SAClD;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"is-date.decorator.js","sourceRoot":"","sources":["../../../src/decorators/type-check/is-date.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,yDAAyD;AACzD,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,KAAK,YAAY,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CACpB,iBAAqC;IAErC,OAAO,UAAU,CACf;QACE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,QAAQ,EAAE,CAAC,KAAK,EAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;YAC3C,cAAc,EAAE,gBAAgB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;SAClD;KACF,EACD,iBAAiB,CAClB,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { IsOptional, ValidateNested } from "class-validator";
2
- export * from "./decorators";
3
- export * from "./utils";
2
+ export * from "./decorators/index.js";
3
+ export * from "./utils/index.js";
4
4
  export { IsOptional, ValidateNested };
package/dist/index.js CHANGED
@@ -1,23 +1,6 @@
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
- exports.ValidateNested = exports.IsOptional = void 0;
18
- const class_validator_1 = require("class-validator");
19
- Object.defineProperty(exports, "IsOptional", { enumerable: true, get: function () { return class_validator_1.IsOptional; } });
20
- Object.defineProperty(exports, "ValidateNested", { enumerable: true, get: function () { return class_validator_1.ValidateNested; } });
21
- __exportStar(require("./decorators"), exports);
22
- __exportStar(require("./utils"), exports);
1
+ import { IsOptional, ValidateNested } from "class-validator";
2
+ export * from "./decorators/index.js";
3
+ export * from "./utils/index.js";
4
+ // class-validator
5
+ export { IsOptional, ValidateNested };
23
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAA6D;AAMpD,2FANA,4BAAU,OAMA;AAAE,+FANA,gCAAc,OAMA;AAJnC,+CAA6B;AAC7B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE7D,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AAEjC,kBAAkB;AAClB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildI18nMessage = buildI18nMessage;
4
- const i18n_1 = require("@nest-boot/i18n");
1
+ import { t } from "@nest-boot/i18n";
5
2
  /**
6
3
  * Creates an i18n-aware validation message factory.
7
4
  *
@@ -12,15 +9,15 @@ const i18n_1 = require("@nest-boot/i18n");
12
9
  * @param callback - Function that receives validation args and returns the translation key suffix
13
10
  * @returns A function usable as the `defaultMessage` in class-validator decorators
14
11
  */
15
- function buildI18nMessage(callback) {
12
+ export function buildI18nMessage(callback) {
16
13
  return (args) => {
17
- return (0, i18n_1.t)(`validation:${callback(args)}`, {
14
+ return t(`validation:${callback(args)}`, {
18
15
  ...args,
19
16
  ...args.constraints?.reduce((constraints, value, index) => ({
20
17
  ...constraints,
21
18
  [`constraint${String(index)}`]: value,
22
19
  }), {}),
23
- property: (0, i18n_1.t)(`property:${args.property}`),
20
+ property: t(`property:${args.property}`),
24
21
  });
25
22
  };
26
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build-i18n-message.js","sourceRoot":"","sources":["../../src/utils/build-i18n-message.ts"],"names":[],"mappings":";;AAaA,4CAgBC;AA7BD,0CAAoC;AAGpC;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAC9B,QAA+C;IAE/C,OAAO,CAAC,IAAyB,EAAU,EAAE;QAC3C,OAAO,IAAA,QAAC,EAAC,cAAc,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;YACvC,GAAG,IAAI;YACP,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CACzB,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,WAAW;gBACd,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK;aACtC,CAAC,EACF,EAAE,CACH;YACD,QAAQ,EAAE,IAAA,QAAC,EAAC,YAAY,IAAI,CAAC,QAAQ,EAAE,CAAC;SACzC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"build-i18n-message.js","sourceRoot":"","sources":["../../src/utils/build-i18n-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAGpC;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAA+C;IAE/C,OAAO,CAAC,IAAyB,EAAU,EAAE;QAC3C,OAAO,CAAC,CAAC,cAAc,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;YACvC,GAAG,IAAI;YACP,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CACzB,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC9B,GAAG,WAAW;gBACd,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK;aACtC,CAAC,EACF,EAAE,CACH;YACD,QAAQ,EAAE,CAAC,CAAC,YAAY,IAAI,CAAC,QAAQ,EAAE,CAAC;SACzC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- export * from "./build-i18n-message";
1
+ export * from "./build-i18n-message.js";
@@ -1,18 +1,2 @@
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("./build-i18n-message"), exports);
1
+ export * from "./build-i18n-message.js";
18
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nest-boot/validator",
3
- "version": "7.2.0",
3
+ "version": "8.0.0-beta.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/nest-boot/nest-boot.git",
@@ -29,32 +29,29 @@
29
29
  "validator": "^13.15.15"
30
30
  },
31
31
  "devDependencies": {
32
- "@nestjs/common": "^11.1.11",
33
- "@nestjs/core": "^11.1.11",
34
- "@types/jest": "^29.5.14",
35
- "@types/node": "^24.12.4",
32
+ "@nestjs/common": "next",
33
+ "@nestjs/core": "next",
34
+ "@types/node": "^26.0.0",
36
35
  "@types/validator": "^13.15.3",
37
36
  "class-transformer": "^0.5.1",
38
37
  "class-validator": "^0.14.2",
39
38
  "eslint": "^9.39.3",
40
- "jest": "^29.7.0",
41
39
  "reflect-metadata": "^0.2.2",
42
40
  "rxjs": "^7.8.2",
43
- "ts-jest": "^29.4.4",
44
- "typescript": "^5.9.3",
45
- "@nest-boot/eslint-plugin": "^7.1.0",
46
- "@nest-boot/i18n": "^7.2.0",
47
- "@nest-boot/eslint-config": "^7.2.0",
48
- "@nest-boot/tsconfig": "^7.2.0"
41
+ "typescript": "^6.0.3",
42
+ "@nest-boot/eslint-plugin": "^8.0.0-beta.0",
43
+ "@nest-boot/eslint-config": "^8.0.0-beta.0",
44
+ "@nest-boot/tsconfig": "^8.0.0-beta.0",
45
+ "@nest-boot/i18n": "^8.0.0-beta.0"
49
46
  },
50
47
  "peerDependencies": {
51
- "@nest-boot/i18n": "^7.0.3",
52
- "@nestjs/common": "^11.0.0",
53
- "@nestjs/core": "^11.0.0",
48
+ "@nestjs/common": "^12.0.0-alpha.5",
49
+ "@nestjs/core": "^12.0.0-alpha.5",
54
50
  "class-transformer": "^0.5.1",
55
51
  "class-validator": "^0.13.0",
56
52
  "reflect-metadata": "^0.2.2",
57
- "rxjs": "^7.0.0"
53
+ "rxjs": "^7.0.0",
54
+ "@nest-boot/i18n": "^8.0.0-beta.0"
58
55
  },
59
56
  "publishConfig": {
60
57
  "access": "public"
@@ -65,9 +62,7 @@
65
62
  "eslint --fix"
66
63
  ]
67
64
  },
68
- "volta": {
69
- "extends": "../../package.json"
70
- },
65
+ "type": "module",
71
66
  "scripts": {
72
67
  "build": "tsc -p tsconfig.build.json",
73
68
  "clean": "rm -rf .nx && rm -rf node_modules && rm -rf dist",