dymo-api 1.2.16 → 1.2.18

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,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isValidData = void 0;
3
+ exports.isValidDataRaw = void 0;
4
4
  const basics_1 = require("../../../../utils/basics.cjs");
5
5
  /**
6
6
  * Validates the provided data using a secure verification endpoint.
@@ -14,7 +14,7 @@ const basics_1 = require("../../../../utils/basics.cjs");
14
14
  * @throws Will throw an error if the token is null, if none of the required fields are present in the data,
15
15
  * or if an error occurs during the verification request.
16
16
  */
17
- const isValidData = async (axiosClient, data) => {
17
+ const isValidDataRaw = async (axiosClient, data) => {
18
18
  if (!axiosClient.defaults.headers?.Authorization)
19
19
  throw (0, basics_1.customError)(3000, "Invalid private token.");
20
20
  if (!Object.keys(data).some((key) => ["url", "email", "phone", "domain", "creditCard", "ip", "wallet", "userAgent", "iban"].includes(key) && data.hasOwnProperty(key)))
@@ -30,4 +30,4 @@ const isValidData = async (axiosClient, data) => {
30
30
  throw (0, basics_1.customError)(5000, `Error ${statusCode}: ${errorMessage}. Details: ${errorDetails}`);
31
31
  }
32
32
  };
33
- exports.isValidData = isValidData;
33
+ exports.isValidDataRaw = isValidDataRaw;
@@ -11,7 +11,7 @@ const basics_1 = require("../../../../utils/basics.cjs");
11
11
  *
12
12
  * Deny rules (some are premium ⚠️):
13
13
  * - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
14
- * "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
14
+ * "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "NO_GRAVATAR" "HIGH_RISK_SCORE" ⚠️
15
15
  *
16
16
  * @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
17
17
  * @throws Error if token is null, rules are empty, or request fails.
@@ -39,7 +39,8 @@ const isValidEmail = async (axiosClient, email, rules) => {
39
39
  plugins: [
40
40
  rules.deny.includes("NO_MX_RECORDS") ? "mxRecords" : undefined,
41
41
  rules.deny.includes("NO_REACHABLE") ? "reachability" : undefined,
42
- rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined
42
+ rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined,
43
+ rules.deny.includes("NO_GRAVATAR") ? "gravatar" : undefined
43
44
  ].filter(Boolean)
44
45
  }, { headers: { "Content-Type": "application/json" } })).data.email;
45
46
  let reasons = [];
