@brilab-mailer/utils 0.0.2-2 → 0.0.2-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.
@@ -1 +1 @@
1
- {"version":3,"file":"is-real-email.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/is-real-email.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AAGzB,qBACa,qBAAsB,YAAW,4BAA4B;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM;IAW5B,cAAc;CAGf;AAED,wBAAgB,WAAW,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAUpF"}
1
+ {"version":3,"file":"is-real-email.decorator.d.ts","sourceRoot":"","sources":["../../src/decorators/is-real-email.decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,4BAA4B,EAC7B,MAAM,iBAAiB,CAAC;AAGzB,qBACa,qBAAsB,YAAW,4BAA4B;IAClE,QAAQ,CAAC,KAAK,EAAE,MAAM;IAa5B,cAAc;CAGf;AAED,wBAAgB,WAAW,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAWpF"}
@@ -1,13 +1,15 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { registerDecorator, ValidatorConstraint, } from 'class-validator';
3
- import * as dns from 'node:dns/promises';
3
+ import { Resolver } from 'node:dns/promises';
4
4
  let IsRealEmailConstraint = class IsRealEmailConstraint {
5
5
  async validate(email) {
6
6
  try {
7
+ const resolver = new Resolver();
8
+ resolver.setServers(['1.1.1.1', '8.8.8.8']);
7
9
  const domain = email.split('@').at(-1);
8
10
  if (!domain)
9
11
  return false;
10
- const mxRecords = await dns.resolveMx(domain);
12
+ const mxRecords = await resolver.resolveMx(domain);
11
13
  return mxRecords && mxRecords.length > 0;
12
14
  }
13
15
  catch {
@@ -25,6 +27,7 @@ export { IsRealEmailConstraint };
25
27
  export function IsRealEmail(validationOptions) {
26
28
  return function (target, propertyKey) {
27
29
  registerDecorator({
30
+ name: 'IsRealEmail',
28
31
  target: target.constructor,
29
32
  propertyName: String(propertyKey),
30
33
  options: validationOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brilab-mailer/utils",
3
- "version": "0.0.2-2",
3
+ "version": "0.0.2-4",
4
4
  "author": "Bohdan Radchenko <radchenkobs@gmail.com>",
5
5
  "type": "module",
6
6
  "main": "./index.js",