dymo-api 1.2.28 → 1.2.30

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.
@@ -52,6 +52,14 @@ const isValidPhone = async (axiosClient, phone, rules) => {
52
52
  reasons.push("FRAUD");
53
53
  if (rules.deny.includes("HIGH_RISK_SCORE") && responsePhone.plugins.riskScore >= 80)
54
54
  reasons.push("HIGH_RISK_SCORE");
55
+ // Country block rules.
56
+ for (const rule of rules.deny) {
57
+ if (rule.startsWith("COUNTRY:")) {
58
+ const block = rule.split(":")[1]; // Extract country code.
59
+ if (responsePhone.countryCode === block)
60
+ reasons.push(`COUNTRY:${block}`);
61
+ }
62
+ }
55
63
  return {
56
64
  phone: responsePhone.phone,
57
65
  allow: reasons.length === 0,
@@ -78,7 +78,7 @@ class DymoAPI {
78
78
  headers: {
79
79
  "User-Agent": "DymoAPISDK/1.0.0",
80
80
  "X-Dymo-SDK-Env": "Node",
81
- "X-Dymo-SDK-Version": "1.2.28"
81
+ "X-Dymo-SDK-Version": "1.2.30"
82
82
  }
83
83
  });
84
84
  // We set the authorization in the Axios client to make requests.
@@ -49,6 +49,14 @@ export const isValidPhone = async (axiosClient, phone, rules) => {
49
49
  reasons.push("FRAUD");
50
50
  if (rules.deny.includes("HIGH_RISK_SCORE") && responsePhone.plugins.riskScore >= 80)
51
51
  reasons.push("HIGH_RISK_SCORE");
52
+ // Country block rules.
53
+ for (const rule of rules.deny) {
54
+ if (rule.startsWith("COUNTRY:")) {
55
+ const block = rule.split(":")[1]; // Extract country code.
56
+ if (responsePhone.countryCode === block)
57
+ reasons.push(`COUNTRY:${block}`);
58
+ }
59
+ }
52
60
  return {
53
61
  phone: responsePhone.phone,
54
62
  allow: reasons.length === 0,
@@ -40,7 +40,7 @@ class DymoAPI {
40
40
  headers: {
41
41
  "User-Agent": "DymoAPISDK/1.0.0",
42
42
  "X-Dymo-SDK-Env": "Node",
43
- "X-Dymo-SDK-Version": "1.2.28"
43
+ "X-Dymo-SDK-Version": "1.2.30"
44
44
  }
45
45
  });
46
46
  // We set the authorization in the Axios client to make requests.
@@ -281,4 +281,4 @@ declare class DymoAPI {
281
281
  isValidPwd(data: Interfaces.IsValidPwdData): Promise<Interfaces.PasswordValidationResult>;
282
282
  }
283
283
  export default DymoAPI;
284
- export type { EmailValidatorRules, NegativeEmailRules, DataEmailValidationAnalysis, PhoneValidatorRules, NegativePhoneRules, DataPhoneValidationAnalysis, WafRules, SensitiveInfoRules } from "./lib/types/interfaces";
284
+ export type { EmailValidatorRules, NegativeEmailRules, DataEmailValidationAnalysis, IPValidatorRules, NegativeIPRules, DataIPValidationAnalysis, PhoneValidatorRules, NegativePhoneRules, DataPhoneValidationAnalysis, WafRules, SensitiveInfoRules } from "./lib/types/interfaces";
@@ -1,5 +1,5 @@
1
1
  import { MxRecord } from "dns";
2
- import { Email, Phone, CreditCard } from "./primitives";
2
+ import { Email, Phone, CreditCard, Char } from "./primitives";
3
3
  export type VerifyPlugins = "blocklist" | "gravatar" | "compromiseDetector" | "mxRecords" | "nsfw" | "reputation" | "riskScore" | "torNetwork" | "typosquatting" | "urlShortener";
4
4
  export type ReputationPlugin = "low" | "medium" | "high" | "very-high" | "education" | "governmental" | "unknown";
5
5
  export type TyposquattingPlugin = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
@@ -69,10 +69,10 @@ export type IPValidator = string;
69
69
  * @typedef {"FRAUD"|"INVALID"|"HIGH_RISK_SCORE"} NegativeIPRules
70
70
  *
71
71
  * @description
72
- * Values indicating why an email is considered negative.
72
+ * Values indicating why an IP is considered negative.
73
73
  * ⚠️ TOR_NETWORK and HIGH_RISK_SCORE are premium features.
74
74
  */
75
- export type NegativeIPRules = "FRAUD" | "INVALID" | "TOR_NETWORK" | "HIGH_RISK_SCORE" | `COUNTRY:${string}${string}`;
75
+ export type NegativeIPRules = "FRAUD" | "INVALID" | "TOR_NETWORK" | "HIGH_RISK_SCORE" | `COUNTRY:${Char}${Char}`;
76
76
  export type PhoneValidator = Phone;
77
77
  /**
78
78
  * @typedef {"FRAUD"|"INVALID"|"HIGH_RISK_SCORE"} NegativePhoneRules
@@ -80,7 +80,7 @@ export type PhoneValidator = Phone;
80
80
  * @description
81
81
  * Values indicating why an phone is considered negative.
82
82
  */
83
- export type NegativePhoneRules = "FRAUD" | "INVALID" | "HIGH_RISK_SCORE";
83
+ export type NegativePhoneRules = "FRAUD" | "INVALID" | "HIGH_RISK_SCORE" | `COUNTRY:${Char}${Char}`;
84
84
  export type NegativeSensitiveInfoRules = "EMAIL" | "PHONE" | "CREDIT_CARD" | "URL" | "DOMAIN" | "IP" | "WALLET" | "USER_AGENT";
85
85
  /**
86
86
  * Response returned by the email validator.
@@ -1,5 +1,6 @@
1
1
  export type Email = `${string}@${string}.${string}` | string;
2
2
  type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
3
+ export type Char = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
3
4
  export type Phone = {
4
5
  /** The country code of the phone number. */
5
6
  iso: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dymo-api",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "description": "Flow system for Dymo API.",
5
5
  "main": "dist/cjs/dymo-api.js",
6
6
  "module": "dist/esm/dymo-api.js",