@@ -71,6 +72,8 @@ const isValidEmail = async (axiosClient, email, rules) => {
71
72
  reasons.push("NO_REACHABLE");
72
73
  if (rules.deny.includes("HIGH_RISK_SCORE") && responseEmail.plugins.riskScore >= 80)
73
74
  reasons.push("HIGH_RISK_SCORE");
75
+ if (rules.deny.includes("NO_GRAVATAR") && !responseEmail.plugins.gravatar)
76
+ reasons.push("NO_GRAVATAR");
74
77
  return {
75
78
  email: responseEmail.email,
76
79
  allow: reasons.length === 0,
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./functions/extractWithTextly/index.cjs"), exports);
18
18
  __exportStar(require("./functions/getRandom/index.cjs"), exports);
19
- __exportStar(require("./functions/isValidData/index.cjs"), exports);
19
+ __exportStar(require("./functions/isValidDataRaw/index.cjs"), exports);
20
20
  __exportStar(require("./functions/isValidEmail/index.cjs"), exports);
21
21
  __exportStar(require("./functions/protectReq/index.cjs"), exports);
22
22
  __exportStar(require("./functions/sendEmail/index.cjs"), exports);
@@ -76,7 +76,7 @@ class DymoAPI {
76
76
  headers: {
77
77
  "User-Agent": "DymoAPISDK/1.0.0",
78
78
  "X-Dymo-SDK-Env": "Node",
79
- "X-Dymo-SDK-Version": "1.2.16"
79
+ "X-Dymo-SDK-Version": "1.2.18"
80
80
  }
81
81
  });
82
82
  // We set the authorization in the Axios client to make requests.
@@ -91,6 +91,7 @@ class DymoAPI {
91
91
  * This method requires either the root API key or the API key to be set.
92
92
  * If neither is set, it will throw an error.
93
93
  *
94
+ * @deprecated Use `isValidDataRaw` instead. This feature will be modified soon.
94
95
  * @param {Object} data - The data to be validated.
95
96
  * @param {string} [data.url] - Optional URL to be validated.
96
97
  * @param {string} [data.email] - Optional email address to be validated.
@@ -108,7 +109,33 @@ class DymoAPI {
108
109
  * [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
109
110
  */
110
111
  async isValidData(data) {
111
- return await PrivateAPI.isValidData(this.axiosClient, data);
112
+ return await PrivateAPI.isValidDataRaw(this.axiosClient, data);
113
+ }
114
+ ;
115
+ /**
116
+ * Validates the given data against the configured validation settings.
117
+ *
118
+ * This method requires either the root API key or the API key to be set.
119
+ * If neither is set, it will throw an error.
120
+ *
121
+ * @param {Object} data - The data to be validated.
122
+ * @param {string} [data.url] - Optional URL to be validated.
123
+ * @param {string} [data.email] - Optional email address to be validated.
124
+ * @param {Interfaces.PhoneData} [data.phone] - Optional phone number data to be validated.
125
+ * @param {string} [data.domain] - Optional domain name to be validated.
126
+ * @param {string|Interfaces.CreditCardData} [data.creditCard] - Optional credit card number or data to be validated.
127
+ * @param {string} [data.ip] - Optional IP address to be validated.
128
+ * @param {string} [data.wallet] - Optional wallet address to be validated.
129
+ * @param {string} [data.userAgent] - Optional user agent string to be validated.
130
+ * @param {string} [data.iban] - Optional IBAN to be validated.
131
+ * @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
132
+ * @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
133
+ * @throws Will throw an error if there is an issue with the validation process.
134
+ *
135
+ * [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
136
+ */
137
+ async isValidDataRaw(data) {
138
+ return await PrivateAPI.isValidDataRaw(this.axiosClient, data);
112
139
  }
113
140
  ;
114
141
  /**
@@ -11,7 +11,7 @@ import { customError } from "../../../../utils/basics.js";
11
11
  * @throws Will throw an error if the token is null, if none of the required fields are present in the data,
12
12
  * or if an error occurs during the verification request.
13
13
  */
14
- export const isValidData = async (axiosClient, data) => {
14
+ export const isValidDataRaw = async (axiosClient, data) => {
15
15
  if (!axiosClient.defaults.headers?.Authorization)
16
16
  throw customError(3000, "Invalid private token.");
17
17
  if (!Object.keys(data).some((key) => ["url", "email", "phone", "domain", "creditCard", "ip", "wallet", "userAgent", "iban"].includes(key) && data.hasOwnProperty(key)))
@@ -8,7 +8,7 @@ import { customError } from "../../../../utils/basics.js";
8
8
  *
9
9
  * Deny rules (some are premium ⚠️):
10
10
  * - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
11
- * "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
11
+ * "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "NO_GRAVATAR" "HIGH_RISK_SCORE" ⚠️
12
12
  *
13
13
  * @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
14
14
  * @throws Error if token is null, rules are empty, or request fails.
@@ -36,7 +36,8 @@ export const isValidEmail = async (axiosClient, email, rules) => {
36
36
  plugins: [
37
37
  rules.deny.includes("NO_MX_RECORDS") ? "mxRecords" : undefined,
38
38
  rules.deny.includes("NO_REACHABLE") ? "reachability" : undefined,
39
- rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined
39
+ rules.deny.includes("HIGH_RISK_SCORE") ? "riskScore" : undefined,
40
+ rules.deny.includes("NO_GRAVATAR") ? "gravatar" : undefined
40
41
  ].filter(Boolean)
41
42
  }, { headers: { "Content-Type": "application/json" } })).data.email;
42
43
  let reasons = [];
@@ -68,6 +69,8 @@ export const isValidEmail = async (axiosClient, email, rules) => {
68
69
  reasons.push("NO_REACHABLE");
69
70
  if (rules.deny.includes("HIGH_RISK_SCORE") && responseEmail.plugins.riskScore >= 80)
70
71
  reasons.push("HIGH_RISK_SCORE");
72
+ if (rules.deny.includes("NO_GRAVATAR") && !responseEmail.plugins.gravatar)
73
+ reasons.push("NO_GRAVATAR");
71
74
  return {
72
75
  email: responseEmail.email,
73
76
  allow: reasons.length === 0,
@@ -1,6 +1,6 @@
1
1
  export * from "./functions/extractWithTextly";
2
2
  export * from "./functions/getRandom";
3
- export * from "./functions/isValidData";
3
+ export * from "./functions/isValidDataRaw";
4
4
  export * from "./functions/isValidEmail";
5
5
  export * from "./functions/protectReq";
6
6
  export * from "./functions/sendEmail";
@@ -38,7 +38,7 @@ class DymoAPI {
38
38
  headers: {
39
39
  "User-Agent": "DymoAPISDK/1.0.0",
40
40
  "X-Dymo-SDK-Env": "Node",
41
- "X-Dymo-SDK-Version": "1.2.16"
41
+ "X-Dymo-SDK-Version": "1.2.18"
42
42
  }
43
43
  });
44
44
  // We set the authorization in the Axios client to make requests.
@@ -53,6 +53,7 @@ class DymoAPI {
53
53
  * This method requires either the root API key or the API key to be set.
54
54
  * If neither is set, it will throw an error.
55
55
  *
56
+ * @deprecated Use `isValidDataRaw` instead. This feature will be modified soon.
56
57
  * @param {Object} data - The data to be validated.
57
58
  * @param {string} [data.url] - Optional URL to be validated.
58
59
  * @param {string} [data.email] - Optional email address to be validated.
@@ -70,7 +71,33 @@ class DymoAPI {
70
71
  * [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
71
72
  */
72
73
  async isValidData(data) {
73
- return await PrivateAPI.isValidData(this.axiosClient, data);
74
+ return await PrivateAPI.isValidDataRaw(this.axiosClient, data);
75
+ }
76
+ ;
77
+ /**
78
+ * Validates the given data against the configured validation settings.
79
+ *
80
+ * This method requires either the root API key or the API key to be set.
81
+ * If neither is set, it will throw an error.
82
+ *
83
+ * @param {Object} data - The data to be validated.
84
+ * @param {string} [data.url] - Optional URL to be validated.
85
+ * @param {string} [data.email] - Optional email address to be validated.
86
+ * @param {Interfaces.PhoneData} [data.phone] - Optional phone number data to be validated.
87
+ * @param {string} [data.domain] - Optional domain name to be validated.
88
+ * @param {string|Interfaces.CreditCardData} [data.creditCard] - Optional credit card number or data to be validated.
89
+ * @param {string} [data.ip] - Optional IP address to be validated.
90
+ * @param {string} [data.wallet] - Optional wallet address to be validated.
91
+ * @param {string} [data.userAgent] - Optional user agent string to be validated.
92
+ * @param {string} [data.iban] - Optional IBAN to be validated.
93
+ * @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
94
+ * @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
95
+ * @throws Will throw an error if there is an issue with the validation process.
96
+ *
97
+ * [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
98
+ */
99
+ async isValidDataRaw(data) {
100
+ return await PrivateAPI.isValidDataRaw(this.axiosClient, data);
74
101
  }
75
102
  ;
76
103
  /**
@@ -12,4 +12,4 @@ import * as Interfaces from "../../../../lib/types/interfaces";
12
12
  * @throws Will throw an error if the token is null, if none of the required fields are present in the data,
13
13
  * or if an error occurs during the verification request.
14
14
  */
15
- export declare const isValidData: (axiosClient: AxiosInstance, data: Interfaces.Validator) => Promise<any>;
15
+ export declare const isValidDataRaw: (axiosClient: AxiosInstance, data: Interfaces.Validator) => Promise<any>;
@@ -9,7 +9,7 @@ import * as Interfaces from "../../../../lib/types/interfaces";
9
9
  *
10
10
  * Deny rules (some are premium ⚠️):
11
11
  * - "FRAUD", "INVALID", "NO_MX_RECORDS" ⚠️, "PROXIED_EMAIL" ⚠️, "FREE_SUBDOMAIN" ⚠️,
12
- * "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "HIGH_RISK_SCORE" ⚠️
12
+ * "PERSONAL_EMAIL", "CORPORATE_EMAIL", "NO_REPLY_EMAIL", "ROLE_ACCOUNT", "NO_REACHABLE", "NO_GRAVATAR" "HIGH_RISK_SCORE" ⚠️
13
13
  *
14
14
  * @returns {Promise<boolean>} True if the email passes all deny rules, false otherwise.
15
15
  * @throws Error if token is null, rules are empty, or request fails.
@@ -1,6 +1,6 @@
1
1
  export * from "./functions/extractWithTextly";
2
2
  export * from "./functions/getRandom";
3
- export * from "./functions/isValidData";
3
+ export * from "./functions/isValidDataRaw";
4
4
  export * from "./functions/isValidEmail";
5
5
  export * from "./functions/protectReq";
6
6
  export * from "./functions/sendEmail";
@@ -36,6 +36,7 @@ declare class DymoAPI {
36
36
  * This method requires either the root API key or the API key to be set.
37
37
  * If neither is set, it will throw an error.
38
38
  *
39
+ * @deprecated Use `isValidDataRaw` instead. This feature will be modified soon.
39
40
  * @param {Object} data - The data to be validated.
40
41
  * @param {string} [data.url] - Optional URL to be validated.
41
42
  * @param {string} [data.email] - Optional email address to be validated.
@@ -53,6 +54,29 @@ declare class DymoAPI {
53
54
  * [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
54
55
  */
55
56
  isValidData(data: Interfaces.Validator): Promise<Interfaces.DataValidationAnalysis>;
57
+ /**
58
+ * Validates the given data against the configured validation settings.
59
+ *
60
+ * This method requires either the root API key or the API key to be set.
61
+ * If neither is set, it will throw an error.
62
+ *
63
+ * @param {Object} data - The data to be validated.
64
+ * @param {string} [data.url] - Optional URL to be validated.
65
+ * @param {string} [data.email] - Optional email address to be validated.
66
+ * @param {Interfaces.PhoneData} [data.phone] - Optional phone number data to be validated.
67
+ * @param {string} [data.domain] - Optional domain name to be validated.
68
+ * @param {string|Interfaces.CreditCardData} [data.creditCard] - Optional credit card number or data to be validated.
69
+ * @param {string} [data.ip] - Optional IP address to be validated.
70
+ * @param {string} [data.wallet] - Optional wallet address to be validated.
71
+ * @param {string} [data.userAgent] - Optional user agent string to be validated.
72
+ * @param {string} [data.iban] - Optional IBAN to be validated.
73
+ * @param {Interfaces.VerifyPlugins[]} [data.plugins] - Optional array of verification plugins to be used.
74
+ * @returns {Promise<Interfaces.DataValidationAnalysis>} A promise that resolves to the response from the server.
75
+ * @throws Will throw an error if there is an issue with the validation process.
76
+ *
77
+ * [Documentation](https://docs.tpeoficial.com/docs/dymo-api/private/data-verifier)
78
+ */
79
+ isValidDataRaw(data: Interfaces.Validator): Promise<Interfaces.DataValidationAnalysis>;
56
80
  /**
57
81
  * Validates the given email against the configured rules.
58
82
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",